From 99beb778cc6bb3502d58b16176af1e98b72f9f60 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Mon, 20 Oct 2003 06:19:02 +0000 Subject: Submitted by Rett Walters: - Implement relative seeking and time display in mpeg2 transport streams. The time display might be off on some streams. CVS patchset: 5556 CVS date: 2003/10/20 06:19:02 --- src/demuxers/demux_ts.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index a361bc32b..e10da8208 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.90 2003/10/06 15:46:20 mroi Exp $ + * $Id: demux_ts.c,v 1.91 2003/10/20 06:19:02 jcdutton Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -771,6 +771,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; m->buf->extra_info->input_pos = this->input->get_current_pos(this->input); + if (this->rate) + m->buf->extra_info->input_time = (int)((int64_t)m->buf->extra_info->input_pos + * 1000 / (this->rate * 50)); m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = NULL; /* forget about buf -- not our responsibility anymore */ @@ -800,6 +803,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; m->buf->extra_info->input_pos = this->input->get_current_pos(this->input); + if (this->rate) + m->buf->extra_info->input_time = (int)((int64_t)m->buf->extra_info->input_pos + * 1000 / (this->rate * 50)); m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = m->fifo->buffer_pool_alloc(m->fifo); @@ -1781,9 +1787,11 @@ static int demux_ts_seek (demux_plugin_t *this_gen, if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) { - if ((!start_pos) && (start_time)) - start_pos = start_time * this->rate * 50; - + if ((!start_pos) && (start_time)) { + start_pos = start_time; + start_pos *= this->rate; + start_pos *= 50; + } this->input->seek (this->input, start_pos, SEEK_SET); } -- cgit v1.2.3