diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-01-26 14:33:02 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-01-31 11:02:24 +0100 |
commit | 264e30abb9387cef3c072298ac530c67bb708e43 (patch) | |
tree | 28a975910e9d3ff1b4fb62af2e757c8a7386fb4b /gst | |
parent | 6a0a9fc01e2aec4020b8f35b4a4ce5df8e60e9d7 (diff) | |
download | gst-plugins-bad-264e30abb9387cef3c072298ac530c67bb708e43.tar.gz gst-plugins-bad-264e30abb9387cef3c072298ac530c67bb708e43.tar.bz2 gst-plugins-bad-264e30abb9387cef3c072298ac530c67bb708e43.zip |
Improve detection of the end of the header metadata
Header metadata is finished after partition.header_byte_count
bytes after the first byte of the primer pack are handled.
After this there can only be index table segments, filler packets,
essence or the start of the next partition.
This fixes playback of some files that have non-standard metadata
packets in the header metadata.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mxf/mxfdemux.c | 31 | ||||
-rw-r--r-- | gst/mxf/mxftypes.h | 1 |
2 files changed, 20 insertions, 12 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 248fddd8..0c144a25 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -490,6 +490,8 @@ gst_mxf_demux_handle_primer_pack (GstMXFDemux * demux, const MXFUL * key, return GST_FLOW_ERROR; } + demux->current_partition->primer.offset = demux->offset; + return GST_FLOW_OK; } @@ -605,11 +607,11 @@ gst_mxf_demux_choose_package (GstMXFDemux * demux) for (i = 0; i < demux->preface->content_storage->n_packages; i++) { if (demux->preface->content_storage->packages[i] && - MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface-> - content_storage->packages[i])) { + MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface->content_storage-> + packages[i])) { ret = - MXF_METADATA_GENERIC_PACKAGE (demux->preface-> - content_storage->packages[i]); + MXF_METADATA_GENERIC_PACKAGE (demux->preface->content_storage-> + packages[i]); break; } } @@ -1084,8 +1086,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) GST_DEBUG_OBJECT (demux, "Switching to component %u", pad->current_component); pad->component = - MXF_METADATA_SOURCE_CLIP (sequence-> - structural_components[pad->current_component]); + MXF_METADATA_SOURCE_CLIP (sequence->structural_components[pad-> + current_component]); if (pad->component == NULL) { GST_ERROR_OBJECT (demux, "No such structural component"); return GST_FLOW_ERROR; @@ -1093,8 +1095,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) if (!pad->component->source_package || !pad->component->source_package->top_level - || !MXF_METADATA_GENERIC_PACKAGE (pad->component->source_package)-> - tracks) { + || !MXF_METADATA_GENERIC_PACKAGE (pad->component-> + source_package)->tracks) { GST_ERROR_OBJECT (demux, "Invalid component"); return GST_FLOW_ERROR; } @@ -1696,7 +1698,9 @@ next_try: } /* parse metadata */ - while (TRUE) { + while (demux->offset < + demux->run_in + demux->current_partition->primer.offset + + demux->current_partition->partition.header_byte_count) { ret = gst_mxf_demux_pull_klv_packet (demux, demux->offset, &key, &buffer, &read); @@ -1732,7 +1736,9 @@ next_try: gst_buffer_unref (buffer); buffer = NULL; } else { - break; + demux->offset += read; + gst_buffer_unref (buffer); + buffer = NULL; } } @@ -1768,8 +1774,9 @@ gst_mxf_demux_handle_klv_packet (GstMXFDemux * demux, const MXFUL * key, if (demux->update_metadata && demux->preface - && !mxf_is_metadata (key) && !mxf_is_descriptive_metadata (key) - && !mxf_is_fill (key)) { + && demux->offset >= + demux->run_in + demux->current_partition->primer.offset + + demux->current_partition->partition.header_byte_count) { demux->current_partition->parsed_metadata = TRUE; if ((ret = gst_mxf_demux_handle_header_metadata_resolve_references (demux)) != diff --git a/gst/mxf/mxftypes.h b/gst/mxf/mxftypes.h index 791c6710..73f4a834 100644 --- a/gst/mxf/mxftypes.h +++ b/gst/mxf/mxftypes.h @@ -112,6 +112,7 @@ typedef struct { /* SMPTE 377M 8.1 */ typedef struct { + guint64 offset; GHashTable *mappings; } MXFPrimerPack; |