[FFmpeg-devel] [patch] 24bit lpcm in mpeg (vob)

Michael Niedermayer michaelni
Sat Apr 12 19:42:32 CEST 2008


On Sat, Apr 12, 2008 at 05:19:24PM +0200, Lars T?uber wrote:
> Hallo!
[...]
> diff -pur ffmpeg/libavcodec/pcm.c ffmpeg.1/libavcodec/pcm.c
> --- ffmpeg/libavcodec/pcm.c	2008-03-21 13:17:05.000000000 +0100
> +++ ffmpeg.1/libavcodec/pcm.c	2008-04-12 17:03:22.000000000 +0200
> @@ -434,6 +434,20 @@ static int pcm_decode_frame(AVCodecConte
>                         (ff_reverse[v & 0xff] << 8);
>          }
>          break;
> +    case CODEC_ID_PCM_S24DVD:
> +        n = buf_size / 12;
> +        for(;n>0;n--) {
> +          *samples++ = bytestream_get_be16(&src);
> +          *samples++ = bytestream_get_be16(&src);
> +          *samples++ = bytestream_get_be16(&src);
> +          *samples++ = bytestream_get_be16(&src);
> +
> +          /** ignore the least significant bytes of each sample,
> +             because we only support 16bit audio right now 
> +           */
> +          src+=4;
> +        }
> +        break;

use 4 space indention please. Also do we have a sample on mphq?


[...]

> 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-12 17:04:29.000000000 +0200

please split changes to code maintained by mans out into a seperate patch.


[...]
> diff -pur ffmpeg/libavcodec/pcm.c ffmpeg.2/libavcodec/pcm.c
> --- ffmpeg/libavcodec/pcm.c	2008-03-21 13:17:05.000000000 +0100
> +++ ffmpeg.2/libavcodec/pcm.c	2008-04-12 15:19:41.000000000 +0200
> @@ -383,15 +383,15 @@ static int pcm_decode_frame(AVCodecConte
>      samples = data;
>      src = buf;
>  
> -    n= av_get_bits_per_sample(avctx->codec_id)/8;
> -    if(n && buf_size % n){
> -        av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
> -        return -1;
> -    }
>      if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
>          av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
>          return -1;
>      }
> +    n= av_get_bits_per_sample(avctx->codec_id)/8 * avctx->channels;
> +    if(n && buf_size % n){
> +        av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
> +        return -1;
> +    }
>  
>      buf_size= FFMIN(buf_size, *data_size/2);
>      *data_size=0;

What is this good for?


> diff -pur ffmpeg.1/libavcodec/utils.c ffmpeg.3/libavcodec/utils.c
> --- ffmpeg.1/libavcodec/utils.c	2008-04-12 14:54:36.000000000 +0200
> +++ ffmpeg.3/libavcodec/utils.c	2008-04-12 15:24:44.000000000 +0200
> @@ -1326,13 +1326,14 @@ int av_get_bits_per_sample(enum CodecID 
>      case CODEC_ID_PCM_S24LE:
>      case CODEC_ID_PCM_U24BE:
>      case CODEC_ID_PCM_U24LE:
> -    case CODEC_ID_PCM_S24DVD:
>          return 24;
>      case CODEC_ID_PCM_S32BE:
>      case CODEC_ID_PCM_S32LE:
>      case CODEC_ID_PCM_U32BE:
>      case CODEC_ID_PCM_U32LE:
>          return 32;
> +    case CODEC_ID_PCM_S24DVD:
> +        return 48;  /** 2 samples are interleaved per block */

This is wrong, its 24 bit per sample.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080412/9e462e3b/attachment.pgp>



More information about the ffmpeg-devel mailing list