Add first version of an MXF demuxer. Currently it supports

Original commit message from CVS:
* configure.ac:
* gst/mxf/Makefile.am:
* gst/mxf/mxf.c: (plugin_init):
* gst/mxf/mxfaes-bwf.c:
(mxf_metadata_wave_audio_essence_descriptor_parse),
(mxf_metadata_wave_audio_essence_descriptor_reset),
(mxf_is_aes_bwf_essence_track), (mxf_bwf_handle_essence_element),
(mxf_bwf_create_caps), (mxf_aes_bwf_create_caps):
* gst/mxf/mxfaes-bwf.h:
* gst/mxf/mxfdemux.c: (gst_mxf_pad_finalize),
(gst_mxf_pad_class_init), (gst_mxf_pad_init),
(gst_mxf_demux_flush), (gst_mxf_demux_remove_pad),
(gst_mxf_demux_reset_mxf_state), (gst_mxf_demux_reset_metadata),
(gst_mxf_demux_reset), (gst_mxf_demux_pull_range),
(gst_mxf_demux_push_src_event),
(gst_mxf_demux_handle_partition_pack),
(gst_mxf_demux_handle_primer_pack),
(gst_mxf_demux_handle_metadata_preface),
(gst_mxf_demux_handle_metadata_identification),
(gst_mxf_demux_handle_metadata_content_storage),
(gst_mxf_demux_handle_metadata_essence_container_data),
(gst_mxf_demux_handle_metadata_material_package),
(gst_mxf_demux_handle_metadata_source_package),
(gst_mxf_demux_handle_metadata_track),
(gst_mxf_demux_handle_metadata_sequence),
(gst_mxf_demux_handle_metadata_structural_component),
(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_metadata_locator),
(gst_mxf_demux_handle_header_metadata_resolve_references),
(gst_mxf_demux_handle_header_metadata_update_streams),
(gst_mxf_demux_handle_metadata),
(gst_mxf_demux_handle_generic_container_system_item),
(gst_mxf_demux_handle_generic_container_essence_element),
(gst_mxf_demux_handle_random_index_pack),
(gst_mxf_demux_handle_index_table_segment),
(gst_mxf_demux_pull_klv_packet),
(gst_mxf_demux_parse_footer_metadata),
(gst_mxf_demux_handle_klv_packet),
(gst_mxf_demux_pull_and_handle_klv_packet), (gst_mxf_demux_loop),
(gst_mxf_demux_chain), (gst_mxf_demux_src_event),
(gst_mxf_demux_src_query_type), (gst_mxf_demux_src_query),
(gst_mxf_demux_sink_activate), (gst_mxf_demux_sink_activate_push),
(gst_mxf_demux_sink_activate_pull), (gst_mxf_demux_sink_event),
(gst_mxf_demux_change_state), (gst_mxf_demux_finalize),
(gst_mxf_demux_base_init), (gst_mxf_demux_class_init),
(gst_mxf_demux_init):
* gst/mxf/mxfdemux.h:
* gst/mxf/mxfmpeg.c: (mxf_metadata_mpeg_video_descriptor_parse),
(mxf_metadata_mpeg_video_descriptor_reset),
(mxf_is_mpeg_video_essence_track),
(mxf_mpeg_video_handle_essence_element),
(mxf_mpeg_video_create_caps):
* gst/mxf/mxfmpeg.h:
* gst/mxf/mxfparse.c: (mxf_is_mxf_packet), (mxf_is_partition_pack),
(mxf_is_header_partition_pack), (mxf_is_body_partition_pack),
(mxf_is_footer_partition_pack), (mxf_is_fill),
(mxf_is_primer_pack), (mxf_is_metadata),
(mxf_is_random_index_pack), (mxf_is_index_table_segment),
(mxf_is_generic_container_system_item),
(mxf_is_generic_container_essence_element),
(mxf_is_generic_container_essence_container_label),
(mxf_ul_is_equal), (mxf_ul_is_zero), (mxf_ul_to_string),
(mxf_umid_is_equal), (mxf_umid_is_zero), (mxf_umid_to_string),
(gst_mxf_ul_hash), (gst_mxf_ul_equal), (mxf_timestamp_parse),
(mxf_timestamp_is_unknown), (mxf_timestamp_compare),
(mxf_fraction_parse), (mxf_utf16_to_utf8),
(mxf_product_version_parse), (mxf_partition_pack_parse),
(mxf_partition_pack_reset), (_mxf_mapping_ul_free),
(mxf_primer_pack_parse), (mxf_primer_pack_reset),
(mxf_local_tag_parse), (gst_mxf_local_tag_free),
(gst_metadata_add_custom_tag), (mxf_metadata_preface_parse),
(mxf_metadata_preface_reset), (mxf_metadata_identification_parse),
(mxf_metadata_identification_reset),
(mxf_metadata_content_storage_parse),
(mxf_metadata_content_storage_reset),
(mxf_metadata_essence_container_data_parse),
(mxf_metadata_essence_container_data_reset),
(mxf_metadata_generic_package_parse),
(mxf_metadata_generic_package_reset), (mxf_metadata_track_parse),
(mxf_metadata_track_reset), (mxf_metadata_track_identifier_parse),
(mxf_metadata_sequence_parse), (mxf_metadata_sequence_reset),
(mxf_metadata_structural_component_parse),
(mxf_metadata_structural_component_reset),
(mxf_metadata_generic_descriptor_parse),
(mxf_metadata_generic_descriptor_reset),
(mxf_metadata_file_descriptor_parse),
(mxf_metadata_file_descriptor_reset),
(mxf_metadata_generic_sound_essence_descriptor_parse),
(mxf_metadata_generic_sound_essence_descriptor_reset),
(mxf_metadata_generic_picture_essence_descriptor_parse),
(mxf_metadata_generic_picture_essence_descriptor_reset),
(mxf_metadata_cdci_picture_essence_descriptor_parse),
(mxf_metadata_cdci_picture_essence_descriptor_reset),
(mxf_metadata_multiple_descriptor_parse),
(mxf_metadata_multiple_descriptor_reset),
(mxf_metadata_locator_parse), (mxf_metadata_locator_reset):
* gst/mxf/mxfparse.h:
* gst/mxf/mxftypes.h:
Add first version of an MXF demuxer. Currently it supports
MPEG video and raw audio and OP 1a/b/c.
This commit is contained in:
Sebastian Dröge 2008-11-21 10:27:15 +00:00
parent bba82abbf7
commit e76ea1ca88
13 changed files with 7255 additions and 0 deletions

110
ChangeLog
View file

@ -1,3 +1,113 @@
2008-11-21 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* configure.ac:
* gst/mxf/Makefile.am:
* gst/mxf/mxf.c: (plugin_init):
* gst/mxf/mxfaes-bwf.c:
(mxf_metadata_wave_audio_essence_descriptor_parse),
(mxf_metadata_wave_audio_essence_descriptor_reset),
(mxf_is_aes_bwf_essence_track), (mxf_bwf_handle_essence_element),
(mxf_bwf_create_caps), (mxf_aes_bwf_create_caps):
* gst/mxf/mxfaes-bwf.h:
* gst/mxf/mxfdemux.c: (gst_mxf_pad_finalize),
(gst_mxf_pad_class_init), (gst_mxf_pad_init),
(gst_mxf_demux_flush), (gst_mxf_demux_remove_pad),
(gst_mxf_demux_reset_mxf_state), (gst_mxf_demux_reset_metadata),
(gst_mxf_demux_reset), (gst_mxf_demux_pull_range),
(gst_mxf_demux_push_src_event),
(gst_mxf_demux_handle_partition_pack),
(gst_mxf_demux_handle_primer_pack),
(gst_mxf_demux_handle_metadata_preface),
(gst_mxf_demux_handle_metadata_identification),
(gst_mxf_demux_handle_metadata_content_storage),
(gst_mxf_demux_handle_metadata_essence_container_data),
(gst_mxf_demux_handle_metadata_material_package),
(gst_mxf_demux_handle_metadata_source_package),
(gst_mxf_demux_handle_metadata_track),
(gst_mxf_demux_handle_metadata_sequence),
(gst_mxf_demux_handle_metadata_structural_component),
(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_metadata_locator),
(gst_mxf_demux_handle_header_metadata_resolve_references),
(gst_mxf_demux_handle_header_metadata_update_streams),
(gst_mxf_demux_handle_metadata),
(gst_mxf_demux_handle_generic_container_system_item),
(gst_mxf_demux_handle_generic_container_essence_element),
(gst_mxf_demux_handle_random_index_pack),
(gst_mxf_demux_handle_index_table_segment),
(gst_mxf_demux_pull_klv_packet),
(gst_mxf_demux_parse_footer_metadata),
(gst_mxf_demux_handle_klv_packet),
(gst_mxf_demux_pull_and_handle_klv_packet), (gst_mxf_demux_loop),
(gst_mxf_demux_chain), (gst_mxf_demux_src_event),
(gst_mxf_demux_src_query_type), (gst_mxf_demux_src_query),
(gst_mxf_demux_sink_activate), (gst_mxf_demux_sink_activate_push),
(gst_mxf_demux_sink_activate_pull), (gst_mxf_demux_sink_event),
(gst_mxf_demux_change_state), (gst_mxf_demux_finalize),
(gst_mxf_demux_base_init), (gst_mxf_demux_class_init),
(gst_mxf_demux_init):
* gst/mxf/mxfdemux.h:
* gst/mxf/mxfmpeg.c: (mxf_metadata_mpeg_video_descriptor_parse),
(mxf_metadata_mpeg_video_descriptor_reset),
(mxf_is_mpeg_video_essence_track),
(mxf_mpeg_video_handle_essence_element),
(mxf_mpeg_video_create_caps):
* gst/mxf/mxfmpeg.h:
* gst/mxf/mxfparse.c: (mxf_is_mxf_packet), (mxf_is_partition_pack),
(mxf_is_header_partition_pack), (mxf_is_body_partition_pack),
(mxf_is_footer_partition_pack), (mxf_is_fill),
(mxf_is_primer_pack), (mxf_is_metadata),
(mxf_is_random_index_pack), (mxf_is_index_table_segment),
(mxf_is_generic_container_system_item),
(mxf_is_generic_container_essence_element),
(mxf_is_generic_container_essence_container_label),
(mxf_ul_is_equal), (mxf_ul_is_zero), (mxf_ul_to_string),
(mxf_umid_is_equal), (mxf_umid_is_zero), (mxf_umid_to_string),
(gst_mxf_ul_hash), (gst_mxf_ul_equal), (mxf_timestamp_parse),
(mxf_timestamp_is_unknown), (mxf_timestamp_compare),
(mxf_fraction_parse), (mxf_utf16_to_utf8),
(mxf_product_version_parse), (mxf_partition_pack_parse),
(mxf_partition_pack_reset), (_mxf_mapping_ul_free),
(mxf_primer_pack_parse), (mxf_primer_pack_reset),
(mxf_local_tag_parse), (gst_mxf_local_tag_free),
(gst_metadata_add_custom_tag), (mxf_metadata_preface_parse),
(mxf_metadata_preface_reset), (mxf_metadata_identification_parse),
(mxf_metadata_identification_reset),
(mxf_metadata_content_storage_parse),
(mxf_metadata_content_storage_reset),
(mxf_metadata_essence_container_data_parse),
(mxf_metadata_essence_container_data_reset),
(mxf_metadata_generic_package_parse),
(mxf_metadata_generic_package_reset), (mxf_metadata_track_parse),
(mxf_metadata_track_reset), (mxf_metadata_track_identifier_parse),
(mxf_metadata_sequence_parse), (mxf_metadata_sequence_reset),
(mxf_metadata_structural_component_parse),
(mxf_metadata_structural_component_reset),
(mxf_metadata_generic_descriptor_parse),
(mxf_metadata_generic_descriptor_reset),
(mxf_metadata_file_descriptor_parse),
(mxf_metadata_file_descriptor_reset),
(mxf_metadata_generic_sound_essence_descriptor_parse),
(mxf_metadata_generic_sound_essence_descriptor_reset),
(mxf_metadata_generic_picture_essence_descriptor_parse),
(mxf_metadata_generic_picture_essence_descriptor_reset),
(mxf_metadata_cdci_picture_essence_descriptor_parse),
(mxf_metadata_cdci_picture_essence_descriptor_reset),
(mxf_metadata_multiple_descriptor_parse),
(mxf_metadata_multiple_descriptor_reset),
(mxf_metadata_locator_parse), (mxf_metadata_locator_reset):
* gst/mxf/mxfparse.h:
* gst/mxf/mxftypes.h:
Add first version of an MXF demuxer. Currently it supports
MPEG video and raw audio and OP 1a/b/c.
2008-11-20 Michael Smith <msmith@songbirdnest.com>
* sys/dshowdecwrapper/gstdshowaudiodec.cpp:

View file

@ -254,6 +254,7 @@ AG_GST_CHECK_PLUGIN(mpegtsmux)
AG_GST_CHECK_PLUGIN(mpeg4videoparse)
AG_GST_CHECK_PLUGIN(mpegvideoparse)
AG_GST_CHECK_PLUGIN(mve)
AG_GST_CHECK_PLUGIN(mxf)
AG_GST_CHECK_PLUGIN(nsf)
AG_GST_CHECK_PLUGIN(nuvdemux)
AG_GST_CHECK_PLUGIN(pcapparse)
@ -1410,6 +1411,7 @@ gst/mpegtsmux/tsmux/Makefile
gst/mpeg4videoparse/Makefile
gst/mpegvideoparse/Makefile
gst/mve/Makefile
gst/mxf/Makefile
gst/nsf/Makefile
gst/nuvdemux/Makefile
gst/pcapparse/Makefile

20
gst/mxf/Makefile.am Normal file
View file

@ -0,0 +1,20 @@
plugin_LTLIBRARIES = libgstmxf.la
libgstmxf_la_SOURCES = \
mxf.c \
mxfdemux.c \
mxfparse.c \
mxfaes-bwf.c \
mxfmpeg.c
libgstmxf_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
libgstmxf_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
libgstmxf_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
mxfdemux.h \
mxfparse.h \
mxfaes-bwf.h \
mxfmpeg.h \
mxftypes.h

46
gst/mxf/mxf.c Normal file
View file

@ -0,0 +1,46 @@
/* GStreamer
* Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gst/gst.h>
#include "mxfdemux.h"
GST_DEBUG_CATEGORY (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "mxfdemux", GST_RANK_PRIMARY,
GST_TYPE_MXF_DEMUX))
return FALSE;
GST_DEBUG_CATEGORY_INIT (mxf_debug, "mxf", 0, "MXF");
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"mxf",
"MXF plugin library",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

382
gst/mxf/mxfaes-bwf.c Normal file
View file

@ -0,0 +1,382 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Implementation of SMPTE 382M - Mapping AES3 and Broadcast Wave
* Audio into the MXF Generic Container
*/
/* TODO:
* - Handle the case were a track only references specific channels
* of the essence (ChannelID property)
* - Add support for more codecs
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <string.h>
#include "mxfaes-bwf.h"
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
/* SMPTE 382M Annex 1 */
gboolean
mxf_metadata_wave_audio_essence_descriptor_parse (const MXFUL * key,
MXFMetadataWaveAudioEssenceDescriptor * descriptor,
const MXFPrimerPack * primer, guint16 type, const guint8 * data, gsize size)
{
guint16 tag, tag_size;
const guint8 *tag_data;
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) {
case 0x3d0a:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 2)
goto error;
descriptor->block_align = GST_READ_UINT16_BE (tag_data);
break;
case 0x3d0b:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->sequence_offset = GST_READ_UINT8 (tag_data);
break;
case 0x3d09:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->avg_bps = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d32:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 16)
goto error;
memcpy (&descriptor->channel_assignment, tag_data, 16);
break;
case 0x3d29:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->peak_envelope_version = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d2a:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->peak_envelope_format = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d2b:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->points_per_peak_value = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d2c:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->peak_envelope_block_size = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d2d:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->peak_channels = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d2e:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->peak_frames = GST_READ_UINT32_BE (tag_data);
break;
case 0x3d2f:
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 8)
goto error;
descriptor->peak_of_peaks_position = GST_READ_UINT64_BE (tag_data);
break;
case 0x3d30:
GST_WRITE_UINT16_BE (data, 0x0000);
if (!mxf_timestamp_parse (&descriptor->peak_envelope_timestamp,
tag_data, tag_size))
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",
descriptor->peak_envelope_timestamp.year,
descriptor->peak_envelope_timestamp.month,
descriptor->peak_envelope_timestamp.day,
descriptor->peak_envelope_timestamp.hour,
descriptor->peak_envelope_timestamp.minute,
descriptor->peak_envelope_timestamp.second,
(descriptor->peak_envelope_timestamp.quarter_msecond * 1000) / 256);
GST_DEBUG (" peak evelope data size = %u",
descriptor->peak_envelope_data_length);
return TRUE;
error:
GST_ERROR ("Invalid wave audio essence descriptor");
mxf_metadata_wave_audio_essence_descriptor_reset (descriptor);
return FALSE;
}
void mxf_metadata_wave_audio_essence_descriptor_reset
(MXFMetadataWaveAudioEssenceDescriptor * descriptor)
{
g_return_if_fail (descriptor != NULL);
mxf_metadata_generic_sound_essence_descriptor_reset (
(MXFMetadataGenericSoundEssenceDescriptor *) descriptor);
memset (descriptor, 0, sizeof (MXFMetadataWaveAudioEssenceDescriptor));
}
gboolean
mxf_is_aes_bwf_essence_track (const MXFMetadataTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, FALSE);
if (track->descriptor == NULL) {
GST_ERROR ("No descriptor for this track");
return FALSE;
}
for (i = 0; i < track->n_descriptor; i++) {
MXFMetadataFileDescriptor *d = track->descriptor[i];
MXFUL *key = &d->essence_container;
/* SMPTE 382M 9 */
if (mxf_is_generic_container_essence_container_label (key) &&
key->u[12] == 0x02 &&
key->u[13] == 0x06 &&
(key->u[14] == 0x01 ||
key->u[14] == 0x02 ||
key->u[14] == 0x03 ||
key->u[14] == 0x04 || key->u[14] == 0x08 || key->u[14] == 0x09))
return TRUE;
}
return FALSE;
}
static GstFlowReturn
mxf_bwf_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
GstCaps * caps, MXFMetadataGenericPackage * package,
MXFMetadataTrack * track, MXFMetadataStructuralComponent * component,
gpointer mapping_data, GstBuffer ** outbuf)
{
*outbuf = buffer;
/* SMPTE 382M Table 1: Check if this is some kind of Wave element */
if (key->u[12] != 0x16 || (key->u[14] != 0x01 && key->u[14] != 0x02
&& key->u[14] != 0x0b)) {
GST_ERROR ("Invalid BWF essence element");
return GST_FLOW_ERROR;
}
/* FIXME: check if the size is a multiply of the unit size, ... */
return GST_FLOW_OK;
}
/* SMPTE RP224 */
static const MXFUL mxf_sound_essence_compression_uncompressed =
{ {0x06, 0x0E, 0x2B, 0x34, 0x04, 0x01, 0x01, 0x01, 0x04, 0x02, 0x02, 0x01,
0x7F, 0x00, 0x00, 0x00}
};
static const MXFUL mxf_sound_essence_compression_aiff =
{ {0x06, 0x0E, 0x2B, 0x34, 0x04, 0x01, 0x01, 0x07, 0x04, 0x02, 0x02, 0x01,
0x7E, 0x00, 0x00, 0x00}
};
static GstCaps *
mxf_bwf_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataTrack * track,
MXFMetadataGenericSoundEssenceDescriptor * descriptor, GstTagList ** tags,
MXFEssenceElementHandler * handler, gpointer * mapping_data)
{
GstCaps *ret = NULL;
MXFMetadataWaveAudioEssenceDescriptor *wa_descriptor = NULL;
gchar str[48];
if (((MXFMetadataGenericDescriptor *) descriptor)->type ==
MXF_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR)
wa_descriptor = (MXFMetadataWaveAudioEssenceDescriptor *) descriptor;
/* TODO: set caps for avg bitrate, audio codec, ...... */
/* TODO: Handle width=!depth, needs shifting of samples */
/* FIXME: set a channel layout */
if (mxf_ul_is_zero (&descriptor->sound_essence_compression) ||
mxf_ul_is_equal (&descriptor->sound_essence_compression,
&mxf_sound_essence_compression_uncompressed)) {
guint block_align;
if (descriptor->channel_count == 0 ||
descriptor->quantization_bits == 0 ||
descriptor->audio_sampling_rate.n == 0 ||
descriptor->audio_sampling_rate.d == 0) {
GST_ERROR ("Invalid descriptor");
return NULL;
}
if (wa_descriptor)
block_align = wa_descriptor->block_align;
else
block_align = GST_ROUND_UP_8 (descriptor->quantization_bits) / 8;
ret = gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT,
(gint) (((gdouble) descriptor->audio_sampling_rate.n) /
((gdouble) descriptor->audio_sampling_rate.d) + 0.5), "channels",
G_TYPE_INT, descriptor->channel_count, "signed", G_TYPE_BOOLEAN,
(block_align != 1), "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, "depth",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, "width",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, NULL);
} else if (mxf_ul_is_equal (&descriptor->sound_essence_compression,
&mxf_sound_essence_compression_aiff)) {
guint block_align;
if (descriptor->channel_count == 0 ||
descriptor->quantization_bits == 0 ||
descriptor->audio_sampling_rate.n == 0 ||
descriptor->audio_sampling_rate.d == 0) {
GST_ERROR ("Invalid descriptor");
return NULL;
}
if (wa_descriptor)
block_align = wa_descriptor->block_align;
else
block_align = GST_ROUND_UP_8 (descriptor->quantization_bits) / 8;
ret = gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT,
(gint) (((gdouble) descriptor->audio_sampling_rate.n) /
((gdouble) descriptor->audio_sampling_rate.d) + 0.5), "channels",
G_TYPE_INT, descriptor->channel_count, "signed", G_TYPE_BOOLEAN,
(block_align != 1), "endianness", G_TYPE_INT, G_BIG_ENDIAN, "depth",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, "width",
G_TYPE_INT, (block_align / descriptor->channel_count) * 8, NULL);
} else {
GST_ERROR ("Unsupported sound essence compression: %s",
mxf_ul_to_string (&descriptor->sound_essence_compression, str));
}
*handler = mxf_bwf_handle_essence_element;
return ret;
}
GstCaps *
mxf_aes_bwf_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataTrack * track, GstTagList ** tags,
MXFEssenceElementHandler * handler, gpointer * mapping_data)
{
MXFMetadataGenericSoundEssenceDescriptor *s = NULL;
guint i;
g_return_val_if_fail (package != NULL, NULL);
g_return_val_if_fail (track != NULL, NULL);
if (track->descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return NULL;
}
/* TODO: handle AES3 audio */
for (i = 0; i < track->n_descriptor; i++) {
if ((track->descriptor[i]->parent.type ==
MXF_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR
|| track->descriptor[i]->parent.type ==
MXF_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR)
&& (track->descriptor[i]->essence_container.u[14] == 0x01
|| track->descriptor[i]->essence_container.u[14] == 0x02
|| track->descriptor[i]->essence_container.u[14] == 0x08)) {
s = (MXFMetadataGenericSoundEssenceDescriptor *) track->descriptor[i];
break;
}
}
if (!s) {
GST_ERROR ("No descriptor found for this track");
return NULL;
} else if (s) {
return mxf_bwf_create_caps (package, track, s, tags, handler, mapping_data);
}
return NULL;
}

66
gst/mxf/mxfaes-bwf.h Normal file
View file

@ -0,0 +1,66 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Implementation of SMPTE 382M - Mapping AES3 and Broadcast Wave
* Audio into the MXF Generic Container
*/
#ifndef __MXF_AES_BWF_H__
#define __MXF_AES_BWF_H__
#include <gst/gst.h>
#include "mxfparse.h"
/* SMPTE 382M Annex 1 */
#define MXF_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR 0x0148
/* SMPTE 382M Annex 1 */
typedef struct {
MXFMetadataGenericSoundEssenceDescriptor parent;
guint16 block_align;
guint8 sequence_offset;
guint32 avg_bps;
MXFUL channel_assignment;
guint32 peak_envelope_version;
guint32 peak_envelope_format;
guint32 points_per_peak_value;
guint32 peak_envelope_block_size;
guint32 peak_channels;
guint32 peak_frames;
gint64 peak_of_peaks_position;
MXFTimestamp peak_envelope_timestamp;
guint8 *peak_envelope_data;
guint16 peak_envelope_data_length;
} MXFMetadataWaveAudioEssenceDescriptor;
gboolean mxf_metadata_wave_audio_essence_descriptor_parse (const MXFUL *key, MXFMetadataWaveAudioEssenceDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, gsize size);
void mxf_metadata_wave_audio_essence_descriptor_reset (MXFMetadataWaveAudioEssenceDescriptor *descriptor);
gboolean mxf_is_aes_bwf_essence_track (const MXFMetadataTrack *track);
GstCaps *
mxf_aes_bwf_create_caps (MXFMetadataGenericPackage *package, MXFMetadataTrack *track, GstTagList **tags, MXFEssenceElementHandler *handler, gpointer *mapping_data);
#endif /* __MXF_AES_BWF_H__ */

2859
gst/mxf/mxfdemux.c Normal file

File diff suppressed because it is too large Load diff

108
gst/mxf/mxfdemux.h Normal file
View file

@ -0,0 +1,108 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MXF_DEMUX_H__
#define __MXF_DEMUX_H__
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include "mxfparse.h"
G_BEGIN_DECLS
#define GST_TYPE_MXF_DEMUX \
(gst_mxf_demux_get_type())
#define GST_MXF_DEMUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MXF_DEMUX,GstMXFDemux))
#define GST_MXF_DEMUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MXF_DEMUX,GstMXFDemuxClass))
#define GST_IS_MXF_DEMUX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MXF_DEMUX))
#define GST_IS_MXF_DEMUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MXF_DEMUX))
typedef struct _GstMXFDemux GstMXFDemux;
typedef struct _GstMXFDemuxClass GstMXFDemuxClass;
struct _GstMXFDemux
{
GstElement element;
GstPad *sinkpad;
GPtrArray *src;
GstAdapter *adapter;
GstSegment segment;
GstEvent *new_seg_event;
GstEvent *close_seg_event;
guint64 offset;
gboolean random_access;
gboolean flushing;
guint64 run_in;
guint64 header_partition_pack_offset;
guint64 footer_partition_pack_offset;
/* MXF file state */
MXFPartitionPack partition;
MXFPrimerPack primer;
/* Structural metadata */
gboolean update_metadata;
gboolean final_metadata;
MXFMetadataPreface preface;
GArray *identification;
MXFMetadataContentStorage content_storage;
GArray *essence_container_data;
GArray *material_package;
GArray *source_package;
GPtrArray *package;
GArray *track;
GArray *sequence;
GArray *structural_component;
GArray *locator;
GPtrArray *descriptor;
GArray *generic_descriptor;
GArray *file_descriptor;
GArray *generic_sound_essence_descriptor;
GArray *generic_picture_essence_descriptor;
GArray *cdci_picture_essence_descriptor;
GArray *mpeg_video_descriptor;
GArray *wave_audio_essence_descriptor;
GArray *multiple_descriptor;
MXFUMID current_package_uid;
MXFMetadataGenericPackage *current_package;
};
struct _GstMXFDemuxClass
{
GstElementClass parent_class;
};
GType gst_mxf_demux_get_type (void);
G_END_DECLS
#endif /* __MXF_DEMUX_H__ */

318
gst/mxf/mxfmpeg.c Normal file
View file

@ -0,0 +1,318 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Implementation of SMPTE 381M - Mapping MPEG streams into the MXF
* Generic Container
*/
/* TODO:
* - Handle PES streams
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <string.h>
#include "mxfmpeg.h"
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
/* SMPTE 381M 8.1 - ULs of local tags */
static const guint8 _single_sequence_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x02, 0x00, 0x00
};
static const guint8 _constant_b_frames_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x03, 0x00, 0x00
};
static const guint8 _coded_content_type_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x04, 0x00, 0x00
};
static const guint8 _low_delay_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x05, 0x00, 0x00
};
static const guint8 _closed_gop_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x06, 0x00, 0x00
};
static const guint8 _identical_gop_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x07, 0x00, 0x00
};
static const guint8 _max_gop_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x08, 0x00, 0x00
};
static const guint8 _b_picture_count_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x09, 0x00, 0x00
};
static const guint8 _bitrate_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x0b, 0x00, 0x00
};
static const guint8 _profile_and_level_ul[] = {
0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x04, 0x01, 0x06, 0x02, 0x01,
0x0a, 0x00, 0x00
};
gboolean
mxf_metadata_mpeg_video_descriptor_parse (const MXFUL * key,
MXFMetadataMPEGVideoDescriptor * descriptor,
const MXFPrimerPack * primer, guint16 type, const guint8 * data, gsize size)
{
guint16 tag, tag_size;
const guint8 *tag_data;
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;
if (tag_size == 0 || tag == 0x0000)
goto next;
if (!(tag_ul =
(MXFUL *) g_hash_table_lookup (primer->mappings,
GUINT_TO_POINTER (((guint) tag)))))
goto next;
if (memcmp (tag_ul, &_single_sequence_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->single_sequence = GST_READ_UINT8 (tag_data);
} else if (memcmp (tag_ul, &_constant_b_frames_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->const_b_frames = GST_READ_UINT8 (tag_data);
} else if (memcmp (tag_ul, &_coded_content_type_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->coded_content_type = GST_READ_UINT8 (tag_data);
} else if (memcmp (tag_ul, &_low_delay_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->low_delay = GST_READ_UINT8 (tag_data);
} else if (memcmp (tag_ul, &_closed_gop_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->closed_gop = GST_READ_UINT8 (tag_data);
} else if (memcmp (tag_ul, &_identical_gop_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
descriptor->identical_gop = GST_READ_UINT8 (tag_data);
} else if (memcmp (tag_ul, &_max_gop_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 2)
goto error;
descriptor->max_gop = GST_READ_UINT16_BE (tag_data);
} else if (memcmp (tag_ul, &_b_picture_count_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 2)
goto error;
descriptor->b_picture_count = GST_READ_UINT16_BE (tag_data);
} else if (memcmp (tag_ul, &_bitrate_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 4)
goto error;
descriptor->bitrate = GST_READ_UINT32_BE (tag_data);
} else if (memcmp (tag_ul, &_profile_and_level_ul, 16) == 0) {
GST_WRITE_UINT16_BE (data, 0x0000);
if (tag_size != 1)
goto error;
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);
return TRUE;
error:
GST_ERROR ("Invalid mpeg video descriptor");
mxf_metadata_mpeg_video_descriptor_reset (descriptor);
return FALSE;
}
void mxf_metadata_mpeg_video_descriptor_reset
(MXFMetadataMPEGVideoDescriptor * descriptor)
{
g_return_if_fail (descriptor != NULL);
mxf_metadata_cdci_picture_essence_descriptor_reset (
(MXFMetadataCDCIPictureEssenceDescriptor *) descriptor);
memset (descriptor, 0, sizeof (MXFMetadataMPEGVideoDescriptor));
}
gboolean
mxf_is_mpeg_video_essence_track (const MXFMetadataTrack * track)
{
guint i;
g_return_val_if_fail (track != NULL, FALSE);
if (track->descriptor == NULL)
return FALSE;
for (i = 0; i < track->n_descriptor; i++) {
MXFMetadataFileDescriptor *d = track->descriptor[i];
MXFUL *key = &d->essence_container;
/* SMPTE 381M 7 */
if (mxf_is_generic_container_essence_container_label (key) &&
key->u[12] == 0x02 &&
(key->u[13] == 0x04 ||
key->u[13] == 0x07 || key->u[13] == 0x08 || key->u[13] == 0x09))
return TRUE;
}
return FALSE;
}
static GstFlowReturn
mxf_mpeg_video_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
GstCaps * caps, MXFMetadataGenericPackage * package,
MXFMetadataTrack * track, MXFMetadataStructuralComponent * component,
gpointer mapping_data, GstBuffer ** outbuf)
{
*outbuf = buffer;
/* SMPTE 381M 6.1 */
if (key->u[12] != 0x15 || (key->u[14] != 0x05 && key->u[14] != 0x06
&& key->u[14] != 0x07)) {
GST_ERROR ("Invalid MPEG video essence element");
return GST_FLOW_ERROR;
}
return GST_FLOW_OK;
}
GstCaps *
mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataTrack * track, GstTagList ** tags,
MXFEssenceElementHandler * handler, gpointer * mapping_data)
{
MXFMetadataMPEGVideoDescriptor *d = NULL;
MXFMetadataFileDescriptor *f = NULL;
guint i;
g_return_val_if_fail (package != NULL, NULL);
g_return_val_if_fail (track != NULL, NULL);
if (track->descriptor == NULL) {
GST_ERROR ("No descriptor found for this track");
return NULL;
}
for (i = 0; i < track->n_descriptor; i++) {
if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_MPEG_VIDEO_DESCRIPTOR) {
d = (MXFMetadataMPEGVideoDescriptor *) track->descriptor[i];
f = track->descriptor[i];
break;
} else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR
|| ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR
|| ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_FILE_DESCRIPTOR) {
f = track->descriptor[i];
}
}
if (!f) {
GST_ERROR ("No descriptor found for this track");
return NULL;
}
*handler = mxf_mpeg_video_handle_essence_element;
/* SMPTE 381M 7 */
if (f->essence_container.u[13] == 0x04) {
/* FIXME: get mpeg version somehow */
GST_DEBUG ("Found MPEG ES stream");
return gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
} else if (f->essence_container.u[13] == 0x07) {
GST_ERROR ("MPEG PES streams not supported yet");
return NULL;
} else if (f->essence_container.u[13] == 0x08) {
/* FIXME: get mpeg version somehow */
GST_DEBUG ("Found MPEG PS stream");
return gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
} else if (f->essence_container.u[13] == 0x09) {
GST_DEBUG ("Found MPEG TS stream");
return gst_caps_new_simple ("video/mpegts", NULL);
}
return NULL;
}

60
gst/mxf/mxfmpeg.h Normal file
View file

@ -0,0 +1,60 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Implementation of SMPTE 381M - Mapping MPEG streams into the MXF
* Generic Container
*/
#ifndef __MXF_MPEG_H__
#define __MXF_MPEG_H__
#include <gst/gst.h>
#include "mxfparse.h"
/* SMPTE 381M 8.1.1 */
#define MXF_METADATA_MPEG_VIDEO_DESCRIPTOR 0x0151
/* SMPTE 381M 8.1 */
typedef struct {
MXFMetadataCDCIPictureEssenceDescriptor parent;
gboolean single_sequence;
gboolean const_b_frames;
guint8 coded_content_type;
gboolean low_delay;
gboolean closed_gop;
gboolean identical_gop;
guint16 max_gop;
guint16 b_picture_count;
guint32 bitrate;
guint8 profile_and_level;
} MXFMetadataMPEGVideoDescriptor;
gboolean mxf_metadata_mpeg_video_descriptor_parse (const MXFUL *key, MXFMetadataMPEGVideoDescriptor *descriptor, const MXFPrimerPack *primer, guint16 type, const guint8 *data, gsize size);
void mxf_metadata_mpeg_video_descriptor_reset (MXFMetadataMPEGVideoDescriptor *descriptor);
gboolean mxf_is_mpeg_video_essence_track (const MXFMetadataTrack *track);
GstCaps *
mxf_mpeg_video_create_caps (MXFMetadataGenericPackage *package, MXFMetadataTrack *track, GstTagList **tags, MXFEssenceElementHandler *handler, gpointer *mapping_data);
#endif /* __MXF_MPEG_H__ */

2692
gst/mxf/mxfparse.c Normal file

File diff suppressed because it is too large Load diff

129
gst/mxf/mxfparse.h Normal file
View file

@ -0,0 +1,129 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MXF_PARSE_H__
#define __MXF_PARSE_H__
#include "mxftypes.h"
typedef GstFlowReturn (*MXFEssenceElementHandler) (const MXFUL *key, GstBuffer *buffer, GstCaps *caps, MXFMetadataGenericPackage *package, MXFMetadataTrack *track, MXFMetadataStructuralComponent *component, gpointer mapping_data, GstBuffer **outbuf);
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_zero (const MXFUL *ul);
gchar *mxf_umid_to_string (const MXFUMID * umid, gchar str[96]);
gboolean mxf_umid_is_equal (const MXFUMID *a, const MXFUMID *b);
gboolean mxf_umid_is_zero (const MXFUMID *umid);
gboolean mxf_is_mxf_packet (const MXFUL *key);
gboolean mxf_is_partition_pack (const MXFUL *key);
gboolean mxf_is_header_partition_pack (const MXFUL *key);
gboolean mxf_is_body_partition_pack (const MXFUL *key);
gboolean mxf_is_footer_partition_pack (const MXFUL *key);
gboolean mxf_is_primer_pack (const MXFUL *key);
gboolean mxf_is_metadata (const MXFUL *key);
gboolean mxf_is_random_index_pack (const MXFUL *key);
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_generic_container_essence_container_label (const MXFUL *key);
gboolean mxf_is_fill (const MXFUL *key);
gchar * mxf_utf16_to_utf8 (const guint8 * data, guint16 size);
gboolean mxf_product_version_parse (MXFProductVersion * product_version,
const guint8 * data, gsize size);
gboolean mxf_fraction_parse (MXFFraction *fraction, const guint8 *data, guint16 size);
gboolean mxf_timestamp_parse (MXFTimestamp * timestamp, const guint8 * data, gsize size);
gboolean mxf_timestamp_is_unknown (const MXFTimestamp *a);
gint mxf_timestamp_compare (const MXFTimestamp *a, const MXFTimestamp *b);
gboolean mxf_partition_pack_parse (const MXFUL *key, MXFPartitionPack *pack, const guint8 *data, gsize size);
void mxf_partition_pack_reset (MXFPartitionPack *pack);
gboolean mxf_primer_pack_parse (const MXFUL *key, MXFPrimerPack *pack, const guint8 *data, gsize size);
void mxf_primer_pack_reset (MXFPrimerPack *pack);
gboolean mxf_local_tag_parse (const guint8 * data, gsize size, guint16 * tag,
guint16 * tag_size, const guint8 ** tag_data);
void gst_mxf_local_tag_free (MXFLocalTag *tag);
gboolean gst_metadata_add_custom_tag (const MXFPrimerPack *primer,
guint16 tag, const guint8 *tag_data, guint16 tag_size,
GHashTable **hash_table);
gboolean mxf_metadata_preface_parse (const MXFUL *key, MXFMetadataPreface *preface, const MXFPrimerPack *primer, const guint8 *data, gsize size);
void mxf_metadata_preface_reset (MXFMetadataPreface *preface);
gboolean mxf_metadata_identification_parse (const MXFUL *key, MXFMetadataIdentification *identification, const MXFPrimerPack *primer, const guint8 *data, gsize size);
void mxf_metadata_identification_reset (MXFMetadataIdentification *identification);
gboolean mxf_metadata_content_storage_parse (const MXFUL *key, MXFMetadataContentStorage *content_storage, const MXFPrimerPack *primer, const guint8 *data, gsize size);
void mxf_metadata_content_storage_reset (MXFMetadataContentStorage *content_storage);
gboolean mxf_metadata_essence_container_data_parse (const MXFUL *key, MXFMetadataEssenceContainerData *essence_container_data, const MXFPrimerPack *primer, const guint8 *data, gsize size);
void mxf_metadata_essence_container_data_reset (MXFMetadataEssenceContainerData *essence_container_data);
gboolean mxf_metadata_generic_package_parse (const MXFUL *key, MXFMetadataGenericPackage *generic_package, const MXFPrimerPack *primer, const guint8 *data, gsize size);
void mxf_metadata_generic_package_reset (MXFMetadataGenericPackage *generic_package);
gboolean mxf_metadata_track_parse (const MXFUL *key, MXFMetadataTrack *track, const MXFPrimerPack *primer, const guint8 *data, gsize size);
void mxf_metadata_track_reset (MXFMetadataTrack *track);
MXFMetadataTrackType mxf_metadata_track_identifier_parse (const MXFUL *track_identifier);
gboolean mxf_metadata_sequence_parse (const MXFUL *key, MXFMetadataSequence *sequence, const MXFPrimerPack *primer, const guint8 *data, gsize size);
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, gsize size);
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, gsize size);
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, gsize size);
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, gsize size);
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, gsize size);
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, gsize size);
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, gsize size);
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, gsize size);
void mxf_metadata_locator_reset (MXFMetadataLocator *locator);
#endif /* __MXF_PARSE_H__ */

463
gst/mxf/mxftypes.h Normal file
View file

@ -0,0 +1,463 @@
/* GStreamer
* Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MXF_TYPES_H__
#define __MXF_TYPES_H__
/* SMPTE 377M 3.2 */
typedef struct {
guint8 u[16];
} MXFUL;
/* SMPTE 377M 3.2 */
typedef struct {
guint8 u[32];
} MXFUMID;
/* SMPTE 377M 3.3 */
typedef struct {
gint16 year;
guint8 month;
guint8 day;
guint8 hour;
guint8 minute;
guint8 second;
guint8 quarter_msecond;
} MXFTimestamp;
/* SMPTE 377M 3.3 */
typedef struct {
guint16 major;
guint16 minor;
guint16 patch;
guint16 build;
guint16 release;
} MXFProductVersion;
/* SMPTE 377M 3.3 */
typedef struct {
gint32 n;
gint32 d;
} MXFFraction;
/* SMPTE 377M 8.3 */
typedef struct {
MXFUL key;
guint16 size;
guint8 *data;
} MXFLocalTag;
typedef enum {
MXF_PARTITION_PACK_HEADER,
MXF_PARTITION_PACK_BODY,
MXF_PARTITION_PACK_FOOTER
} MXFPartitionPackType;
/* SMPTE 377M 6.1, Table 1 and 2 */
typedef struct {
gboolean valid;
MXFPartitionPackType type;
gboolean closed;
gboolean complete;
guint16 major_version;
guint16 minor_version;
guint32 kag_size;
guint64 this_partition;
guint64 prev_partition;
guint64 footer_partition;
guint64 header_byte_count;
guint64 index_byte_count;
guint32 index_sid;
guint64 body_offset;
guint32 body_sid;
MXFUL operational_pattern;
guint32 n_essence_containers;
MXFUL *essence_containers;
} MXFPartitionPack;
/* SMPTE 377M 8.1 */
typedef struct {
gboolean valid;
GHashTable *mappings;
} MXFPrimerPack;
/* SMPTE 377M 8.6 table 14 */
#define MXF_METADATA_PREFACE (0x012f)
#define MXF_METADATA_IDENTIFICATION (0x0130)
#define MXF_METADATA_CONTENT_STORAGE (0x0118)
#define MXF_METADATA_ESSENCE_CONTAINER_DATA (0x0123)
#define MXF_METADATA_MATERIAL_PACKAGE (0x0136)
#define MXF_METADATA_SOURCE_PACKAGE (0x0137)
#define MXF_METADATA_TRACK (0x013b)
#define MXF_METADATA_EVENT_TRACK (0x0139)
#define MXF_METADATA_STATIC_TRACK (0x013a)
#define MXF_METADATA_SEQUENCE (0x010f)
#define MXF_METADATA_SOURCE_CLIP (0x0111)
#define MXF_METADATA_TIMECODE_COMPONENT (0x0114)
#define MXF_METADATA_DM_SEGMENT (0x0141)
#define MXF_METADATA_DM_SOURCE_CLIP (0x0145)
#define MXF_METADATA_FILE_DESCRIPTOR (0x0125)
#define MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (0x0127)
#define MXF_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR (0x0128)
#define MXF_METADATA_RGBA_PICTURE_ESSENCE_DESCRIPTOR (0x0129)
#define MXF_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR (0x0142)
#define MXF_METADATA_GENERIC_DATA_ESSENCE_DESCRIPTOR (0x0143)
#define MXF_METADATA_MULTIPLE_DESCRIPTOR (0x0144)
#define MXF_METADATA_NETWORK_LOCATOR (0x0132)
#define MXF_METADATA_TEXT_LOCATOR (0x0133)
/* SMPTE 377M Annex A, B, C, D */
typedef struct _MXFMetadataPreface MXFMetadataPreface;
typedef struct _MXFMetadataIdentification MXFMetadataIdentification;
typedef struct _MXFMetadataContentStorage MXFMetadataContentStorage;
typedef struct _MXFMetadataEssenceContainerData MXFMetadataEssenceContainerData;
typedef struct _MXFMetadataGenericPackage MXFMetadataGenericPackage;
typedef MXFMetadataGenericPackage MXFMetadataMaterialPackage;
typedef MXFMetadataGenericPackage MXFMetadataSourcePackage;
typedef struct _MXFMetadataTrack MXFMetadataTrack;
typedef struct _MXFMetadataSequence MXFMetadataSequence;
typedef struct _MXFMetadataStructuralComponent MXFMetadataStructuralComponent;
typedef struct _MXFMetadataGenericDescriptor MXFMetadataGenericDescriptor;
typedef struct _MXFMetadataFileDescriptor MXFMetadataFileDescriptor;
typedef struct _MXFMetadataGenericPictureEssenceDescriptor MXFMetadataGenericPictureEssenceDescriptor;
typedef struct _MXFMetadataCDCIPictureEssenceDescriptor MXFMetadataCDCIPictureEssenceDescriptor;
typedef struct _MXFMetadataGenericSoundEssenceDescriptor MXFMetadataGenericSoundEssenceDescriptor;
typedef struct _MXFMetadataMultipleDescriptor MXFMetadataMultipleDescriptor;
typedef struct _MXFMetadataLocator MXFMetadataLocator;
struct _MXFMetadataPreface {
MXFUL instance_uid;
MXFUL generation_uid;
MXFTimestamp last_modified_date;
guint16 version;
guint32 object_model_version;
MXFUL primary_package_uid;
MXFMetadataGenericPackage *primary_package;
guint32 n_identifications;
MXFUL *identifications_uids;
MXFMetadataIdentification **identifications;
MXFUL content_storage_uid;
MXFMetadataContentStorage *content_storage;
MXFUL operational_pattern;
guint32 n_essence_containers;
MXFUL *essence_containers;
guint32 n_dm_schemes;
MXFUL *dm_schemes;
GHashTable *other_tags;
};
struct _MXFMetadataIdentification {
MXFUL instance_uid;
MXFUL generation_uid;
gchar *company_name;
gchar *product_name;
MXFProductVersion product_version;
gchar *version_string;
MXFUL product_uid;
MXFTimestamp modification_date;
MXFProductVersion toolkit_version;
gchar *platform;
GHashTable *other_tags;
};
struct _MXFMetadataContentStorage {
MXFUL instance_uid;
MXFUL generation_uid;
guint32 n_packages;
MXFUL *packages_uids;
MXFMetadataGenericPackage **packages;
guint32 n_essence_container_data;
MXFUL *essence_container_data_uids;
MXFMetadataEssenceContainerData **essence_container_data;
GHashTable *other_tags;
};
struct _MXFMetadataEssenceContainerData {
MXFUL instance_uid;
MXFUMID linked_package_uid;
MXFMetadataGenericPackage *linked_package;
MXFUL generation_uid;
guint32 index_sid;
guint32 body_sid;
GHashTable *other_tags;
};
typedef enum {
MXF_METADATA_GENERIC_PACKAGE_SOURCE = 0,
MXF_METADATA_GENERIC_PACKAGE_MATERIAL = 1,
MXF_METADATA_GENERIC_PACKAGE_TOP_LEVEL_SOURCE = 2
} MXFMetadataGenericPackageType;
struct _MXFMetadataGenericPackage {
MXFUL instance_uid;
MXFUMID package_uid;
MXFUL generation_uid;
MXFMetadataGenericPackageType type;
gchar *name;
MXFTimestamp package_creation_date;
MXFTimestamp package_modified_date;
guint32 n_tracks;
MXFUL *tracks_uids;
MXFMetadataTrack **tracks;
guint n_timecode_tracks;
guint n_metadata_tracks;
guint n_essence_tracks;
guint n_other_tracks;
/* Only in Source packages */
MXFUL descriptors_uid;
guint32 n_descriptors;
MXFMetadataGenericDescriptor **descriptors;
GHashTable *other_tags;
};
typedef enum {
MXF_METADATA_TRACK_UNKNOWN = 0x00,
MXF_METADATA_TRACK_TIMECODE_12M_INACTIVE = 0x10,
MXF_METADATA_TRACK_TIMECODE_12M_ACTIVE = 0x11,
MXF_METADATA_TRACK_TIMECODE_309M = 0x12,
MXF_METADATA_TRACK_METADATA = 0x20,
MXF_METADATA_TRACK_PICTURE_ESSENCE = 0x30,
MXF_METADATA_TRACK_SOUND_ESSENCE = 0x31,
MXF_METADATA_TRACK_DATA_ESSENCE = 0x32,
MXF_METADATA_TRACK_AUXILIARY_DATA = 0x40,
MXF_METADATA_TRACK_PARSED_TEXT = 0x41
} MXFMetadataTrackType;
struct _MXFMetadataTrack {
MXFUL instance_uid;
MXFUL generation_uid;
guint32 track_id;
guint32 track_number;
gchar *track_name;
MXFFraction edit_rate;
gint64 origin;
MXFUL sequence_uid;
MXFMetadataSequence *sequence;
MXFMetadataFileDescriptor **descriptor;
guint n_descriptor;
GHashTable *other_tags;
};
struct _MXFMetadataSequence {
MXFUL instance_uid;
MXFUL generation_uid;
MXFUL data_definition;
gint64 duration;
guint32 n_structural_components;
MXFUL *structural_components_uids;
MXFMetadataStructuralComponent **structural_components;
GHashTable *other_tags;
};
struct _MXFMetadataStructuralComponent {
guint16 type;
MXFUL instance_uid;
MXFUL generation_uid;
MXFUL data_definition;
gint64 duration;
union {
struct {
gint64 start_timecode;
guint16 rounded_timecode_base;
gboolean drop_frame;
} timecode_component;
struct {
gint64 start_position;
MXFUMID source_package_id;
MXFMetadataGenericPackage *source_package;
guint32 source_track_id;
} source_clip;
};
GHashTable *other_tags;
};
struct _MXFMetadataGenericDescriptor {
guint16 type;
MXFUL instance_uid;
MXFUL generation_uid;
guint32 n_locators;
MXFUL *locators_uids;
MXFMetadataLocator **locators;
gboolean is_file_descriptor;
GHashTable *other_tags;
};
struct _MXFMetadataFileDescriptor {
MXFMetadataGenericDescriptor parent;
guint32 linked_track_id;
MXFFraction sample_rate;
gint64 container_duration;
MXFUL essence_container;
MXFUL codec;
};
struct _MXFMetadataGenericPictureEssenceDescriptor {
MXFMetadataFileDescriptor parent;
guint8 signal_standard;
guint8 frame_layout;
guint32 stored_width;
guint32 stored_height;
gint32 stored_f2_offset;
guint32 sampled_width;
guint32 sampled_height;
gint32 sampled_x_offset;
gint32 sampled_y_offset;
guint32 display_height;
guint32 display_width;
gint32 display_x_offset;
gint32 display_y_offset;
gint32 display_f2_offset;
MXFFraction aspect_ratio;
guint8 active_format_descriptor;
gint32 video_line_map[2];
guint8 alpha_transparency;
MXFUL capture_gamma;
guint32 image_alignment_offset;
guint32 image_start_offset;
guint32 image_end_offset;
guint8 field_dominance;
MXFUL picture_essence_coding;
};
struct _MXFMetadataCDCIPictureEssenceDescriptor {
MXFMetadataGenericPictureEssenceDescriptor parent;
guint32 component_depth;
guint32 horizontal_subsampling;
guint32 vertical_subsampling;
guint8 color_siting;
gboolean reversed_byte_order;
gint16 padding_bits;
guint32 alpha_sample_depth;
guint32 black_ref_level;
guint32 white_ref_level;
guint32 color_range;
};
struct _MXFMetadataGenericSoundEssenceDescriptor {
MXFMetadataFileDescriptor parent;
MXFFraction audio_sampling_rate;
gboolean locked;
gint8 audio_ref_level;
guint8 electro_spatial_formulation;
guint32 channel_count;
guint32 quantization_bits;
gint8 dial_norm;
MXFUL sound_essence_compression;
};
struct _MXFMetadataMultipleDescriptor {
MXFMetadataFileDescriptor parent;
MXFUL *sub_descriptors_uids;
guint32 n_sub_descriptors;
MXFMetadataGenericDescriptor **sub_descriptors;
};
struct _MXFMetadataLocator {
guint16 type;
MXFUL instance_uid;
MXFUL generation_uid;
gchar *location;
GHashTable *other_tags;
};
#endif /* __MXF_TYPES_H__ */