changeset 29688:94f1bca4f4b6

Add a -nosub option that allows disabling auto-selected subtitles as e.g. the mkv demuxer supports.
author reimar
date Mon, 28 Sep 2009 11:32:27 +0000
parents ce2631b54dec
children ee15229abcda
files cfg-common-opts.h mencoder.c mplayer.c
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-common-opts.h	Mon Sep 28 11:31:25 2009 +0000
+++ b/cfg-common-opts.h	Mon Sep 28 11:32:27 2009 +0000
@@ -132,6 +132,7 @@
 	{"ausid", &audio_substream_id, CONF_TYPE_INT, 0, 0, 0, NULL},
 	{"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, -2, 8190, NULL},
 	{"sid", &dvdsub_id, CONF_TYPE_INT, CONF_RANGE, -2, 8190, NULL},
+	{"nosub", &dvdsub_id, CONF_TYPE_FLAG, 0, -1, -2, NULL},
 	{"novideo", &video_id, CONF_TYPE_FLAG, 0, -1, -2, NULL},
 
 	{ "hr-mp3-seek", &hr_mp3_seek, CONF_TYPE_FLAG, 0, 0, 1, NULL },
--- a/mencoder.c	Mon Sep 28 11:31:25 2009 +0000
+++ b/mencoder.c	Mon Sep 28 11:32:27 2009 +0000
@@ -101,7 +101,7 @@
 
 int audio_id=-1;
 int video_id=-1;
-int dvdsub_id=-2;
+int dvdsub_id=-1;
 int vobsub_id=-1;
 char* audio_lang=NULL;
 char* dvdsub_lang=NULL;
@@ -554,10 +554,10 @@
 
   select_audio(demuxer, audio_id, audio_lang);
 
-  if (dvdsub_id < 0 && dvdsub_lang)
+  if (dvdsub_id == -1 && dvdsub_lang)
     dvdsub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang);
 
-  if (dvdsub_id < 0)
+  if (dvdsub_id == -1)
     dvdsub_id = demuxer_default_sub_track(demuxer);
 
   for (i = 0; i < MAX_S_STREAMS; i++) {
--- a/mplayer.c	Mon Sep 28 11:31:25 2009 +0000
+++ b/mplayer.c	Mon Sep 28 11:32:27 2009 +0000
@@ -253,7 +253,7 @@
 // streaming:
 int audio_id=-1;
 int video_id=-1;
-int dvdsub_id=-2;
+int dvdsub_id=-1;
 int vobsub_id=-1;
 char* audio_lang=NULL;
 char* dvdsub_lang=NULL;
@@ -3491,11 +3491,11 @@
   } else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) {
     // if there are text subs to use, use those.  (autosubs come last here)
     mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS];
-  } else if (dvdsub_id < 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
+  } else if (dvdsub_id == -1 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
     // finally select subs by language and container hints
-    if (dvdsub_id < 0 && dvdsub_lang)
+    if (dvdsub_id == -1 && dvdsub_lang)
       dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang);
-    if (dvdsub_id < 0)
+    if (dvdsub_id == -1)
       dvdsub_id = demuxer_default_sub_track(mpctx->demuxer);
     if (dvdsub_id >= 0)
       mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id;