changeset 15128:96512bcb2eca

allow sub_select and vobsub_lang to select particular subtitle
author henry
date Mon, 11 Apr 2005 21:26:14 +0000
parents c8abe722140e
children 2075e798f6f2
files DOCS/tech/slave.txt input/input.c mplayer.c
diffstat 3 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/tech/slave.txt	Mon Apr 11 21:25:06 2005 +0000
+++ b/DOCS/tech/slave.txt	Mon Apr 11 21:26:14 2005 +0000
@@ -101,10 +101,12 @@
 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 [<value>]
+    Display subtitle with index <value>. Turn subtitle display off if
+    <value> is -1 or greater than the highest available subtitle index.
+    Cycle through the available subtitles if <value> 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
--- a/input/input.c	Mon Apr 11 21:25:06 2005 +0000
+++ b/input/input.c	Mon Apr 11 21:26:14 2005 +0000
@@ -77,8 +77,8 @@
   { 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}} } },
--- a/mplayer.c	Mon Apr 11 21:25:06 2005 +0000
+++ b/mplayer.c	Mon Apr 11 21:26:14 2005 +0000
@@ -3375,8 +3375,12 @@
     case MP_CMD_SUB_SELECT:
     if (global_sub_size) {
         int source = -1;
-
-        global_sub_pos++;
+        int v = cmd->args[0].v.i;
+
+        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)