[FFmpeg-devel] [PATCH] H264 parser fix
Howard Chu
hyc
Wed May 26 05:49:13 CEST 2010
Michael Niedermayer wrote:
> On Tue, May 25, 2010 at 09:31:51AM -0700, Howard Chu wrote:
>>>> It seems odd to me that the parser
>>>> entry points all require an AVCodecContext but av_parser_init() only
>>>> takes
>>>> a codec_id. If av_parser_init() took an AVCodecContext instead, all of
>>>> the
>>>> necessary information would be available.
>>>
>>> well, yes, its not given during init but just later, i dont see how this
>>> would be a problem
>>
>> This patch works. It just means adding an if (extradata_not_parsed_yet)
>> test in h264_parse(), instead of handling it unconditionally at init time.
>> Probably a trivial overhead. I've just taken the extradata parsing code
>> from ff_h264_decode_init() and broken it out into its own function so that
>> h264_parse can use it too.
>> + if (!h->sps_buffers[0]&& avctx->extradata_size) {
>
> that looks wrong, i dont think anything gurantees that there is a sps
> with sps_id=0
OK. Added an explicit flag to the H264Context for this instead. Still this
feels clumsy, it should have just been done in the parser_init step. Also it
feels clumsy that it has to be parsed again, when the H264Context hanging off
the AVCodecContext may already have it (due to ff_h264_decode_init() having
parsed it already).
There was a suggestion on IRC to add an av_parser_init2() API which provides
the AVCodecContext, to be given to a new H264 parser_init2 function. It could
just fallback to passing the codec_id if a given parser doesn't implement the
init2 function...
> no need to pass AVCodecContext if its in h->s.avctx
OK.
> also the factorization should be a seperate patch
OK, split into two separate patches.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: refactor.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100525/81f312e2/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: parser.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100525/81f312e2/attachment-0001.txt>
More information about the ffmpeg-devel
mailing list