diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2008-05-18 19:27:59 +0000 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2008-05-18 19:27:59 +0000 |
commit | 706b1dff39f7373567a55345349b05b87e6facf2 (patch) | |
tree | e8c4536ba8080ef7f5aa2dff19e161096b3ac87b /gst/avi/gstavimux.c | |
parent | e00fb9ce5b3a4d70f794ec215b12ecc6b8928f94 (diff) |
gst/avi/gstavimux.c: Set proper rate in avi stream header for PCM audio, and also do some more sanity checks on caps ...
Original commit message from CVS:
* gst/avi/gstavimux.c: (gst_avi_mux_audsink_set_caps):
Set proper rate in avi stream header for PCM audio, and also do some
more sanity checks on caps in this case. Fixes #511489.
Diffstat (limited to 'gst/avi/gstavimux.c')
-rw-r--r-- | gst/avi/gstavimux.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index f301e97e..08f28d48 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -629,11 +629,28 @@ gst_avi_mux_audsink_set_caps (GstPad * pad, GstCaps * vscaps) if (!strcmp (mimetype, "audio/x-raw-int")) { gint width, depth; + gboolean signedness; avipad->auds.format = GST_RIFF_WAVE_FORMAT_PCM; if (!gst_structure_get_int (structure, "width", &width) || - (width != 8 && !gst_structure_get_int (structure, "depth", &depth))) { + !gst_structure_get_int (structure, "depth", &depth) || + !gst_structure_get_boolean (structure, "signed", &signedness)) { + GST_DEBUG_OBJECT (avimux, + "broken caps, width/depth/signed field missing"); + goto refuse_caps; + } + + /* no clear place to put different values for these while keeping to spec */ + if (width != depth) { + GST_DEBUG_OBJECT (avimux, "width must be same as depth!"); + goto refuse_caps; + } + + /* because that's the way the caps will be recreated from riff data */ + if ((width == 8 && signedness) || (width == 16 && !signedness)) { + GST_DEBUG_OBJECT (avimux, + "8-bit PCM must be unsigned, 16-bit PCM signed"); goto refuse_caps; } @@ -683,12 +700,12 @@ gst_avi_mux_audsink_set_caps (GstPad * pad, GstCaps * vscaps) avipad->auds.blockalign = 1; avipad->auds.av_bps = 0; avipad->auds.size = 16; - - if (!avipad->auds.format) - goto refuse_caps; } - avipad->parent.hdr.rate = avipad->auds.blockalign * avipad->auds.rate; + if (!avipad->auds.format) + goto refuse_caps; + + avipad->parent.hdr.rate = avipad->auds.rate; avipad->parent.hdr.samplesize = avipad->auds.blockalign; avipad->parent.hdr.scale = 1; |