diff options
Diffstat (limited to 'src/demuxers/demux_mpeg.c')
-rw-r--r-- | src/demuxers/demux_mpeg.c | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 055f718cc..c4f057a56 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mpeg.c,v 1.141 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_mpeg.c,v 1.142 2004/06/13 21:28:53 miguelfreitas Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -357,9 +357,12 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - buf->extra_info->input_pos = this->input->get_current_pos (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) ); + if (this->rate) - 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)); this->audio_fifo->put (this->audio_fifo, buf); @@ -386,9 +389,11 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags |= BUF_FLAG_PREVIEW; - buf->extra_info->input_pos = this->input->get_current_pos (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) ); if (this->rate) - 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)); if(this->audio_fifo) @@ -447,10 +452,12 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - buf->extra_info->input_pos = this->input->get_current_pos (this->input); - if (this->rate) - buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos - * 1000 / (this->rate * 50)); + 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) ); + if (this->rate) + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + * 1000 / (this->rate * 50)); this->audio_fifo->put (this->audio_fifo, buf); @@ -517,10 +524,12 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - buf->extra_info->input_pos = this->input->get_current_pos (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) ); if (this->rate) - buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos - * 1000 / (this->rate * 50)); + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + * 1000 / (this->rate * 50)); this->video_fifo->put (this->video_fifo, buf); } @@ -645,10 +654,12 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - buf->extra_info->input_pos = this->input->get_current_pos (this->input); - if (this->rate) - buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos - * 1000 / (this->rate * 50)); + 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) ); + if (this->rate) + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + * 1000 / (this->rate * 50)); this->audio_fifo->put (this->audio_fifo, buf); @@ -677,10 +688,12 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - buf->extra_info->input_pos = this->input->get_current_pos (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) ); if (this->rate) - buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos - * 1000 / (this->rate * 50)); + buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + * 1000 / (this->rate * 50)); this->video_fifo->put (this->video_fifo, buf); } @@ -965,6 +978,8 @@ static int demux_mpeg_seek (demux_plugin_t *this_gen, demux_mpeg_t *this = (demux_mpeg_t *) this_gen; start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); if (INPUT_IS_SEEKABLE(this->input)) { @@ -1225,6 +1240,6 @@ demuxer_info_t demux_info_mpeg = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "mpeg", XINE_VERSION_CODE, &demux_info_mpeg, init_plugin }, + { PLUGIN_DEMUX, 25, "mpeg", XINE_VERSION_CODE, &demux_info_mpeg, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |