summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-07-14 20:55:17 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-07-14 20:55:17 +0000
commit43926fa28a72a0593f97b9e5718172ce26f27612 (patch)
tree325d7b79b1eb57df6832486838e7b5f752ad471c
parent7606bfa52694101c02009db4d10f44954877b4e9 (diff)
downloadxine-lib-43926fa28a72a0593f97b9e5718172ce26f27612.tar.gz
xine-lib-43926fa28a72a0593f97b9e5718172ce26f27612.tar.bz2
some fixes to osd displaying (show the right time after seeks)
CVS patchset: 2264 CVS date: 2002/07/14 20:55:17
-rw-r--r--src/xine-engine/audio_decoder.c12
-rw-r--r--src/xine-engine/video_decoder.c11
-rw-r--r--src/xine-engine/xine.c41
-rw-r--r--src/xine-engine/xine_internal.h5
4 files changed, 44 insertions, 25 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 9ac59d4a2..5daccea9c 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.79 2002/07/13 15:54:03 tmattern Exp $
+ * $Id: audio_decoder.c,v 1.80 2002/07/14 20:55:17 miguelfreitas Exp $
*
*
* functions that implement audio decoding
@@ -68,9 +68,15 @@ void *audio_decoder_loop (void *this_gen) {
if (buf->input_pos)
this->cur_input_pos = buf->input_pos;
-
- if (buf->input_time)
+ if (buf->input_length)
+ this->cur_input_length = buf->input_length;
+ if (buf->input_time) {
this->cur_input_time = buf->input_time;
+ pthread_mutex_lock (&this->osd_lock);
+ if( this->curtime_needed_for_osd && !(--this->curtime_needed_for_osd) )
+ xine_internal_osd (this, ">",90000);
+ pthread_mutex_unlock (&this->osd_lock);
+ }
switch (buf->type) {
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index d570b1af0..bd62be3d2 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.91 2002/07/05 15:08:58 mroi Exp $
+ * $Id: video_decoder.c,v 1.92 2002/07/14 20:55:17 miguelfreitas Exp $
*
*/
@@ -83,9 +83,14 @@ void *video_decoder_loop (void *this_gen) {
this->cur_input_pos = buf->input_pos;
if (buf->input_length)
this->cur_input_length = buf->input_length;
- if (buf->input_time)
+ if (buf->input_time) {
this->cur_input_time = buf->input_time;
-
+ pthread_mutex_lock (&this->osd_lock);
+ if( this->curtime_needed_for_osd && !(--this->curtime_needed_for_osd) )
+ xine_internal_osd (this, ">",90000);
+ pthread_mutex_unlock (&this->osd_lock);
+ }
+
#ifdef VIDEO_DECODER_LOG
printf ("video_decoder: got buffer 0x%08x\n", buf->type);
#endif
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index fc0d1b8c5..80c9642e3 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.144 2002/07/14 01:27:03 tmmm Exp $
+ * $Id: xine.c,v 1.145 2002/07/14 20:55:17 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -169,12 +169,15 @@ int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec
return 0;
}
-static void xine_internal_osd (xine_t *this, char *str,
- uint32_t start_time, uint32_t duration) {
+void xine_internal_osd (xine_t *this, char *str, int duration) {
uint32_t seconds;
char tstr[256];
-
+ int64_t start_time;
+
+ this->curtime_needed_for_osd = 0;
+ start_time = this->metronom->get_current_time (this->metronom);
+
if (this->osd_display) {
this->osd_renderer->filled_rect (this->osd, 0, 0, 299, 99, 0);
@@ -226,8 +229,6 @@ void xine_stop_internal (xine_t *this) {
printf ("xine_stop\n");
- /* xine_internal_osd (this, "}", this->metronom->get_current_time (this->metronom), 30000); never works */
-
if (this->status == XINE_STOP) {
printf ("xine_stop ignored\n");
return;
@@ -273,6 +274,7 @@ void xine_stop (xine_t *this) {
if(this->status == XINE_STOP) {
play_logo_internal(this);
}
+
pthread_mutex_unlock (&this->xine_lock);
}
@@ -485,11 +487,9 @@ int xine_play_internal (xine_t *this, char *mrl,
this->status = XINE_PLAY;
strncpy (this->cur_mrl, mrl, 1024);
- /* osd */
- /* FIXME: how do we assure an updated cur_input_time? */
- /* xine_usec_sleep(100000); */
- xine_internal_osd (this, ">", this->metronom->get_current_time (this->metronom), 300000);
-
+ /* osd will be updated as soon as we know cur_input_time */
+ if( !this->playing_logo )
+ this->curtime_needed_for_osd = 5;
}
return 1;
@@ -582,6 +582,7 @@ void xine_exit (xine_t *this) {
pthread_mutex_destroy (&this->logo_lock);
pthread_mutex_destroy (&this->xine_lock);
pthread_mutex_destroy (&this->finished_lock);
+ pthread_mutex_destroy (&this->osd_lock);
free (this);
@@ -634,6 +635,8 @@ xine_t *xine_init (vo_driver_t *vo,
pthread_mutex_init (&this->xine_lock, NULL);
pthread_mutex_init (&this->finished_lock, NULL);
+
+ pthread_mutex_init (&this->osd_lock, NULL);
this->finished_thread_running = 0;
@@ -853,27 +856,29 @@ void xine_set_speed (xine_t *this, int speed) {
/* osd */
+ pthread_mutex_lock (&this->osd_lock);
switch (speed) {
case SPEED_PAUSE:
- xine_internal_osd (this, "<", this->metronom->get_current_time (this->metronom), 10000);
+ xine_internal_osd (this, "<", 10000);
break;
case SPEED_SLOW_4:
- xine_internal_osd (this, "<>", this->metronom->get_current_time (this->metronom), 20000 * speed);
+ xine_internal_osd (this, "<>", 20000 * speed);
break;
case SPEED_SLOW_2:
- xine_internal_osd (this, "@>", this->metronom->get_current_time (this->metronom), 20000 * speed);
+ xine_internal_osd (this, "@>", 20000 * speed);
break;
case SPEED_NORMAL:
- xine_internal_osd (this, ">", this->metronom->get_current_time (this->metronom), 20000 * speed);
+ xine_internal_osd (this, ">", 20000 * speed);
break;
case SPEED_FAST_2:
- xine_internal_osd (this, "$$", this->metronom->get_current_time (this->metronom), 20000 * speed);
+ xine_internal_osd (this, "$$", 20000 * speed);
break;
case SPEED_FAST_4:
- xine_internal_osd (this, "$$$", this->metronom->get_current_time (this->metronom), 20000 * speed);
+ xine_internal_osd (this, "$$$", 20000 * speed);
break;
}
-
+ pthread_mutex_unlock (&this->osd_lock);
+
/* make sure osd can be displayed */
xine_usec_sleep(100000);
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 0c4f86d5b..efe20c3e9 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.91 2002/07/10 14:02:41 mroi Exp $
+ * $Id: xine_internal.h,v 1.92 2002/07/14 20:55:17 miguelfreitas Exp $
*
*/
@@ -263,6 +263,8 @@ struct xine_s {
void *report_codec_user_data;
int playing_logo;
+ int curtime_needed_for_osd;
+ pthread_mutex_t osd_lock;
};
/*
@@ -442,6 +444,7 @@ char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls);
void xine_notify_stream_finished (xine_t *this);
void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t buf_type, int handled );
+void xine_internal_osd (xine_t *this, char *str, int duration);
/*
* video decoder stuff