diff options
author | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2002-09-18 04:20:09 +0000 |
---|---|---|
committer | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2002-09-18 04:20:09 +0000 |
commit | 40a213a03b067c8ac436b784c6a54d0e6e3d2311 (patch) | |
tree | 358bd1fd1471cd7938f8db6c21f72ffe8853e27d | |
parent | db4a9292eb386fe91bbb4059c1b172e45bd32ce7 (diff) | |
download | xine-lib-40a213a03b067c8ac436b784c6a54d0e6e3d2311.tar.gz xine-lib-40a213a03b067c8ac436b784c6a54d0e6e3d2311.tar.bz2 |
Updating the DVD menu code to use better nav_pci information.
libspudec parses nav_pci info correctly.
libdvdnav does not parse nav_pci info at all.
CVS patchset: 2681
CVS date: 2002/09/18 04:20:09
-rw-r--r-- | src/input/input_dvd.c | 93 | ||||
-rw-r--r-- | src/libspudec/spu.c | 6 | ||||
-rw-r--r-- | src/libspudec/spu_decoder_api.h | 6 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 20 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 5 |
5 files changed, 99 insertions, 31 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 3359693f4..2aa90b5a7 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.83 2002/09/17 07:53:59 jcdutton Exp $ + * $Id: input_dvd.c,v 1.84 2002/09/18 04:20:09 jcdutton Exp $ * */ @@ -1127,16 +1127,22 @@ static void dvdnav_event_listener (void *this_gen, xine_event_t *event) { break; case XINE_EVENT_INPUT_SELECT: { - xine_dvdnav_send_button_update(this, 1); - dvdnav_button_activate(this->dvdnav); + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + xine_dvdnav_send_button_update(this, 1); + dvdnav_button_activate(this->dvdnav, &nav_pci); + } } break; case XINE_EVENT_MOUSE_BUTTON: { - xine_input_event_t *input_event = (xine_input_event_t*) event; - xine_dvdnav_send_button_update(this, 1); - dvdnav_mouse_activate(this->dvdnav, input_event->x, + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + xine_input_event_t *input_event = (xine_input_event_t*) event; + xine_dvdnav_send_button_update(this, 1); + dvdnav_mouse_activate(this->dvdnav, &nav_pci, input_event->x, input_event->y); + } } break; case XINE_EVENT_INPUT_BUTTON_FORCE: /* For libspudec to feedback forced button select from NAV PCI packets. */ @@ -1146,34 +1152,57 @@ static void dvdnav_event_listener (void *this_gen, xine_event_t *event) { #ifdef INPUT_DEBUG printf("input_dvd: BUTTON_FORCE %d\n", but->buttonN); #endif - dvdnav_button_select(this->dvdnav, but->buttonN); + dvdnav_button_select(this->dvdnav, &but->nav_pci, but->buttonN); } break; case XINE_EVENT_MOUSE_MOVE: { - xine_input_event_t *input_event = (xine_input_event_t*) event; + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + xine_input_event_t *input_event = (xine_input_event_t*) event; /* printf("input_dvd: Mouse move (x,y) = (%i,%i)\n", input_event->x, input_event->y); */ - dvdnav_mouse_select(this->dvdnav, input_event->x, input_event->y); - xine_dvdnav_send_button_update(this, 0); + dvdnav_mouse_select(this->dvdnav, &nav_pci, input_event->x, input_event->y); + xine_dvdnav_send_button_update(this, 0); + } } break; case XINE_EVENT_INPUT_UP: - dvdnav_upper_button_select(this->dvdnav); - xine_dvdnav_send_button_update(this, 0); - break; + { + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + dvdnav_upper_button_select(this->dvdnav, &nav_pci); + xine_dvdnav_send_button_update(this, 0); + } + break; + } case XINE_EVENT_INPUT_DOWN: - dvdnav_lower_button_select(this->dvdnav); - xine_dvdnav_send_button_update(this, 0); - break; + { + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + dvdnav_lower_button_select(this->dvdnav, &nav_pci); + xine_dvdnav_send_button_update(this, 0); + } + break; + } case XINE_EVENT_INPUT_LEFT: - dvdnav_left_button_select(this->dvdnav); - xine_dvdnav_send_button_update(this, 0); - break; + { + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + dvdnav_left_button_select(this->dvdnav, &nav_pci); + xine_dvdnav_send_button_update(this, 0); + } + break; + } case XINE_EVENT_INPUT_RIGHT: - dvdnav_right_button_select(this->dvdnav); - xine_dvdnav_send_button_update(this, 0); - break; + { + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + dvdnav_right_button_select(this->dvdnav, &nav_pci); + xine_dvdnav_send_button_update(this, 0); + } + break; + } case XINE_EVENT_INPUT_NUMBER_9: this->typed_buttonN++; case XINE_EVENT_INPUT_NUMBER_8: @@ -1193,11 +1222,16 @@ static void dvdnav_event_listener (void *this_gen, xine_event_t *event) { case XINE_EVENT_INPUT_NUMBER_1: this->typed_buttonN++; case XINE_EVENT_INPUT_NUMBER_0: - dvdnav_button_select(this->dvdnav, this->typed_buttonN); - xine_dvdnav_send_button_update(this, 1); - dvdnav_button_activate(this->dvdnav); - this->typed_buttonN = 0; - break; + { + pci_t nav_pci; + if (this->xine->cur_spu_decoder_plugin->get_nav_pci(this->xine->cur_spu_decoder_plugin, &nav_pci) ) { + dvdnav_button_select(this->dvdnav, &nav_pci, this->typed_buttonN); + xine_dvdnav_send_button_update(this, 1); + dvdnav_button_activate(this->dvdnav, &nav_pci); + this->typed_buttonN = 0; + } + break; + } case XINE_EVENT_INPUT_NUMBER_10_ADD: this->typed_buttonN += 10; } @@ -1493,6 +1527,11 @@ static void *init_input_plugin (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.84 2002/09/18 04:20:09 jcdutton + * Updating the DVD menu code to use better nav_pci information. + * libspudec parses nav_pci info correctly. + * libdvdnav does not parse nav_pci info at all. + * * Revision 1.83 2002/09/17 07:53:59 jcdutton * Make input_dvd.c mrl playlist work again. * diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index b302ce9dc..da1aedfcd 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -35,7 +35,7 @@ * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: spu.c,v 1.45 2002/09/04 23:31:10 guenter Exp $ + * $Id: spu.c,v 1.46 2002/09/18 04:20:09 jcdutton Exp $ * */ @@ -338,6 +338,10 @@ void spudec_process (spudec_decoder_t *this, uint32_t stream_id) { spu_event.event.type = XINE_EVENT_INPUT_BUTTON_FORCE; spu_event.data = &spu_button; spu_button.buttonN = this->buttonN; + /* The BUTTON_FORCE event cannot call "get_nav_pci", + so the nav_pci info has to be passed in the event instead. */ + /* FIXME: the dxr3 code will have to be updated. */ + memcpy(&spu_button.nav_pci, &this->pci, sizeof(pci_t) ); xine_send_event(this->xine, &spu_event.event); } #ifdef LOG_BUTTON diff --git a/src/libspudec/spu_decoder_api.h b/src/libspudec/spu_decoder_api.h index a03e02621..19575a505 100644 --- a/src/libspudec/spu_decoder_api.h +++ b/src/libspudec/spu_decoder_api.h @@ -25,6 +25,9 @@ #define HAVE_SPU_API_H #define SPU_DECODER_IFACE_VERSION 9 +/* FIXME: Needed for spu_button_t */ +/* But will not be on all users's systems. (From the libspudec directory or libdvdread). */ +#include <nav_types.h> /* * generic xine spu decoder plugin interface @@ -50,6 +53,8 @@ struct spu_decoder_s { void (*dispose) (spu_decoder_t *this); + int (*get_nav_pci) (spu_decoder_t *this, void *nav_pci); + }; typedef struct spu_button_s spu_button_t; @@ -61,6 +66,7 @@ struct spu_button_s { uint16_t top, bottom; int64_t pts; uint32_t buttonN; + pci_t nav_pci; }; typedef struct spudec_clut_table_s spudec_clut_table_t; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 9ee27bf01..e62aab25f 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.75 2002/09/05 22:18:58 mroi Exp $ + * $Id: xine_decoder.c,v 1.76 2002/09/18 04:20:09 jcdutton Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -291,7 +291,24 @@ static void spudec_dispose (spu_decoder_t *this_gen) { free (this->event.object.overlay); free (this); } +/* gets the current already correctly processed nav_pci info */ +/* This is not perfectly in sync with the display, but all the same, */ +/* much closer than doing it at the input stage. */ +/* returns a bool for error/success.*/ +static int spudec_get_nav_pci (spu_decoder_t *this_gen, void *pci) { + spudec_decoder_t *this = (spudec_decoder_t *) this_gen; + pci_t *nav_pci = (pci_t *) pci; + + if (!this || !nav_pci) + return 0; + + pthread_mutex_lock(&this->nav_pci_lock); + memcpy(nav_pci, &this->pci, sizeof(pci_t) ); + pthread_mutex_unlock(&this->nav_pci_lock); + return 1; +} + static void *init_spu_decoder_plugin (xine_t *xine, void *data) { spudec_decoder_t *this ; @@ -304,6 +321,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { this->spu_decoder.close = spudec_close; this->spu_decoder.get_identifier = spudec_get_id; this->spu_decoder.dispose = spudec_dispose; + this->spu_decoder.get_nav_pci = spudec_get_nav_pci; this->xine = xine; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 0ebbe223c..b8b7f2031 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.97 2002/09/18 00:51:34 guenter Exp $ + * $Id: video_decoder.c,v 1.98 2002/09/18 04:20:09 jcdutton Exp $ * */ @@ -154,7 +154,8 @@ void *video_decoder_loop (void *this_gen) { /* Inform UI of SPU channel changes */ ui_event.event.type = XINE_EVENT_UI_CHANNELS_CHANGED; ui_event.data = NULL; - xine_send_event(this, &ui_event.event); + /* FIXME: This event sometimes causes a segfault in the xine-ui gui */ + /* xine_send_event(this, &ui_event.event); */ } break; |