changeset 31559:631f813874f0

Factor out a large conditional, hopefully making it easier to add more subtitle types.
author reimar
date Fri, 02 Jul 2010 21:19:21 +0000
parents a3a50df246f8
children 6e550be9e418
files mpcommon.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mpcommon.c	Fri Jul 02 21:14:42 2010 +0000
+++ b/mpcommon.c	Fri Jul 02 21:19:21 2010 +0000
@@ -90,6 +90,7 @@
     unsigned char *packet=NULL;
     int len;
     char type = d_dvdsub->sh ? ((sh_sub_t *)d_dvdsub->sh)->type : 'v';
+    int text_sub = type == 't' || type == 'm' || type == 'a' || type == 'd';
     static subtitle subs;
     if (reset) {
         sub_clear_text(&subs, MP_NOPTS_VALUE);
@@ -160,7 +161,7 @@
 
         if (spudec_changed(vo_spudec))
             vo_osd_changed(OSDTYPE_SPU);
-    } else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a' || type == 'd')) {
+    } else if (dvdsub_id >= 0 && text_sub) {
         double curpts = refpts + sub_delay;
         double endpts;
         if (type == 'd' && !d_dvdsub->demuxer->teletext) {
@@ -246,7 +247,7 @@
             if (d_dvdsub->non_interleaved)
                 ds_get_next_pts(d_dvdsub);
         }
-        if (sub_clear_text(&subs, curpts))
+        if (text_sub && sub_clear_text(&subs, curpts))
             set_osd_subtitle(&subs);
     }
     current_module=NULL;