Mercurial > mplayer.hg
changeset 21119:5f9009952814
Move vo_spudec initialization into a separate function, for later reuse
author | reimar |
---|---|
date | Tue, 21 Nov 2006 15:43:23 +0000 |
parents | 2b762f7a3bd8 |
children | f508dff0bd43 |
files | mplayer.c |
diffstat | 1 files changed, 46 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/mplayer.c Tue Nov 21 15:40:53 2006 +0000 +++ b/mplayer.c Tue Nov 21 15:43:23 2006 +0000 @@ -1031,6 +1031,51 @@ } #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 @@ //================== 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