[FFmpeg-devel] [PATCH] close parser in av_find_stream_info is parsing is not needed
Baptiste Coudurier
baptiste.coudurier
Tue May 18 15:51:05 CEST 2010
On 5/18/10 5:58 AM, Michael Niedermayer wrote:
> 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
IMHO this is an ugly hack anyway, extradata should be extracted with a
bitstream filter. This has proven to produce side effects.
Anyway, in ffmpeg.c:
int ticks= ist->st->parser ?
ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
This is no good for H264 in mkv, since parser is set but does not set
repeat_pict. What do suggest ?
Using repeat_pict like this outside libavformat looks a bit weird to me
anyway.
--
Baptiste COUDURIER
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel
mailing list