diff options
author | Christian Schmidt <schmidt@digadd.de> | 2013-08-30 18:15:47 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-08-31 11:26:29 +0200 |
commit | a42e3a6700547e4e49445bda81d3a89ec3e081a9 (patch) | |
tree | 791493f32f608bfa47622c2084158f3033ce6a92 /libavformat/mpeg.c | |
parent | 21fd2f84ce21f8e03d0287a759cdcc5a5ea1d0a8 (diff) | |
download | ffmpeg-a42e3a6700547e4e49445bda81d3a89ec3e081a9.tar.gz |
pcm_dvd: consolidate pieces from pcm.c and mpeg.c
Remove the header decoding for PCM audio from mpeg.c and the
20/24bit parts from pcm.c and merge them into a new decoder in
pcm-dvd.c.
The decoder has added support for samples that span multiple
packets and modified 20/24bit group decoding. Both is needed to
decode samples that have been generated with DVD-Lab Pro 2. The
decoding of 16bit PCM and two channel 24bit is identical to
before. No other samples are known to verify the correctness of
the encoding this software does.
The complete list of tested formats is
48kHz/16bit/2-8 channels
48kHz/24bit/2-5 channels
96kHz/16bit/2-4 channels
96kHz/24bit/2 channels
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/mpeg.c')
-rw-r--r-- | libavformat/mpeg.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 8a4c6d7acc..7430bb0113 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -453,7 +453,6 @@ static int mpegps_read_packet(AVFormatContext *s, codec_id = AV_CODEC_ID_DTS; } else if (startcode >= 0xa0 && startcode <= 0xaf) { type = AVMEDIA_TYPE_AUDIO; - /* 16 bit form will be handled as AV_CODEC_ID_PCM_S16BE */ codec_id = AV_CODEC_ID_PCM_DVD; } else if (startcode >= 0xb0 && startcode <= 0xbf) { type = AVMEDIA_TYPE_AUDIO; @@ -494,35 +493,10 @@ static int mpegps_read_packet(AVFormatContext *s, st->id = startcode; st->codec->codec_type = type; st->codec->codec_id = codec_id; - if (codec_id != AV_CODEC_ID_PCM_S16BE) - st->need_parsing = AVSTREAM_PARSE_FULL; + st->need_parsing = AVSTREAM_PARSE_FULL; found: if(st->discard >= AVDISCARD_ALL) goto skip; - if ((startcode >= 0xa0 && startcode <= 0xaf) || - (startcode == 0x1bd && ((dvdaudio_substream_type & 0xe0) == 0xa0))) { - int b1, freq; - - /* for LPCM, we just skip the header and consider it is raw - audio data */ - if (len <= 3) - goto skip; - avio_r8(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */ - b1 = avio_r8(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */ - avio_r8(s->pb); /* dynamic range control (0x80 = off) */ - len -= 3; - freq = (b1 >> 4) & 3; - st->codec->sample_rate = lpcm_freq_tab[freq]; - st->codec->channels = 1 + (b1 & 7); - st->codec->bits_per_coded_sample = 16 + ((b1 >> 6) & 3) * 4; - st->codec->bit_rate = st->codec->channels * - st->codec->sample_rate * - st->codec->bits_per_coded_sample; - if (st->codec->bits_per_coded_sample == 16) - st->codec->codec_id = AV_CODEC_ID_PCM_S16BE; - else if (st->codec->bits_per_coded_sample == 28) - return AVERROR(EINVAL); - } ret = av_get_packet(s->pb, pkt, len); pkt->pts = pts; pkt->dts = dts; |