summaryrefslogtreecommitdiffstats
path: root/ext/flac
diff options
context:
space:
mode:
authorMichael Smith <msmith@xiph.org>2005-12-09 11:12:48 +0000
committerMichael Smith <msmith@xiph.org>2005-12-09 11:12:48 +0000
commit689ec3d7ae60a4ad8effd9f7ff9b67ca4db1f34d (patch)
tree1f4113ceb6f100ba51a3134666e13f6edd61ad93 /ext/flac
parent207aced76da0526d2bd60e874896623cf8714423 (diff)
ext/flac/gstflacdec.c: Accept a wider range of flac files, more closely matching flac sp
Original commit message from CVS: * ext/flac/gstflacdec.c: (raw_caps_factory), (gst_flacdec_write): Accept a wider range of flac files, more closely matching flac sp
Diffstat (limited to 'ext/flac')
-rw-r--r--ext/flac/gstflacdec.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index dc8ed7b2..67725e20 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -149,8 +149,8 @@ raw_caps_factory (void)
"endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
"signed = (boolean) true, "
"width = (int) { 8, 16, 32 }, "
- "depth = (int) { 8, 16, 24, 32 }, "
- "rate = (int) [ 11025, 48000 ], " "channels = (int) [ 1, 6 ]");
+ "depth = (int) { 8, 12, 16, 20, 24, 32 }, "
+ "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 8 ]");
}
static void
@@ -437,12 +437,29 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder,
FlacDec *flacdec;
GstBuffer *outbuf;
guint depth = frame->header.bits_per_sample;
- guint width = (depth == 24) ? 32 : depth;
+ guint width;
guint channels = frame->header.channels;
guint samples = frame->header.blocksize;
guint j, i;
GstFlowReturn ret;
+ switch (depth) {
+ case 8:
+ width = 8;
+ break;
+ case 12:
+ case 16:
+ width = 16;
+ break;
+ case 20:
+ case 24:
+ case 32:
+ width = 32;
+ break;
+ default:
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+ }
+
flacdec = GST_FLACDEC (client_data);
if (flacdec->need_discont) {
@@ -510,7 +527,7 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder,
*outbuffer++ = (guint8) buffer[j][i];
}
}
- } else if (depth == 16) {
+ } else if (depth == 12 || depth == 16) {
guint16 *outbuffer = (guint16 *) GST_BUFFER_DATA (outbuf);
for (i = 0; i < samples; i++) {
@@ -518,7 +535,7 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder,
*outbuffer++ = (guint16) buffer[j][i];
}
}
- } else if (depth == 24 || depth == 32) {
+ } else if (depth == 20 || depth == 24 || depth == 32) {
guint32 *outbuffer = (guint32 *) GST_BUFFER_DATA (outbuf);
for (i = 0; i < samples; i++) {