[FFmpeg-devel] [RFC] LPCM 24 bits support
Måns Rullgård
mans
Thu Apr 24 21:14:41 CEST 2008
Lars T?uber <lars.taeuber at gmx.net> writes:
> diff -pur ffmpeg/libavcodec/Makefile ffmpeg.1/libavcodec/Makefile
> --- ffmpeg/libavcodec/Makefile 2008-04-19 20:25:42.000000000 +0200
> +++ ffmpeg.1/libavcodec/Makefile 2008-04-19 20:27:50.000000000 +0200
> @@ -236,6 +236,7 @@ OBJS-$(CONFIG_ZMBV_ENCODER) +
>
> OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
> OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
> +OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm.o
> OBJS-$(CONFIG_PCM_MULAW_DECODER) += pcm.o
> OBJS-$(CONFIG_PCM_MULAW_ENCODER) += pcm.o
> OBJS-$(CONFIG_PCM_S8_DECODER) += pcm.o
>
> diff -pur ffmpeg/libavformat/mpeg.c ffmpeg.1/libavformat/mpeg.c
> --- ffmpeg/libavformat/mpeg.c 2008-03-04 21:54:06.000000000 +0100
> +++ ffmpeg.1/libavformat/mpeg.c 2008-04-19 20:27:58.000000000 +0200
> @@ -473,7 +473,9 @@ static int mpegps_read_packet(AVFormatCo
> codec_id = CODEC_ID_DTS;
> } else if (startcode >= 0xa0 && startcode <= 0xaf) {
> type = CODEC_TYPE_AUDIO;
> - codec_id = CODEC_ID_PCM_S16BE;
> + /* CODEC_ID_PCM_S16BE will be handled as the 16bit
> + form of CODEC_ID_PCM_DVD */
> + codec_id = CODEC_ID_PCM_DVD;
> } else if (startcode >= 0xb0 && startcode <= 0xbf) {
> type = CODEC_TYPE_AUDIO;
> codec_id = CODEC_ID_MLP;
> @@ -518,7 +520,15 @@ static int mpegps_read_packet(AVFormatCo
> 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);
OK
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list