# HG changeset patch # User ben # Date 1201202045 0 # Node ID 883c6c3ae041be04d8587f9a0f5dbb450357041a # Parent 7ccdc98df1a0137c7f97c1b746afc35b5fe1bb4d Add new command to switch between dvdnav titles Based on parts of dvdnav monster patches from Otvos Attila diff -r 7ccdc98df1a0 -r 883c6c3ae041 command.c --- 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: diff -r 7ccdc98df1a0 -r 883c6c3ae041 input/input.c --- 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}} }}, diff -r 7ccdc98df1a0 -r 883c6c3ae041 input/input.h --- 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 diff -r 7ccdc98df1a0 -r 883c6c3ae041 stream/stream_dvdnav.c --- 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", diff -r 7ccdc98df1a0 -r 883c6c3ae041 stream/stream_dvdnav.h --- 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 */