gst/mxf/mxfdemux.c: Generalize some lines of codes that are more or less the same by a macro.

Original commit message from CVS:
* gst/mxf/mxfdemux.c:
(gst_mxf_demux_handle_header_metadata_resolve_references):
Generalize some lines of codes that are more or less the same
by a macro.
This commit is contained in:
Sebastian Dröge 2008-12-05 10:32:55 +00:00
parent b0e94e354f
commit 278604dfa1
2 changed files with 41 additions and 73 deletions

View file

@ -1,3 +1,10 @@
2008-12-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfdemux.c:
(gst_mxf_demux_handle_header_metadata_resolve_references):
Generalize some lines of codes that are more or less the same
by a macro.
2008-12-04 Sebastian Dröge <sebastian.droege@collabora.co.uk> 2008-12-04 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* configure.ac: * configure.ac:

View file

@ -1165,76 +1165,38 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
/* Fill in demux->descriptor */ /* Fill in demux->descriptor */
demux->descriptor = g_ptr_array_new (); demux->descriptor = g_ptr_array_new ();
if (demux->generic_descriptor) {
for (i = 0; i < demux->generic_descriptor->len; i++) { #define FILL_DESCRIPTOR_ARRAY(desc_array, TYPE) \
g_ptr_array_add (demux->descriptor, G_STMT_START { \
&g_array_index (demux->generic_descriptor, if (desc_array) { \
MXFMetadataGenericDescriptor, i)); for (i = 0; i < desc_array->len; i++) { \
} g_ptr_array_add (demux->descriptor, \
} &g_array_index (desc_array, TYPE, i)); \
if (demux->file_descriptor) { } \
for (i = 0; i < demux->file_descriptor->len; i++) { } \
g_ptr_array_add (demux->descriptor, } G_STMT_END
&g_array_index (demux->file_descriptor, MXFMetadataFileDescriptor,
i)); FILL_DESCRIPTOR_ARRAY (demux->generic_descriptor,
} MXFMetadataGenericDescriptor);
} FILL_DESCRIPTOR_ARRAY (demux->file_descriptor, MXFMetadataFileDescriptor);
if (demux->generic_picture_essence_descriptor) { FILL_DESCRIPTOR_ARRAY (demux->generic_picture_essence_descriptor,
for (i = 0; i < demux->generic_picture_essence_descriptor->len; i++) { MXFMetadataGenericPictureEssenceDescriptor);
g_ptr_array_add (demux->descriptor, FILL_DESCRIPTOR_ARRAY (demux->cdci_picture_essence_descriptor,
&g_array_index (demux->generic_picture_essence_descriptor, MXFMetadataCDCIPictureEssenceDescriptor);
MXFMetadataGenericPictureEssenceDescriptor, i)); FILL_DESCRIPTOR_ARRAY (demux->rgba_picture_essence_descriptor,
} MXFMetadataRGBAPictureEssenceDescriptor);
} FILL_DESCRIPTOR_ARRAY (demux->mpeg_video_descriptor,
if (demux->cdci_picture_essence_descriptor) { MXFMetadataMPEGVideoDescriptor);
for (i = 0; i < demux->cdci_picture_essence_descriptor->len; i++) { FILL_DESCRIPTOR_ARRAY (demux->generic_sound_essence_descriptor,
g_ptr_array_add (demux->descriptor, MXFMetadataGenericSoundEssenceDescriptor);
&g_array_index (demux->cdci_picture_essence_descriptor, FILL_DESCRIPTOR_ARRAY (demux->wave_audio_essence_descriptor,
MXFMetadataCDCIPictureEssenceDescriptor, i)); MXFMetadataWaveAudioEssenceDescriptor);
} FILL_DESCRIPTOR_ARRAY (demux->aes3_audio_essence_descriptor,
} MXFMetadataAES3AudioEssenceDescriptor);
if (demux->rgba_picture_essence_descriptor) { FILL_DESCRIPTOR_ARRAY (demux->multiple_descriptor,
for (i = 0; i < demux->rgba_picture_essence_descriptor->len; i++) { MXFMetadataMultipleDescriptor);
g_ptr_array_add (demux->descriptor,
&g_array_index (demux->rgba_picture_essence_descriptor, #undef FILL_DESCRIPTOR_ARRAY
MXFMetadataRGBAPictureEssenceDescriptor, i));
}
}
if (demux->mpeg_video_descriptor) {
for (i = 0; i < demux->mpeg_video_descriptor->len; i++) {
g_ptr_array_add (demux->descriptor,
&g_array_index (demux->mpeg_video_descriptor,
MXFMetadataMPEGVideoDescriptor, i));
}
}
if (demux->generic_sound_essence_descriptor) {
for (i = 0; i < demux->generic_sound_essence_descriptor->len; i++) {
g_ptr_array_add (demux->descriptor,
&g_array_index (demux->generic_sound_essence_descriptor,
MXFMetadataGenericSoundEssenceDescriptor, i));
}
}
if (demux->wave_audio_essence_descriptor) {
for (i = 0; i < demux->wave_audio_essence_descriptor->len; i++) {
g_ptr_array_add (demux->descriptor,
&g_array_index (demux->wave_audio_essence_descriptor,
MXFMetadataWaveAudioEssenceDescriptor, i));
}
}
if (demux->aes3_audio_essence_descriptor) {
for (i = 0; i < demux->aes3_audio_essence_descriptor->len; i++) {
g_ptr_array_add (demux->descriptor,
&g_array_index (demux->aes3_audio_essence_descriptor,
MXFMetadataAES3AudioEssenceDescriptor, i));
}
}
if (demux->multiple_descriptor) {
for (i = 0; i < demux->multiple_descriptor->len; i++) {
g_ptr_array_add (demux->descriptor,
&g_array_index (demux->multiple_descriptor,
MXFMetadataMultipleDescriptor, i));
}
}
/* Fill in demux->package */ /* Fill in demux->package */
demux->package = g_ptr_array_new (); demux->package = g_ptr_array_new ();
@ -1347,9 +1309,8 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
MXFMetadataEssenceContainerData, i); MXFMetadataEssenceContainerData, i);
for (j = 0; j < demux->content_storage.n_essence_container_data; j++) { for (j = 0; j < demux->content_storage.n_essence_container_data; j++) {
if (mxf_ul_is_equal (&demux-> if (mxf_ul_is_equal (&demux->content_storage.
content_storage.essence_container_data_uids[j], essence_container_data_uids[j], &data->instance_uid)) {
&data->instance_uid)) {
demux->content_storage.essence_container_data[j] = data; demux->content_storage.essence_container_data[j] = data;
break; break;
} }