diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-11-26 10:37:34 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-11-26 10:37:34 +0000 |
commit | 0be182446746b7b03026b6baf667ef5cfe4ef860 (patch) | |
tree | 53dac4e8911e59009dd8aa729c442c6f5a8b1991 /gst | |
parent | 4317cdbec06f8b36f102b6afb031183339f70592 (diff) | |
download | gst-plugins-bad-0be182446746b7b03026b6baf667ef5cfe4ef860.tar.gz gst-plugins-bad-0be182446746b7b03026b6baf667ef5cfe4ef860.tar.bz2 gst-plugins-bad-0be182446746b7b03026b6baf667ef5cfe4ef860.zip |
gst/mxf/: When memset'ing the descriptors to zeroes only touch the part of this descriptor, not it's parent type.
Original commit message from CVS:
* gst/mxf/mxfaes-bwf.c:
(mxf_metadata_wave_audio_essence_descriptor_reset):
* gst/mxf/mxfmpeg.c: (mxf_metadata_mpeg_video_descriptor_reset):
* gst/mxf/mxfparse.c: (mxf_metadata_file_descriptor_handle_tag),
(mxf_metadata_file_descriptor_reset),
(mxf_metadata_generic_sound_essence_descriptor_reset),
(mxf_metadata_generic_picture_essence_descriptor_reset),
(mxf_metadata_cdci_picture_essence_descriptor_reset),
(mxf_metadata_rgba_picture_essence_descriptor_reset),
(mxf_metadata_multiple_descriptor_reset):
* gst/mxf/mxfparse.h:
When memset'ing the descriptors to zeroes only touch the part
of this descriptor, not it's parent type.
Set correct default values for all metadata fields.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mxf/mxfaes-bwf.c | 4 | ||||
-rw-r--r-- | gst/mxf/mxfmpeg.c | 3 | ||||
-rw-r--r-- | gst/mxf/mxfparse.c | 32 | ||||
-rw-r--r-- | gst/mxf/mxfparse.h | 8 |
4 files changed, 37 insertions, 10 deletions
diff --git a/gst/mxf/mxfaes-bwf.c b/gst/mxf/mxfaes-bwf.c index 7e7ddf90..c121d57d 100644 --- a/gst/mxf/mxfaes-bwf.c +++ b/gst/mxf/mxfaes-bwf.c @@ -179,7 +179,9 @@ void mxf_metadata_wave_audio_essence_descriptor_reset mxf_metadata_generic_sound_essence_descriptor_reset ( (MXFMetadataGenericSoundEssenceDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataWaveAudioEssenceDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, + MXFMetadataWaveAudioEssenceDescriptor, + MXFMetadataGenericSoundEssenceDescriptor); } gboolean diff --git a/gst/mxf/mxfmpeg.c b/gst/mxf/mxfmpeg.c index 18f652ff..4c6e7306 100644 --- a/gst/mxf/mxfmpeg.c +++ b/gst/mxf/mxfmpeg.c @@ -190,7 +190,8 @@ void mxf_metadata_mpeg_video_descriptor_reset mxf_metadata_cdci_picture_essence_descriptor_reset ( (MXFMetadataCDCIPictureEssenceDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataMPEGVideoDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, MXFMetadataMPEGVideoDescriptor, + MXFMetadataCDCIPictureEssenceDescriptor); } gboolean diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index efe102b5..533e2561 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -1894,8 +1894,6 @@ mxf_metadata_file_descriptor_handle_tag (MXFMetadataGenericDescriptor * d, gboolean ret = FALSE; gchar str[48]; - descriptor->parent.is_file_descriptor = TRUE; - switch (tag) { case 0x3006: if (tag_size != 4) @@ -1957,7 +1955,10 @@ mxf_metadata_file_descriptor_reset (MXFMetadataFileDescriptor * descriptor) mxf_metadata_generic_descriptor_reset ((MXFMetadataGenericDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataFileDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, MXFMetadataFileDescriptor, + MXFMetadataGenericDescriptor); + + descriptor->parent.is_file_descriptor = TRUE; } gboolean @@ -2053,7 +2054,11 @@ void mxf_metadata_generic_sound_essence_descriptor_reset mxf_metadata_file_descriptor_reset ((MXFMetadataFileDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataGenericSoundEssenceDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, + MXFMetadataGenericSoundEssenceDescriptor, MXFMetadataFileDescriptor); + + descriptor->audio_sampling_rate.n = 48000; + descriptor->audio_sampling_rate.d = 1; } gboolean @@ -2275,7 +2280,10 @@ void mxf_metadata_generic_picture_essence_descriptor_reset mxf_metadata_file_descriptor_reset ((MXFMetadataFileDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataGenericPictureEssenceDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, + MXFMetadataGenericPictureEssenceDescriptor, MXFMetadataFileDescriptor); + + descriptor->signal_standard = 1; } void mxf_metadata_generic_picture_essence_descriptor_set_caps @@ -2412,7 +2420,9 @@ void mxf_metadata_cdci_picture_essence_descriptor_reset mxf_metadata_generic_picture_essence_descriptor_reset ( (MXFMetadataGenericPictureEssenceDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataCDCIPictureEssenceDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, + MXFMetadataCDCIPictureEssenceDescriptor, + MXFMetadataGenericPictureEssenceDescriptor); } gboolean @@ -2485,7 +2495,12 @@ void mxf_metadata_rgba_picture_essence_descriptor_reset mxf_metadata_generic_picture_essence_descriptor_reset ( (MXFMetadataGenericPictureEssenceDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataRGBAPictureEssenceDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, + MXFMetadataRGBAPictureEssenceDescriptor, + MXFMetadataGenericPictureEssenceDescriptor); + + descriptor->component_max_ref = 255; + descriptor->alpha_max_ref = 255; } gboolean @@ -2550,7 +2565,8 @@ void mxf_metadata_multiple_descriptor_reset mxf_metadata_file_descriptor_reset ((MXFMetadataFileDescriptor *) descriptor); - memset (descriptor, 0, sizeof (MXFMetadataMultipleDescriptor)); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, MXFMetadataMultipleDescriptor, + MXFMetadataFileDescriptor); } gboolean diff --git a/gst/mxf/mxfparse.h b/gst/mxf/mxfparse.h index 94a5d766..730829fe 100644 --- a/gst/mxf/mxfparse.h +++ b/gst/mxf/mxfparse.h @@ -20,6 +20,8 @@ #ifndef __MXF_PARSE_H__ #define __MXF_PARSE_H__ +#include <string.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); @@ -111,6 +113,12 @@ void mxf_metadata_structural_component_reset (MXFMetadataStructuralComponent *co 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); +#define MXF_METADATA_DESCRIPTOR_CLEAR(descriptor, type, parent_type) \ + G_STMT_START { \ + guint8 *___data = (guint8 *) descriptor + sizeof (parent_type); \ + memset (___data, 0, sizeof (type) - sizeof (parent_type)); \ + } G_STMT_END + 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); |