[MPlayer-dev-eng] [PATCH] Extend ao_pcm to support more PCM formats

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jan 19 23:39:28 CET 2010


On Tue, Jan 19, 2010 at 01:58:32PM -0800, Peter Fordham wrote:
> @@ -111,32 +111,48 @@
>              strdup(ao_pcm_waveheader?"audiodump.wav":"audiodump.pcm");
>      }
>  
> -    bits=8;
> -    switch(format){
> -    case AF_FORMAT_S32_BE:
> -        format=AF_FORMAT_S32_LE;
> -    case AF_FORMAT_S32_LE:
> -        bits=32;
> +    switch (format & AF_FORMAT_BITS_MASK)
> +    {
> +    default:
> +    case AF_FORMAT_8BIT:
> +        bits = 8;
>          break;
> -    case AF_FORMAT_FLOAT_BE:
> -        format=AF_FORMAT_FLOAT_LE;
> -    case AF_FORMAT_FLOAT_LE:
> -        bits=32;
> +    case AF_FORMAT_16BIT:
> +        bits = 16;
>          break;
> -    case AF_FORMAT_S8:
> -        format=AF_FORMAT_U8;
> -    case AF_FORMAT_U8:
> +    case AF_FORMAT_24BIT:
> +        bits = 24;
>          break;
> -    case AF_FORMAT_AC3_BE:
> -    case AF_FORMAT_AC3_LE:
> -        bits=16;
> +    case AF_FORMAT_32BIT:
> +        bits = 32;
>          break;
> -    default:
> -        format=AF_FORMAT_S16_LE;
> -        bits=16;
> +    case AF_FORMAT_40BIT:
> +        bits = 40;
>          break;
> +    case AF_FORMAT_48BIT:
> +        bits = 48;
> +        break;
>      }

Af_fmt2bits

>  
> +    if (ao_pcm_waveheader)
> +    {
> +        // WAV files must have one of the following formats
> +
> +        switch(format){
> +        case AF_FORMAT_U8:
> +        case AF_FORMAT_S16_LE:
> +        case AF_FORMAT_S24_LE:
> +        case AF_FORMAT_S32_LE:
> +        case AF_FORMAT_FLOAT_LE:
> +        case AF_FORMAT_AC3_BE:
> +        case AF_FORMAT_AC3_LE:
> +             break;
> +        default:
> +            format = AF_FORMAT_S16_LE;
> +            break;
> +        }
> +    }

Should be before, otherwise for the default case bits will be set to the wrong
(don't know if it will be used in that case, but it's not a good idea either way)/



More information about the MPlayer-dev-eng mailing list