changeset 26087:2a112aed0dda

Demuxer-independent subtitle track selection.
author eugeni
date Fri, 29 Feb 2008 17:25:44 +0000
parents c9a877daca42
children 12904c37c798
files mencoder.c mplayer.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mencoder.c	Fri Feb 29 17:25:43 2008 +0000
+++ b/mencoder.c	Fri Feb 29 17:25:44 2008 +0000
@@ -600,6 +600,18 @@
 	mencoder_exit(1,NULL);
   }
  
+  if (dvdsub_id < 0 && dvdsub_lang)
+    dvdsub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang);
+
+  for (i = 0; i < MAX_S_STREAMS; i++) {
+    sh_sub_t *sh = demuxer->s_streams[i];
+    if (sh && sh->sid == dvdsub_id) {
+      demuxer->sub->id = i;
+      demuxer->sub->sh = sh;
+      break;
+    }
+  }
+
   if(dvd_chapter>1) {
     float pts;
     if (demuxer_seek_chapter(demuxer, dvd_chapter-1, 1, &pts, NULL, NULL) >= 0 && pts > -1.0)
--- a/mplayer.c	Fri Feb 29 17:25:43 2008 +0000
+++ b/mplayer.c	Fri Feb 29 17:25:44 2008 +0000
@@ -3444,6 +3444,8 @@
 if (mpctx->global_sub_size) {
   // find the best sub to use
   int vobsub_index_id = vobsub_get_index_by_id(vo_vobsub, vobsub_id);
+  if (dvdsub_id < 0 && dvdsub_lang)
+    dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang);
   if (vobsub_index_id >= 0) {
     // if user asks for a vobsub id, use that first.
     mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_index_id;