summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-04-25 11:17:16 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-05-20 13:31:02 +0200
commitc69f41d2997ba958fb14a6464ec673baca0c5634 (patch)
treef342a846de897eacb20192f17c851e7b490ca400
parent9b168e6b4d0a1a4dfe8bbcd98bd1c4b6e456be0b (diff)
applemedia: replace private function with its public variant
FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom is an un-documented private function which might change its signature as it already did in the past. Replace it with CMVideoFormatDescriptionCreate and the also un-documented Extensions dictionary.
-rw-r--r--sys/applemedia/vtdec.c41
-rw-r--r--sys/applemedia/vtutil.c37
-rw-r--r--sys/applemedia/vtutil.h8
3 files changed, 76 insertions, 10 deletions
diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c
index 6947680b0..2aed900aa 100644
--- a/sys/applemedia/vtdec.c
+++ b/sys/applemedia/vtdec.c
@@ -54,11 +54,6 @@ static gboolean gst_vtdec_sink_event (GstPad * pad, GstObject * parent,
static CMSampleBufferRef gst_vtdec_sample_buffer_from (GstVTDec * self,
GstBuffer * buf);
-extern OSStatus FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom
- (CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
- UInt32 atomId, const UInt8 * data, CFIndex len, void *unk1,
- CMFormatDescriptionRef * formatDesc);
-
static void
gst_vtdec_base_init (GstVTDecClass * klass)
{
@@ -359,15 +354,41 @@ gst_vtdec_create_format_description_from_codec_data (GstVTDec * self,
GstBuffer * codec_data)
{
CMFormatDescriptionRef fmt_desc;
- OSStatus status;
+ CFMutableDictionaryRef extensions, par, atoms;
GstMapInfo map;
+ OSStatus status;
gst_buffer_map (codec_data, &map, GST_MAP_READ);
- status =
- FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom (NULL,
- self->details->format_id, self->vinfo.width, self->vinfo.height, 'avcC',
- map.data, map.size, NULL, &fmt_desc);
+ /* CVPixelAspectRatio dict */
+ par = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ gst_vtutil_dict_set_i32 (par, CFSTR ("HorizontalSpacing"),
+ self->vinfo.par_n);
+ gst_vtutil_dict_set_i32 (par, CFSTR ("VerticalSpacing"),
+ self->vinfo.par_d);
+
+ /* SampleDescriptionExtensionAtoms dict */
+ atoms = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ gst_vtutil_dict_set_data (atoms, CFSTR ("avcC"), map.data, map.size);
+
+ /* Extensions dict */
+ extensions = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ gst_vtutil_dict_set_string (extensions,
+ CFSTR ("CVImageBufferChromaLocationBottomField"), "left");
+ gst_vtutil_dict_set_string (extensions,
+ CFSTR ("CVImageBufferChromaLocationTopField"), "left");
+ gst_vtutil_dict_set_boolean (extensions, CFSTR("FullRangeVideo"), FALSE);
+ gst_vtutil_dict_set_object (extensions, CFSTR ("CVPixelAspectRatio"),
+ (CFTypeRef *) par);
+ gst_vtutil_dict_set_object (extensions,
+ CFSTR ("SampleDescriptionExtensionAtoms"), (CFTypeRef *) atoms);
+
+ status = CMVideoFormatDescriptionCreate (NULL,
+ self->details->format_id, self->vinfo.width, self->vinfo.height,
+ extensions, &fmt_desc);
gst_buffer_unmap (codec_data, &map);
diff --git a/sys/applemedia/vtutil.c b/sys/applemedia/vtutil.c
index d87cb0f5c..40274c25b 100644
--- a/sys/applemedia/vtutil.c
+++ b/sys/applemedia/vtutil.c
@@ -59,3 +59,40 @@ gst_vtutil_dict_set_i32 (CFMutableDictionaryRef dict, CFStringRef key,
CFDictionarySetValue (dict, key, number);
CFRelease (number);
}
+
+void
+gst_vtutil_dict_set_string (CFMutableDictionaryRef dict, CFStringRef key,
+ const gchar * value)
+{
+ CFStringRef string;
+
+ string = CFStringCreateWithCString (NULL, value, kCFStringEncodingASCII);
+ CFDictionarySetValue (dict, key, string);
+ CFRelease (string);
+}
+
+void
+gst_vtutil_dict_set_boolean (CFMutableDictionaryRef dict, CFStringRef key,
+ gboolean value)
+{
+ CFDictionarySetValue (dict, key, value ? kCFBooleanTrue: kCFBooleanFalse);
+}
+
+void
+gst_vtutil_dict_set_data (CFMutableDictionaryRef dict, CFStringRef key,
+ guint8 * value, guint64 length)
+{
+ CFDataRef data;
+
+ data = CFDataCreate (NULL, value, length);
+ CFDictionarySetValue (dict, key, data);
+ CFRelease (data);
+}
+
+void
+gst_vtutil_dict_set_object (CFMutableDictionaryRef dict, CFStringRef key,
+ CFTypeRef *value)
+{
+ CFDictionarySetValue (dict, key, value);
+ CFRelease (value);
+}
diff --git a/sys/applemedia/vtutil.h b/sys/applemedia/vtutil.h
index 5a8180817..4aa974bec 100644
--- a/sys/applemedia/vtutil.h
+++ b/sys/applemedia/vtutil.h
@@ -29,6 +29,14 @@ gchar * gst_vtutil_object_to_string (CFTypeRef obj);
gchar * gst_vtutil_string_to_utf8 (CFStringRef s);
void gst_vtutil_dict_set_i32 (CFMutableDictionaryRef dict,
CFStringRef key, gint32 value);
+void gst_vtutil_dict_set_string (CFMutableDictionaryRef dict,
+ CFStringRef key, const gchar * value);
+void gst_vtutil_dict_set_boolean (CFMutableDictionaryRef dict,
+ CFStringRef key, gboolean value);
+void gst_vtutil_dict_set_data (CFMutableDictionaryRef dict,
+ CFStringRef key, guint8 * value, guint64 length);
+void gst_vtutil_dict_set_object (CFMutableDictionaryRef dict,
+ CFStringRef key, CFTypeRef * value);
G_END_DECLS