diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-06-13 21:28:52 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-06-13 21:28:52 +0000 |
commit | f85a943fdff3f12db8faf4b84e4f63aafdc60db3 (patch) | |
tree | e16cc52e6b9a9548714a1ee31a5265ff34127467 /src/demuxers/demux_mpeg_pes.c | |
parent | 62f8ce9ec67fb85da1023b5db90a0a5f1609cff7 (diff) | |
download | xine-lib-f85a943fdff3f12db8faf4b84e4f63aafdc60db3.tar.gz xine-lib-f85a943fdff3f12db8faf4b84e4f63aafdc60db3.tar.bz2 |
implement steps 1, 2, 3 and 4 of the seeking proposal:
http://article.gmane.org/gmane.comp.video.xine.devel/9532
it is now up to demuxers to decide what the 0..65535 position means.
demuxers tested: ogg, voc, flac, rm, asf, vqa, vob, avi, y4m, au, mov, ts, mp3, mpg, wav, ra, mve
CVS patchset: 6686
CVS date: 2004/06/13 21:28:52
Diffstat (limited to 'src/demuxers/demux_mpeg_pes.c')
-rw-r--r-- | src/demuxers/demux_mpeg_pes.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 757e33394..5c3e5e02e 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.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_mpeg_pes.c,v 1.24 2004/05/16 21:35:16 jcdutton Exp $ + * $Id: demux_mpeg_pes.c,v 1.25 2004/06/13 21:28:53 miguelfreitas Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -186,10 +186,10 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) else buf->decoder_flags = 0; - if( !buf->extra_info->input_length ) { - buf->extra_info->input_pos = this->input->get_current_pos (this->input); - buf->extra_info->input_length = this->input->get_length (this->input); - } + if( this->input->get_length (this->input) ) + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->input->get_length (this->input) ); + i = this->input->read (this->input, buf->mem, (off_t) 6); if (i != 6) { buf->free_buffer (buf); @@ -548,7 +548,7 @@ static int32_t parse_private_stream_2(demux_mpeg_pes_t *this, uint8_t *p, buf_el cell_time += (frames * 1000)/30; this->last_cell_time = cell_time; - this->last_cell_pos = buf->extra_info->input_pos; + this->last_cell_pos = this->input->get_current_pos (this->input); this->last_begin_time = buf->extra_info->input_time; } @@ -591,17 +591,17 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element /* some input plugins like DVD can have better timing information and have * already set the total_time, so we can derive our datarate from this */ if (buf->extra_info->total_time) - this->rate = (int)((int64_t)buf->extra_info->input_length * 1000 / + this->rate = (int)((int64_t)this->input->get_length (this->input) * 1000 / (buf->extra_info->total_time * 50)); if (this->rate && this->last_cell_time) { if( this->last_begin_time == buf->extra_info->input_time ) buf->extra_info->input_time = this->last_cell_time + buf->extra_info->input_time + - ((buf->extra_info->input_pos - this->last_cell_pos) * 1000 / (this->rate * 50)); + ((this->input->get_current_pos (this->input) - this->last_cell_pos) * 1000 / (this->rate * 50)); } if (this->rate && !buf->extra_info->input_time) - buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); /* FIXME: This was determined by comparing a single MPEG1 and a single MPEG2 stream */ @@ -1272,6 +1272,8 @@ static int demux_mpeg_pes_seek (demux_plugin_t *this_gen, demux_mpeg_pes_t *this = (demux_mpeg_pes_t *) this_gen; start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { @@ -1529,6 +1531,6 @@ demuxer_info_t demux_info_mpeg_pes = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "mpeg_pes", XINE_VERSION_CODE, &demux_info_mpeg_pes, init_plugin }, + { PLUGIN_DEMUX, 25, "mpeg_pes", XINE_VERSION_CODE, &demux_info_mpeg_pes, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |