diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-07 10:38:26 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-07 10:38:26 +0100 |
commit | 8dc9f2ea4d01ebefa87b77b879d577b5bed115eb (patch) | |
tree | 0b299de8ef4e525d221d5ef8c708ccdc1d5991c7 /gst | |
parent | 3c3dff6869a3f3ffdf327e004977fa39594dd2c2 (diff) | |
download | gst-plugins-bad-8dc9f2ea4d01ebefa87b77b879d577b5bed115eb.tar.gz gst-plugins-bad-8dc9f2ea4d01ebefa87b77b879d577b5bed115eb.tar.bz2 gst-plugins-bad-8dc9f2ea4d01ebefa87b77b879d577b5bed115eb.zip |
mxfdemux: Add support for non-standard Avid MXF files containing DNxHD essence
Avid uses a custom essence container UL and custom essence element keys
that are fortunately compatible with the generic container essence
elements. Partially fixes bug #561922.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mxf/mxfdemux.c | 9 | ||||
-rw-r--r-- | gst/mxf/mxfparse.c | 12 | ||||
-rw-r--r-- | gst/mxf/mxfparse.h | 1 | ||||
-rw-r--r-- | gst/mxf/mxfvc3.c | 18 |
4 files changed, 36 insertions, 4 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 32978dd2..1316c83d 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -2133,7 +2133,8 @@ next_try: gst_buffer_unref (buffer); buffer = NULL; } else if (mxf_is_generic_container_system_item (&key) || - mxf_is_generic_container_essence_element (&key)) { + mxf_is_generic_container_essence_element (&key) || + mxf_is_avid_essence_container_essence_element (&key)) { demux->offset += read; gst_buffer_unref (buffer); buffer = NULL; @@ -2183,7 +2184,8 @@ gst_mxf_demux_handle_klv_packet (GstMXFDemux * demux, const MXFUL * key, demux->run_in + demux->current_partition->primer.offset + demux->current_partition->partition.header_byte_count || mxf_is_generic_container_system_item (key) || - mxf_is_generic_container_essence_element (key))) { + mxf_is_generic_container_essence_element (key) || + mxf_is_avid_essence_container_essence_element (key))) { demux->current_partition->parsed_metadata = TRUE; if ((ret = gst_mxf_demux_resolve_references (demux)) != GST_FLOW_OK || (ret = gst_mxf_demux_update_tracks (demux)) != GST_FLOW_OK) { @@ -2234,7 +2236,8 @@ gst_mxf_demux_handle_klv_packet (GstMXFDemux * demux, const MXFUL * key, } else if (mxf_is_generic_container_system_item (key)) { ret = gst_mxf_demux_handle_generic_container_system_item (demux, key, buffer); - } else if (mxf_is_generic_container_essence_element (key)) { + } else if (mxf_is_generic_container_essence_element (key) || + mxf_is_avid_essence_container_essence_element (key)) { ret = gst_mxf_demux_handle_generic_container_essence_element (demux, key, buffer, peek); diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index 70b98c85..c5c81fdb 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -215,6 +215,18 @@ mxf_is_avid_essence_container_label (const MXFUL * key) return (memcmp (&key->u, avid_essence_container_label, 16) == 0); } +/* Essence element key found in files generated by Avid */ +static const guint8 avid_essence_element_ul[] = { + 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x01, 0x0e, 0x04, 0x03, 0x01, 0x00, + 0x00, 0x00, 0x00 +}; + +gboolean +mxf_is_avid_essence_container_essence_element (const MXFUL * key) +{ + return (memcmp (&key->u, avid_essence_element_ul, 12) == 0); +} + gboolean mxf_ul_is_equal (const MXFUL * a, const MXFUL * b) { diff --git a/gst/mxf/mxfparse.h b/gst/mxf/mxfparse.h index b4e4cc26..eb29d205 100644 --- a/gst/mxf/mxfparse.h +++ b/gst/mxf/mxfparse.h @@ -61,6 +61,7 @@ gboolean mxf_is_index_table_segment (const MXFUL *key); gboolean mxf_is_generic_container_system_item (const MXFUL *key); gboolean mxf_is_generic_container_essence_element (const MXFUL *key); +gboolean mxf_is_avid_essence_container_essence_element (const MXFUL * key); gboolean mxf_is_generic_container_essence_container_label (const MXFUL *key); gboolean mxf_is_avid_essence_container_label (const MXFUL *key); diff --git a/gst/mxf/mxfvc3.c b/gst/mxf/mxfvc3.c index 497355ef..e0f9b804 100644 --- a/gst/mxf/mxfvc3.c +++ b/gst/mxf/mxfvc3.c @@ -33,6 +33,11 @@ GST_DEBUG_CATEGORY_EXTERN (mxf_debug); #define GST_CAT_DEFAULT mxf_debug +static const guint8 picture_essence_coding_vc3_avid[] = { + 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, 0x0e, 0x04, 0x02, 0x01, 0x02, + 0x04, 0x01, 0x00 +}; + static gboolean mxf_is_vc3_essence_track (const MXFMetadataTimelineTrack * track) { @@ -54,8 +59,19 @@ mxf_is_vc3_essence_track (const MXFMetadataTimelineTrack * track) /* SMPTE S2019-4 7 */ if (mxf_is_generic_container_essence_container_label (key) && key->u[12] == 0x02 && key->u[13] == 0x11 && - (key->u[14] == 0x01 || key->u[14] == 0x02)) + (key->u[14] == 0x01 || key->u[14] == 0x02)) { return TRUE; + } else if (mxf_is_avid_essence_container_label (key)) { + MXFMetadataGenericPictureEssenceDescriptor *p; + + if (!MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (d)) + return FALSE; + p = MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (d); + + key = &p->picture_essence_coding; + if (memcmp (key, picture_essence_coding_vc3_avid, 16) == 0) + return TRUE; + } } return FALSE; |