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

Michael Chinen mchinen
Wed Aug 25 21:54:53 CEST 2010


On Wed, Aug 25, 2010 at 4:04 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Wed, Aug 25, 2010 at 12:35:31PM +0200, Michael Chinen wrote:
>> 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
>
> if(!(s->flags & PARSER_FLAG_FETCHED_OFFSET) {
> ? ?s->next_frame_offset =
> ? ? ? ?s->cur_offset ? ?= pos;
> ? ?s->flags |= PARSER_FLAG_FETCHED_OFFSET;
> }
>
> i dont know if this can be merged into some other code to simplify it
> further

Thanks, for some reason I couldn't see it and thought the other
(AVFMT_FLAG_GENERIC_INDEX) flags were important to this, but thats not
the case as its not harmful to fetch these variables in all cases.

Here's an updated patch.

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: 2264 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100825/d55470bd/attachment.obj>



More information about the ffmpeg-devel mailing list