[FFmpeg-devel] [PATCH] Stream parsing

Benjamin Larsson banan
Sun Oct 3 21:23:44 CEST 2010


On 10/03/2010 08:46 PM, Reimar D?ffinger wrote:
> On Sun, Oct 03, 2010 at 02:40:52PM -0400, Justin Ruggles wrote:
>> Benjamin Larsson wrote:
>>
>>> $topic, previously discussed in [RFC] Stream parsing
>>>
>>> MvH
>>> Benjamin Larsson
>>>
>>
>>> +/**
>>> + * Codec should fill in channel configuration and samplerate instead of container
>>> + */
>>> +#define CODEC_CAP_CHANNEL_CONF     0x0400
>> [...]
>>> @@ -2191,9 +2192,17 @@
>>>              }
>>>          }
>>>          assert(!st->codec->codec);
>>> +        codec = avcodec_find_decoder(st->codec->codec_id);
>>> +
>>> +        /* Force decoding of at least one frame of codec data
>>> +         * this makes sure the codec initializes the channel configuration
>>> +         * and does not trust the values from the container.
>>> +         */
>>> +        if (codec && codec->capabilities & CODEC_CAP_CHANNEL_CONF)
>>> +            st->codec->channels = 0;
>>
>> Your documentation says channel configuration and samplerate.  Why is
>> sample_rate not also set to 0 here?
> 
> I think the documentation should say:
> Will override container channel configuration (i.e. even if it was
> specified by the container) and fill in sample rate (i.e. usually only
> when it was not set by the container).
> I do not know 100% this is what will happen (e.g. SBR actually might
> double the container-specified value I think), but in principle that
> would be the ideal behaviour.

In av_find_stream_info() you will see that aac has a special case where
everything is left to the codec to decide.

MvH
Benjamin Larsson



More information about the ffmpeg-devel mailing list