summaryrefslogtreecommitdiffstats
path: root/gst/mxf/mxfaes-bwf.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-22 15:51:37 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-22 15:51:37 +0100
commiteffb5786da04e28effadc0602ef1ec5465458801 (patch)
tree0c187c241f51bda6bcec5cccdba7df8330803c0c /gst/mxf/mxfaes-bwf.c
parentddced37a8b83be290343502d4099d8f325da4e3f (diff)
downloadgst-plugins-bad-effb5786da04e28effadc0602ef1ec5465458801.tar.gz
gst-plugins-bad-effb5786da04e28effadc0602ef1ec5465458801.tar.bz2
gst-plugins-bad-effb5786da04e28effadc0602ef1ec5465458801.zip
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.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gst/mxf/mxfaes-bwf.c b/gst/mxf/mxfaes-bwf.c
index 9b08ffbb..cf61ea7e 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);