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.
This commit is contained in:
Mark Nauwelaerts 2008-05-18 19:27:59 +00:00
parent e00fb9ce5b
commit 706b1dff39
2 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2008-05-18 Mark Nauwelaerts <mnauw@users.sf.net>
* 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.
2008-05-17 Sebastian Dröge <slomo@circular-chaos.org>
* sys/v4l2/gstv4l2src.c:

View file

@ -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;
avipad->parent.hdr.rate = avipad->auds.rate;
avipad->parent.hdr.samplesize = avipad->auds.blockalign;
avipad->parent.hdr.scale = 1;