From 99b10adaf384ec06310020e553e5081be6624128 Mon Sep 17 00:00:00 2001 From: Rich J Wareham Date: Thu, 18 Oct 2001 14:42:59 +0000 Subject: Slight re-ordering to make sure that input plugins can register event listeners CVS patchset: 830 CVS date: 2001/10/18 14:42:59 --- src/libspudec/xine_decoder.c | 6 +++++- src/xine-engine/video_decoder.c | 8 +++++--- src/xine-engine/xine.c | 17 +++++++++++------ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 46f4e21be..5f6109868 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_decoder.c @@ -19,7 +19,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.14 2001/10/05 11:10:00 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.15 2001/10/18 14:42:59 richwareham Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -226,6 +226,10 @@ static vo_overlay_t* spudec_get_overlay(ovl_src_t *ovl_src, int pts) { static void spudec_event(spu_decoder_t *this_gen, spu_event_t *event) { spudec_decoder_t *this = (spudec_decoder_t*) this_gen; + if((!this) || (!event)) { + return; + } + switch (event->sub_type) { case SPU_EVENT_BUTTON: { diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index d454aae3a..f958098e4 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.54 2001/10/05 01:56:57 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.55 2001/10/18 14:43:00 richwareham Exp $ * */ @@ -241,9 +241,11 @@ static void spu_event_handler(xine_t *this, event_t *event, void *data) { switch(event->type) { case XINE_SPU_EVENT: + /* -- This can cause a segfault! if (!this->cur_spu_decoder_plugin) - update_spu_decoder(this, BUF_SPU_CLUT); /* preload spu decoder */ - + update_spu_decoder(this, BUF_SPU_CLUT); + */ + if (this->cur_spu_decoder_plugin) this->cur_spu_decoder_plugin->event(this->cur_spu_decoder_plugin, (spu_event_t*) event); diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 1cbdfcf66..6480bf670 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.67 2001/10/09 03:06:24 miguelfreitas Exp $ + * $Id: xine.c,v 1.68 2001/10/18 14:43:00 richwareham Exp $ * * top-level xine functions * @@ -440,6 +440,14 @@ xine_t *xine_init (vo_driver_t *vo, pthread_mutex_init (&this->finished_lock, NULL); + /* + * init event listeners + */ + this->num_event_listeners = 0; /* Initially there are none */ + this->cur_input_plugin = NULL; /* In case the input plugin event handlers + * are called too early. */ + this->cur_spu_decoder_plugin = NULL; + /* * create a metronom */ @@ -475,11 +483,8 @@ xine_t *xine_init (vo_driver_t *vo, audio_decoder_init (this); printf("xine_init returning\n"); - /* - * init event listeners - */ - this->num_event_listeners = 0; /* Initially there are none */ - + /* Add an event listener */ + if((xine_register_event_listener(this, event_handler)) < 1) { fprintf(stderr, "xine_register_event_listener() failed.\n"); } -- cgit v1.2.3