changeset 25817:883c6c3ae041

Add new command to switch between dvdnav titles Based on parts of dvdnav monster patches from Otvos Attila
author ben
date Thu, 24 Jan 2008 19:14:05 +0000
parents 7ccdc98df1a0
children 2f6ad8c8ebf3
files command.c input/input.c input/input.h stream/stream_dvdnav.c stream/stream_dvdnav.h
diffstat 5 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Wed Jan 23 22:34:51 2008 +0000
+++ b/command.c	Thu Jan 24 19:14:05 2008 +0000
@@ -3134,6 +3134,12 @@
 				"Selected button number %d", button);
 	    }
 	    break;
+
+	case MP_CMD_SWITCH_TITLE:
+	    if (mpctx->stream->type == STREAMTYPE_DVDNAV)
+	        mp_dvdnav_switch_title(mpctx->stream, cmd->args[0].v.i);
+	    break;
+
 #endif
 
 	default:
--- a/input/input.c	Wed Jan 23 22:34:51 2008 +0000
+++ b/input/input.c	Thu Jan 24 19:14:05 2008 +0000
@@ -120,6 +120,7 @@
   { MP_CMD_GET_META_GENRE, "get_meta_genre", 0, { {-1,{0}} } },
   { MP_CMD_SWITCH_AUDIO, "switch_audio", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
   { MP_CMD_SWITCH_ANGLE, "switch_angle", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
+  { MP_CMD_SWITCH_TITLE, "switch_title", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
 #ifdef USE_TV
   { MP_CMD_TV_START_SCAN, "tv_start_scan", 0,  { {-1,{0}} }},
   { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1,  { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }},
--- a/input/input.h	Wed Jan 23 22:34:51 2008 +0000
+++ b/input/input.h	Thu Jan 24 19:14:05 2008 +0000
@@ -108,6 +108,7 @@
 #define MP_CMD_SUB_DEMUX 104
 #define MP_CMD_SWITCH_ANGLE 105
 #define MP_CMD_ASS_USE_MARGINS 106
+#define MP_CMD_SWITCH_TITLE 107
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
--- a/stream/stream_dvdnav.c	Wed Jan 23 22:34:51 2008 +0000
+++ b/stream/stream_dvdnav.c	Thu Jan 24 19:14:05 2008 +0000
@@ -759,6 +759,15 @@
   hl->ey = hlev.ey;
 }
 
+void mp_dvdnav_switch_title (stream_t *stream, int title) {
+  dvdnav_priv_t *priv = (dvdnav_priv_t *) stream->priv;
+  uint32_t titles;
+
+  dvdnav_get_number_of_titles (priv->dvdnav, &titles);
+  if (title > 0 && title <= titles)
+    dvdnav_title_play (priv->dvdnav, title);
+}
+
 const stream_info_t stream_info_dvdnav = {
   "DVDNAV stream",
   "null",
--- a/stream/stream_dvdnav.h	Wed Jan 23 22:34:51 2008 +0000
+++ b/stream/stream_dvdnav.h	Thu Jan 24 19:14:05 2008 +0000
@@ -21,5 +21,6 @@
 void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button);
 void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl);
 unsigned int *mp_dvdnav_get_spu_clut(stream_t *stream);
+void mp_dvdnav_switch_title(stream_t *stream, int title);
 
 #endif /* MPLAYER_STREAM_DVDNAV_H */