On 04/23/2011 01:24 PM, Diego Biurrun wrote:
> On Sat, Apr 23, 2011 at 01:16:45PM +0200, Benjamin Larsson wrote:
>> On 04/23/2011 12:18 PM, Diego Biurrun wrote:
>>> On Fri, Apr 22, 2011 at 10:19:44PM -0400, Justin Ruggles wrote:
>>>>
>>>> Based on patches by clsid2 in ffdshow-tryout.
>>>>
>>>> --- a/libavcodec/aacdec.c
>>>> +++ b/libavcodec/aacdec.c
>>>> @@ -549,7 +549,11 @@ static av_cold int aac_decode_init(AVCodecContext 
>>>> *avctx)
>>>>  
>>>> +#if CONFIG_AUDIO_FLOAT
>>>> +    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
>>>> +#else
>>>>      avctx->sample_fmt = AV_SAMPLE_FMT_S16;
>>>> +#endif
>>>
>>> The code is now littered with these #if #else #endif blocks in many
>>> places.  Maybe you can just set a few #defines at the top depending
>>> on whether or not CONFIG_AUDIO_FLOAT is in effect or not and use
>>> them below.  This would concentrate the #ifdeffery in one place.
>>
>> Exactly how do you propose to do that?
> 
> Something like this at the top of the file (note that the names could
> likely be improved):
> 
> #if CONFIG_AUDIO_FLOAT
> #define AV_SAMPLE_FMT_NATIVE AV_SAMPLE_FMT_FLT
> #else
> #define AV_SAMPLE_FMT_NATIVE AV_SAMPLE_FMT_S16
> #endif
> 
> and then the above ugly block just reads
> 
>     avctx->sample_fmt = AV_SAMPLE_FMT_NATIVE;
> 
> Since at least the AV_SAMPLE_FMT thing is used in multiple places
> within each file, this should even save some lines.  Also, I think
> both AAC and AC-3 used the same formats, probably more codecs do,
> so this could be placed in a common header, saving even more
> #ifdeffery...
> 
> Diego

Well I see this as an intermediate thing, we want codecs to only output
their native formats. I'd rather have it visible in the code then hidden
in some header.

MvH
Benjamin Larsson
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to