[Ffmpeg-devel] [PATCH] apple caff demuxer

Baptiste Coudurier baptiste.coudurier
Wed Apr 4 12:31:14 CEST 2007


Hi

Michael Niedermayer wrote:
> Hi
> 
> quick review below (ill leave the final review/approval for caff to
> baptiste ...)
> 
> 
> On Wed, Apr 04, 2007 at 02:28:56AM -0400, Justin Ruggles wrote:
> [...]
>>>> +
>>>> +void ff_caff_get_codec_id(CaffContext *ctx)
>>>> +{
>>>> +    ctx->codec_id = CODEC_ID_NONE;
>>>> +
>>>> +    /* codec selection for lpcm is chosen using format description and flags */
>>>> +    if(ctx->format_id == MKBETAG('l','p','c','m')) {
>>>> +        /* unpacked 24-bit is not currently supported */
>>>> +        if((ctx->bits_per_channel == 24) &&
>>>> +           (ctx->bytes_per_packet == (ctx->channels_per_frame * 4))) {
>>>> +            return;
>>>> +        }
>>>> +        /* floating-point lpcm is not currently supported */
>>>> +        if(ctx->format_flags & CAFF_LPCM_FLAGS_IS_FLOAT) {
>>>> +            return;
>>>> +        }
>>>> +        if(ctx->bits_per_channel == 8) {
>>>> +            ctx->codec_id = CODEC_ID_PCM_S8;
>>>> +        } else if(ctx->bits_per_channel == 16) {
>>>> +            if(ctx->format_flags & CAFF_LPCM_FLAGS_IS_LITTLEENDIAN) {
>>>> +                ctx->codec_id = CODEC_ID_PCM_S16LE;
>>>> +            } else {
>>>> +                ctx->codec_id = CODEC_ID_PCM_S16BE;
>>>> +            }
>>>> +        } else if(ctx->bits_per_channel == 24) {
>>>> +            if(ctx->format_flags & CAFF_LPCM_FLAGS_IS_LITTLEENDIAN) {
>>>> +                ctx->codec_id = CODEC_ID_PCM_S24LE;
>>>> +            } else {
>>>> +                ctx->codec_id = CODEC_ID_PCM_S24BE;
>>>> +            }
>>>> +        } else if(ctx->bits_per_channel == 32) {
>>>> +            if(ctx->format_flags & CAFF_LPCM_FLAGS_IS_LITTLEENDIAN) {
>>>> +                ctx->codec_id = CODEC_ID_PCM_S32LE;
>>>> +            } else {
>>>> +                ctx->codec_id = CODEC_ID_PCM_S32BE;
>>>> +            }
>>>
>>> that mess begins to be duplicated in every demuxer, maybe
>>> CODEC_ID_RAWAUDIO should be added, how to handle the BE/LE case ?
>> maybe CODEC_ID_PCM_BE / CODEC_ID_PCM_LE.  and actually use the
>> SampleFormat in AVCodecContext, which would make it easy to implement
>> floating-point PCM decoding.
> 
> dunno, why split BE/LE ?

I would be more in favor of not splitting also, but how can we
differentiate them ?

How can we permute between them without different codec id ? wav only
accepts LE for example. You'd like to add new sample formats ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list