From f85a943fdff3f12db8faf4b84e4f63aafdc60db3 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 13 Jun 2004 21:28:52 +0000 Subject: 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 --- src/demuxers/demux.h | 8 +++--- src/demuxers/demux_4xm.c | 17 ++++++++----- src/demuxers/demux_aac.c | 7 ++--- src/demuxers/demux_ac3.c | 11 +++++--- src/demuxers/demux_aiff.c | 10 +++++--- src/demuxers/demux_asf.c | 18 ++++++++----- src/demuxers/demux_aud.c | 6 ++--- src/demuxers/demux_avi.c | 32 +++++++++++++++-------- src/demuxers/demux_cdda.c | 13 ++++++---- src/demuxers/demux_eawve.c | 6 +++-- src/demuxers/demux_elem.c | 10 +++++--- src/demuxers/demux_film.c | 33 ++++++++++++++---------- src/demuxers/demux_flac.c | 14 +++++----- src/demuxers/demux_fli.c | 12 ++++----- src/demuxers/demux_flv.c | 9 ++++--- src/demuxers/demux_idcin.c | 14 +++++----- src/demuxers/demux_iff.c | 14 ++++++---- src/demuxers/demux_image.c | 4 +-- src/demuxers/demux_ipmovie.c | 14 +++++----- src/demuxers/demux_matroska.c | 39 ++++++++++++++-------------- src/demuxers/demux_mng.c | 8 +++--- src/demuxers/demux_mod.c | 11 ++------ src/demuxers/demux_mpeg.c | 55 +++++++++++++++++++++++++--------------- src/demuxers/demux_mpeg_block.c | 21 +++++++-------- src/demuxers/demux_mpeg_pes.c | 22 ++++++++-------- src/demuxers/demux_mpgaudio.c | 8 ++++-- src/demuxers/demux_nsf.c | 11 ++++---- src/demuxers/demux_nsv.c | 12 ++++----- src/demuxers/demux_ogg.c | 22 +++++++++++----- src/demuxers/demux_pva.c | 23 ++++++++++++----- src/demuxers/demux_qt.c | 17 ++++++++----- src/demuxers/demux_rawdv.c | 13 ++++++---- src/demuxers/demux_real.c | 28 ++++++++++++-------- src/demuxers/demux_realaudio.c | 17 ++++++++----- src/demuxers/demux_roq.c | 18 +++++++++---- src/demuxers/demux_slave.c | 4 +-- src/demuxers/demux_smjpeg.c | 6 ++--- src/demuxers/demux_snd.c | 10 +++++--- src/demuxers/demux_str.c | 18 ++++++++----- src/demuxers/demux_ts.c | 24 +++++++++++------- src/demuxers/demux_vmd.c | 22 +++++++++------- src/demuxers/demux_voc.c | 11 +++++--- src/demuxers/demux_vox.c | 7 ++--- src/demuxers/demux_vqa.c | 10 ++++---- src/demuxers/demux_wav.c | 10 +++++--- src/demuxers/demux_wc3movie.c | 13 ++++++---- src/demuxers/demux_yuv4mpeg2.c | 10 +++++--- src/demuxers/demux_yuv_frames.c | 4 +-- src/demuxers/group_audio.c | 30 +++++++++++----------- src/demuxers/group_games.c | 24 +++++++++--------- src/demuxers/matroska.h | 5 ++-- src/input/input_cdda.c | 4 +-- src/input/input_dvb.c | 2 +- src/input/input_dvd.c | 13 +++++++--- src/input/input_file.c | 4 +-- src/input/input_gnome_vfs.c | 4 +-- src/input/input_http.c | 4 +-- src/input/input_mms.c | 4 +-- src/input/input_net.c | 4 +-- src/input/input_plugin.h | 4 +-- src/input/input_pnm.c | 2 +- src/input/input_pvr.c | 4 +-- src/input/input_rtp.c | 2 +- src/input/input_rtsp.c | 2 +- src/input/input_stdin_fifo.c | 4 +-- src/input/input_v4l.c | 4 +-- src/input/input_vcd.c | 4 +-- src/input/vcd/xineplug_inp_vcd.c | 4 +-- src/libflac/decoder_flac.c | 2 +- src/libflac/demux_flac.c | 15 +++++++---- src/libsputext/demux_sputext.c | 4 +-- src/libsputext/xine_decoder.c | 8 +++--- src/xine-engine/audio_out.c | 4 +-- src/xine-engine/buffer.h | 20 ++++++++------- src/xine-engine/demux.c | 16 +++++------- src/xine-engine/video_out.c | 4 +-- src/xine-engine/xine.c | 35 +++++-------------------- src/xine-engine/xine_internal.h | 11 ++++---- 78 files changed, 551 insertions(+), 422 deletions(-) diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h index df05ef286..625922c26 100644 --- a/src/demuxers/demux.h +++ b/src/demuxers/demux.h @@ -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.h,v 1.37 2004/02/12 18:05:45 mroi Exp $ + * $Id: demux.h,v 1.38 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifndef HAVE_DEMUX_H @@ -33,7 +33,7 @@ # include #endif -#define DEMUXER_PLUGIN_IFACE_VERSION 24 +#define DEMUXER_PLUGIN_IFACE_VERSION 25 #define DEMUX_OK 0 #define DEMUX_FINISHED 1 @@ -106,7 +106,9 @@ struct demux_plugin_s { * * for seekable streams, a start position can be specified * - * start_pos : position in input source + * start_pos : position in input source (0..65535) + * this is defined as most convenient to demuxer, can be + * either time or offset based. * start_time : position measured in miliseconds from stream start * playing : true if this is a new seek within an already playing stream * false if playback of this stream has not started yet diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index 95a6e6ab0..c6d2d3f0e 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.c @@ -23,7 +23,7 @@ * For more information on the 4xm file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_4xm.c,v 1.14 2004/02/09 22:24:36 jstembridge Exp $ + * $Id: demux_4xm.c,v 1.15 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -264,8 +264,9 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { /* send the 8-byte chunk header first */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_4XM; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->filesize ); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; buf->size = 8; @@ -278,8 +279,9 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { while (remaining_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_4XM; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->filesize ); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; @@ -326,8 +328,9 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { while (remaining_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->tracks[current_track].audio_type; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->filesize ); /* let the engine sort it out */ buf->extra_info->input_time = 0; buf->pts = 0; diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index ee39fd071..f1eda8597 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -21,7 +21,7 @@ * This demuxer presently only detects a raw AAC file by the extension * '.aac'. Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.4 2004/03/22 00:12:57 f1rmb Exp $ + * $Id: demux_aac.c,v 1.5 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -71,8 +71,9 @@ static int demux_aac_send_chunk(demux_plugin_t *this_gen) { /* just load an entire buffer from wherever the audio happens to be */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_AAC; - 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) ); buf->pts = 0; bytes_read = this->input->read(this->input, buf->content, buf->max_size); diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c index 1ec686674..e86678811 100644 --- a/src/demuxers/demux_ac3.c +++ b/src/demuxers/demux_ac3.c @@ -23,7 +23,7 @@ * This demuxer detects raw AC3 data in a file and shovels AC3 data * directly to the AC3 decoder. * - * $Id: demux_ac3.c,v 1.15 2004/01/09 01:26:32 miguelfreitas Exp $ + * $Id: demux_ac3.c,v 1.16 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -187,7 +187,7 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) { audio_pts /= this->sample_rate; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, audio_pts, 0); + _x_demux_control_newpts(this->stream, audio_pts, BUF_FLAG_SEEK); this->seek_flag = 0; } @@ -209,8 +209,9 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) { } buf->type = BUF_AUDIO_A52; - buf->extra_info->input_pos = current_stream_pos; - 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) current_stream_pos * + 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; buf->decoder_flags |= BUF_FLAG_FRAME_END; @@ -250,6 +251,8 @@ static int demux_ac3_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_ac3_t *this = (demux_ac3_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); this->seek_flag = 1; this->status = DEMUX_OK; diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index 4d8020aa8..3589cadd0 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -21,7 +21,7 @@ /* * AIFF File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_aiff.c,v 1.38 2004/01/09 01:26:32 miguelfreitas Exp $ + * $Id: demux_aiff.c,v 1.39 2004/06/13 21:28:52 miguelfreitas Exp $ * */ @@ -183,7 +183,7 @@ static int demux_aiff_send_chunk (demux_plugin_t *this_gen) { current_pts /= this->audio_bytes_per_second; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, current_pts, 0); + _x_demux_control_newpts(this->stream, current_pts, BUF_FLAG_SEEK); this->seek_flag = 0; } @@ -195,8 +195,8 @@ static int demux_aiff_send_chunk (demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = current_pts / 90; buf->pts = current_pts; @@ -267,6 +267,8 @@ static int demux_aiff_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_aiff_t *this = (demux_aiff_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); this->seek_flag = 1; this->status = DEMUX_OK; diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index cd8f1b4ed..4f48b40c3 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.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_asf.c,v 1.160 2004/05/30 14:38:02 tmattern Exp $ + * $Id: demux_asf.c,v 1.161 2004/06/13 21:28:52 miguelfreitas Exp $ * * demultiplexer for asf streams * @@ -833,11 +833,13 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, lprintf ("data: %d %d %d %d\n", buf->content[0], buf->content[1], buf->content[2], buf->content[3]); - 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) ); buf->extra_info->input_time = timestamp; - lprintf ("input pos is %lld, input time is %d, rate %d\n", - buf->extra_info->input_pos, + lprintf ("input normpos is %lld, input time is %d, rate %d\n", + buf->extra_info->input_normpos, buf->extra_info->input_time, this->rate); @@ -942,7 +944,9 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, buf = stream->fifo->buffer_pool_alloc (stream->fifo); xine_fast_memcpy (buf->content, p, bufsize); - 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) ); buf->extra_info->input_time = stream->timestamp; #if 0 @@ -1895,6 +1899,8 @@ static int demux_asf_seek (demux_plugin_t *this_gen, int64_t ts; start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); lprintf ("demux_asf_seek: start_pos = %lld, start_time=%d\n", start_pos, start_time); @@ -2250,6 +2256,6 @@ demuxer_info_t demux_info_asf = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "asf", XINE_VERSION_CODE, &demux_info_asf, init_class }, + { PLUGIN_DEMUX, 25, "asf", XINE_VERSION_CODE, &demux_info_asf, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c index fd132a3d1..5ebf25e13 100644 --- a/src/demuxers/demux_aud.c +++ b/src/demuxers/demux_aud.c @@ -34,7 +34,7 @@ * data. This makes seeking conceptually impossible. Upshot: Random * seeking is not supported. * - * $Id: demux_aud.c,v 1.18 2004/04/20 13:57:26 valtri Exp $ + * $Id: demux_aud.c,v 1.19 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -164,8 +164,8 @@ static int demux_aud_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 600eb8cb8..e44068e98 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.204 2004/06/05 14:11:24 tmattern Exp $ + * $Id: demux_avi.c,v 1.205 2004/06/13 21:28:52 miguelfreitas Exp $ * * demultiplexer for avi streams * @@ -1589,7 +1589,9 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { buf->type = audio->audio_type | i; buf->extra_info->input_time = audio_pts / 90; - 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) ); check_newpts (this, buf->pts, PTS_AUDIO); this->audio_fifo->put (this->audio_fifo, buf); @@ -1608,13 +1610,17 @@ static int demux_avi_next (demux_avi_t *this, int decoder_flags) { buf->type = this->avi->video_type; buf->extra_info->input_time = video_pts / 90; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - if (this->has_index) { + if (this->has_index && this->avi->video_idx.video_frames > 2) { /* use video_frames-2 instead of video_frames-1 to fix problems with weird non-interleaved streams */ - buf->extra_info->input_length = - this->avi->video_idx.vindex[this->avi->video_idx.video_frames - 2].pos; + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / + this->avi->video_idx.vindex[this->avi->video_idx.video_frames - 2].pos); + } else { + 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) ); } buf->extra_info->frame_number = this->avi->video_posf; buf->decoder_flags |= decoder_flags; @@ -1743,7 +1749,9 @@ static int demux_avi_next_streaming (demux_avi_t *this, int decoder_flags) { return 0; } buf->extra_info->input_time = audio_pts / 90; - 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) ); buf->type = audio->audio_type | audio_stream; @@ -1788,8 +1796,7 @@ static int demux_avi_next_streaming (demux_avi_t *this, int decoder_flags) { buf->type = this->avi->video_type; buf->extra_info->input_time = video_pts / 90; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = buf->extra_info->input_pos; + buf->extra_info->input_normpos = 65535; buf->extra_info->frame_number = this->avi->video_posf; buf->decoder_flags |= decoder_flags; @@ -2040,7 +2047,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { static int demux_avi_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_avi_t *this = (demux_avi_t *) this_gen; - + if (!this->streaming) { _x_demux_flush_engine (this->stream); this->seek_request = 1; @@ -2058,6 +2065,9 @@ static int demux_avi_seek_internal (demux_avi_t *this) { int64_t audio_pts; off_t start_pos = this->seek_start_pos; int start_time = this->seek_start_time; + + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); this->status = DEMUX_OK; @@ -2353,6 +2363,6 @@ demuxer_info_t demux_info_avi = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "avi", XINE_VERSION_CODE, &demux_info_avi, init_class }, + { PLUGIN_DEMUX, 25, "avi", XINE_VERSION_CODE, &demux_info_avi, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c index 2c12c4902..3790ee6b9 100644 --- a/src/demuxers/demux_cdda.c +++ b/src/demuxers/demux_cdda.c @@ -24,7 +24,7 @@ * linear PCM "decoder" (which in turn sends them directly to the audio * output target; this is a really fancy CD-playing architecture). * - * $Id: demux_cdda.c,v 1.18 2004/01/09 01:26:32 miguelfreitas Exp $ + * $Id: demux_cdda.c,v 1.19 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -84,16 +84,17 @@ static int demux_cdda_send_chunk (demux_plugin_t *this_gen) { } buf->type = BUF_AUDIO_LPCM_LE; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = this->input->get_length(this->input); - buf->pts = buf->extra_info->input_pos; + 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) ); + buf->pts = this->input->get_current_pos(this->input); buf->pts *= 90000; buf->pts /= CD_BYTES_PER_SECOND; buf->extra_info->input_time = buf->pts / 90; buf->decoder_flags |= BUF_FLAG_FRAME_END; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, buf->pts, 0); + _x_demux_control_newpts(this->stream, buf->pts, BUF_FLAG_SEEK); this->seek_flag = 0; } @@ -139,6 +140,8 @@ static void demux_cdda_send_headers(demux_plugin_t *this_gen) { static int demux_cdda_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_cdda_t *this = (demux_cdda_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); start_time /= 1000; if (start_pos) diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index 1e67154c8..7d7cc922a 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_eawve.c,v 1.27 2004/01/09 01:26:32 miguelfreitas Exp $ + * $Id: demux_eawve.c,v 1.28 2004/06/13 21:28:52 miguelfreitas Exp $ * * demux_eawve.c, Demuxer plugin for Electronic Arts' WVE file format * @@ -222,7 +222,9 @@ static int demux_eawve_send_chunk(demux_eawve_t *this){ buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); buf->type = BUF_AUDIO_EA_ADPCM; - 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) ); buf->extra_info->input_time = (int)((int64_t)this->sample_counter * 1000 / 22050); buf->pts = this->sample_counter; buf->pts *= 90000; diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index d626fe619..4fa76ffd7 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_elem.c,v 1.84 2004/05/16 18:01:28 tmattern Exp $ + * $Id: demux_elem.c,v 1.85 2004/06/13 21:28:52 miguelfreitas Exp $ * * demultiplexer for elementary mpeg streams */ @@ -84,7 +84,9 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) { buf->size = done; buf->content = buf->mem; buf->pts = 0; - 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) ); buf->type = BUF_VIDEO_MPEG; if (preview_mode) @@ -142,6 +144,8 @@ static int demux_mpeg_elem_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); this->status = DEMUX_OK; @@ -303,6 +307,6 @@ demuxer_info_t demux_info_elem = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "elem", XINE_VERSION_CODE, &demux_info_elem, init_plugin }, + { PLUGIN_DEMUX, 25, "elem", XINE_VERSION_CODE, &demux_info_elem, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index eb3e60c81..762c243f2 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -21,7 +21,7 @@ * For more information on the FILM file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_film.c,v 1.75 2004/02/09 22:24:36 jstembridge Exp $ + * $Id: demux_film.c,v 1.76 2004/06/13 21:28:52 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -417,9 +417,10 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = this->video_type; - buf->extra_info->input_pos = - this->sample_table[i].sample_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double)(this->sample_table[i].sample_offset - + this->data_start) * + 65535 / this->data_size); buf->extra_info->input_time = this->sample_table[i].pts / 90; buf->pts = this->sample_table[i].pts; @@ -487,9 +488,10 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = this->video_type; - buf->extra_info->input_pos = - this->sample_table[i].sample_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double)(this->sample_table[i].sample_offset - + this->data_start) * + 65535 / this->data_size); buf->extra_info->input_time = this->sample_table[i].pts / 90; buf->pts = this->sample_table[i].pts; @@ -531,9 +533,10 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = - this->sample_table[i].sample_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double)(this->sample_table[i].sample_offset - + this->data_start) * + 65535 / this->data_size); /* special hack to accomodate linear PCM decoder: only the first * buffer gets the real pts */ @@ -598,9 +601,10 @@ static int demux_film_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = - this->sample_table[i].sample_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double)(this->sample_table[i].sample_offset - + this->data_start) * + 65535 / this->data_size); /* special hack to accomodate linear PCM decoder: only the first * buffer gets the real pts */ @@ -721,6 +725,9 @@ static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start int found; int64_t keyframe_pts; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); + this->waiting_for_keyframe = 1; this->status = DEMUX_OK; _x_demux_flush_engine(this->stream); diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index e29133c32..a988c1c6f 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -23,7 +23,7 @@ * For more information on the FLAC file format, visit: * http://flac.sourceforge.net/ * - * $Id: demux_flac.c,v 1.1 2004/06/11 01:29:49 tmmm Exp $ + * $Id: demux_flac.c,v 1.2 2004/06/13 21:28:53 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -225,9 +225,9 @@ static int demux_flac_send_chunk(demux_plugin_t *this_gen) { * boundaries and let the engine figure out the pts */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_FLAC; - buf->extra_info->input_pos = this->input->get_current_pos(this->input) - - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int) ( (double) (this->input->get_current_pos(this->input) - + this->data_start) * 65535 / this->data_size ); buf->pts = 0; buf->size = buf->max_size; @@ -245,8 +245,8 @@ static int demux_flac_send_chunk(demux_plugin_t *this_gen) { input_time_guess = this->total_samples; input_time_guess /= this->sample_rate; input_time_guess *= 1000; - input_time_guess *= buf->extra_info->input_pos; - input_time_guess /= buf->extra_info->input_length; + input_time_guess *= buf->extra_info->input_normpos; + input_time_guess /= 65535; buf->extra_info->input_time = input_time_guess; if (this->input->read(this->input, buf->content, buf->size) != @@ -294,6 +294,8 @@ static void demux_flac_send_headers(demux_plugin_t *this_gen) { static int demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_flac_t *this = (demux_flac_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); int seekpoint_index = 0; int64_t start_pts; diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index ced7ea9f1..d1eb4d254 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -24,7 +24,7 @@ * avoid while programming a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_fli.c,v 1.54 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_fli.c,v 1.55 2004/06/13 21:28:53 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -178,9 +178,9 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) { /* send a buffer with only the chunk header */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_FLI; - buf->extra_info->input_pos = current_file_pos; + if( this->stream_len ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->stream_len); buf->extra_info->input_time = this->pts_counter / 90; - buf->extra_info->input_length = this->stream_len; buf->pts = this->pts_counter; buf->size = 6; memcpy(buf->content, fli_buf, 6); @@ -191,9 +191,9 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_FLI; - buf->extra_info->input_pos = current_file_pos; + if( this->stream_len ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->stream_len); buf->extra_info->input_time = this->pts_counter / 90; - buf->extra_info->input_length = this->stream_len; buf->pts = this->pts_counter; if (chunk_size > buf->max_size) @@ -400,6 +400,6 @@ demuxer_info_t demux_info_fli = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "fli", XINE_VERSION_CODE, &demux_info_fli, init_plugin }, + { PLUGIN_DEMUX, 25, "fli", XINE_VERSION_CODE, &demux_info_fli, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 8c22fd2d3..c9eba89ce 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -24,7 +24,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.2 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_flv.c,v 1.3 2004/06/13 21:28:53 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -144,8 +144,9 @@ printf (" chunk_type = %X, 0x%X -1 bytes, pts %lld, sub-type = %X\n", while (remaining_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_FLV1; - 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) ); if (remaining_bytes > buf->max_size) buf->size = buf->max_size; @@ -343,6 +344,6 @@ demuxer_info_t demux_info_flv = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "flashvideo", XINE_VERSION_CODE, &demux_info_flv, init_plugin }, + { PLUGIN_DEMUX, 25, "flashvideo", XINE_VERSION_CODE, &demux_info_flv, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 4213ff3b3..f9412d6b0 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -65,7 +65,7 @@ * - if any bytes exceed 63, do not shift the bytes at all before * transmitting them to the video decoder * - * $Id: demux_idcin.c,v 1.51 2004/02/09 22:24:36 jstembridge Exp $ + * $Id: demux_idcin.c,v 1.52 2004/06/13 21:28:53 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -197,9 +197,10 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_IDCIN; - buf->extra_info->input_pos = this->input->get_current_pos(this->input) - - IDCIN_HEADER_SIZE - HUFFMAN_TABLE_SIZE;; - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) (this->input->get_current_pos (this->input) - + IDCIN_HEADER_SIZE - HUFFMAN_TABLE_SIZE) * + 65535 / this->filesize ); buf->extra_info->input_time = this->pts_counter / 90; buf->pts = this->pts_counter; @@ -240,8 +241,9 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_LPCM_LE; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->filesize ); buf->extra_info->input_time = this->pts_counter / 90; buf->pts = this->pts_counter; diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c index 70778e7cd..b7f26d6a7 100644 --- a/src/demuxers/demux_iff.c +++ b/src/demuxers/demux_iff.c @@ -36,7 +36,7 @@ * * ANIM (Animations) * - Animation works fine, without seeking. * - * $Id: demux_iff.c,v 1.10 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_iff.c,v 1.11 2004/06/13 21:28:53 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -799,8 +799,8 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = zw_pts; - buf->extra_info->input_length = input_length; + if( input_length ) + buf->extra_info->input_normpos = (int)((double)zw_pts * 65535 / input_length); buf->pts = zw_pts * 90000 / this->audio_bytes_per_second; buf->extra_info->input_time = buf->pts / 90; @@ -958,7 +958,9 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) { else buf->decoder_info[0] = this->video_pts_inc; buf->decoder_info_ptr[0] = this->anhd; - 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) ); buf->pts = this->video_pts; buf->extra_info->input_time = buf->pts / 90; @@ -1078,6 +1080,8 @@ static int demux_iff_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_iff_t *this = (demux_iff_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); switch( this->iff_type ) { case IFF_8SVX_CHUNK: @@ -1332,7 +1336,7 @@ demuxer_info_t demux_info_iff = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "iff", XINE_VERSION_CODE, &demux_info_iff, init_plugin }, + { PLUGIN_DEMUX, 25, "iff", XINE_VERSION_CODE, &demux_info_iff, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c index b684417c7..5c2a860c2 100644 --- a/src/demuxers/demux_image.c +++ b/src/demuxers/demux_image.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_image.c,v 1.14 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_image.c,v 1.15 2004/06/13 21:28:53 miguelfreitas Exp $ * * image dummy demultiplexer */ @@ -235,6 +235,6 @@ demuxer_info_t demux_info_image = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "image", XINE_VERSION_CODE, &demux_info_image, init_class }, + { PLUGIN_DEMUX, 25, "image", XINE_VERSION_CODE, &demux_info_image, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index bf90bebf6..20c1c3118 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -23,7 +23,7 @@ * For more information regarding the Interplay MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_ipmovie.c,v 1.24 2004/05/29 20:20:55 tmmm Exp $ + * $Id: demux_ipmovie.c,v 1.25 2004/06/13 21:28:53 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -333,8 +333,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { while (opcode_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; @@ -454,8 +454,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { while (decode_map_size_countdown) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_INTERPLAY; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; @@ -475,8 +475,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { while (opcode_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_INTERPLAY; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; buf->decoder_flags = BUF_FLAG_FRAMERATE; diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 7713bcfe8..b8442341c 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.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_matroska.c,v 1.27 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_matroska.c,v 1.28 2004/06/13 21:28:53 miguelfreitas Exp $ * * demultiplexer for matroska streams * @@ -512,8 +512,7 @@ static void handle_realvideo (demux_plugin_t *this_gen, matroska_track_t *track, int decoder_flags, uint8_t *data, int data_len, int64_t data_pts, int data_duration, - off_t input_pos, off_t input_length, - int input_time) { + int input_normpos, int input_time) { demux_matroska_t *this = (demux_matroska_t *) this_gen; int chunks; int chunk_tab_size; @@ -527,7 +526,7 @@ static void handle_realvideo (demux_plugin_t *this_gen, matroska_track_t *track, data + chunk_tab_size + 1, data_len - chunk_tab_size - 1, data_pts, track->buf_type, decoder_flags, - input_pos, input_length, input_time, + input_normpos, input_time, this->duration, 0); /* sends the fragment table */ @@ -562,8 +561,7 @@ static void handle_sub_ssa (demux_plugin_t *this_gen, matroska_track_t *track, int decoder_flags, uint8_t *data, int data_len, int64_t data_pts, int data_duration, - off_t input_pos, off_t input_length, - int input_time) { + int input_normpos, int input_time) { buf_element_t *buf; uint32_t *val; int commas = 0; @@ -622,8 +620,7 @@ static void handle_sub_ssa (demux_plugin_t *this_gen, matroska_track_t *track, *dest = '\0'; dest++; dest_len--; buf->size = dest - (char *)buf->content; - buf->extra_info->input_pos = input_pos; - buf->extra_info->input_length = input_length; + buf->extra_info->input_normpos = input_normpos; buf->extra_info->input_time = input_time; track->fifo->put(track->fifo, buf); @@ -636,8 +633,7 @@ static void handle_sub_utf8 (demux_plugin_t *this_gen, matroska_track_t *track, int decoder_flags, uint8_t *data, int data_len, int64_t data_pts, int data_duration, - off_t input_pos, off_t input_length, - int input_time) { + int input_normpos, int input_time) { demux_matroska_t *this = (demux_matroska_t *) this_gen; buf_element_t *buf; uint32_t *val; @@ -658,8 +654,7 @@ static void handle_sub_utf8 (demux_plugin_t *this_gen, matroska_track_t *track, buf->content[8 + data_len] = '\0'; lprintf("sub: %s\n", buf->content + 8); - buf->extra_info->input_pos = input_pos; - buf->extra_info->input_length = input_length; + buf->extra_info->input_normpos = input_normpos; buf->extra_info->input_time = input_time; track->fifo->put(track->fifo, buf); } else { @@ -1254,7 +1249,7 @@ static int read_block_data (demux_matroska_t *this, int len) { static int parse_block (demux_matroska_t *this, uint64_t block_size, uint64_t cluster_timecode, uint64_t block_duration, - off_t block_pos, off_t file_len, int is_key) { + int normpos, int is_key) { matroska_track_t *track; int64_t track_num; uint8_t *data; @@ -1327,11 +1322,11 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, decoder_flags, data, block_size_left, pts, xduration, - block_pos, file_len, pts / 90); + normpos, pts / 90); } else { _x_demux_send_data(track->fifo, data, block_size_left, pts, track->buf_type, decoder_flags, - block_pos, file_len, pts / 90, + normpos, pts / 90, this->duration, 0); } } else { @@ -1422,11 +1417,11 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, decoder_flags, data, frame[i], pts, 0, - block_pos, file_len, pts / 90); + normpos, pts / 90); } else { _x_demux_send_data(track->fifo, data, frame[i], pts, track->buf_type, decoder_flags, - block_pos, file_len, pts / 90, + normpos, pts / 90, this->duration, 0); } data += frame[i]; @@ -1445,6 +1440,7 @@ static int parse_block_group(demux_matroska_t *this, uint64_t block_duration = 0; off_t block_pos = 0; off_t file_len = 0; + int normpos = 0; int block_len = 0; int is_key = 1; @@ -1460,6 +1456,8 @@ static int parse_block_group(demux_matroska_t *this, block_pos = this->input->get_current_pos(this->input); block_len = elem.len; file_len = this->input->get_length(this->input); + if( file_len ) + normpos = (int) ( (double) block_pos * 65535 / file_len ); if (!read_block_data(this, elem.len)) return 0; @@ -1490,7 +1488,7 @@ static int parse_block_group(demux_matroska_t *this, /* we have the duration, we can parse the block now */ if (!parse_block(this, block_len, cluster_timecode, block_duration, - block_pos, file_len, is_key)) + normpos, is_key)) return 0; return 1; } @@ -2003,6 +2001,9 @@ static int demux_matroska_seek (demux_plugin_t *this_gen, matroska_index_t *index; matroska_track_t *track; int i, entry; + + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); this->status = DEMUX_OK; @@ -2323,6 +2324,6 @@ demuxer_info_t demux_info_matroska = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "matroska", XINE_VERSION_CODE, &demux_info_matroska, init_class }, + { PLUGIN_DEMUX, 25, "matroska", XINE_VERSION_CODE, &demux_info_matroska, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index 7b99ffc21..5d5221606 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mng.c,v 1.22 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_mng.c,v 1.23 2004/06/13 21:28:53 miguelfreitas Exp $ * * demux_mng.c, Demuxer plugin for Multiple-image Network Graphics format * @@ -170,7 +170,9 @@ static int demux_mng_send_chunk(demux_mng_t *this){ buf->type = BUF_VIDEO_RGB; buf->decoder_flags = BUF_FLAG_FRAMERATE; buf->decoder_info[0] = 90 * this->timer_count; - 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) ); buf->extra_info->input_time = this->tick_count; buf->pts = 90 * this->tick_count; @@ -375,6 +377,6 @@ demuxer_info_t demux_info_mng = { }; plugin_info_t xine_plugin_info[] = { - { PLUGIN_DEMUX, 24, "mng", XINE_VERSION_CODE, &demux_info_mng, (void*)init_plugin}, + { PLUGIN_DEMUX, 25, "mng", XINE_VERSION_CODE, &demux_info_mng, (void*)init_plugin}, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index 4d96dee81..185ef5c97 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -147,17 +147,11 @@ static int demux_mod_send_chunk(demux_plugin_t *this_gen) { buf->free_buffer(buf); } else { - int64_t input_pos; - buf->size = mlen; buf->pts = this->current_pts; buf->extra_info->input_time = buf->pts / 90; - buf->extra_info->input_length = this->input->get_length(this->input); - input_pos = buf->extra_info->input_length; - input_pos *= buf->extra_info->input_time; - input_pos /= this->mod_length; - buf->extra_info->input_pos = input_pos; + buf->extra_info->input_normpos = buf->extra_info->input_time * 65535 / this->mod_length; buf->decoder_flags = BUF_FLAG_FRAME_END; if (this->seek_flag) { @@ -216,11 +210,10 @@ static int demux_mod_seek (demux_plugin_t *this_gen, demux_mod_t *this = (demux_mod_t *) this_gen; int64_t seek_millis; - if (start_pos) { seek_millis = this->mod_length; seek_millis *= start_pos; - seek_millis /= this->input->get_length(this->input); + seek_millis /= 65535; } else { seek_millis = start_time; } 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 } }; diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 5b11595fc..637e5f5f6 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.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_block.c,v 1.207 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_mpeg_block.c,v 1.208 2004/06/13 21:28:53 miguelfreitas Exp $ * * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) @@ -226,10 +226,9 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m 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) ); while(p < (buf->content + this->blocksize)) { if (p[0] || p[1] || (p[2] != 1)) { @@ -521,7 +520,7 @@ static int32_t parse_private_stream_2(demux_mpeg_block_t *this, uint8_t *p, buf_ 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; } @@ -565,17 +564,17 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme /* 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)); if (this->mpeg1) { header_len = 6; @@ -1267,6 +1266,8 @@ static int demux_mpeg_block_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); start_time /= 1000; if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { @@ -1559,6 +1560,6 @@ demuxer_info_t demux_info_mpeg_block = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "mpeg_block", XINE_VERSION_CODE, &demux_info_mpeg_block, init_plugin }, + { PLUGIN_DEMUX, 25, "mpeg_block", XINE_VERSION_CODE, &demux_info_mpeg_block, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; 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 } }; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index ecf08f193..87f5f6aa4 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.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_mpgaudio.c,v 1.137 2004/05/05 22:37:46 tmattern Exp $ + * $Id: demux_mpgaudio.c,v 1.138 2004/06/13 21:28:54 miguelfreitas Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -424,7 +424,9 @@ static int mpg123_parse_frame_payload(demux_mpgaudio_t *this, pts = (int64_t)this->cur_fpts; check_newpts(this, pts); - buf->extra_info->input_pos = frame_pos; + if( this->input->get_length (this->input) ) + buf->extra_info->input_normpos = (int)( (double) frame_pos * + 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = pts / 90; buf->pts = pts; buf->size = len + 4; @@ -750,6 +752,8 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen; + 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) { if (!start_pos && start_time && this->stream_length > 0) { diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c index b76cd2cec..dae756d8d 100644 --- a/src/demuxers/demux_nsf.c +++ b/src/demuxers/demux_nsf.c @@ -30,7 +30,7 @@ * For more information regarding the NSF format, visit: * http://www.tripoint.org/kevtris/nes/nsfspec.txt * - * $Id: demux_nsf.c,v 1.21 2004/01/09 01:26:33 miguelfreitas Exp $ + * $Id: demux_nsf.c,v 1.22 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -142,8 +142,7 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) { else buf->size = buf->max_size; - buf->extra_info->input_pos = 0; - buf->extra_info->input_length = 0; + buf->extra_info->input_normpos = 0; buf->extra_info->input_time = 0; buf->pts = 0; @@ -171,8 +170,8 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) { buf->decoder_info[1] = 0; buf->type = BUF_AUDIO_NSF; - buf->extra_info->input_pos = this->current_song - 1; - buf->extra_info->input_length = this->total_songs; + if(this->total_songs) + buf->extra_info->input_normpos = (this->current_song - 1) * 65535 / this->total_songs; buf->extra_info->input_time = this->current_pts / 90; buf->pts = this->current_pts; buf->size = 0; @@ -238,6 +237,8 @@ static int demux_nsf_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_nsf_t *this = (demux_nsf_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->total_songs ); /* if thread is not running, initialize demuxer */ if( !playing ) { diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index 15f328441..a29cd9ca8 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -23,7 +23,7 @@ * For more information regarding the NSV file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_nsv.c,v 1.16 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_nsv.c,v 1.17 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -309,9 +309,9 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) { } buf->type = this->video_type; - buf->extra_info->input_pos = current_file_pos; + if( this->data_size ) + buf->extra_info->input_normpos = (int)((double)current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = this->video_pts / 90; - buf->extra_info->input_length = this->data_size; buf->pts = this->video_pts; buf->decoder_flags |= BUF_FLAG_FRAMERATE; buf->decoder_info[0] = this->frame_pts_inc; @@ -337,9 +337,9 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) { } buf->type = this->audio_type; - buf->extra_info->input_pos = current_file_pos; + if( this->data_size ) + buf->extra_info->input_normpos = (int)((double)current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = this->video_pts / 90; - buf->extra_info->input_length = this->data_size; buf->pts = this->video_pts; buf->decoder_flags |= BUF_FLAG_FRAMERATE; buf->decoder_info[0] = this->frame_pts_inc; @@ -530,6 +530,6 @@ demuxer_info_t demux_info_nsv = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "nsv", XINE_VERSION_CODE, &demux_info_nsv, demux_nsv_init_plugin }, + { PLUGIN_DEMUX, 25, "nsv", XINE_VERSION_CODE, &demux_info_nsv, demux_nsv_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index cd6d0090f..ed1124f64 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.145 2004/05/16 18:01:43 tmattern Exp $ + * $Id: demux_ogg.c,v 1.146 2004/06/13 21:28:54 miguelfreitas Exp $ * * demultiplexer for ogg streams * @@ -305,7 +305,9 @@ static void send_ogg_packet (demux_ogg_t *this, } buf->pts = pts; - 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) ); buf->extra_info->input_time = buf->pts / 90 ; buf->type = this->si[stream_num]->buf_types; @@ -546,7 +548,13 @@ static void send_ogg_buf (demux_ogg_t *this, uint32_t decoder_flags) { int hdrlen; + int normpos = 0; + if( this->input->get_length (this->input) ) + normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->input->get_length (this->input) ); + + hdrlen = (*op->packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*op->packet & PACKET_LEN_BITS2) << 1; @@ -584,8 +592,7 @@ static void send_ogg_buf (demux_ogg_t *this, _x_demux_send_data(this->audio_fifo, data, size, pts, this->si[stream_num]->buf_types, decoder_flags, - this->input->get_current_pos(this->input), - this->input->get_length(this->input), + normpos, pts / 90, this->time_length, 0); @@ -651,8 +658,7 @@ static void send_ogg_buf (demux_ogg_t *this, _x_demux_send_data(this->video_fifo, data, size, pts, this->si[stream_num]->buf_types, decoder_flags, - this->input->get_current_pos(this->input), - this->input->get_length(this->input), + normpos, pts / 90, this->time_length, 0); if (this->chapter_info && op->granulepos != -1) { @@ -1443,6 +1449,8 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, demux_ogg_t *this = (demux_ogg_t *) this_gen; int i; start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); /* * seek to start position */ @@ -1760,6 +1768,6 @@ demuxer_info_t demux_info_ogg = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "ogg", XINE_VERSION_CODE, &demux_info_ogg, init_class }, + { PLUGIN_DEMUX, 25, "ogg", XINE_VERSION_CODE, &demux_info_ogg, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c index 2ef44959d..687680513 100644 --- a/src/demuxers/demux_pva.c +++ b/src/demuxers/demux_pva.c @@ -23,7 +23,7 @@ * For more information regarding the PVA file format, refer to this PDF: * http://www.technotrend.de/download/av_format_v1.pdf * - * $Id: demux_pva.c,v 1.18 2004/05/16 18:01:44 tmattern Exp $ + * $Id: demux_pva.c,v 1.19 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -170,8 +170,8 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { buf->type = BUF_VIDEO_MPEG; buf->pts = pts; pts = 0; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int) ((double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = buf->pts / 90; if (chunk_size > buf->max_size) @@ -254,7 +254,9 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { buf->type = BUF_AUDIO_MPEG; buf->pts = pts; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); + if( this->data_size ) + buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * + 65535 / this->data_size); this->audio_fifo->put (this->audio_fifo, buf); @@ -301,7 +303,9 @@ static void demux_pva_send_headers(demux_plugin_t *this_gen) { buf->size = n; buf->pts = 0; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); + if( this->data_size ) + buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * + 65535 / this->data_size); buf->type = BUF_VIDEO_MPEG; buf->decoder_flags = BUF_FLAG_PREVIEW; @@ -326,7 +330,9 @@ static void demux_pva_send_headers(demux_plugin_t *this_gen) { buf->size = n; buf->pts = 0; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); + if( this->data_size ) + buf->extra_info->input_normpos = (int) ((double) this->input->get_current_pos(this->input) * + 65535 / this->data_size); buf->type = BUF_AUDIO_MPEG; buf->decoder_flags = BUF_FLAG_PREVIEW; @@ -343,6 +349,9 @@ static int demux_pva_seek (demux_plugin_t *this_gen, unsigned char seek_buffer[SEEK_BUFFER_SIZE]; int found = 0; int i; + + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); /* start from the start_pos */ this->input->seek(this->input, start_pos, SEEK_SET); @@ -517,6 +526,6 @@ demuxer_info_t demux_info_pva = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "pva", XINE_VERSION_CODE, &demux_info_pva, init_plugin }, + { PLUGIN_DEMUX, 25, "pva", XINE_VERSION_CODE, &demux_info_pva, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 78467caee..07db42a6e 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.186 2004/06/07 21:15:04 jstembridge Exp $ + * $Id: demux_qt.c,v 1.187 2004/06/13 21:28:54 miguelfreitas Exp $ * */ @@ -2296,8 +2296,9 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = video_trak->properties->video.codec_buftype; - buf->extra_info->input_pos = video_trak->frames[i].offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) (video_trak->frames[i].offset - this->data_start) + * 65535 / this->data_size); buf->extra_info->input_time = video_trak->frames[i].pts / 90; buf->pts = video_trak->frames[i].pts; @@ -2353,8 +2354,9 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = audio_trak->properties->audio.codec_buftype; - buf->extra_info->input_pos = audio_trak->frames[i].offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) (audio_trak->frames[i].offset - this->data_start) + * 65535 / this->data_size); /* The audio chunk is often broken up into multiple 8K buffers when * it is sent to the audio decoder. Only attach the proper timestamp * to the first buffer. This is for the linear PCM decoder which @@ -2716,6 +2718,9 @@ static int demux_qt_seek (demux_plugin_t *this_gen, qt_trak *video_trak = NULL; qt_trak *audio_trak = NULL; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); + int64_t keyframe_pts; /* short-circuit any attempts to seek in a non-seekable stream, including @@ -2976,6 +2981,6 @@ demuxer_info_t demux_info_qt = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "quicktime", XINE_VERSION_CODE, &demux_info_qt, init_plugin }, + { PLUGIN_DEMUX, 25, "quicktime", XINE_VERSION_CODE, &demux_info_qt, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c index 8cc4b3763..5dc554cbe 100644 --- a/src/demuxers/demux_rawdv.c +++ b/src/demuxers/demux_rawdv.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_rawdv.c,v 1.20 2004/05/16 18:01:44 tmattern Exp $ + * $Id: demux_rawdv.c,v 1.21 2004/06/13 21:28:54 miguelfreitas Exp $ * * demultiplexer for raw dv streams */ @@ -94,7 +94,9 @@ static int demux_raw_dv_next (demux_raw_dv_t *this) { buf->pts = this->pts; buf->extra_info->input_time = this->pts/90; - 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) ); buf->extra_info->frame_number = this->cur_frame; buf->type = BUF_VIDEO_DV; @@ -109,7 +111,7 @@ static int demux_raw_dv_next (demux_raw_dv_t *this) { abuf->size = buf->size; abuf->decoder_flags = buf->decoder_flags; abuf->extra_info->input_time = buf->extra_info->input_time; - abuf->extra_info->input_pos = buf->extra_info->input_pos; + abuf->extra_info->input_normpos = buf->extra_info->input_normpos; this->audio_fifo->put (this->audio_fifo, abuf); } if (!this->bytes_left) { @@ -287,7 +289,8 @@ static int demux_raw_dv_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_raw_dv_t *this = (demux_raw_dv_t *) this_gen; - + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); if (!INPUT_IS_SEEKABLE(this->input)) { this->status = DEMUX_OK; @@ -429,6 +432,6 @@ demuxer_info_t demux_info_raw_dv = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "rawdv", XINE_VERSION_CODE, &demux_info_raw_dv, init_plugin }, + { PLUGIN_DEMUX, 25, "rawdv", XINE_VERSION_CODE, &demux_info_raw_dv, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 438ce33ba..60f170ce8 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -31,7 +31,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.99 2004/05/27 11:10:13 miguelfreitas Exp $ + * $Id: demux_real.c,v 1.100 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -679,8 +679,8 @@ unknown: buf->size = this->video_stream->mdpr->type_specific_len; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END; buf->type = this->video_stream->buf_type; - buf->extra_info->input_pos = 0; - buf->extra_info->input_time = 0; + buf->extra_info->input_normpos = 0; + buf->extra_info->input_time = 0; this->video_fifo->put (this->video_fifo, buf); @@ -973,6 +973,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { uint32_t id, timestamp; int64_t pts; off_t offset, input_length = 0; + int normpos = 0; if(this->reference_mode) return demux_real_parse_references(this); @@ -1121,6 +1122,8 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { if(this->data_start && this->data_chunk_size) input_length = this->data_start + 18 + this->data_chunk_size; + if( input_length ) + normpos = (int)((double) this->input->get_current_pos(this->input) * 65535 / input_length); check_newpts (this, pts, PTS_VIDEO, 0); @@ -1224,8 +1227,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { buf->pts = pts; pts = 0; - buf->extra_info->input_pos = this->input->get_current_pos(this->input); - buf->extra_info->input_length = input_length; + buf->extra_info->input_normpos = normpos; buf->extra_info->input_time = input_time; buf->extra_info->total_time = this->duration; @@ -1269,6 +1271,9 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { input_length = this->data_start + 18 + this->data_chunk_size; else input_length = 0; + + if( input_length ) + normpos = (int)((double) this->input->get_current_pos(this->input) * 65535 / input_length); check_newpts (this, pts, PTS_AUDIO, 0); @@ -1287,8 +1292,8 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { for(i = 0; i < frames; i++) { if(_x_demux_read_send_data(this->audio_fifo, this->input, sizes[i], pts, - this->audio_stream->buf_type, 0, this->input->get_current_pos(this->input), - input_length, input_time, this->duration, 0) < 0) { + this->audio_stream->buf_type, 0, normpos, + input_time, this->duration, 0) < 0) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "read error 44\n"); @@ -1303,8 +1308,8 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { free(sizes); } else { if(_x_demux_read_send_data(this->audio_fifo, this->input, size, pts, - this->audio_stream->buf_type, 0, this->input->get_current_pos(this->input), - input_length, input_time, this->duration, 0) < 0) { + this->audio_stream->buf_type, 0, normpos, + input_time, this->duration, 0) < 0) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "read error 44\n"); @@ -1405,6 +1410,9 @@ static int demux_real_seek (demux_plugin_t *this_gen, demux_real_t *this = (demux_real_t *) this_gen; real_index_entry_t *index, *other_index = NULL; int i = 0, entries; + + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) && ((this->audio_stream && this->audio_stream->index) || @@ -1650,6 +1658,6 @@ demuxer_info_t demux_info_real = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "real", XINE_VERSION_CODE, &demux_info_real, init_class }, + { PLUGIN_DEMUX, 25, "real", XINE_VERSION_CODE, &demux_info_real, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 9c0ce32d1..d1de83015 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -22,7 +22,7 @@ * RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net) * improved by James Stembridge (jstembridge@users.sourceforge.net) * - * $Id: demux_realaudio.c,v 1.31 2004/03/14 22:10:15 jstembridge Exp $ + * $Id: demux_realaudio.c,v 1.32 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -199,24 +199,25 @@ static int open_ra_file(demux_ra_t *this) { static int demux_ra_send_chunk(demux_plugin_t *this_gen) { demux_ra_t *this = (demux_ra_t *) this_gen; - off_t current_file_pos; + off_t current_normpos = 0; int64_t current_pts; /* just load data chunks from wherever the stream happens to be * pointing; issue a DEMUX_FINISHED status if EOF is reached */ - current_file_pos = - this->input->get_current_pos(this->input) - this->data_start; + if( this->input->get_length (this->input) ) + current_normpos = (int)( (double) (this->input->get_current_pos (this->input) - this->data_start) * + 65535 / this->data_size ); current_pts = 0; /* let the engine sort out the pts for now */ if (this->seek_flag) { - _x_demux_control_newpts(this->stream, current_pts, 0); + _x_demux_control_newpts(this->stream, current_pts, BUF_FLAG_SEEK); this->seek_flag = 0; } if(_x_demux_read_send_data(this->audio_fifo, this->input, this->block_align, - current_pts, this->audio_type, 0, current_file_pos, - this->data_size, current_pts / 90, 0, 0) < 0) { + current_pts, this->audio_type, 0, current_normpos, + current_pts / 90, 0, 0) < 0) { this->status = DEMUX_FINISHED; } @@ -261,6 +262,8 @@ static int demux_ra_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_ra_t *this = (demux_ra_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); this->seek_flag = 1; this->status = DEMUX_OK; diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index 217439028..ed261d728 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -23,7 +23,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: demux_roq.c,v 1.52 2004/05/29 19:01:53 tmmm Exp $ + * $Id: demux_roq.c,v 1.53 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -208,7 +208,9 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { /* send out the preamble */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_ROQ; - buf->extra_info->input_pos = current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE; + if( this->input->get_length (this->input) ) + buf->extra_info->input_normpos = (int)( (double) (current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE) * + 65535 / this->input->get_length (this->input) ); buf->pts = 0; buf->size = RoQ_CHUNK_PREAMBLE_SIZE; memcpy(buf->content, preamble, RoQ_CHUNK_PREAMBLE_SIZE); @@ -218,7 +220,9 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_ROQ; - buf->extra_info->input_pos = current_file_pos; + if( this->input->get_length (this->input) ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * + 65535 / this->input->get_length (this->input) ); buf->pts = audio_pts; if (chunk_size > buf->max_size) @@ -253,7 +257,9 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { /* send out the preamble */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_ROQ; - buf->extra_info->input_pos = current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE; + if( this->input->get_length (this->input) ) + buf->extra_info->input_normpos = (int)( (double) (current_file_pos - RoQ_CHUNK_PREAMBLE_SIZE) * + 65535 / this->input->get_length (this->input) ); buf->pts = this->video_pts_counter; buf->size = RoQ_CHUNK_PREAMBLE_SIZE; memcpy(buf->content, preamble, RoQ_CHUNK_PREAMBLE_SIZE); @@ -262,7 +268,9 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_VIDEO_ROQ; - buf->extra_info->input_pos = current_file_pos; + if( this->input->get_length (this->input) ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * + 65535 / this->input->get_length (this->input) ); buf->pts = this->video_pts_counter; if (chunk_size > buf->max_size) diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index 17b986c66..2d86c4b85 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -21,7 +21,7 @@ */ /* - * $Id: demux_slave.c,v 1.12 2004/05/16 18:01:44 tmattern Exp $ + * $Id: demux_slave.c,v 1.13 2004/06/13 21:28:54 miguelfreitas Exp $ * * demuxer for slave "protocol" * master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is, @@ -442,6 +442,6 @@ demuxer_info_t demux_info_slave = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "slave", XINE_VERSION_CODE, &demux_info_slave, init_plugin }, + { PLUGIN_DEMUX, 25, "slave", XINE_VERSION_CODE, &demux_info_slave, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index d4fa0a9c1..afe28328d 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -23,7 +23,7 @@ * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 * - * $Id: demux_smjpeg.c,v 1.49 2004/02/09 22:24:37 jstembridge Exp $ + * $Id: demux_smjpeg.c,v 1.50 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -255,8 +255,8 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) { buf->type = this->video_type; } - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->input_length; + if( this->input_length ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->input_length); buf->extra_info->input_time = pts / 90; buf->pts = pts; diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index ea7e9d901..e1fcdf399 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -21,7 +21,7 @@ /* * SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_snd.c,v 1.38 2004/01/09 01:26:33 miguelfreitas Exp $ + * $Id: demux_snd.c,v 1.39 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -165,15 +165,15 @@ static int demux_snd_send_chunk(demux_plugin_t *this_gen) { current_pts /= this->audio_bytes_per_second; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, current_pts, 0); + _x_demux_control_newpts(this->stream, current_pts, BUF_FLAG_SEEK); this->seek_flag = 0; } while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = current_pts / 90; buf->pts = current_pts; @@ -236,6 +236,8 @@ static void demux_snd_send_headers(demux_plugin_t *this_gen) { static int demux_snd_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_snd_t *this = (demux_snd_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); this->seek_flag = 1; this->status = DEMUX_OK; diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index 821e738d4..ddb800260 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -24,7 +24,7 @@ * This demuxer handles either raw STR files (which are just a concatenation * of raw compact disc sectors) or STR files with RIFF headers. * - * $Id: demux_str.c,v 1.24 2004/02/09 22:24:37 jstembridge Exp $ + * $Id: demux_str.c,v 1.25 2004/06/13 21:28:54 miguelfreitas Exp $ */ /* @@ -359,7 +359,7 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { buf->pts = frame_number * FRAME_DURATION; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, buf->pts, 0); + _x_demux_control_newpts(this->stream, buf->pts, BUF_FLAG_SEEK); this->seek_flag = 0; } @@ -371,8 +371,9 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { *} */ - buf->extra_info->input_pos = current_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_pos * + 65535 / this->data_size ); buf->extra_info->input_time = (current_pos*1000)/(CD_RAW_SECTOR_SIZE*75); /* constant size chunk */ @@ -404,12 +405,13 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { ((sector[0x13] & 0x04) ? 18900 : 37800); if (this->seek_flag) { - _x_demux_control_newpts(this->stream, buf->pts, 0); + _x_demux_control_newpts(this->stream, buf->pts, BUF_FLAG_SEEK); this->seek_flag = 0; } - buf->extra_info->input_pos = current_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_pos * + 65535 / this->data_size ); buf->extra_info->input_time = (current_pos*1000)/(CD_RAW_SECTOR_SIZE*75); buf->size = 2304; @@ -498,6 +500,8 @@ static void demux_str_send_headers(demux_plugin_t *this_gen) { static int demux_str_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_str_t *this = (demux_str_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); _x_demux_flush_engine (this->stream); diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 4e64efcfc..69b956b6b 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.103 2004/06/10 20:16:59 jcdutton Exp $ + * $Id: demux_ts.c,v 1.104 2004/06/13 21:28:54 miguelfreitas Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -779,10 +779,12 @@ 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)); + if( this->input->get_length (this->input) ) + m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->input->get_length (this->input) ); + if (this->rate) + m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + * 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 */ @@ -812,10 +814,12 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->type = m->type; 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->input->get_length (this->input) ) + m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + 65535 / this->input->get_length (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->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) + * 1000 / (this->rate * 50)); m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = m->fifo->buffer_pool_alloc(m->fifo); @@ -1799,6 +1803,8 @@ static int demux_ts_seek (demux_plugin_t *this_gen, demux_ts_t *this = (demux_ts_t *) this_gen; int i; 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) { @@ -2097,6 +2103,6 @@ demuxer_info_t demux_info_ts = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class }, + { PLUGIN_DEMUX, 25, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index eb8c38f5f..fb7174031 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -28,7 +28,7 @@ * checking the first 2 bytes, which are 0x2E 0x03 in a Sierra VMD file. * There is a 1/65536 chance of a false positive using this method. * - * $Id: demux_vmd.c,v 1.2 2004/02/09 22:24:37 jstembridge Exp $ + * $Id: demux_vmd.c,v 1.3 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -235,8 +235,9 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { /* send off the frame record first in its own buffer */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_VMD; - buf->extra_info->input_pos = frame->frame_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + 65535 / this->data_size); memcpy(buf->content, frame->frame_record, BYTES_PER_FRAME_RECORD); buf->size = BYTES_PER_FRAME_RECORD; buf->pts = frame->pts; @@ -246,8 +247,9 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { while (remaining_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_VMD; - buf->extra_info->input_pos = frame->frame_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + 65535 / this->data_size); if (remaining_bytes > buf->max_size) buf->size = buf->max_size; @@ -276,8 +278,9 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { /* send off the frame record first in its own buffer */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_VMD; - buf->extra_info->input_pos = frame->frame_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + 65535 / this->data_size); memcpy(buf->content, frame->frame_record, BYTES_PER_FRAME_RECORD); buf->size = BYTES_PER_FRAME_RECORD; buf->pts = 0; /* let the engine sort out the audio pts */ @@ -287,8 +290,9 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) { while (remaining_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_VMD; - buf->extra_info->input_pos = frame->frame_offset - this->data_start; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) (frame->frame_offset - this->data_start) * + 65535 / this->data_size); if (remaining_bytes > buf->max_size) buf->size = buf->max_size; diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index fe234176f..441d8acaa 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -25,7 +25,7 @@ * It will only play that block if it is PCM data. More variations will be * supported as they are encountered. * - * $Id: demux_voc.c,v 1.38 2004/01/09 01:26:33 miguelfreitas Exp $ + * $Id: demux_voc.c,v 1.39 2004/06/13 21:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -152,7 +152,7 @@ static int demux_voc_send_chunk(demux_plugin_t *this_gen) { current_pts /= this->audio_sample_rate; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, current_pts, 0); + _x_demux_control_newpts(this->stream, current_pts, BUF_FLAG_SEEK); this->seek_flag = 0; } @@ -165,8 +165,8 @@ static int demux_voc_send_chunk(demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = this->audio_type; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = current_pts / 90; buf->pts = current_pts; @@ -231,6 +231,9 @@ static void demux_voc_send_headers(demux_plugin_t *this_gen) { static int demux_voc_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_voc_t *this = (demux_voc_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); + this->seek_flag = 1; this->status = DEMUX_OK; _x_demux_flush_engine (this->stream); diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c index 64846c2ba..53e8d2399 100644 --- a/src/demuxers/demux_vox.c +++ b/src/demuxers/demux_vox.c @@ -22,7 +22,7 @@ * VOX Demuxer by Mike Melanson (melanson@pcisys.net) * This a demuxer for .vox files containing raw Dialogic ADPCM data. * - * $Id: demux_vox.c,v 1.12 2004/01/09 01:26:33 miguelfreitas Exp $ + * $Id: demux_vox.c,v 1.13 2004/06/13 21:28:54 miguelfreitas Exp $ * */ @@ -89,8 +89,9 @@ static int demux_vox_send_chunk (demux_plugin_t *this_gen) { else buf->size = buf->max_size; - buf->extra_info->input_pos = current_file_pos; - 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) current_file_pos * + 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; buf->decoder_flags |= BUF_FLAG_FRAME_END; diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c index 109aed9b9..41209ce75 100644 --- a/src/demuxers/demux_vqa.c +++ b/src/demuxers/demux_vqa.c @@ -29,7 +29,7 @@ * block needs information from the previous audio block in order to be * decoded, thus making random seeking difficult. * - * $Id: demux_vqa.c,v 1.40 2004/02/09 22:24:37 jstembridge Exp $ + * $Id: demux_vqa.c,v 1.41 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -163,8 +163,8 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) { if(this->audio_fifo) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_VQA_IMA; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->filesize); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; @@ -208,8 +208,8 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_VQA; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->filesize; + if( this->filesize ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->filesize); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index 663176bf2..cfe2b02e2 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -22,7 +22,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.58 2004/05/31 14:44:16 tmmm Exp $ + * $Id: demux_wav.c,v 1.59 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -200,7 +200,7 @@ static int demux_wav_send_chunk(demux_plugin_t *this_gen) { current_pts /= this->wave->nAvgBytesPerSec; if (this->seek_flag) { - _x_demux_control_newpts(this->stream, current_pts, 0); + _x_demux_control_newpts(this->stream, current_pts, BUF_FLAG_SEEK); this->seek_flag = 0; } @@ -211,8 +211,8 @@ static int demux_wav_send_chunk(demux_plugin_t *this_gen) { } buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = current_pts / 90; buf->pts = current_pts; @@ -304,6 +304,8 @@ static int demux_wav_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_wav_t *this = (demux_wav_t *) this_gen; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); this->seek_flag = 1; this->status = DEMUX_OK; diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index 5be5212da..d1f52258e 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -24,7 +24,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.51 2004/02/09 22:24:37 jstembridge Exp $ + * $Id: demux_wc3movie.c,v 1.52 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -209,8 +209,8 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_LPCM_LE; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; @@ -239,8 +239,8 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_WC3; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)( (double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = this->video_pts / 90; buf->pts = this->video_pts; @@ -533,6 +533,9 @@ static int demux_mve_seek (demux_plugin_t *this_gen, int new_shot = -1; start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); + this->status = DEMUX_OK; _x_demux_flush_engine(this->stream); this->seek_flag = 1; diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c index d7a790dbd..c8819c52b 100644 --- a/src/demuxers/demux_yuv4mpeg2.c +++ b/src/demuxers/demux_yuv4mpeg2.c @@ -24,7 +24,7 @@ * tools, visit: * http://mjpeg.sourceforge.net/ * - * $Id: demux_yuv4mpeg2.c,v 1.38 2004/05/16 18:01:44 tmattern Exp $ + * $Id: demux_yuv4mpeg2.c,v 1.39 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -265,8 +265,8 @@ static int demux_yuv4mpeg2_send_chunk(demux_plugin_t *this_gen) { while(bytes_remaining) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_I420; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size; + if( this->data_size ) + buf->extra_info->input_normpos = (int)((double) current_file_pos * 65535 / this->data_size); buf->extra_info->input_time = pts / 90; buf->pts = pts; @@ -337,6 +337,8 @@ static int demux_yuv4mpeg2_seek (demux_plugin_t *this_gen, demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen; start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->data_size ); if (INPUT_IS_SEEKABLE(this->input)) { @@ -498,6 +500,6 @@ demuxer_info_t demux_info_yuv4mpeg2 = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "yuv4mpeg2", XINE_VERSION_CODE, &demux_info_yuv4mpeg2, init_plugin }, + { PLUGIN_DEMUX, 25, "yuv4mpeg2", XINE_VERSION_CODE, &demux_info_yuv4mpeg2, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c index e2e82e7dc..a1b4451cb 100644 --- a/src/demuxers/demux_yuv_frames.c +++ b/src/demuxers/demux_yuv_frames.c @@ -20,7 +20,7 @@ */ /* - * $Id: demux_yuv_frames.c,v 1.16 2004/05/16 18:01:44 tmattern Exp $ + * $Id: demux_yuv_frames.c,v 1.17 2004/06/13 21:28:55 miguelfreitas Exp $ * * dummy demultiplexer for raw yuv frames (delivered by v4l) */ @@ -276,7 +276,7 @@ demuxer_info_t demux_info_yuv_frames = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "yuv_frames", XINE_VERSION_CODE, &demux_info_yuv_frames, init_class }, + { PLUGIN_DEMUX, 25, "yuv_frames", XINE_VERSION_CODE, &demux_info_yuv_frames, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index eef80d21a..fcafb49bc 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -19,7 +19,7 @@ * * This file contains plugin entries for several demuxers used in games * - * $Id: group_audio.c,v 1.14 2004/06/11 01:29:49 tmmm Exp $ + * $Id: group_audio.c,v 1.15 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -95,21 +95,21 @@ demuxer_info_t demux_info_mod = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "aac", XINE_VERSION_CODE, &demux_info_aac, demux_aac_init_plugin }, - { PLUGIN_DEMUX, 24, "ac3", XINE_VERSION_CODE, &demux_info_ac3, demux_ac3_init_plugin }, - { PLUGIN_DEMUX, 24, "aud", XINE_VERSION_CODE, &demux_info_aud, demux_aud_init_plugin }, - { PLUGIN_DEMUX, 24, "aiff", XINE_VERSION_CODE, &demux_info_aiff, demux_aiff_init_plugin }, - { PLUGIN_DEMUX, 24, "cdda", XINE_VERSION_CODE, &demux_info_cdda, demux_cdda_init_plugin }, - { PLUGIN_DEMUX, 24, "flac", XINE_VERSION_CODE, &demux_info_flac, demux_flac_init_plugin }, - { PLUGIN_DEMUX, 24, "mp3", XINE_VERSION_CODE, &demux_info_mpgaudio, demux_mpgaudio_init_class }, - { PLUGIN_DEMUX, 24, "nsf", XINE_VERSION_CODE, &demux_info_nsf, demux_nsf_init_plugin }, - { PLUGIN_DEMUX, 24, "realaudio", XINE_VERSION_CODE, &demux_info_realaudio, demux_realaudio_init_plugin }, - { PLUGIN_DEMUX, 24, "snd", XINE_VERSION_CODE, &demux_info_snd, demux_snd_init_plugin }, - { PLUGIN_DEMUX, 24, "voc", XINE_VERSION_CODE, &demux_info_voc, demux_voc_init_plugin }, - { PLUGIN_DEMUX, 24, "vox", XINE_VERSION_CODE, &demux_info_vox, demux_vox_init_plugin }, - { PLUGIN_DEMUX, 24, "wav", XINE_VERSION_CODE, &demux_info_wav, demux_wav_init_plugin }, + { PLUGIN_DEMUX, 25, "aac", XINE_VERSION_CODE, &demux_info_aac, demux_aac_init_plugin }, + { PLUGIN_DEMUX, 25, "ac3", XINE_VERSION_CODE, &demux_info_ac3, demux_ac3_init_plugin }, + { PLUGIN_DEMUX, 25, "aud", XINE_VERSION_CODE, &demux_info_aud, demux_aud_init_plugin }, + { PLUGIN_DEMUX, 25, "aiff", XINE_VERSION_CODE, &demux_info_aiff, demux_aiff_init_plugin }, + { PLUGIN_DEMUX, 25, "cdda", XINE_VERSION_CODE, &demux_info_cdda, demux_cdda_init_plugin }, + { PLUGIN_DEMUX, 25, "flac", XINE_VERSION_CODE, &demux_info_flac, demux_flac_init_plugin }, + { PLUGIN_DEMUX, 25, "mp3", XINE_VERSION_CODE, &demux_info_mpgaudio, demux_mpgaudio_init_class }, + { PLUGIN_DEMUX, 25, "nsf", XINE_VERSION_CODE, &demux_info_nsf, demux_nsf_init_plugin }, + { PLUGIN_DEMUX, 25, "realaudio", XINE_VERSION_CODE, &demux_info_realaudio, demux_realaudio_init_plugin }, + { PLUGIN_DEMUX, 25, "snd", XINE_VERSION_CODE, &demux_info_snd, demux_snd_init_plugin }, + { PLUGIN_DEMUX, 25, "voc", XINE_VERSION_CODE, &demux_info_voc, demux_voc_init_plugin }, + { PLUGIN_DEMUX, 25, "vox", XINE_VERSION_CODE, &demux_info_vox, demux_vox_init_plugin }, + { PLUGIN_DEMUX, 25, "wav", XINE_VERSION_CODE, &demux_info_wav, demux_wav_init_plugin }, #ifdef HAVE_MODPLUG - { PLUGIN_DEMUX, 24, "mod", XINE_VERSION_CODE, &demux_info_mod, demux_mod_init_plugin }, + { PLUGIN_DEMUX, 25, "mod", XINE_VERSION_CODE, &demux_info_mod, demux_mod_init_plugin }, #endif { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/group_games.c b/src/demuxers/group_games.c index af255a707..3c9ad1b97 100644 --- a/src/demuxers/group_games.c +++ b/src/demuxers/group_games.c @@ -19,7 +19,7 @@ * * This file contains plugin entries for several demuxers used in games * - * $Id: group_games.c,v 1.10 2004/05/16 18:01:44 tmattern Exp $ + * $Id: group_games.c,v 1.11 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -81,16 +81,16 @@ demuxer_info_t demux_info_vmd = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "wve", XINE_VERSION_CODE, &demux_info_eawve, demux_eawve_init_plugin}, - { PLUGIN_DEMUX, 24, "idcin", XINE_VERSION_CODE, &demux_info_idcin, demux_idcin_init_plugin }, - { PLUGIN_DEMUX, 24, "ipmovie", XINE_VERSION_CODE, &demux_info_ipmovie, demux_ipmovie_init_plugin }, - { PLUGIN_DEMUX, 24, "vqa", XINE_VERSION_CODE, &demux_info_vqa, demux_vqa_init_plugin }, - { PLUGIN_DEMUX, 24, "wc3movie", XINE_VERSION_CODE, &demux_info_wc3movie, demux_wc3movie_init_plugin }, - { PLUGIN_DEMUX, 24, "roq", XINE_VERSION_CODE, &demux_info_roq, demux_roq_init_plugin }, - { PLUGIN_DEMUX, 24, "str", XINE_VERSION_CODE, &demux_info_str, demux_str_init_plugin }, - { PLUGIN_DEMUX, 24, "film", XINE_VERSION_CODE, &demux_info_film, demux_film_init_plugin }, - { PLUGIN_DEMUX, 24, "smjpeg", XINE_VERSION_CODE, &demux_info_smjpeg, demux_smjpeg_init_plugin }, - { PLUGIN_DEMUX, 24, "fourxm", XINE_VERSION_CODE, &demux_info_fourxm, demux_fourxm_init_plugin }, - { PLUGIN_DEMUX, 24, "vmd", XINE_VERSION_CODE, &demux_info_vmd, demux_vmd_init_plugin }, + { PLUGIN_DEMUX, 25, "wve", XINE_VERSION_CODE, &demux_info_eawve, demux_eawve_init_plugin}, + { PLUGIN_DEMUX, 25, "idcin", XINE_VERSION_CODE, &demux_info_idcin, demux_idcin_init_plugin }, + { PLUGIN_DEMUX, 25, "ipmovie", XINE_VERSION_CODE, &demux_info_ipmovie, demux_ipmovie_init_plugin }, + { PLUGIN_DEMUX, 25, "vqa", XINE_VERSION_CODE, &demux_info_vqa, demux_vqa_init_plugin }, + { PLUGIN_DEMUX, 25, "wc3movie", XINE_VERSION_CODE, &demux_info_wc3movie, demux_wc3movie_init_plugin }, + { PLUGIN_DEMUX, 25, "roq", XINE_VERSION_CODE, &demux_info_roq, demux_roq_init_plugin }, + { PLUGIN_DEMUX, 25, "str", XINE_VERSION_CODE, &demux_info_str, demux_str_init_plugin }, + { PLUGIN_DEMUX, 25, "film", XINE_VERSION_CODE, &demux_info_film, demux_film_init_plugin }, + { PLUGIN_DEMUX, 25, "smjpeg", XINE_VERSION_CODE, &demux_info_smjpeg, demux_smjpeg_init_plugin }, + { PLUGIN_DEMUX, 25, "fourxm", XINE_VERSION_CODE, &demux_info_fourxm, demux_fourxm_init_plugin }, + { PLUGIN_DEMUX, 25, "vmd", XINE_VERSION_CODE, &demux_info_vmd, demux_vmd_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index d44c6f825..2c887f152 100644 --- a/src/demuxers/matroska.h +++ b/src/demuxers/matroska.h @@ -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: matroska.h,v 1.6 2004/02/12 23:31:19 jstembridge Exp $ + * $Id: matroska.h,v 1.7 2004/06/13 21:28:55 miguelfreitas Exp $ * */ #ifndef MATROSKA_H @@ -226,8 +226,7 @@ struct matroska_track_s { int decoder_flags, uint8_t *data, int data_len, int64_t data_pts, int data_duration, - off_t input_pos, off_t input_length, - int input_time); + int input_normpos, int input_time); }; /* IDs in the tags master */ diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 1009e34cc..7ea7e2074 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.59 2004/05/26 16:37:41 mroi Exp $ + * $Id: input_cdda.c,v 1.60 2004/06/13 21:28:55 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -2571,7 +2571,7 @@ static void *init_plugin (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "CD", XINE_VERSION_CODE, NULL, init_plugin }, + { PLUGIN_INPUT, 15, "CD", XINE_VERSION_CODE, NULL, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index a476a934f..30b9891e8 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1339,6 +1339,6 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "DVB", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "DVB", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 899487819..40987d00c 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,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: input_dvd.c,v 1.180 2004/04/10 15:45:10 mroi Exp $ + * $Id: input_dvd.c,v 1.181 2004/06/13 21:28:56 miguelfreitas Exp $ * */ @@ -775,8 +775,6 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, if (this->pg_length && this->pgc_length) { int pos, length; dvdnav_get_position(this->dvdnav, &pos, &length); - buf->extra_info->input_pos = pos * (off_t)DVD_BLOCK_SIZE; - buf->extra_info->input_length = length * (off_t)DVD_BLOCK_SIZE; switch (((dvd_input_class_t *)this->input_plugin.input_class)->seek_mode) { case 0: /* PGC based seeking */ buf->extra_info->total_time = this->pgc_length / 90; @@ -1773,6 +1771,13 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.181 2004/06/13 21:28:56 miguelfreitas + * 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 + * * Revision 1.180 2004/04/10 15:45:10 mroi * improving config help strings * @@ -2295,6 +2300,6 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "DVD", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "DVD", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_file.c b/src/input/input_file.c index c04a79d76..e09fc6716 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.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: input_file.c,v 1.91 2004/04/15 00:14:57 hadess Exp $ + * $Id: input_file.c,v 1.92 2004/06/13 21:28:56 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -877,6 +877,6 @@ static void *init_plugin (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "FILE", XINE_VERSION_CODE, NULL, init_plugin }, + { PLUGIN_INPUT, 15, "FILE", XINE_VERSION_CODE, NULL, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 3d8accfcd..4c7a61842 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -18,7 +18,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: input_gnome_vfs.c,v 1.20 2004/05/02 16:33:23 hadess Exp $ + * $Id: input_gnome_vfs.c,v 1.21 2004/06/13 21:28:56 miguelfreitas Exp $ */ @@ -355,7 +355,7 @@ static void } plugin_info_t xine_plugin_info[] = { - { PLUGIN_INPUT, 14, "gnomevfs", XINE_VERSION_CODE, NULL, + { PLUGIN_INPUT, 15, "gnomevfs", XINE_VERSION_CODE, NULL, init_input_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_http.c b/src/input/input_http.c index 17e4748f0..dd3c74d86 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.90 2004/05/27 03:44:45 miguelfreitas Exp $ + * $Id: input_http.c,v 1.91 2004/06/13 21:28:56 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -1075,6 +1075,6 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "http", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "http", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index aa9f6fbfa..befb42f25 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.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: input_mms.c,v 1.51 2004/04/26 15:05:04 mroi Exp $ + * $Id: input_mms.c,v 1.52 2004/06/13 21:28:56 miguelfreitas Exp $ * * mms input plugin based on work from major mms */ @@ -477,6 +477,6 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "mms", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "mms", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_net.c b/src/input/input_net.c index 2b1c9528f..0d560b9d4 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -20,7 +20,7 @@ * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.57 2003/12/14 22:13:23 siggi Exp $ + * $Id: input_net.c,v 1.58 2004/06/13 21:28:56 miguelfreitas Exp $ * * how to set up mp1e for use with this plugin: * @@ -546,7 +546,7 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "tcp", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "tcp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index ac2537a71..65d50ce73 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -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: input_plugin.h,v 1.55 2003/12/14 22:13:23 siggi Exp $ + * $Id: input_plugin.h,v 1.56 2004/06/13 21:28:56 miguelfreitas Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -36,7 +36,7 @@ # include #endif -#define INPUT_PLUGIN_IFACE_VERSION 14 +#define INPUT_PLUGIN_IFACE_VERSION 15 typedef struct input_class_s input_class_t ; typedef struct input_plugin_s input_plugin_t; diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index c111deb67..0849ea6a7 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -300,7 +300,7 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "pnm", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "pnm", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 0ad0d9eab..0cbffd47d 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/\!\! * - * $Id: input_pvr.c,v 1.45 2004/05/16 19:32:36 miguelfreitas Exp $ + * $Id: input_pvr.c,v 1.46 2004/06/13 21:28:56 miguelfreitas Exp $ */ /************************************************************************** @@ -1559,7 +1559,7 @@ static void *init_plugin (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "pvr", XINE_VERSION_CODE, NULL, init_plugin }, + { PLUGIN_INPUT, 15, "pvr", XINE_VERSION_CODE, NULL, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index 8e851cb16..c13ba963e 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -778,7 +778,7 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "rtp", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "rtp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 6c31693af..3057be8cf 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -313,7 +313,7 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "rtsp", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "rtsp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index c0c3d1dc4..fa1dd682f 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.57 2004/04/19 20:20:51 hadess Exp $ + * $Id: input_stdin_fifo.c,v 1.58 2004/06/13 21:28:56 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -376,6 +376,6 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "stdin", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "stdin", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 60a6dbb23..3c527f773 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -1957,8 +1957,8 @@ static void *init_radio_class (xine_t *xine, void *data) plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 14, "v4l_radio", XINE_VERSION_CODE, NULL, init_radio_class }, - { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 14, "v4l_tv", XINE_VERSION_CODE, NULL, init_video_class }, + { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 15, "v4l_radio", XINE_VERSION_CODE, NULL, init_radio_class }, + { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 15, "v4l_tv", XINE_VERSION_CODE, NULL, init_video_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index d19378a2d..cc255b370 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.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: input_vcd.c,v 1.73 2004/04/10 15:45:11 mroi Exp $ + * $Id: input_vcd.c,v 1.74 2004/06/13 21:28:56 miguelfreitas Exp $ * */ @@ -1112,6 +1112,6 @@ static void *init_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, "VCDO", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 15, "VCDO", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index f211821d0..65f04563c 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1,5 +1,5 @@ /* - $Id: xineplug_inp_vcd.c,v 1.17 2004/04/28 10:57:12 rockyb Exp $ + $Id: xineplug_inp_vcd.c,v 1.18 2004/06/13 21:28:56 miguelfreitas Exp $ Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -1784,7 +1784,7 @@ _("Format used in the GUI Title. Similar to the Unix date " const plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 14, (char *) SHORT_PLUGIN_NAME, XINE_VERSION_CODE, + { PLUGIN_INPUT, 15, (char *) SHORT_PLUGIN_NAME, XINE_VERSION_CODE, NULL, vcd_init }, { PLUGIN_NONE, 0, (char *) "", 0, NULL, NULL } }; diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c index 631c5a294..ffafb0f13 100644 --- a/src/libflac/decoder_flac.c +++ b/src/libflac/decoder_flac.c @@ -418,7 +418,7 @@ static decoder_info_t dec_info_audio = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class }, + { PLUGIN_DEMUX, 25, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class }, { PLUGIN_AUDIO_DECODER, 15, "flacdec", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c index dadc03e2e..94cb96c47 100644 --- a/src/libflac/demux_flac.c +++ b/src/libflac/demux_flac.c @@ -274,7 +274,7 @@ static int demux_flac_send_chunk (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; buf_element_t *buf = NULL; - off_t current_file_pos; + off_t current_file_pos, file_size = 0; int64_t current_pts; unsigned int remaining_sample_bytes = 0; @@ -282,11 +282,13 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { current_file_pos = this->input->get_current_pos (this->input) - this->data_start; + if( (this->data_size - this->data_start) > 0 ) + file_size = (this->data_size - this->data_start); current_pts = current_file_pos; current_pts *= this->length_in_msec * 90; - if( (this->data_size - this->data_start) > 0 ) - current_pts /= (this->data_size - this->data_start); + if( file_size ) + current_pts /= file_size; if (this->seek_flag) { #ifdef USE_ESTIMATED_PTS @@ -307,8 +309,8 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_FLAC; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size - this->data_start; + if( file_size ) + buf->extra_info->input_normpos = (int) ((double)current_file_pos * 65535 / file_size); buf->extra_info->input_time = current_pts / 90; #ifdef USE_ESTIMATED_PTS buf->pts = current_pts; @@ -406,6 +408,9 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int lprintf("demux_flac_seek\n"); + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); + if (!start_pos && start_time) { double distance = (double)start_time; diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 9a754b62f..a35eba0a3 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.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_sputext.c,v 1.35 2004/06/11 09:47:30 valtri Exp $ + * $Id: demux_sputext.c,v 1.36 2004/06/13 21:28:57 miguelfreitas Exp $ * * code based on old libsputext/xine_decoder.c * @@ -1431,6 +1431,6 @@ static void *init_sputext_demux_class (xine_t *xine, void *data) { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 24, "sputext", XINE_VERSION_CODE, NULL, &init_sputext_demux_class }, + { PLUGIN_DEMUX, 25, "sputext", XINE_VERSION_CODE, NULL, &init_sputext_demux_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 07f520f0d..15846f870 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.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: xine_decoder.c,v 1.82 2004/06/11 09:47:30 valtri Exp $ + * $Id: xine_decoder.c,v 1.83 2004/06/13 21:28:57 miguelfreitas Exp $ * */ @@ -626,12 +626,12 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { _x_get_current_info (this->stream->master, &extra_info, sizeof(extra_info) ); - lprintf("master: %d slave: %d input_pos: %lld vo_discard: %d\n", - master_status, slave_status, extra_info.input_pos, vo_discard); + lprintf("master: %d slave: %d input_normpos: %lld vo_discard: %d\n", + master_status, slave_status, extra_info.input_normpos, vo_discard); if( !this->started && (master_status == XINE_STATUS_PLAY && slave_status == XINE_STATUS_PLAY && - extra_info.input_pos) ) { + extra_info.input_normpos) ) { lprintf("started\n"); this->width = this->height = 0; diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index adf87b658..4e88d9eee 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.178 2004/05/29 14:45:25 mroi Exp $ + * $Id: audio_out.c,v 1.179 2004/06/13 21:28:57 miguelfreitas Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -1213,7 +1213,7 @@ int xine_get_next_audio_frame (xine_audio_port_t *this_gen, frame->sample_rate = this->input.rate; frame->num_channels = _x_ao_mode2channels (this->input.mode); frame->bits_per_sample = this->input.bits; - frame->pos_stream = out_buf->extra_info->input_pos; + frame->pos_stream = out_buf->extra_info->input_normpos; frame->pos_time = out_buf->extra_info->input_time; frame->data = (uint8_t *) out_buf->mem; diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index fa0087779..fa8f72348 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -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: buffer.h,v 1.137 2004/06/01 04:31:17 tmmm Exp $ + * $Id: buffer.h,v 1.138 2004/06/13 21:28:57 miguelfreitas Exp $ * * * contents: @@ -250,16 +250,18 @@ typedef struct extra_info_s extra_info_t; struct extra_info_s { - off_t input_pos; /* remember where this buf came from in the input source */ - off_t input_length; /* remember the length of the input source */ - int input_time;/* time offset in miliseconds from beginning of stream */ - uint32_t frame_number; /* number of current frame if known */ + int input_normpos; /* remember where this buf came from in + * the input source (0..65535). can be + * either time or offset based. */ + int input_time; /* time offset in miliseconds from + * beginning of stream */ + uint32_t frame_number; /* number of current frame if known */ - int seek_count; /* internal engine use */ - int64_t vpts; /* set on output layers only */ + int seek_count; /* internal engine use */ + int64_t vpts; /* set on output layers only */ - int invalid; /* do not use this extra info to update anything */ - int total_time; /* duration in miliseconds of the stream */ + int invalid; /* do not use this extra info to update anything */ + int total_time; /* duration in miliseconds of the stream */ }; diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 6399c0776..d01e2a887 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.49 2004/05/16 21:45:24 jcdutton Exp $ + * $Id: demux.c,v 1.50 2004/06/13 21:28:57 miguelfreitas Exp $ */ @@ -483,7 +483,7 @@ int _x_action_pending (xine_stream_t *stream) { */ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, - off_t input_pos, off_t input_length, + int input_normpos, int input_time, int total_time, uint32_t frame_number) { buf_element_t *buf; @@ -510,8 +510,7 @@ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, buf->pts = pts; pts = 0; - buf->extra_info->input_pos = input_pos; - buf->extra_info->input_length = input_length; + buf->extra_info->input_normpos = input_normpos; buf->extra_info->input_time = input_time; buf->extra_info->total_time = total_time; buf->extra_info->frame_number = frame_number; @@ -529,9 +528,9 @@ void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, */ int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_pos, - off_t input_length, int input_time, - int total_time, uint32_t frame_number) { + uint32_t decoder_flags, off_t input_normpos, + int input_time, int total_time, + uint32_t frame_number) { buf_element_t *buf; decoder_flags |= BUF_FLAG_FRAME_START; @@ -558,8 +557,7 @@ int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, buf->pts = pts; pts = 0; - buf->extra_info->input_pos = input_pos; - buf->extra_info->input_length = input_length; + buf->extra_info->input_normpos = input_normpos; buf->extra_info->input_time = input_time; buf->extra_info->total_time = total_time; buf->extra_info->frame_number = frame_number; diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index f3a566934..8a9873f53 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.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: video_out.c,v 1.197 2004/06/02 19:46:11 tmattern Exp $ + * $Id: video_out.c,v 1.198 2004/06/13 21:28:57 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -1169,7 +1169,7 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, frame->duration = img->duration; frame->width = img->width; frame->height = img->height; - frame->pos_stream = img->extra_info->input_pos; + frame->pos_stream = img->extra_info->input_normpos; frame->pos_time = img->extra_info->input_time; frame->aspect_ratio = img->ratio; frame->colorspace = img->format; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index efc12a68d..adda44141 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.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: xine.c,v 1.294 2004/06/02 19:46:10 tmattern Exp $ + * $Id: xine.c,v 1.295 2004/06/13 21:28:57 miguelfreitas Exp $ */ /* @@ -108,11 +108,8 @@ void _x_extra_info_reset( extra_info_t *extra_info ) { void _x_extra_info_merge( extra_info_t *dst, extra_info_t *src ) { if (!src->invalid) { - if( src->input_pos ) - dst->input_pos = src->input_pos; - - if( src->input_length ) - dst->input_length = src->input_length; + if( src->input_normpos ) + dst->input_normpos = src->input_normpos; if( src->input_time ) dst->input_time = src->input_time; @@ -1084,8 +1081,6 @@ static void __wait_first_frame (xine_stream_t *stream) { static int __play_internal (xine_stream_t *stream, int start_pos, int start_time) { - double share ; - off_t pos, len; int demux_status; int demux_thread_running; @@ -1127,20 +1122,10 @@ static int __play_internal (xine_stream_t *stream, int start_pos, int start_time /* * start/seek demux */ - if (start_pos) { - pthread_mutex_lock( &stream->current_extra_info_lock ); - len = stream->current_extra_info->input_length; - pthread_mutex_unlock( &stream->current_extra_info_lock ); - if ((len == 0) && stream->input_plugin) - len = stream->input_plugin->get_length (stream->input_plugin); - share = (double) start_pos / 65535; - pos = (off_t) (share * len) ; - } else - pos = 0; /* seek to new position (no data is sent to decoders yet) */ demux_status = stream->demux_plugin->seek (stream->demux_plugin, - pos, start_time, + start_pos, start_time, stream->demux_thread_running); if (stream->audio_out) @@ -1557,8 +1542,7 @@ void _x_select_spu_channel (xine_stream_t *stream, int channel) { static int __get_current_position (xine_stream_t *stream) { - off_t len; - double share; + int pos; pthread_mutex_lock (&stream->frontend_lock); @@ -1581,17 +1565,12 @@ static int __get_current_position (xine_stream_t *stream) { } pthread_mutex_lock( &stream->current_extra_info_lock ); - len = stream->current_extra_info->input_length; - share = (double) stream->current_extra_info->input_pos; + pos = stream->current_extra_info->input_normpos; pthread_mutex_unlock( &stream->current_extra_info_lock ); - if (len == 0) len = stream->input_plugin->get_length (stream->input_plugin); - share /= (double) len; - share *= 65536; - pthread_mutex_unlock (&stream->frontend_lock); - return (int) share; + return pos; } void _x_get_current_info (xine_stream_t *stream, extra_info_t *extra_info, int size) { diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 01f5bf5ad..5c45168db 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -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: xine_internal.h,v 1.157 2004/05/29 14:45:25 mroi Exp $ + * $Id: xine_internal.h,v 1.158 2004/06/13 21:28:58 miguelfreitas Exp $ * */ @@ -400,15 +400,14 @@ int _x_action_pending (xine_stream_t *stream); void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, - off_t input_pos, off_t input_length, - int input_time, int total_time, + int input_normpos, int input_time, int total_time, uint32_t frame_number); int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_pos, - off_t input_length, int input_time, - int total_time, uint32_t frame_number); + uint32_t decoder_flags, off_t input_normpos, + int input_time, int total_time, + uint32_t frame_number); /* -- cgit v1.2.3