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

Michael Chinen mchinen
Thu Aug 26 10:43:51 CEST 2010


On Thu, Aug 26, 2010 at 1:01 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Wed, Aug 25, 2010 at 09:54:53PM +0200, Michael Chinen wrote:
>> 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
>
>> ?libavcodec/avcodec.h | ? ?1 +
>> ?libavcodec/parser.c ?| ? ?6 ++++++
>> ?libavformat/utils.c ?| ? ?4 ----
>> ?3 files changed, 7 insertions(+), 4 deletions(-)
>> 347f71afb10d2eb0d5c908815098935bc8c7ac34 ?0001-fix-index_entries-pos-was-being-set-wrong-for-files-.patch
>> From e258c1084ff2b6f978ec5c6751c27f9ec642a04f Mon Sep 17 00:00:00 2001
>> From: Michael Chinen <mchinen at gmail.com>
>> Date: Sun, 8 Aug 2010 17:24:35 +0200
>> Subject: [PATCH] fix index_entries pos (was being set wrong for files with data_offset > 0)
>>
>> 2nd submission:
>> refactor parser offset fetching (by moving into parser.c)
>>
>> 3rd submission:
>> flip meaning of fetch offset flag
>> ---
>> ?libavcodec/avcodec.h | ? ?1 +
>> ?libavcodec/parser.c ?| ? ?6 ++++++
>> ?libavformat/utils.c ?| ? ?4 ----
>> ?3 files changed, 7 insertions(+), 4 deletions(-)
>
> this should be ok if reg tests/fate dont change otherwise i need to see
> the chnages first

It passes 'make test' on my machine, but I can understand if someone
else wants to verify first.  'make test' runs all the fate tests,
right?

Michael



More information about the ffmpeg-devel mailing list