changeset 19768:1069a634fc92

added mp_dvdnav_handle_input to handle user's input (revived from the repository with few changes)
author nicodvb
date Sat, 09 Sep 2006 21:37:57 +0000
parents df81093327a6
children cc67a85cb722
files stream/stream_dvdnav.c stream/stream_dvdnav.h
diffstat 2 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvdnav.c	Sat Sep 09 21:32:06 2006 +0000
+++ b/stream/stream_dvdnav.c	Sat Sep 09 21:37:57 2006 +0000
@@ -430,6 +430,46 @@
   return STREAM_OK;
 }
 
+
+int mp_dvdnav_handle_input(stream_t *stream, int cmd) {
+  dvdnav_priv_t * dvdnav_priv=(dvdnav_priv_t*)stream->priv;
+  dvdnav_t *nav = dvdnav_priv->dvdnav;
+  dvdnav_status_t status;
+  pci_t *pci = dvdnav_get_current_nav_pci(nav);
+  int reset = 0;
+
+  if(cmd != MP_CMD_DVDNAV_SELECT && !pci)
+    return 0;
+
+  switch(cmd) {
+    case MP_CMD_DVDNAV_UP:
+      status = dvdnav_upper_button_select(nav, pci);
+      break;
+    case MP_CMD_DVDNAV_DOWN:
+      status = dvdnav_lower_button_select(nav, pci);
+      break;
+    case MP_CMD_DVDNAV_LEFT:
+      status = dvdnav_left_button_select(nav, pci);
+      break;
+    case MP_CMD_DVDNAV_RIGHT:
+      status = dvdnav_right_button_select(nav, pci);
+      break;
+    case MP_CMD_DVDNAV_MENU:
+      status = dvdnav_menu_call(nav,DVD_MENU_Root);
+      reset = 1;
+      break;
+    case MP_CMD_DVDNAV_SELECT:
+      status = dvdnav_button_activate(nav, pci);
+      reset = 1;
+      break;
+    default:
+      mp_msg(MSGT_CPLAYER, MSGL_V, "Unknown DVDNAV cmd %d\n", cmd);
+      break;
+  }
+
+  return reset;
+}
+
 stream_info_t stream_info_dvdnav = {
   "DVDNAV stream",
   "null",
--- a/stream/stream_dvdnav.h	Sat Sep 09 21:32:06 2006 +0000
+++ b/stream/stream_dvdnav.h	Sat Sep 09 21:37:57 2006 +0000
@@ -43,5 +43,6 @@
 
 void dvdnav_stream_fullstart(dvdnav_priv_t *dvdnav_priv);
 unsigned int * dvdnav_stream_get_palette(dvdnav_priv_t * dvdnav_priv);
+int mp_dvdnav_handle_input(stream_t *stream, int cmd);
 
 #endif