summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-06-10 13:41:55 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-06-10 13:41:55 +0000
commit681de9b185ef4780618bb86c3a7e5ca3e167df82 (patch)
tree12f5ddcbf00f1c84988f504bc09c61c88eee3704 /src
parentb1fa43121059ad7584c59f769408099f5cb79052 (diff)
downloadxine-lib-681de9b185ef4780618bb86c3a7e5ca3e167df82.tar.gz
xine-lib-681de9b185ef4780618bb86c3a7e5ca3e167df82.tar.bz2
better fix for logo race condition
CVS patchset: 2056 CVS date: 2002/06/10 13:41:55
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/audio_decoder.c13
-rw-r--r--src/xine-engine/video_decoder.c14
-rw-r--r--src/xine-engine/xine.c53
-rw-r--r--src/xine-engine/xine_internal.h4
4 files changed, 47 insertions, 37 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index e533f49f5..019b3f786 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.76 2002/06/09 10:59:33 miguelfreitas Exp $
+ * $Id: audio_decoder.c,v 1.77 2002/06/10 13:41:55 miguelfreitas Exp $
*
*
* functions that implement audio decoding
@@ -99,11 +99,16 @@ void *audio_decoder_loop (void *this_gen) {
pthread_mutex_lock (&this->finished_lock);
- if (!this->audio_finished && (buf->decoder_flags & BUF_FLAG_END_STREAM)) {
+ if (!this->audio_finished ) {
this->audio_finished = 1;
-
+
if (this->video_finished) {
- xine_notify_stream_finished (this);
+ if( this->playing_logo )
+ buf->decoder_flags = 0;
+ this->playing_logo = 0;
+
+ if( buf->decoder_flags & BUF_FLAG_END_STREAM )
+ xine_notify_stream_finished (this);
}
}
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 10c2b5022..54d1cf75a 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.88 2002/06/09 10:59:33 miguelfreitas Exp $
+ * $Id: video_decoder.c,v 1.89 2002/06/10 13:41:55 miguelfreitas Exp $
*
*/
@@ -158,12 +158,16 @@ void *video_decoder_loop (void *this_gen) {
pthread_mutex_lock (&this->finished_lock);
this->spu_finished = 1;
- if (!this->video_finished && (buf->decoder_flags & BUF_FLAG_END_STREAM )) {
-
+ if (!this->video_finished ) {
this->video_finished = 1;
-
+
if (this->audio_finished) {
- xine_notify_stream_finished (this);
+ if( this->playing_logo )
+ buf->decoder_flags = 0;
+ this->playing_logo = 0;
+
+ if( buf->decoder_flags & BUF_FLAG_END_STREAM )
+ xine_notify_stream_finished (this);
}
}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 804c24593..bad6a10ff 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.138 2002/06/10 00:26:10 miguelfreitas Exp $
+ * $Id: xine.c,v 1.139 2002/06/10 13:41:55 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -58,6 +58,16 @@
#define LOGO_DELAY 500000 /* usec */
+static void play_logo_internal(xine_t *this) {
+ pthread_mutex_lock (&this->logo_lock);
+ this->playing_logo = 1;
+ if( !xine_play_internal(this, this->logo_mrl, 0, 0) )
+ this->playing_logo = 0;
+ else
+ this->status = XINE_LOGO;
+ pthread_mutex_unlock (&this->logo_lock);
+}
+
/* config callback for logo mrl changing */
static void _logo_change_cb(void *data, cfg_entry_t *cfg) {
xine_t *this = (xine_t *) data;
@@ -75,10 +85,7 @@ static void _logo_change_cb(void *data, cfg_entry_t *cfg) {
xine_stop_internal(this);
this->metronom->adjust_clock(this->metronom,
this->metronom->get_current_time(this->metronom) + 30 * 90000 );
- pthread_mutex_lock (&this->logo_lock);
- xine_play_internal(this, this->logo_mrl, 0, 0);
- this->status = XINE_LOGO;
- pthread_mutex_unlock (&this->logo_lock);
+ play_logo_internal(this);
}
pthread_mutex_unlock (&this->xine_lock);
}
@@ -91,22 +98,16 @@ void * xine_notify_stream_finished_thread (void * this_gen) {
xine_stop_internal (this);
pthread_mutex_unlock (&this->xine_lock);
- pthread_mutex_lock (&this->logo_lock);
- if (strcmp(this->cur_mrl, this->logo_mrl)) {
-
- event.type = XINE_EVENT_PLAYBACK_FINISHED;
- xine_send_event (this, &event);
+ event.type = XINE_EVENT_PLAYBACK_FINISHED;
+ xine_send_event (this, &event);
- xine_usec_sleep (LOGO_DELAY);
+ xine_usec_sleep (LOGO_DELAY);
- pthread_mutex_lock (&this->xine_lock);
- if (this->status == XINE_STOP) {
- xine_play_internal(this, this->logo_mrl, 0, 0);
- this->status = XINE_LOGO;
- }
- pthread_mutex_unlock (&this->xine_lock);
+ pthread_mutex_lock (&this->xine_lock);
+ if (this->status == XINE_STOP) {
+ play_logo_internal(this);
}
- pthread_mutex_unlock (&this->logo_lock);
+ pthread_mutex_unlock (&this->xine_lock);
return NULL;
}
@@ -270,10 +271,7 @@ void xine_stop (xine_t *this) {
this->metronom->get_current_time(this->metronom) + 30 * 90000 );
if(this->status == XINE_STOP) {
- pthread_mutex_lock (&this->logo_lock);
- xine_play_internal(this, this->logo_mrl,0,0);
- this->status = XINE_LOGO;
- pthread_mutex_unlock (&this->logo_lock);
+ play_logo_internal(this);
}
pthread_mutex_unlock (&this->xine_lock);
}
@@ -695,10 +693,7 @@ xine_t *xine_init (vo_driver_t *vo,
this->osd_renderer->hide (this->osd, 300000);
}
- pthread_mutex_lock (&this->logo_lock);
- xine_play(this, this->logo_mrl,0,0);
- this->status = XINE_LOGO;
- pthread_mutex_unlock (&this->logo_lock);
+ play_logo_internal(this);
return this;
}
@@ -755,8 +750,12 @@ int xine_get_current_position (xine_t *this) {
}
int xine_get_status(xine_t *this) {
+ int status;
- return this->status;
+ status = this->status;
+ if( status == XINE_LOGO )
+ status = XINE_STOP;
+ return status;
}
/* ***
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 0342acd2d..ba907df0a 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.87 2002/06/07 04:15:46 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.88 2002/06/10 13:41:55 miguelfreitas Exp $
*
*/
@@ -259,6 +259,8 @@ struct xine_s {
xine_report_codec_t report_codec_cb;
void *report_codec_user_data;
+
+ int playing_logo;
};
/*