changeset 21120:f508dff0bd43

Reuse init_vo_spudec in subtitle switching code. Also generalize vobsub and ass init code to work for demuxers besides matroska (fixes subtitle switching with http://samples.mplayerhq.hu/sub/NeroMP4/unsupported-embedded-subs-2.mp4)
author reimar
date Tue, 21 Nov 2006 15:48:00 +0000
parents 5f9009952814
children 1bf36651b5ab
files mplayer.c
diffstat 1 files changed, 7 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Tue Nov 21 15:43:23 2006 +0000
+++ b/mplayer.c	Tue Nov 21 15:48:00 2006 +0000
@@ -2379,32 +2379,15 @@
             }
             if (demuxer->type == DEMUXER_TYPE_MATROSKA) {
                 d_dvdsub->id = demux_mkv_change_subs(demuxer, dvdsub_id);
+            }
+            if (d_dvdsub->sh && d_dvdsub->id >= 0) {
+                sh_sub_t *sh = d_dvdsub->sh;
+                if (sh->type == 'v')
+                    init_vo_spudec();
 #ifdef USE_ASS
-                if (ass_enabled && (d_dvdsub->id >= 0) &&
-                        (((sh_sub_t *)d_dvdsub->sh)->type == 'a')) {
-                    ass_track = ((sh_sub_t *)d_dvdsub->sh)->ass_track;
-                }
+                else if (ass_enabled && sh->type == 'a')
+                    ass_track = sh->ass_track;
 #endif
-                if (d_dvdsub->id >= 0 &&
-                    ((sh_sub_t *)d_dvdsub->sh)->type == 'v') {
-                    sh_sub_t *mkv_sh_sub = (sh_sub_t *)d_dvdsub->sh;
-                    if (vo_spudec != NULL)
-                        spudec_free(vo_spudec);
-                    vo_spudec =
-                        spudec_new_scaled_vobsub(mkv_sh_sub->has_palette ?
-                                                 mkv_sh_sub->palette :
-                                                 NULL, mkv_sh_sub->colors,
-                                                 mkv_sh_sub->custom_colors,
-                                                 mkv_sh_sub->width,
-                                                 mkv_sh_sub->height);
-                    if (!forced_subs_only)
-                        forced_subs_only = mkv_sh_sub->forced_subs_only;
-                    if (vo_spudec) {
-                        spudec_set_forced_subs_only(vo_spudec,
-                                                    forced_subs_only);
-                        inited_flags |= INITED_SPUDEC;
-                    }
-                }
             }
         }
     } else { // off