mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
gst/mxf/: Rewrite parsing of descriptors to go top-down instead of bottom-up which makes it possible to have the buff...
Original commit message from CVS: * gst/mxf/mxfaes-bwf.c: (mxf_metadata_wave_audio_essence_descriptor_handle_tag): * gst/mxf/mxfaes-bwf.h: * gst/mxf/mxfdemux.c: (gst_mxf_demux_handle_metadata_generic_descriptor), (gst_mxf_demux_handle_metadata_file_descriptor), (gst_mxf_demux_handle_metadata_multiple_descriptor), (gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor), (gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor), (gst_mxf_demux_handle_metadata_mpeg_video_descriptor), (gst_mxf_demux_handle_metadata_generic_sound_essence_descriptor), (gst_mxf_demux_handle_metadata_wave_audio_essence_descriptor), (gst_mxf_demux_handle_header_metadata_resolve_references), (gst_mxf_demux_handle_metadata): * gst/mxf/mxfmpeg.c: (mxf_metadata_mpeg_video_descriptor_handle_tag): * gst/mxf/mxfmpeg.h: * gst/mxf/mxfparse.c: (mxf_partition_pack_parse), (mxf_primer_pack_parse), (mxf_metadata_preface_parse), (mxf_metadata_identification_parse), (mxf_metadata_content_storage_parse), (mxf_metadata_essence_container_data_parse), (mxf_metadata_generic_package_parse), (mxf_metadata_track_parse), (mxf_metadata_sequence_parse), (mxf_metadata_structural_component_parse), (mxf_metadata_descriptor_parse), (mxf_metadata_generic_descriptor_handle_tag), (mxf_metadata_generic_descriptor_reset), (mxf_metadata_file_descriptor_handle_tag), (mxf_metadata_generic_sound_essence_descriptor_handle_tag), (mxf_metadata_generic_picture_essence_descriptor_handle_tag), (mxf_metadata_cdci_picture_essence_descriptor_handle_tag), (mxf_metadata_multiple_descriptor_handle_tag), (mxf_metadata_locator_parse): * gst/mxf/mxfparse.h: Rewrite parsing of descriptors to go top-down instead of bottom-up which makes it possible to have the buffer data non-writable. Improve debugging a bit.
This commit is contained in:
parent
a485e4c252
commit
fb8d2b901d
8 changed files with 1105 additions and 1211 deletions
42
ChangeLog
42
ChangeLog
|
@ -1,3 +1,45 @@
|
||||||
|
2008-11-25 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst/mxf/mxfaes-bwf.c:
|
||||||
|
(mxf_metadata_wave_audio_essence_descriptor_handle_tag):
|
||||||
|
* gst/mxf/mxfaes-bwf.h:
|
||||||
|
* gst/mxf/mxfdemux.c:
|
||||||
|
(gst_mxf_demux_handle_metadata_generic_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_file_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_multiple_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_mpeg_video_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_generic_sound_essence_descriptor),
|
||||||
|
(gst_mxf_demux_handle_metadata_wave_audio_essence_descriptor),
|
||||||
|
(gst_mxf_demux_handle_header_metadata_resolve_references),
|
||||||
|
(gst_mxf_demux_handle_metadata):
|
||||||
|
* gst/mxf/mxfmpeg.c:
|
||||||
|
(mxf_metadata_mpeg_video_descriptor_handle_tag):
|
||||||
|
* gst/mxf/mxfmpeg.h:
|
||||||
|
* gst/mxf/mxfparse.c: (mxf_partition_pack_parse),
|
||||||
|
(mxf_primer_pack_parse), (mxf_metadata_preface_parse),
|
||||||
|
(mxf_metadata_identification_parse),
|
||||||
|
(mxf_metadata_content_storage_parse),
|
||||||
|
(mxf_metadata_essence_container_data_parse),
|
||||||
|
(mxf_metadata_generic_package_parse), (mxf_metadata_track_parse),
|
||||||
|
(mxf_metadata_sequence_parse),
|
||||||
|
(mxf_metadata_structural_component_parse),
|
||||||
|
(mxf_metadata_descriptor_parse),
|
||||||
|
(mxf_metadata_generic_descriptor_handle_tag),
|
||||||
|
(mxf_metadata_generic_descriptor_reset),
|
||||||
|
(mxf_metadata_file_descriptor_handle_tag),
|
||||||
|
(mxf_metadata_generic_sound_essence_descriptor_handle_tag),
|
||||||
|
(mxf_metadata_generic_picture_essence_descriptor_handle_tag),
|
||||||
|
(mxf_metadata_cdci_picture_essence_descriptor_handle_tag),
|
||||||
|
(mxf_metadata_multiple_descriptor_handle_tag),
|
||||||
|
(mxf_metadata_locator_parse):
|
||||||
|
* gst/mxf/mxfparse.h:
|
||||||
|
Rewrite parsing of descriptors to go top-down instead of bottom-up
|
||||||
|
which makes it possible to have the buffer data non-writable.
|
||||||
|
|
||||||
|
Improve debugging a bit.
|
||||||
|
|
||||||
2008-11-24 Michael Smith <msmith@songbirdnest.com>
|
2008-11-24 Michael Smith <msmith@songbirdnest.com>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -41,135 +41,103 @@ GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
|
||||||
|
|
||||||
/* SMPTE 382M Annex 1 */
|
/* SMPTE 382M Annex 1 */
|
||||||
gboolean
|
gboolean
|
||||||
mxf_metadata_wave_audio_essence_descriptor_parse (const MXFUL * key,
|
mxf_metadata_wave_audio_essence_descriptor_handle_tag
|
||||||
MXFMetadataWaveAudioEssenceDescriptor * descriptor,
|
(MXFMetadataGenericDescriptor * d, const MXFPrimerPack * primer,
|
||||||
const MXFPrimerPack * primer, guint16 type, const guint8 * data, guint size)
|
guint16 tag, const guint8 * tag_data, guint16 tag_size)
|
||||||
{
|
{
|
||||||
guint16 tag, tag_size;
|
MXFMetadataWaveAudioEssenceDescriptor *descriptor =
|
||||||
const guint8 *tag_data;
|
(MXFMetadataWaveAudioEssenceDescriptor *) d;
|
||||||
|
gboolean ret = FALSE;
|
||||||
gchar str[48];
|
gchar str[48];
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, FALSE);
|
|
||||||
|
|
||||||
memset (descriptor, 0, sizeof (MXFMetadataWaveAudioEssenceDescriptor));
|
|
||||||
|
|
||||||
if (!mxf_metadata_generic_sound_essence_descriptor_parse (key,
|
|
||||||
(MXFMetadataGenericSoundEssenceDescriptor *) descriptor, primer, type,
|
|
||||||
data, size))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
while (mxf_local_tag_parse (data, size, &tag, &tag_size, &tag_data)) {
|
|
||||||
if (tag_size == 0 || tag == 0x0000)
|
|
||||||
goto next;
|
|
||||||
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 0x3d0a:
|
case 0x3d0a:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 2)
|
if (tag_size != 2)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->block_align = GST_READ_UINT16_BE (tag_data);
|
descriptor->block_align = GST_READ_UINT16_BE (tag_data);
|
||||||
|
GST_DEBUG (" block align = %u", descriptor->block_align);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d0b:
|
case 0x3d0b:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->sequence_offset = GST_READ_UINT8 (tag_data);
|
descriptor->sequence_offset = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" sequence offset = %u", descriptor->sequence_offset);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d09:
|
case 0x3d09:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->avg_bps = GST_READ_UINT32_BE (tag_data);
|
descriptor->avg_bps = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" average bps = %u", descriptor->avg_bps);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d32:
|
case 0x3d32:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 16)
|
if (tag_size != 16)
|
||||||
goto error;
|
goto error;
|
||||||
memcpy (&descriptor->channel_assignment, tag_data, 16);
|
memcpy (&descriptor->channel_assignment, tag_data, 16);
|
||||||
|
GST_DEBUG (" channel assignment = %s",
|
||||||
|
mxf_ul_to_string (&descriptor->channel_assignment, str));
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d29:
|
case 0x3d29:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->peak_envelope_version = GST_READ_UINT32_BE (tag_data);
|
descriptor->peak_envelope_version = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" peak envelope version = %u",
|
||||||
|
descriptor->peak_envelope_version);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d2a:
|
case 0x3d2a:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->peak_envelope_format = GST_READ_UINT32_BE (tag_data);
|
descriptor->peak_envelope_format = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" peak envelope format = %u",
|
||||||
|
descriptor->peak_envelope_format);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d2b:
|
case 0x3d2b:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->points_per_peak_value = GST_READ_UINT32_BE (tag_data);
|
descriptor->points_per_peak_value = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" points per peak value = %u",
|
||||||
|
descriptor->points_per_peak_value);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d2c:
|
case 0x3d2c:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->peak_envelope_block_size = GST_READ_UINT32_BE (tag_data);
|
descriptor->peak_envelope_block_size = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" peak envelope block size = %u",
|
||||||
|
descriptor->peak_envelope_block_size);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d2d:
|
case 0x3d2d:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->peak_channels = GST_READ_UINT32_BE (tag_data);
|
descriptor->peak_channels = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" peak channels = %u", descriptor->peak_channels);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d2e:
|
case 0x3d2e:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->peak_frames = GST_READ_UINT32_BE (tag_data);
|
descriptor->peak_frames = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" peak frames = %u", descriptor->peak_frames);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d2f:
|
case 0x3d2f:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 8)
|
if (tag_size != 8)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->peak_of_peaks_position = GST_READ_UINT64_BE (tag_data);
|
descriptor->peak_of_peaks_position = GST_READ_UINT64_BE (tag_data);
|
||||||
|
GST_DEBUG (" peak of peaks position = %" G_GINT64_FORMAT,
|
||||||
|
descriptor->peak_of_peaks_position);
|
||||||
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x3d30:
|
case 0x3d30:
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (!mxf_timestamp_parse (&descriptor->peak_envelope_timestamp,
|
if (!mxf_timestamp_parse (&descriptor->peak_envelope_timestamp,
|
||||||
tag_data, tag_size))
|
tag_data, tag_size))
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
|
||||||
case 0x3d31:
|
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
descriptor->peak_envelope_data = g_memdup (tag_data, tag_size);
|
|
||||||
descriptor->peak_envelope_data_length = tag_size;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (type != MXF_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR)
|
|
||||||
goto next;
|
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (!gst_metadata_add_custom_tag (primer, tag, tag_data, tag_size,
|
|
||||||
&((MXFMetadataGenericDescriptor *) descriptor)->other_tags))
|
|
||||||
goto error;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
next:
|
|
||||||
data += 4 + tag_size;
|
|
||||||
size -= 4 + tag_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG ("Parsed wave audio essence descriptor:");
|
|
||||||
GST_DEBUG (" block align = %u", descriptor->block_align);
|
|
||||||
GST_DEBUG (" sequence offset = %u", descriptor->sequence_offset);
|
|
||||||
GST_DEBUG (" average bps = %u", descriptor->avg_bps);
|
|
||||||
GST_DEBUG (" channel assignment = %s",
|
|
||||||
mxf_ul_to_string (&descriptor->channel_assignment, str));
|
|
||||||
GST_DEBUG (" peak envelope version = %u", descriptor->peak_envelope_version);
|
|
||||||
GST_DEBUG (" peak envelope format = %u", descriptor->peak_envelope_format);
|
|
||||||
GST_DEBUG (" points per peak value = %u", descriptor->points_per_peak_value);
|
|
||||||
GST_DEBUG (" peak envelope block size = %u",
|
|
||||||
descriptor->peak_envelope_block_size);
|
|
||||||
GST_DEBUG (" peak channels = %u", descriptor->peak_channels);
|
|
||||||
GST_DEBUG (" peak frames = %u", descriptor->peak_frames);
|
|
||||||
GST_DEBUG (" peak of peaks position = %" G_GINT64_FORMAT,
|
|
||||||
descriptor->peak_of_peaks_position);
|
|
||||||
GST_DEBUG (" peak envelope timestamp = %d/%u/%u %u:%u:%u.%u",
|
GST_DEBUG (" peak envelope timestamp = %d/%u/%u %u:%u:%u.%u",
|
||||||
descriptor->peak_envelope_timestamp.year,
|
descriptor->peak_envelope_timestamp.year,
|
||||||
descriptor->peak_envelope_timestamp.month,
|
descriptor->peak_envelope_timestamp.month,
|
||||||
|
@ -178,17 +146,29 @@ mxf_metadata_wave_audio_essence_descriptor_parse (const MXFUL * key,
|
||||||
descriptor->peak_envelope_timestamp.minute,
|
descriptor->peak_envelope_timestamp.minute,
|
||||||
descriptor->peak_envelope_timestamp.second,
|
descriptor->peak_envelope_timestamp.second,
|
||||||
(descriptor->peak_envelope_timestamp.quarter_msecond * 1000) / 256);
|
(descriptor->peak_envelope_timestamp.quarter_msecond * 1000) / 256);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
case 0x3d31:
|
||||||
|
descriptor->peak_envelope_data = g_memdup (tag_data, tag_size);
|
||||||
|
descriptor->peak_envelope_data_length = tag_size;
|
||||||
GST_DEBUG (" peak evelope data size = %u",
|
GST_DEBUG (" peak evelope data size = %u",
|
||||||
descriptor->peak_envelope_data_length);
|
descriptor->peak_envelope_data_length);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret =
|
||||||
|
mxf_metadata_generic_sound_essence_descriptor_handle_tag (d, primer,
|
||||||
|
tag, tag_data, tag_size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
GST_ERROR ("Invalid wave audio essence descriptor");
|
GST_ERROR ("Invalid wave audio essence descriptor tag 0x%04x of size %u", tag,
|
||||||
mxf_metadata_wave_audio_essence_descriptor_reset (descriptor);
|
tag_size);
|
||||||
|
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mxf_metadata_wave_audio_essence_descriptor_reset
|
void mxf_metadata_wave_audio_essence_descriptor_reset
|
||||||
|
|
|
@ -55,7 +55,8 @@ typedef struct {
|
||||||
guint16 peak_envelope_data_length;
|
guint16 peak_envelope_data_length;
|
||||||
} MXFMetadataWaveAudioEssenceDescriptor;
|
} MXFMetadataWaveAudioEssenceDescriptor;
|
||||||
|
|
||||||
gboolean mxf_metadata_wave_audio_essence_descriptor_parse (const MXFUL *key, MXFMetadataWaveAudioEssenceDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_wave_audio_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_wave_audio_essence_descriptor_reset (MXFMetadataWaveAudioEssenceDescriptor *descriptor);
|
void mxf_metadata_wave_audio_essence_descriptor_reset (MXFMetadataWaveAudioEssenceDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_is_aes_bwf_essence_track (const MXFMetadataTrack *track);
|
gboolean mxf_is_aes_bwf_essence_track (const MXFMetadataTrack *track);
|
||||||
|
|
|
@ -703,21 +703,26 @@ gst_mxf_demux_handle_metadata_generic_descriptor (GstMXFDemux * demux,
|
||||||
{
|
{
|
||||||
MXFMetadataGenericDescriptor descriptor;
|
MXFMetadataGenericDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata generic descriptor of size %u"
|
"Handling metadata generic descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_generic_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_generic_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset) mxf_metadata_generic_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux, "Parsing metadata generic descriptor failed");
|
GST_ERROR_OBJECT (demux, "Parsing metadata generic descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!demux->generic_descriptor)
|
if (!demux->generic_descriptor)
|
||||||
demux->generic_descriptor =
|
demux->generic_descriptor =
|
||||||
g_array_new (FALSE, FALSE, sizeof (MXFMetadataGenericDescriptor));
|
g_array_new (FALSE, TRUE, sizeof (MXFMetadataGenericDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->generic_descriptor, descriptor);
|
g_array_append_val (demux->generic_descriptor, descriptor);
|
||||||
|
|
||||||
|
@ -730,21 +735,26 @@ gst_mxf_demux_handle_metadata_file_descriptor (GstMXFDemux * demux,
|
||||||
{
|
{
|
||||||
MXFMetadataFileDescriptor descriptor;
|
MXFMetadataFileDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata file descriptor of size %u"
|
"Handling metadata file descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_file_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_file_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset) mxf_metadata_file_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux, "Parsing metadata file descriptor failed");
|
GST_ERROR_OBJECT (demux, "Parsing metadata file descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!demux->file_descriptor)
|
if (!demux->file_descriptor)
|
||||||
demux->file_descriptor =
|
demux->file_descriptor =
|
||||||
g_array_new (FALSE, FALSE, sizeof (MXFMetadataFileDescriptor));
|
g_array_new (FALSE, TRUE, sizeof (MXFMetadataFileDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->file_descriptor, descriptor);
|
g_array_append_val (demux->file_descriptor, descriptor);
|
||||||
|
|
||||||
|
@ -757,21 +767,27 @@ gst_mxf_demux_handle_metadata_multiple_descriptor (GstMXFDemux * demux,
|
||||||
{
|
{
|
||||||
MXFMetadataMultipleDescriptor descriptor;
|
MXFMetadataMultipleDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata multiple descriptor of size %u"
|
"Handling metadata multiple descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_multiple_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_multiple_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset) mxf_metadata_multiple_descriptor_reset))
|
||||||
|
{
|
||||||
GST_ERROR_OBJECT (demux, "Parsing metadata multiple descriptor failed");
|
GST_ERROR_OBJECT (demux, "Parsing metadata multiple descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!demux->multiple_descriptor)
|
if (!demux->multiple_descriptor)
|
||||||
demux->multiple_descriptor =
|
demux->multiple_descriptor =
|
||||||
g_array_new (FALSE, FALSE, sizeof (MXFMetadataMultipleDescriptor));
|
g_array_new (FALSE, TRUE, sizeof (MXFMetadataMultipleDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->multiple_descriptor, descriptor);
|
g_array_append_val (demux->multiple_descriptor, descriptor);
|
||||||
|
|
||||||
|
@ -784,14 +800,20 @@ gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor (GstMXFDemux *
|
||||||
{
|
{
|
||||||
MXFMetadataGenericPictureEssenceDescriptor descriptor;
|
MXFMetadataGenericPictureEssenceDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata generic picture essence descriptor of size %u"
|
"Handling metadata generic picture essence descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_generic_picture_essence_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_generic_picture_essence_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset)
|
||||||
|
mxf_metadata_generic_picture_essence_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux,
|
GST_ERROR_OBJECT (demux,
|
||||||
"Parsing metadata generic picture essence descriptor failed");
|
"Parsing metadata generic picture essence descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -799,7 +821,7 @@ gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor (GstMXFDemux *
|
||||||
|
|
||||||
if (!demux->generic_picture_essence_descriptor)
|
if (!demux->generic_picture_essence_descriptor)
|
||||||
demux->generic_picture_essence_descriptor =
|
demux->generic_picture_essence_descriptor =
|
||||||
g_array_new (FALSE, FALSE,
|
g_array_new (FALSE, TRUE,
|
||||||
sizeof (MXFMetadataGenericPictureEssenceDescriptor));
|
sizeof (MXFMetadataGenericPictureEssenceDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->generic_picture_essence_descriptor, descriptor);
|
g_array_append_val (demux->generic_picture_essence_descriptor, descriptor);
|
||||||
|
@ -813,14 +835,20 @@ gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor (GstMXFDemux *
|
||||||
{
|
{
|
||||||
MXFMetadataCDCIPictureEssenceDescriptor descriptor;
|
MXFMetadataCDCIPictureEssenceDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata CDCI picture essence descriptor of size %u"
|
"Handling metadata CDCI picture essence descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_cdci_picture_essence_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_cdci_picture_essence_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset)
|
||||||
|
mxf_metadata_cdci_picture_essence_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux,
|
GST_ERROR_OBJECT (demux,
|
||||||
"Parsing metadata CDCI picture essence descriptor failed");
|
"Parsing metadata CDCI picture essence descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -828,7 +856,7 @@ gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor (GstMXFDemux *
|
||||||
|
|
||||||
if (!demux->cdci_picture_essence_descriptor)
|
if (!demux->cdci_picture_essence_descriptor)
|
||||||
demux->cdci_picture_essence_descriptor =
|
demux->cdci_picture_essence_descriptor =
|
||||||
g_array_new (FALSE, FALSE,
|
g_array_new (FALSE, TRUE,
|
||||||
sizeof (MXFMetadataCDCIPictureEssenceDescriptor));
|
sizeof (MXFMetadataCDCIPictureEssenceDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->cdci_picture_essence_descriptor, descriptor);
|
g_array_append_val (demux->cdci_picture_essence_descriptor, descriptor);
|
||||||
|
@ -842,21 +870,27 @@ gst_mxf_demux_handle_metadata_mpeg_video_descriptor (GstMXFDemux * demux,
|
||||||
{
|
{
|
||||||
MXFMetadataMPEGVideoDescriptor descriptor;
|
MXFMetadataMPEGVideoDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata MPEG video descriptor of size %u"
|
"Handling metadata MPEG video descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_mpeg_video_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_mpeg_video_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset)
|
||||||
|
mxf_metadata_mpeg_video_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux, "Parsing metadata MPEG video descriptor failed");
|
GST_ERROR_OBJECT (demux, "Parsing metadata MPEG video descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!demux->mpeg_video_descriptor)
|
if (!demux->mpeg_video_descriptor)
|
||||||
demux->mpeg_video_descriptor =
|
demux->mpeg_video_descriptor =
|
||||||
g_array_new (FALSE, FALSE, sizeof (MXFMetadataMPEGVideoDescriptor));
|
g_array_new (FALSE, TRUE, sizeof (MXFMetadataMPEGVideoDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->mpeg_video_descriptor, descriptor);
|
g_array_append_val (demux->mpeg_video_descriptor, descriptor);
|
||||||
|
|
||||||
|
@ -869,14 +903,20 @@ gst_mxf_demux_handle_metadata_generic_sound_essence_descriptor (GstMXFDemux *
|
||||||
{
|
{
|
||||||
MXFMetadataGenericSoundEssenceDescriptor descriptor;
|
MXFMetadataGenericSoundEssenceDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata generic sound essence descriptor of size %u"
|
"Handling metadata generic sound essence descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_generic_sound_essence_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_generic_sound_essence_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset)
|
||||||
|
mxf_metadata_generic_sound_essence_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux,
|
GST_ERROR_OBJECT (demux,
|
||||||
"Parsing metadata generic sound essence descriptor failed");
|
"Parsing metadata generic sound essence descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -884,7 +924,7 @@ gst_mxf_demux_handle_metadata_generic_sound_essence_descriptor (GstMXFDemux *
|
||||||
|
|
||||||
if (!demux->generic_sound_essence_descriptor)
|
if (!demux->generic_sound_essence_descriptor)
|
||||||
demux->generic_sound_essence_descriptor =
|
demux->generic_sound_essence_descriptor =
|
||||||
g_array_new (FALSE, FALSE,
|
g_array_new (FALSE, TRUE,
|
||||||
sizeof (MXFMetadataGenericSoundEssenceDescriptor));
|
sizeof (MXFMetadataGenericSoundEssenceDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->generic_sound_essence_descriptor, descriptor);
|
g_array_append_val (demux->generic_sound_essence_descriptor, descriptor);
|
||||||
|
@ -898,14 +938,20 @@ gst_mxf_demux_handle_metadata_wave_audio_essence_descriptor (GstMXFDemux *
|
||||||
{
|
{
|
||||||
MXFMetadataWaveAudioEssenceDescriptor descriptor;
|
MXFMetadataWaveAudioEssenceDescriptor descriptor;
|
||||||
|
|
||||||
|
memset (&descriptor, 0, sizeof (descriptor));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
"Handling metadata wave sound essence descriptor of size %u"
|
"Handling metadata wave sound essence descriptor of size %u"
|
||||||
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
|
||||||
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
GST_BUFFER_SIZE (buffer), demux->offset, type);
|
||||||
|
|
||||||
if (!mxf_metadata_wave_audio_essence_descriptor_parse (key, &descriptor,
|
if (!mxf_metadata_descriptor_parse (key,
|
||||||
&demux->primer, type, GST_BUFFER_DATA (buffer),
|
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
|
||||||
GST_BUFFER_SIZE (buffer))) {
|
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
|
||||||
|
(MXFMetadataDescriptorHandleTag)
|
||||||
|
mxf_metadata_wave_audio_essence_descriptor_handle_tag,
|
||||||
|
(MXFMetadataDescriptorReset)
|
||||||
|
mxf_metadata_wave_audio_essence_descriptor_reset)) {
|
||||||
GST_ERROR_OBJECT (demux,
|
GST_ERROR_OBJECT (demux,
|
||||||
"Parsing metadata wave sound essence descriptor failed");
|
"Parsing metadata wave sound essence descriptor failed");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -913,7 +959,7 @@ gst_mxf_demux_handle_metadata_wave_audio_essence_descriptor (GstMXFDemux *
|
||||||
|
|
||||||
if (!demux->wave_audio_essence_descriptor)
|
if (!demux->wave_audio_essence_descriptor)
|
||||||
demux->wave_audio_essence_descriptor =
|
demux->wave_audio_essence_descriptor =
|
||||||
g_array_new (FALSE, FALSE,
|
g_array_new (FALSE, TRUE,
|
||||||
sizeof (MXFMetadataWaveAudioEssenceDescriptor));
|
sizeof (MXFMetadataWaveAudioEssenceDescriptor));
|
||||||
|
|
||||||
g_array_append_val (demux->wave_audio_essence_descriptor, descriptor);
|
g_array_append_val (demux->wave_audio_essence_descriptor, descriptor);
|
||||||
|
@ -1748,12 +1794,6 @@ gst_mxf_demux_handle_metadata (GstMXFDemux * demux, const MXFUL * key,
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make writable as the parsing of descriptors sets already read local tags to 0x0000 */
|
|
||||||
if (!gst_buffer_is_writable (buffer))
|
|
||||||
buffer = gst_buffer_copy (buffer);
|
|
||||||
else
|
|
||||||
buffer = gst_buffer_ref (buffer);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MXF_METADATA_PREFACE:
|
case MXF_METADATA_PREFACE:
|
||||||
ret = gst_mxf_demux_handle_metadata_preface (demux, key, buffer);
|
ret = gst_mxf_demux_handle_metadata_preface (demux, key, buffer);
|
||||||
|
@ -1838,8 +1878,6 @@ gst_mxf_demux_handle_metadata (GstMXFDemux * demux, const MXFUL * key,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,116 +89,94 @@ static const guint8 _profile_and_level_ul[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mxf_metadata_mpeg_video_descriptor_parse (const MXFUL * key,
|
mxf_metadata_mpeg_video_descriptor_handle_tag (MXFMetadataGenericDescriptor * d,
|
||||||
MXFMetadataMPEGVideoDescriptor * descriptor,
|
const MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data,
|
||||||
const MXFPrimerPack * primer, guint16 type, const guint8 * data, guint size)
|
guint16 tag_size)
|
||||||
{
|
{
|
||||||
guint16 tag, tag_size;
|
MXFMetadataMPEGVideoDescriptor *descriptor =
|
||||||
const guint8 *tag_data;
|
(MXFMetadataMPEGVideoDescriptor *) d;
|
||||||
|
gboolean ret = FALSE;
|
||||||
g_return_val_if_fail (data != NULL, FALSE);
|
|
||||||
|
|
||||||
memset (descriptor, 0, sizeof (MXFMetadataMPEGVideoDescriptor));
|
|
||||||
|
|
||||||
if (!mxf_metadata_cdci_picture_essence_descriptor_parse (key,
|
|
||||||
(MXFMetadataCDCIPictureEssenceDescriptor *) descriptor, primer, type,
|
|
||||||
data, size))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
while (mxf_local_tag_parse (data, size, &tag, &tag_size, &tag_data)) {
|
|
||||||
MXFUL *tag_ul = NULL;
|
MXFUL *tag_ul = NULL;
|
||||||
|
|
||||||
if (tag_size == 0 || tag == 0x0000)
|
|
||||||
goto next;
|
|
||||||
|
|
||||||
if (!(tag_ul =
|
if (!(tag_ul =
|
||||||
(MXFUL *) g_hash_table_lookup (primer->mappings,
|
(MXFUL *) g_hash_table_lookup (primer->mappings,
|
||||||
GUINT_TO_POINTER (((guint) tag)))))
|
GUINT_TO_POINTER (((guint) tag)))))
|
||||||
goto next;
|
return FALSE;
|
||||||
|
|
||||||
if (memcmp (tag_ul, &_single_sequence_ul, 16) == 0) {
|
if (memcmp (tag_ul, &_single_sequence_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->single_sequence = GST_READ_UINT8 (tag_data);
|
descriptor->single_sequence = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" single sequence = %s",
|
||||||
|
(descriptor->single_sequence) ? "yes" : "no");
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_constant_b_frames_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_constant_b_frames_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->const_b_frames = GST_READ_UINT8 (tag_data);
|
descriptor->const_b_frames = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" constant b frames = %s",
|
||||||
|
(descriptor->single_sequence) ? "yes" : "no");
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_coded_content_type_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_coded_content_type_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->coded_content_type = GST_READ_UINT8 (tag_data);
|
descriptor->coded_content_type = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" coded content type = %u", descriptor->coded_content_type);
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_low_delay_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_low_delay_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->low_delay = GST_READ_UINT8 (tag_data);
|
descriptor->low_delay = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" low delay = %s", (descriptor->low_delay) ? "yes" : "no");
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_closed_gop_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_closed_gop_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->closed_gop = GST_READ_UINT8 (tag_data);
|
descriptor->closed_gop = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" closed gop = %s", (descriptor->closed_gop) ? "yes" : "no");
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_identical_gop_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_identical_gop_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->identical_gop = GST_READ_UINT8 (tag_data);
|
descriptor->identical_gop = GST_READ_UINT8 (tag_data);
|
||||||
|
GST_DEBUG (" identical gop = %s",
|
||||||
|
(descriptor->identical_gop) ? "yes" : "no");
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_max_gop_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_max_gop_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 2)
|
if (tag_size != 2)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->max_gop = GST_READ_UINT16_BE (tag_data);
|
descriptor->max_gop = GST_READ_UINT16_BE (tag_data);
|
||||||
|
GST_DEBUG (" max gop = %u", descriptor->max_gop);
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_b_picture_count_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_b_picture_count_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 2)
|
if (tag_size != 2)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->b_picture_count = GST_READ_UINT16_BE (tag_data);
|
descriptor->b_picture_count = GST_READ_UINT16_BE (tag_data);
|
||||||
|
GST_DEBUG (" b picture count = %u", descriptor->b_picture_count);
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_bitrate_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_bitrate_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->bitrate = GST_READ_UINT32_BE (tag_data);
|
descriptor->bitrate = GST_READ_UINT32_BE (tag_data);
|
||||||
|
GST_DEBUG (" bitrate = %u", descriptor->bitrate);
|
||||||
|
ret = TRUE;
|
||||||
} else if (memcmp (tag_ul, &_profile_and_level_ul, 16) == 0) {
|
} else if (memcmp (tag_ul, &_profile_and_level_ul, 16) == 0) {
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
goto error;
|
goto error;
|
||||||
descriptor->profile_and_level = GST_READ_UINT8 (tag_data);
|
descriptor->profile_and_level = GST_READ_UINT8 (tag_data);
|
||||||
} else {
|
|
||||||
if (type != MXF_METADATA_MPEG_VIDEO_DESCRIPTOR)
|
|
||||||
goto next;
|
|
||||||
GST_WRITE_UINT16_BE (data, 0x0000);
|
|
||||||
if (!gst_metadata_add_custom_tag (primer, tag, tag_data, tag_size,
|
|
||||||
&((MXFMetadataGenericDescriptor *) descriptor)->other_tags))
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
next:
|
|
||||||
data += 4 + tag_size;
|
|
||||||
size -= 4 + tag_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG ("Parsed mpeg video descriptors:");
|
|
||||||
GST_DEBUG (" single sequence = %s",
|
|
||||||
(descriptor->single_sequence) ? "yes" : "no");
|
|
||||||
GST_DEBUG (" constant b frames = %s",
|
|
||||||
(descriptor->single_sequence) ? "yes" : "no");
|
|
||||||
GST_DEBUG (" coded content type = %u", descriptor->coded_content_type);
|
|
||||||
GST_DEBUG (" low delay = %s", (descriptor->low_delay) ? "yes" : "no");
|
|
||||||
GST_DEBUG (" closed gop = %s", (descriptor->closed_gop) ? "yes" : "no");
|
|
||||||
GST_DEBUG (" identical gop = %s",
|
|
||||||
(descriptor->identical_gop) ? "yes" : "no");
|
|
||||||
GST_DEBUG (" max gop = %u", descriptor->max_gop);
|
|
||||||
GST_DEBUG (" b picture count = %u", descriptor->b_picture_count);
|
|
||||||
GST_DEBUG (" bitrate = %u", descriptor->bitrate);
|
|
||||||
GST_DEBUG (" profile & level = %u", descriptor->profile_and_level);
|
GST_DEBUG (" profile & level = %u", descriptor->profile_and_level);
|
||||||
|
ret = TRUE;
|
||||||
|
} else {
|
||||||
|
ret =
|
||||||
|
mxf_metadata_cdci_picture_essence_descriptor_handle_tag (d, primer, tag,
|
||||||
|
tag_data, tag_size);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
GST_ERROR ("Invalid mpeg video descriptor");
|
GST_ERROR ("Invalid mpeg video descriptor tag 0x%04x of size %u", tag,
|
||||||
mxf_metadata_mpeg_video_descriptor_reset (descriptor);
|
tag_size);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
guint8 profile_and_level;
|
guint8 profile_and_level;
|
||||||
} MXFMetadataMPEGVideoDescriptor;
|
} MXFMetadataMPEGVideoDescriptor;
|
||||||
|
|
||||||
gboolean mxf_metadata_mpeg_video_descriptor_parse (const MXFUL *key, MXFMetadataMPEGVideoDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_mpeg_video_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor, const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_mpeg_video_descriptor_reset (MXFMetadataMPEGVideoDescriptor *descriptor);
|
void mxf_metadata_mpeg_video_descriptor_reset (MXFMetadataMPEGVideoDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_is_mpeg_video_essence_track (const MXFMetadataTrack *track);
|
gboolean mxf_is_mpeg_video_essence_track (const MXFMetadataTrack *track);
|
||||||
|
|
1104
gst/mxf/mxfparse.c
1104
gst/mxf/mxfparse.c
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,10 @@
|
||||||
|
|
||||||
typedef GstFlowReturn (*MXFEssenceElementHandler) (const MXFUL *key, GstBuffer *buffer, GstCaps *caps, MXFMetadataGenericPackage *package, MXFMetadataTrack *track, MXFMetadataStructuralComponent *component, gpointer mapping_data, GstBuffer **outbuf);
|
typedef GstFlowReturn (*MXFEssenceElementHandler) (const MXFUL *key, GstBuffer *buffer, GstCaps *caps, MXFMetadataGenericPackage *package, MXFMetadataTrack *track, MXFMetadataStructuralComponent *component, gpointer mapping_data, GstBuffer **outbuf);
|
||||||
|
|
||||||
|
typedef gboolean (*MXFMetadataDescriptorHandleTag) (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
|
typedef void (*MXFMetadataDescriptorReset) (MXFMetadataGenericDescriptor *descriptor);
|
||||||
|
|
||||||
gchar * mxf_ul_to_string (const MXFUL *ul, gchar str[48]);
|
gchar * mxf_ul_to_string (const MXFUL *ul, gchar str[48]);
|
||||||
gboolean mxf_ul_is_equal (const MXFUL *a, const MXFUL *b);
|
gboolean mxf_ul_is_equal (const MXFUL *a, const MXFUL *b);
|
||||||
gboolean mxf_ul_is_zero (const MXFUL *ul);
|
gboolean mxf_ul_is_zero (const MXFUL *ul);
|
||||||
|
@ -104,22 +108,31 @@ void mxf_metadata_sequence_reset (MXFMetadataSequence *sequence);
|
||||||
gboolean mxf_metadata_structural_component_parse (const MXFUL *key, MXFMetadataStructuralComponent *component, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_structural_component_parse (const MXFUL *key, MXFMetadataStructuralComponent *component, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
||||||
void mxf_metadata_structural_component_reset (MXFMetadataStructuralComponent *component);
|
void mxf_metadata_structural_component_reset (MXFMetadataStructuralComponent *component);
|
||||||
|
|
||||||
gboolean mxf_metadata_generic_descriptor_parse (const MXFUL *key, MXFMetadataGenericDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean
|
||||||
|
mxf_metadata_descriptor_parse (const MXFUL * key, MXFMetadataGenericDescriptor * descriptor, const MXFPrimerPack * primer, guint16 type, const guint8 * data, guint size, MXFMetadataDescriptorHandleTag handle_tag, MXFMetadataDescriptorReset reset);
|
||||||
|
|
||||||
|
gboolean mxf_metadata_generic_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_generic_descriptor_reset (MXFMetadataGenericDescriptor *descriptor);
|
void mxf_metadata_generic_descriptor_reset (MXFMetadataGenericDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_metadata_file_descriptor_parse (const MXFUL *key, MXFMetadataFileDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_file_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_file_descriptor_reset (MXFMetadataFileDescriptor *descriptor);
|
void mxf_metadata_file_descriptor_reset (MXFMetadataFileDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_metadata_generic_sound_essence_descriptor_parse (const MXFUL *key, MXFMetadataGenericSoundEssenceDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_generic_sound_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_generic_sound_essence_descriptor_reset (MXFMetadataGenericSoundEssenceDescriptor *descriptor);
|
void mxf_metadata_generic_sound_essence_descriptor_reset (MXFMetadataGenericSoundEssenceDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_metadata_generic_picture_essence_descriptor_parse (const MXFUL *key, MXFMetadataGenericPictureEssenceDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_generic_picture_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_generic_picture_essence_descriptor_reset (MXFMetadataGenericPictureEssenceDescriptor *descriptor);
|
void mxf_metadata_generic_picture_essence_descriptor_reset (MXFMetadataGenericPictureEssenceDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_metadata_cdci_picture_essence_descriptor_parse (const MXFUL *key, MXFMetadataCDCIPictureEssenceDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_cdci_picture_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_cdci_picture_essence_descriptor_reset (MXFMetadataCDCIPictureEssenceDescriptor *descriptor);
|
void mxf_metadata_cdci_picture_essence_descriptor_reset (MXFMetadataCDCIPictureEssenceDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_metadata_multiple_descriptor_parse (const MXFUL *key, MXFMetadataMultipleDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_multiple_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
|
||||||
|
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
|
||||||
void mxf_metadata_multiple_descriptor_reset (MXFMetadataMultipleDescriptor *descriptor);
|
void mxf_metadata_multiple_descriptor_reset (MXFMetadataMultipleDescriptor *descriptor);
|
||||||
|
|
||||||
gboolean mxf_metadata_locator_parse (const MXFUL *key, MXFMetadataLocator *locator, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
gboolean mxf_metadata_locator_parse (const MXFUL *key, MXFMetadataLocator *locator, const MXFPrimerPack *primer, guint16 type, const guint8 *data, guint size);
|
||||||
|
|
Loading…
Reference in a new issue