summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-21 15:43:23 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-21 15:43:23 +0000
commitc99a4cad085790926671e7d42666a2b89b55ee9d (patch)
tree08816002bbce2c7d09f0a5f02bf41ef34397b393 /mplayer.c
parent95de8f239fcf8c28ab09ee46bebfc32209ec169a (diff)
downloadmpv-c99a4cad085790926671e7d42666a2b89b55ee9d.tar.bz2
mpv-c99a4cad085790926671e7d42666a2b89b55ee9d.tar.xz
Move vo_spudec initialization into a separate function, for later reuse
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21135 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c86
1 files changed, 46 insertions, 40 deletions
diff --git a/mplayer.c b/mplayer.c
index 4d678c7272..64906e5cdd 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1031,6 +1031,51 @@ void update_set_of_subtitles(void)
}
#endif /* USE_SUB */
+void init_vo_spudec(void) {
+ if (vo_spudec)
+ spudec_free(vo_spudec);
+ inited_flags &= ~INITED_SPUDEC;
+ vo_spudec = NULL;
+ if (spudec_ifo) {
+ unsigned int palette[16], width, height;
+ current_module="spudec_init_vobsub";
+ if (vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0)
+ vo_spudec=spudec_new_scaled(palette, width, height);
+ }
+
+#ifdef USE_DVDREAD
+ if (vo_spudec==NULL && stream->type==STREAMTYPE_DVD) {
+ current_module="spudec_init_dvdread";
+ vo_spudec=spudec_new_scaled(((dvd_priv_t *)(stream->priv))->cur_pgc->palette,
+ sh_video->disp_w, sh_video->disp_h);
+ }
+#endif
+
+ if ((vo_spudec == NULL) && (demuxer->type == DEMUXER_TYPE_MATROSKA) &&
+ (d_dvdsub->sh != NULL) && (((sh_sub_t *)d_dvdsub->sh)->type == 'v')) {
+ sh_sub_t *mkv_sh_sub = (sh_sub_t *)d_dvdsub->sh;
+ current_module = "spudec_init_matroska";
+ vo_spudec =
+ spudec_new_scaled_vobsub(mkv_sh_sub->palette, mkv_sh_sub->colors,
+ mkv_sh_sub->custom_colors, mkv_sh_sub->width,
+ mkv_sh_sub->height);
+ forced_subs_only = mkv_sh_sub->forced_subs_only;
+ }
+
+ if (vo_spudec==NULL) {
+ sh_sub_t *sh = (sh_sub_t *)d_dvdsub->sh;
+ unsigned int *palette = NULL;
+ if (sh && sh->has_palette)
+ palette = sh->palette;
+ current_module="spudec_init_normal";
+ vo_spudec=spudec_new_scaled(palette, sh_video->disp_w, sh_video->disp_h);
+ spudec_set_font_factor(vo_spudec,font_factor);
+ }
+
+ if (vo_spudec!=NULL)
+ inited_flags|=INITED_SPUDEC;
+}
+
/*
* In Mac OS X the SDL-lib is built upon Cocoa. The easiest way to
* make it all work is to use the builtin SDL-bootstrap code, which
@@ -4384,46 +4429,7 @@ demux_info_print(demuxer);
//================== Read SUBTITLES (DVD & TEXT) ==========================
if(vo_spudec==NULL && sh_video &&
(stream->type==STREAMTYPE_DVD || d_dvdsub->id >= 0)){
-
-if (spudec_ifo) {
- unsigned int palette[16], width, height;
- current_module="spudec_init_vobsub";
- if (vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0)
- vo_spudec=spudec_new_scaled(palette, width, height);
-}
-
-#ifdef USE_DVDREAD
-if (vo_spudec==NULL && stream->type==STREAMTYPE_DVD) {
- current_module="spudec_init_dvdread";
- vo_spudec=spudec_new_scaled(((dvd_priv_t *)(stream->priv))->cur_pgc->palette,
- sh_video->disp_w, sh_video->disp_h);
-}
-#endif
-
-if ((vo_spudec == NULL) && (demuxer->type == DEMUXER_TYPE_MATROSKA) &&
- (d_dvdsub->sh != NULL) && (((sh_sub_t *)d_dvdsub->sh)->type == 'v')) {
- sh_sub_t *mkv_sh_sub = (sh_sub_t *)d_dvdsub->sh;
- current_module = "spudec_init_matroska";
- vo_spudec =
- spudec_new_scaled_vobsub(mkv_sh_sub->palette, mkv_sh_sub->colors,
- mkv_sh_sub->custom_colors, mkv_sh_sub->width,
- mkv_sh_sub->height);
- forced_subs_only = mkv_sh_sub->forced_subs_only;
-}
-
-if (vo_spudec==NULL) {
- sh_sub_t *sh = (sh_sub_t *)d_dvdsub->sh;
- unsigned int *palette = NULL;
- if (sh && sh->has_palette)
- palette = sh->palette;
- current_module="spudec_init_normal";
- vo_spudec=spudec_new_scaled(palette, sh_video->disp_w, sh_video->disp_h);
- spudec_set_font_factor(vo_spudec,font_factor);
-}
-
-if (vo_spudec!=NULL)
- inited_flags|=INITED_SPUDEC;
-
+ init_vo_spudec();
}
// Apply current settings for forced subs