diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2006-12-24 11:24:59 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-12-24 11:24:59 +0000 |
commit | 7735292ec2300a00b1f7778a4c91e60843b4cec9 (patch) | |
tree | a93ef32785ad120b48b3773ee39e931fb16cb136 /gst/matroska/matroska-mux.c | |
parent | 2f003d73d5e1d16120c66fdcfe68a5df1aba2fbc (diff) |
gst/matroska/matroska-mux.c: The "signed" field in audio caps is of boolean type, trying to use gst_structure_get_int...
Original commit message from CVS:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_audio_pad_setcaps):
The "signed" field in audio caps is of boolean type, trying to use
gst_structure_get_int() to extract it will fail. Fixing this makes
matroskamux accept raw audio input (#387121) (use at your own risk
though, due to the matroska spec being not entirely useful in this
respect).
Also fix up raw audio structures in template caps so that they
represent what our setcaps function will actually accept, so that
converters know what to convert to.
Finally, don't fail if there isn't an "endianness" field in 8-bit
PCM caps.
Diffstat (limited to 'gst/matroska/matroska-mux.c')
-rw-r--r-- | gst/matroska/matroska-mux.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index a2754108..cdb5e32d 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -105,10 +105,15 @@ static GstStaticPadTemplate audiosink_templ = "audio/x-vorbis, " COMMON_AUDIO_CAPS "; " "audio/x-raw-int, " - "width = (int) { 8, 16, 24 }, " - "depth = (int) { 8, 16, 24 }, " + "width = (int) 8, " + "depth = (int) 8, " + "signed = (boolean) false, " + COMMON_AUDIO_CAPS ";" + "audio/x-raw-int, " + "width = (int) 16, " + "depth = (int) 16, " "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " - "signed = (boolean) { true, false }, " + "signed = (boolean) true, " COMMON_AUDIO_CAPS ";" "audio/x-tta, " "width = (int) { 8, 16, 24 }, " @@ -984,15 +989,29 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps) gint endianness, width, depth; gboolean signedness; - if (!gst_structure_get_int (structure, "endianness", &endianness) || - !gst_structure_get_int (structure, "width", &width) || + if (!gst_structure_get_int (structure, "width", &width) || !gst_structure_get_int (structure, "depth", &depth) || - !gst_structure_get_int (structure, "signed", &signedness)) + !gst_structure_get_boolean (structure, "signed", &signedness)) { + GST_DEBUG_OBJECT (mux, "broken caps, width/depth/signed field missing"); return FALSE; + } - if (width != depth || - (width == 8 && signedness) || (width == 16 && !signedness)) + if (depth > 8 && + !gst_structure_get_int (structure, "endianness", &endianness)) { + GST_DEBUG_OBJECT (mux, "broken caps, no endianness specified"); return FALSE; + } + + if (width != depth) { + GST_DEBUG_OBJECT (mux, "width must be same as depth!"); + return FALSE; + } + + /* where is this spec'ed out? (tpm) */ + if ((width == 8 && signedness) || (width == 16 && !signedness)) { + GST_DEBUG_OBJECT (mux, "8-bit PCM must be unsigned, 16-bit PCM signed"); + return FALSE; + } audiocontext->bitdepth = depth; if (endianness == G_BIG_ENDIAN) |