[FFmpeg-devel] [PATCH] VC-1 SP/MP test bitstreams demuxer

Kostya kostya.shishkov
Sun Jan 27 14:47:34 CET 2008


On Sun, Jan 27, 2008 at 12:57:50PM +0100, Michael Niedermayer wrote:
> On Sun, Jan 27, 2008 at 10:19:54AM +0200, Kostya wrote:
> [...]
> 
> > 
> > > > +    if(av_get_packet(pb, pkt, frame_size) < 0)
> > > > +        return AVERROR(EIO);
> > > > +    pkt->flags |= keyframe ? PKT_FLAG_KEY : 0;
> > > > +
> > > > +    return pkt->size;
> > > > +}
> > > > +
> > > > +AVInputFormat vc1t_demuxer = {
> > > > +    "vc1test",
> > > > +    "VC1 test bitstream format",
> > > > +    0,
> > > > +    vc1t_probe,
> > > > +    vc1t_read_header,
> > > > +    vc1t_read_packet,
> > > > +};
> > > 
> > > does seeking work?
> > > if no try setting AVFMT_GENERIC_INDEX and try again
> > > if still not, check if the generic code builds the index properly
> > > and fix it, this should be just a 1 or 2 line fix in utils.c
> > 
> > It won't work as index is built only for parsed formats.
> 
> yes, i meant you could fix that :)
> though thats of course independant of this patch ...

You could as well ;)
Here's an untested proof of concept
 
> [...]
> > +    if(!s->streams[0]->r_frame_rate.num)
> > +        pkt->pts = pts;
> 
> you are missusing r_frame_rate.num here
> actually i dont see what would prevent lavf to set it to a non zero value
> in av_find_stream_info() and then break this ...

How should I redo it then?
 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
-------------- next part --------------
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c	(revision 11619)
+++ libavformat/utils.c	(working copy)
@@ -769,6 +769,11 @@
                 *pkt = s->cur_pkt;
                 compute_pkt_fields(s, st, NULL, pkt);
                 s->cur_st = NULL;
+                if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & PKT_FLAG_KEY){
+                    ff_reduce_index(s, st->index);
+                    av_add_index_entry(st, pkt->pos, pkt->dts,
+                                        0, 0, AVINDEX_KEYFRAME);
+                }
                 break;
             } else if (s->cur_len > 0 && st->discard < AVDISCARD_ALL) {
                 len = av_parser_parse(st->parser, st->codec, &pkt->data, &pkt->size,



More information about the ffmpeg-devel mailing list