From e28bd7c6dee5cb060c08777a6c90d30df4aa6c4b Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 24 Jan 2008 19:14:05 +0000 Subject: [PATCH] Add new command to switch between dvdnav titles Based on parts of dvdnav monster patches from Otvos Attila git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25845 b3059339-0415-0410-9bf9-f77b7e298cf2 --- command.c | 6 ++++++ input/input.c | 1 + input/input.h | 1 + stream/stream_dvdnav.c | 9 +++++++++ stream/stream_dvdnav.h | 1 + 5 files changed, 18 insertions(+) diff --git a/command.c b/command.c index 987cf840de..d8718b955e 100644 --- a/command.c +++ b/command.c @@ -3134,6 +3134,12 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd) "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 --git a/input/input.c b/input/input.c index 6073451c8b..de31ccd20e 100644 --- a/input/input.c +++ b/input/input.c @@ -120,6 +120,7 @@ static const mp_cmd_t mp_cmds[] = { { 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 --git a/input/input.h b/input/input.h index c75f370ca7..1290ecd19d 100644 --- a/input/input.h +++ b/input/input.h @@ -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 --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index d8d97bf217..03231b017b 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -759,6 +759,15 @@ void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl) { 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 --git a/stream/stream_dvdnav.h b/stream/stream_dvdnav.h index 307cfe6c92..a148113f1e 100644 --- a/stream/stream_dvdnav.h +++ b/stream/stream_dvdnav.h @@ -21,5 +21,6 @@ int mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button); 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 */