Set the sub_id for DTS audio inside a wave file to 1 for 14-bit, and 0 for 16-bit
git-svn-id: svn+ssh://74.125.59.83/svnsource/ffmpeg/trunk@62 c0683bf1-fb26-4375-bba1-98ccd3d3b0d1
diff --git a/libavformat/wav.c b/libavformat/wav.c
index a25249c..41cd7df 100755
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -166,6 +166,7 @@
// Make sure there's 2 matches
int matchesLeft = 2;
int matchNow = 0;
+ int dtsBitSize = 0;
for (int i = 0; i < sizeLeft; i++)
{
@@ -173,23 +174,35 @@
if (pb->buf_ptr[i] == 0xff && pb->buf_ptr[i+1] == 0x1f &&
pb->buf_ptr[i+2] == 0x00 && pb->buf_ptr[i+3] == 0xe8 &&
(pb->buf_ptr[i+4] & 0xf0) == 0xf0 && pb->buf_ptr[i+5] == 0x07)
+ {
matchNow = 1;
+ dtsBitSize = 14;
+ }
/* 14 bits and big endian bitstream */
if (pb->buf_ptr[i] == 0x1f && pb->buf_ptr[i+1] == 0xff &&
pb->buf_ptr[i+2] == 0xe8 && pb->buf_ptr[i+3] == 0x00 &&
pb->buf_ptr[i+4] == 0x07 && (pb->buf_ptr[i+5] & 0xf0) == 0xf0)
+ {
matchNow = 1;
+ dtsBitSize = 14;
+ }
/* 16 bits and little endian bitstream */
if (pb->buf_ptr[i] == 0xfe && pb->buf_ptr[i+1] == 0x7f &&
pb->buf_ptr[i+2] == 0x01 && pb->buf_ptr[i+3] == 0x80)
+ {
matchNow = 1;
+ dtsBitSize = 16;
+ }
/* 16 bits and big endian bitstream */
if (pb->buf_ptr[i] == 0x7f && pb->buf_ptr[i+1] == 0xfe &&
pb->buf_ptr[i+2] == 0x80 && pb->buf_ptr[i+3] == 0x01)
+ {
matchNow = 1;
+ dtsBitSize = 16;
+ }
if (matchNow)
{
@@ -198,6 +211,7 @@
if (matchesLeft == 0)
{
codec->codec_id = CODEC_ID_DTS;
+ codec->sub_id = (dtsBitSize == 14) ? 1 : 0;
break;
}
}