[FFmpeg-devel] [RFC] stream parsing

Benjamin Larsson banan
Mon Sep 27 12:59:27 CEST 2010

On 09/27/2010 12:39 PM, Michael Niedermayer wrote:
>>> Please tell me if this works:
>>> @@ -2000,6 +2000,8 @@
>>>      int val;
>>>      switch(enc->codec_type) {
>>>      case AVMEDIA_TYPE_AUDIO:
>>> +        if(!enc->channel_layout && (!enc->codec || (enc->codec->capabilities & CODEC_CAP_CHANNEL_CONF)))
>>> +            return 0;
>>>          val = enc->sample_rate && enc->channels && enc->sample_fmt != SAMPLE_FMT_NONE;
>>>          if(!enc->frame_size &&
>>>             (enc->codec_id == CODEC_ID_VORBIS ||
>>> if not, please tell me why it fails, ill fix it
>> Well it works if the container does not populate the channel_layout
>> (riff based ones do that if the field is there). So in that case the
> and is it wrong in the riff case?
> (if its wrong this could be argued to be a bug in the riff demuxer)

Well I wanted the  CODEC_CAP_CHANNEL_CONF flag to mean that whatever
channel configuration info is stored in the container, it should be
overridden by the codec info (ie sample_rate, channels, channel_layout).
It has nothing to do with if the riff demuxer is buggy or not.

In the riff case if the is a wavefmt_extensible header and the stored
codec is pcm then there is no other info then in the container, ie we
have to use that. But if the stored codec is dca we should use the info
from the codec as it is more reliable. Your patch does not cover that
scenario. I think that we should cover this scenario. My original patch
does cover this scanario and the same technique is used for AAC.

Benjamin Larsson

More information about the ffmpeg-devel mailing list