[MPlayer-dev-eng] Proposed support for Kate streams
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Mar 18 11:44:45 CET 2008
On Tue, Mar 18, 2008 at 11:17:40AM +0100, Reimar Döffinger wrote:
> On Tue, Mar 18, 2008 at 12:24:52PM +0300, Evgeniy Stepanov wrote:
> > On Tuesday 18 March 2008 11:28:00 Reimar Döffinger wrote:
> > > > Slightly off-topic, it seems too early to switch to lavf demuxer at least
> > > > for ogg and avi: the former does not support seeking to keyframes
> > >
> > > I never considered that really relevant I must admit, but I assumed it
> > > would be a rather simple, although maybe ugly fix.
> >
> > I'm not sure about that. Lavf ogg demuxer misses seeking code, and generic
> > seeking routines simply ignore keyframe information. I really think it cannot
> > be ignored, because it makes seeking almost unusable.
>
> Just make ogg_read_timestamp only return keyframes and seeking will only
> go to keyframes. Not sure if this is the intended behaviour and if it
> would be accepted, but it does not look difficult to me (beyond needing
> a reliable way of detecting keyframes, which IIRC can be quite painful).
More specifically, you could just try attached patch (I have not tested it yet).
-------------- next part --------------
Index: libavformat/oggdec.c
===================================================================
--- libavformat/oggdec.c (revision 12478)
+++ libavformat/oggdec.c (working copy)
@@ -559,13 +559,17 @@
int i;
url_fseek(bc, *pos_arg, SEEK_SET);
while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) {
+ ogg->streams[i].pflags = 0;
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
ogg->streams[i].codec && i == stream_index) {
- pts = ogg_gptopts(s, i, ogg->streams[i].granule);
+ int64_t next_pts = ogg_gptopts(s, i, ogg->streams[i].granule);
+ if (ogg->streams[i].pflags & PKT_FLAG_KEY) {
+ pts = next_pts;
// FIXME: this is the position of the packet after the one with above
// pts.
*pos_arg = url_ftell(bc);
break;
+ }
}
}
ogg_reset(ogg);
More information about the MPlayer-dev-eng
mailing list