summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xine-engine/audio_decoder.c3
-rw-r--r--src/xine-engine/video_decoder.c5
-rw-r--r--src/xine-engine/xine.c34
-rw-r--r--src/xine-engine/xine_internal.h4
4 files changed, 33 insertions, 13 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 50d1e47a9..844643b0a 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_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: audio_decoder.c,v 1.93 2002/12/21 12:56:51 miguelfreitas Exp $
+ * $Id: audio_decoder.c,v 1.94 2002/12/21 16:13:43 miguelfreitas Exp $
*
*
* functions that implement audio decoding
@@ -66,6 +66,7 @@ void *audio_decoder_loop (void *stream_gen) {
#endif
extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info );
+ stream->audio_decoder_extra_info->seek_count = stream->video_seek_count;
switch (buf->type) {
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 809f1c048..7f43b3dd0 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_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: video_decoder.c,v 1.114 2002/12/21 12:56:52 miguelfreitas Exp $
+ * $Id: video_decoder.c,v 1.115 2002/12/21 16:13:43 miguelfreitas Exp $
*
*/
@@ -77,6 +77,7 @@ void *video_decoder_loop (void *stream_gen) {
buf = stream->video_fifo->get (stream->video_fifo);
extra_info_merge( stream->video_decoder_extra_info, buf->extra_info );
+ stream->video_decoder_extra_info->seek_count = stream->video_seek_count;
#ifdef LOG
printf ("video_decoder: got buffer 0x%08x\n", buf->type);
@@ -183,6 +184,8 @@ void *video_decoder_loop (void *stream_gen) {
case BUF_CONTROL_RESET_DECODER:
extra_info_reset( stream->video_decoder_extra_info );
+ stream->video_seek_count++;
+
if (stream->video_decoder_plugin) {
stream->video_decoder_plugin->reset (stream->video_decoder_plugin);
}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 26cb21c81..31d13ca11 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.200 2002/12/21 12:56:52 miguelfreitas Exp $
+ * $Id: xine.c,v 1.201 2002/12/21 16:13:43 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -115,6 +115,9 @@ void extra_info_merge( extra_info_t *dst, extra_info_t *src ) {
if( src->frame_number )
dst->frame_number = src->frame_number;
+
+ if( src->seek_count )
+ dst->seek_count = src->seek_count;
}
static void xine_set_speed_internal (xine_stream_t *stream, int speed) {
@@ -288,9 +291,12 @@ xine_stream_t *xine_stream_new (xine_t *this,
pthread_mutex_lock (&this->streams_lock);
stream = (xine_stream_t *) xine_xmalloc (sizeof (xine_stream_t)) ;
- stream->current_extra_info = xine_xmalloc( sizeof( extra_info_t ) );
- stream->audio_decoder_extra_info = xine_xmalloc( sizeof( extra_info_t ) );
- stream->video_decoder_extra_info = xine_xmalloc( sizeof( extra_info_t ) );
+ stream->current_extra_info = malloc( sizeof( extra_info_t ) );
+ stream->audio_decoder_extra_info = malloc( sizeof( extra_info_t ) );
+ stream->video_decoder_extra_info = malloc( sizeof( extra_info_t ) );
+ extra_info_reset( stream->current_extra_info );
+ extra_info_reset( stream->video_decoder_extra_info );
+ extra_info_reset( stream->audio_decoder_extra_info );
stream->xine = this;
stream->status = XINE_STATUS_STOP;
@@ -754,6 +760,7 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t
pthread_mutex_lock (&stream->first_frame_lock);
stream->first_frame_flag = 1;
pthread_mutex_unlock (&stream->first_frame_lock);
+ extra_info_reset( stream->current_extra_info );
printf ("xine: xine_play_internal ...done\n");
@@ -965,17 +972,21 @@ static int xine_get_current_position (xine_stream_t *stream) {
if (!stream->input_plugin) {
printf ("xine: xine_get_current_position: no input source\n");
pthread_mutex_unlock (&stream->frontend_lock);
- return 0;
+ return -1;
}
-
- if ( (!stream->video_decoder_plugin && !stream->audio_decoder_plugin) ||
- !stream->first_frame_flag ) {
+
+ if ( (!stream->video_decoder_plugin && !stream->audio_decoder_plugin) ) {
if( stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] )
extra_info_merge( stream->current_extra_info, stream->video_decoder_extra_info );
else
extra_info_merge( stream->current_extra_info, stream->audio_decoder_extra_info );
}
+ if ( stream->current_extra_info->seek_count != stream->video_seek_count ) {
+ pthread_mutex_unlock (&stream->frontend_lock);
+ return -1; /* position not yet known */
+ }
+
len = stream->current_extra_info->input_length;
if (len == 0) len = stream->input_plugin->get_length (stream->input_plugin);
share = (double) stream->current_extra_info->input_pos / (double) len * 65535;
@@ -1036,10 +1047,13 @@ static int xine_get_stream_length (xine_stream_t *stream) {
int xine_get_pos_length (xine_stream_t *stream, int *pos_stream,
int *pos_time, int *length_time) {
- xine_get_current_position (stream); /* force updating extra_info */
+ int pos = xine_get_current_position (stream); /* force updating extra_info */
+
+ if (pos == -1)
+ return 0;
if (pos_stream)
- *pos_stream = xine_get_current_position (stream);
+ *pos_stream = pos;
if (pos_time)
*pos_time = stream->current_extra_info->input_time * 1000;
if (length_time)
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 67da17d62..5f8947147 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.115 2002/12/21 12:56:52 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.116 2002/12/21 16:13:43 miguelfreitas Exp $
*
*/
@@ -130,6 +130,7 @@ struct extra_info_s {
off_t input_length; /* remember the length of the input source */
int input_time;/* time offset in seconds from beginning of stream */
uint32_t frame_number; /* number of current frame if known */
+ int seek_count; /* internal engine use */
};
/*
@@ -233,6 +234,7 @@ struct xine_stream_s {
int demux_action_pending;
extra_info_t *current_extra_info;
+ int video_seek_count;
int err;
};