[FFmpeg-devel] [RFC] stream parsing
Michael Niedermayer
michaelni
Mon Sep 27 02:35:18 CEST 2010
On Mon, Sep 27, 2010 at 01:17:40AM +0200, Benjamin Larsson wrote:
>
> >> -static int has_codec_parameters(AVCodecContext *enc)
> >> +static int has_codec_parameters(AVCodecContext *enc, AVCodec *codec)
> >> {
> >> int val;
> >> switch(enc->codec_type) {
> >> case AVMEDIA_TYPE_AUDIO:
> >> val = enc->sample_rate && enc->channels && enc->sample_fmt != SAMPLE_FMT_NONE;
> >> + /* Some containers report wrong information about channel configuration
> >> + * let the codecs handle it in those cases (dca for example)).
> >> + */
> >> + if (codec && codec->capabilities & CODEC_CAP_CHANNEL_CONF) {
> >> + enc->sample_rate = 0;
> >> + enc->channel_layout = 0;
> >> + enc->frame_size = 0;
> >> + enc->channels = 0;
> >> + return 0;
> >> + }
> >
> > av_find_stream_info() will return once all streams has_codec_parameters()
> > return non zero
> > this explicitly returns 0 unconditional on any parameters being available or
> > not thus has_codec_parameters() will never return non zero for an affected
> > stream, leading to exit only by bug and time/pos limits
>
> codec is always NULL in the for(;;) block. Thus this code will only be
> triggered once.
i have to maintain this code, and this patch is a huge convoluted hack
passing NULL instead of the correct AVCodec to make the code not end in a
near infinite loop is just crazy
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100927/f2700827/attachment.pgp>
More information about the ffmpeg-devel
mailing list