From e956780cc0eb3888a8b70de3c03af76f7b3921b8 Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 11 Apr 2005 21:26:14 +0000 Subject: [PATCH] allow sub_select and vobsub_lang to select particular subtitle git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15129 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/slave.txt | 10 ++++++---- input/input.c | 4 ++-- mplayer.c | 6 +++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt index 940b5d279c..59b5374379 100644 --- a/DOCS/tech/slave.txt +++ b/DOCS/tech/slave.txt @@ -101,10 +101,12 @@ sub_visibility get_sub_visibility Print out subtitle visibility (1 == on, 0 == off). -sub_select - Cycle through the available subtitles. Supported subtitle sources are - -sub options on the command line, VOBsubs, DVD subtitles, and Ogg text - streams. +sub_select [] + Display subtitle with index . Turn subtitle display off if + is -1 or greater than the highest available subtitle index. + Cycle through the available subtitles if is omitted or less + than -1. Supported subtitle sources are -sub options on the command + line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams. sub_log Logs the current or last displayed subtitle together with filename diff --git a/input/input.c b/input/input.c index a1470f1bd1..402c11b8a3 100644 --- a/input/input.c +++ b/input/input.c @@ -77,8 +77,8 @@ static mp_cmd_t mp_cmds[] = { { MP_CMD_SUB_POS, "sub_pos", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, { MP_CMD_SUB_ALIGNMENT, "sub_alignment",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } }, { MP_CMD_SUB_VISIBILITY, "sub_visibility", 0, { {-1,{0}} } }, - { MP_CMD_SUB_SELECT, "vobsub_lang", 0, { {-1,{0}} } }, // for compatibility - { MP_CMD_SUB_SELECT, "sub_select", 0, { {-1,{0}} } }, + { MP_CMD_SUB_SELECT, "vobsub_lang", 0, { { MP_CMD_ARG_INT,{-2} }, {-1,{0}} } }, // for compatibility + { MP_CMD_SUB_SELECT, "sub_select", 0, { { MP_CMD_ARG_INT,{-2} }, {-1,{0}} } }, { MP_CMD_SUB_LOG, "sub_log", 0, { {-1,{0}} } }, { MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } }, { MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } }, diff --git a/mplayer.c b/mplayer.c index 41813e5af5..24d6c571fd 100644 --- a/mplayer.c +++ b/mplayer.c @@ -3375,8 +3375,12 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still) case MP_CMD_SUB_SELECT: if (global_sub_size) { int source = -1; + int v = cmd->args[0].v.i; - global_sub_pos++; + if (v < -1) + global_sub_pos++; + else + global_sub_pos = v; if (global_sub_pos >= global_sub_size) global_sub_pos = -1; if (global_sub_pos >= 0)