diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-03-22 15:51:37 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-03-22 15:51:37 +0100 |
commit | effb5786da04e28effadc0602ef1ec5465458801 (patch) | |
tree | 0c187c241f51bda6bcec5cccdba7df8330803c0c /gst/mxf/mxfaes-bwf.c | |
parent | ddced37a8b83be290343502d4099d8f325da4e3f (diff) | |
download | gstreamer-plugins-bad-effb5786da04e28effadc0602ef1ec5465458801.tar.gz |
mxfmux: Fix some memory leaks, improve debugging and handle errors better
Diffstat (limited to 'gst/mxf/mxfaes-bwf.c')
-rw-r--r-- | gst/mxf/mxfaes-bwf.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gst/mxf/mxfaes-bwf.c b/gst/mxf/mxfaes-bwf.c index 9b08ffbb3..cf61ea7e5 100644 --- a/gst/mxf/mxfaes-bwf.c +++ b/gst/mxf/mxfaes-bwf.c @@ -1445,14 +1445,14 @@ mxf_bwf_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps, gint width, rate, channels, endianness; s = gst_caps_get_structure (caps, 0); - if (strcmp (gst_structure_get_name (s), "audio/x-raw-int") != 0) - return NULL; - - if (!gst_structure_get_int (s, "width", &width) || + if (strcmp (gst_structure_get_name (s), "audio/x-raw-int") != 0 || + !gst_structure_get_int (s, "width", &width) || !gst_structure_get_int (s, "rate", &rate) || !gst_structure_get_int (s, "channels", &channels) || - !gst_structure_get_int (s, "endianness", &endianness)) + !gst_structure_get_int (s, "endianness", &endianness)) { + GST_ERROR ("Invalid caps %" GST_PTR_FORMAT, caps); return NULL; + } ret = (MXFMetadataWaveAudioEssenceDescriptor *) gst_mini_object_new (MXF_TYPE_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR); @@ -1468,7 +1468,13 @@ mxf_bwf_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps, ret->block_align = (width / 8) * channels; ret->parent.quantization_bits = width; ret->avg_bps = ret->block_align * rate; - mxf_metadata_generic_sound_essence_descriptor_from_caps (&ret->parent, caps); + + if (!mxf_metadata_generic_sound_essence_descriptor_from_caps (&ret->parent, + caps)) { + gst_mini_object_unref (GST_MINI_OBJECT_CAST (ret)); + return NULL; + } + *handler = mxf_bwf_write_func; md = g_new0 (BWFMappingData, 1); |