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

Michael Niedermayer michaelni
Thu Aug 26 01:01:58 CEST 2010


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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100826/d96a2fd3/attachment.pgp>



More information about the ffmpeg-devel mailing list