# HG changeset patch # User reimar # Date 1278105561 0 # Node ID 631f813874f04afb0cc9ded1c42218207f58e7f1 # Parent a3a50df246f8abb5f964949329e321f8eab33fea Factor out a large conditional, hopefully making it easier to add more subtitle types. diff -r a3a50df246f8 -r 631f813874f0 mpcommon.c --- 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;