[FFmpeg-devel] [PATCH] fix seeking and index generation

Michael Chinen mchinen
Wed Aug 25 12:35:31 CEST 2010


On Tue, Aug 24, 2010 at 9:06 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
[...]
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -1043,6 +1043,12 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
>> ? ? ? ? ?/* select current input stream component */
>> ? ? ? ? ?st = s->cur_st;
>> ? ? ? ? ?if (st) {
>> + ? ? ? ? ? ?if(st->parser && (st->parser->flags & PARSER_FLAG_FETCH_OFFSET) &&
>> + ? ? ? ? ? ? ? (s->iformat->flags & AVFMT_GENERIC_INDEX)) {
>> + ? ? ? ? ? ? ? ?st->parser->next_frame_offset =
>> + ? ? ? ? ? ? ? ?st->parser->cur_offset ? ? ? ?= st->cur_pkt.pos;
>> + ? ? ? ? ? ? ? ?st->parser->flags ^= PARSER_FLAG_FETCH_OFFSET;
>> + ? ? ? ? ? ?}
>
> fliping the meaning of PARSER_FLAG_FETCH_OFFSET should simplify the code
> also the existing and this can be factored i guess

I'm sorry but I'm not sure how to simply things by flipping the
meaning of the flag.  In any case, there is now two points in util.c
that set the flag upon parser init, and this may invalidate whatever
solution you were thinking of.  Please take a look and let me know.

I found a clean way to refactor this into the av_parse_parse2 function
of parser.c, since the next_frame_offset and cur_offset variables are
only used there (and belong to the parser.)

Michael

[...]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-index_entries-pos-was-being-set-wrong-for-files-.patch
Type: application/octet-stream
Size: 3026 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100825/777baf1c/attachment.obj>



More information about the ffmpeg-devel mailing list