From e3315ad3c7c2aa0d9698c81195b05c36f78c0427 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Thu, 24 Oct 2002 11:30:38 +0000 Subject: Further changes to DVD code. CVS patchset: 2981 CVS date: 2002/10/24 11:30:38 --- src/input/input_dvd.c | 27 +++++++------- src/libspudec/spu_decoder_api.h | 2 ++ src/libspudec/xine_decoder.c | 78 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 16 deletions(-) diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index aee52480b..1474c67c0 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.99 2002/10/23 20:26:34 guenter Exp $ + * $Id: input_dvd.c,v 1.100 2002/10/24 11:30:38 jcdutton Exp $ * */ @@ -763,10 +763,12 @@ static void flush_buffers(dvd_input_plugin_t *this) { } static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode) { - int button; - spu_button_t spu_button; - /* FIXME: get events working */ - /*xine_spu_event_t spu_event;*/ + int32_t button; + int32_t show; + + if (!this || !(this->stream) || !(this->stream->spu_decoder_plugin) ) { + return; + } dvdnav_get_current_highlight(this->dvdnav, &button); if (button == this->buttonN && (mode ==0) ) return; this->buttonN = button; /* Avoid duplicate sending of button info */ @@ -775,13 +777,8 @@ static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode) { #endif /* Do we want to show or hide the button? */ /* libspudec will control hiding */ -/* FIXME: get events working - spu_event.event.type = XINE_EVENT_SPU_BUTTON; - spu_event.data = &spu_button; -*/ - spu_button.show = mode + 1; /* mode=0 select, 1 activate. */ - spu_button.buttonN = button; - /*xine_send_event(this->stream, &spu_event.event);*/ + show = mode + 1; /* mode=0 select, 1 activate. */ + this->stream->spu_decoder_plugin->set_button (this->stream->spu_decoder_plugin, button, mode + 1); } static void dvd_event_listener(void *this_gen, const xine_event_t *event) { @@ -790,12 +787,11 @@ static void dvd_event_listener(void *this_gen, const xine_event_t *event) { dvd_input_class_t *class = (dvd_input_class_t*)this->input_plugin.input_class; config_values_t *config = class->config; /* Pointer to XineRC config file */ printf("input_dvd:dvd_event_listener: EVENT=%d\n", event->type); - /* dvd_input_class_t *class = (dvd_input_class_t*)class_gen; */ + if(!this->dvdnav) { return; } -/* FIXME */ switch(event->type) { case XINE_EVENT_INPUT_MENU2: printf("input_dvd: MENU2 key hit.\n"); @@ -1658,6 +1654,9 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.100 2002/10/24 11:30:38 jcdutton + * Further changes to DVD code. + * * Revision 1.99 2002/10/23 20:26:34 guenter * final c++ -> c coding style fixes, libxine compiles now * diff --git a/src/libspudec/spu_decoder_api.h b/src/libspudec/spu_decoder_api.h index 3374ef447..d2522f1cc 100644 --- a/src/libspudec/spu_decoder_api.h +++ b/src/libspudec/spu_decoder_api.h @@ -75,6 +75,8 @@ struct spu_decoder_s { int (*get_nav_pci) (spu_decoder_t *this, pci_t *nav_pci); + void (*set_button) (spu_decoder_t *this_gen, int32_t button, int32_t mode); + void *node; /* used by plugin loader */ }; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 7b0c3c601..6e4e12930 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.80 2002/10/23 11:44:31 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.81 2002/10/24 11:30:39 jcdutton Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -287,7 +287,80 @@ static int spudec_get_nav_pci (spu_decoder_t *this_gen, pci_t *pci) { return 1; } - + +static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t show) { + spudec_decoder_t *this = (spudec_decoder_t *) this_gen; + /* This function will move to video_overlay + * when video_overlay does menus */ + + video_overlay_instance_t *ovl_instance; + video_overlay_event_t *overlay_event = NULL; + vo_overlay_t *overlay = NULL; + overlay_event = xine_xmalloc (sizeof(video_overlay_event_t)); + + overlay = xine_xmalloc (sizeof(vo_overlay_t)); + /* FIXME: Watch out for threads. We should really put a lock on this + * because events is a different thread than decode_data */ + +#ifdef LOG_DEBUG + printf ("libspudec:xine_decoder.c:spudec_event_listener:this->menu_handle=%u\n",this->menu_handle); +#endif + + if (show > 0) { +#ifdef LOG_NAV + fprintf (stderr,"libspudec:xine_decoder.c:spudec_event_listener:buttonN = %u show=%d\n", + button, + show); +#endif + this->buttonN = button; + if (this->button_filter != 1) { +#ifdef LOG_NAV + fprintf (stdout,"libspudec:xine_decoder.c:spudec_event_listener:buttonN updates not allowed\n"); +#endif + /* Only update highlight is the menu will let us */ + free(overlay_event); + free(overlay); + return; + } + if (show == 2) { + this->button_filter = 2; + } + pthread_mutex_lock(&this->nav_pci_lock); + overlay_event->object.handle = this->menu_handle; + overlay_event->object.pts = this->pci.hli.hl_gi.hli_s_ptm; + overlay_event->object.overlay=overlay; + overlay_event->event_type = EVENT_MENU_BUTTON; +#ifdef LOG_NAV + fprintf(stderr, "libspudec:Button Overlay\n"); +#endif + spudec_copy_nav_to_overlay(&this->pci, this->state.clut, this->buttonN, show-1, + overlay, &this->overlay ); + pthread_mutex_unlock(&this->nav_pci_lock); + } else { + fprintf (stderr,"libspudec:xine_decoder.c:spudec_event_listener:HIDE ????\n"); + assert(0); + overlay_event->object.handle = this->menu_handle; + overlay_event->event_type = EVENT_HIDE_MENU; + } + overlay_event->vpts = 0; + if (this->vo_out) { + ovl_instance = this->vo_out->get_overlay_instance (this->vo_out); +#ifdef LOG_NAV + fprintf(stderr, "libspudec: add_event type=%d : current time=%lld, spu vpts=%lli\n", + overlay_event->event_type, + this->stream->metronom->get_current_time(this->stream->metronom), + overlay_event->vpts); +#endif + ovl_instance->add_event (ovl_instance, (void *)overlay_event); + free(overlay_event); + free(overlay); + } else { + free(overlay_event); + free(overlay); + } + return; +} + static spu_decoder_t *open_plugin (spu_decoder_class_t *class_gen, xine_stream_t *stream) { spudec_decoder_t *this ; @@ -299,6 +372,7 @@ static spu_decoder_t *open_plugin (spu_decoder_class_t *class_gen, xine_stream_t this->spu_decoder.reset = spudec_reset; this->spu_decoder.dispose = spudec_dispose; this->spu_decoder.get_nav_pci = spudec_get_nav_pci; + this->spu_decoder.set_button = spudec_set_button; this->stream = stream; this->class = (spudec_class_t *) class_gen; -- cgit v1.2.3