[FFmpeg-devel] [PATCH] add AVCodecContext field to specify desired number of channels

Måns Rullgård mans
Mon Aug 20 22:20:29 CEST 2007


Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:

> Hello,
> On Mon, Aug 20, 2007 at 07:37:47PM +0200, Michael Niedermayer wrote:
>> On Mon, Aug 20, 2007 at 04:53:26PM +0200, Reimar D?ffinger wrote:
>> > On Mon, Aug 20, 2007 at 01:57:57PM +0200, Michael Niedermayer wrote:
>> > > On Sun, Aug 19, 2007 at 10:08:13PM +0200, Michael Niedermayer wrote:
>> > > > On Sun, Aug 19, 2007 at 04:56:44PM +0200, Reimar D?ffinger wrote:
>> > > > > Hello,
>> > > > > since the current way of setting ->channels no matter how it is done
>> > > > > will break some codecs I suggest adding a new field.
>> > > > > Also has the advantage that it will be easier to allow handling the
>> > > > > cases where either the number of desired channels changes or the number
>> > > > > of channels in the file changes.
>> > > > > I also think that the current behaviour of dca is not good: if it can't
>> > > > > deliver the requested number of channels it should just use either
>> > > > > something close or the native number instead of failing.
>> > > > > Is it right to add this at the end of the context or should it be near
>> > > > > "channels"?
>> > > > 
>> > > > looks ok though maybe you should wait a day or two before applying it
>> > > > maybe someone, justin, kostya? have some comments
>> > > 
>> > > also dont forget to update the AVOption array un libavcodec/utils.c
>> > 
>> > Like this?
>> [...]
>> > @@ -753,6 +753,7 @@ static const AVOption options[]={
>> >  {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E},
>> >  {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
>> >  {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
>> > +{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|D},
>> 
>> i think the max/min can be improved
>> 5000 channels is not sane neither is -3 channels
>
> I agree, but I didn't want to "invent" some numbers and those are the
> values that are used for "channels".

I think you can safely exclude negative numbers.  Choosing an upper
limit is admittedly more arbitrary.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list