[MPlayer-dev-eng] [PATCH] RTMP seek support
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Mar 30 07:57:31 CEST 2010
On Mon, Mar 29, 2010 at 05:48:00PM -0700, Howard Chu wrote:
> Reimar Döffinger wrote:
> >On Mon, Mar 29, 2010 at 07:32:35PM +0200, Reimar Döffinger wrote:
> >>On Sun, Mar 28, 2010 at 08:02:16PM -0700, Howard Chu wrote:
> >>>As a followon to this patch
> >>> https://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-March/086051.html
> >>>
> >>>this patch is needed for mplayer to support rtmp seek. (The ffmpeg
> >>>patch just gets it working for ffplay.)
> >>
> >>You will have to make sure the stream is actually lavf,
>
> Since rtmp support is only provided by ffmpeg, that seems to be a
> foregone conclusion.
But you're assuming that the stream->priv field is always a URLContext
when the lavf _demuxer_ is used, and the lavf demuxer sure is used for
other things than rtmp!
> >>and even then
> >>I'd like to think some more if this is not too hackish.
>
> >Now I remember why it felt so wrong: look at the existing
> >STREAM_CTRL_SEEK_TO_TIME stuff for DVDs and try to reuse it if at
> >all possible.
>
> I've been down that road before.
>
> http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2010-March/063988.html
>
> It didn't work, because demux_seek() never invoked stream_control().
> It has something to do with this in demux_seek():
If librtmp can report the current time stamp that would be the best place
to get it from.
Passing the time that MPlayer collects from the status line and using it
as a fallback is an option, too.
Otherwise something like this might do it:
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c (revision 30976)
+++ libmpdemux/demux_lavf.c (working copy)
@@ -536,6 +536,13 @@
return demuxer;
}
+static double get_cur_dts(AVFormatContext *avfc, int stream_id)
+{
+ if (avfc->streams[stream_id]->cur_dts == AV_NOPTS_VALUE)
+ return MP_NOPTS_VALUE;
+ return avfc->streams[stream_id]->cur_dts * av_q2d(avfc->streams[stream_id]->time_base);
+}
+
static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
lavf_priv_t *priv= demux->priv;
AVPacket pkt;
@@ -597,6 +604,8 @@
}
dp->pos=demux->filepos;
dp->flags= !!(pkt.flags&PKT_FLAG_KEY);
+ if (id == demux->video->id || demux->video->id < 0)
+ demux->stream_pts = get_cur_dts(priv->avfc, id);
// append packet to DS stream:
ds_add_packet(ds,dp);
return 1;
More information about the MPlayer-dev-eng
mailing list