[FFmpeg-devel] [PATCH] close parser in av_find_stream_info is parsing is not needed

Michael Niedermayer michaelni
Tue May 18 14:58:04 CEST 2010

On Mon, May 17, 2010 at 01:17:42PM -0700, Baptiste Coudurier wrote:
> Hey guys,
> $subject.
> The parser is opened here:
>         //only for the split stuff
>         if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {
>             st->parser = av_parser_init(st->codec->codec_id);
>             if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
>                 st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
>             }
>         }
> So either, it must be closed after, or it shouldn't be opened if parsing is 
> not needed. I'm not sure of the side effects.

Parsers that have a AVCodecParser.split() must be opened and must stay open
until they have extracted the global headers into extradata
after that they could be closed if they arent needed for any other reasons

There are several problems with this though, for example streams that start
later (after av_find_stream_info()) might not have a parser enabled even if
they need one for split().

also if we close them before they have set extradata that similarly would
be a problem

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100518/a6ca35b8/attachment.pgp>

More information about the ffmpeg-devel mailing list