From 4860abb116674c7be31e825db05cdcfd30f3aff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20T=C3=A4uber?= Date: Wed, 21 May 2008 02:26:42 +0000 Subject: [PATCH] =?UTF-8?q?support=20dvd=20pcm=2020/24=20bits,=20patch=20b?= =?UTF-8?q?y=20Lars=20T=C3=A4uber,=20lars.taeuber=20gmx=20net?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally committed as revision 13206 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/mpeg.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 480c0541ca..3f508dcddf 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -474,7 +474,8 @@ static int mpegps_read_packet(AVFormatContext *s, codec_id = CODEC_ID_DTS; } else if (startcode >= 0xa0 && startcode <= 0xaf) { type = CODEC_TYPE_AUDIO; - codec_id = CODEC_ID_PCM_S16BE; + /* 16 bit form will be handled as CODEC_ID_PCM_S16BE */ + codec_id = CODEC_ID_PCM_DVD; } else if (startcode >= 0xb0 && startcode <= 0xbf) { type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_MLP; @@ -519,7 +520,14 @@ static int mpegps_read_packet(AVFormatContext *s, freq = (b1 >> 4) & 3; st->codec->sample_rate = lpcm_freq_tab[freq]; st->codec->channels = 1 + (b1 & 7); - st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2; + st->codec->bits_per_sample = 16 + ((b1 >> 6) & 3) * 4; + st->codec->bit_rate = st->codec->channels * + st->codec->sample_rate * + st->codec->bits_per_sample; + if (st->codec->bits_per_sample == 16) + st->codec->codec_id = CODEC_ID_PCM_S16BE; + else if (st->codec->bits_per_sample == 28) + return AVERROR(EINVAL); } av_new_packet(pkt, len); get_buffer(s->pb, pkt->data, pkt->size);