diff mpcommon.c @ 29670:2e3751815a21

Add support for displaying subtitles on the command-line when playing audio-only files.
author reimar
date Wed, 23 Sep 2009 21:48:48 +0000
parents ecc719c6d7a9
children d287e2785570
line wrap: on
line diff
--- a/mpcommon.c	Wed Sep 23 21:27:36 2009 +0000
+++ b/mpcommon.c	Wed Sep 23 21:48:48 2009 +0000
@@ -75,8 +75,7 @@
     if (reset) {
         sub_clear_text(&subs, MP_NOPTS_VALUE);
         if (vo_sub) {
-            vo_sub = NULL;
-            vo_osd_changed(OSDTYPE_SUBTITLE);
+            set_osd_subtitle(NULL);
         }
         if (vo_spudec) {
             spudec_reset(vo_spudec);
@@ -145,7 +144,6 @@
     } else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a')) {
         double curpts = refpts + sub_delay;
         double endpts;
-        vo_sub = &subs;
         while (d_dvdsub->first) {
             double subpts = ds_get_next_pts(d_dvdsub);
             if (subpts > curpts)
@@ -167,7 +165,6 @@
                                       (long long)(subpts*1000 + 0.5),
                                       (long long)((endpts-subpts)*1000 + 0.5));
                 } else { // plaintext subs with libass
-                    vo_sub = NULL;
                     if (subpts != MP_NOPTS_VALUE) {
                         if (endpts == MP_NOPTS_VALUE) endpts = subpts + 3;
                         sub_clear_text(&subs, MP_NOPTS_VALUE);
@@ -195,11 +192,11 @@
                     packet = p;
                 }
                 sub_add_text(&subs, packet, len, endpts);
-                vo_osd_changed(OSDTYPE_SUBTITLE);
+                set_osd_subtitle(&subs);
             }
         }
         if (sub_clear_text(&subs, curpts))
-            vo_osd_changed(OSDTYPE_SUBTITLE);
+            set_osd_subtitle(&subs);
     }
     current_module=NULL;
 }