comparison mplayer.c @ 33574:1a7606be0b94

Factor out a tiny bit of common code.
author reimar
date Sun, 19 Jun 2011 16:05:35 +0000
parents 4f9ad91c79b4
children c111d9e9cfb0
comparison
equal deleted inserted replaced
33573:42b250e4f40e 33574:1a7606be0b94
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 void init_vo_spudec(void) 1156 void init_vo_spudec(void)
1157 { 1157 {
1158 unsigned width, height;
1158 spudec_free(vo_spudec); 1159 spudec_free(vo_spudec);
1159 vo_spudec = NULL; 1160 vo_spudec = NULL;
1160 1161
1161 // we currently can't work without video stream 1162 // we currently can't work without video stream
1162 if (!mpctx->sh_video) 1163 if (!mpctx->sh_video)
1163 return; 1164 return;
1164 1165
1165 if (spudec_ifo) { 1166 if (spudec_ifo) {
1166 unsigned int palette[16], width, height; 1167 unsigned int palette[16];
1167 current_module = "spudec_init_vobsub"; 1168 current_module = "spudec_init_vobsub";
1168 if (vobsub_parse_ifo(NULL, spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0) 1169 if (vobsub_parse_ifo(NULL, spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0)
1169 vo_spudec = spudec_new_scaled(palette, width, height, NULL, 0); 1170 vo_spudec = spudec_new_scaled(palette, width, height, NULL, 0);
1170 } 1171 }
1172
1173 width = mpctx->sh_video->disp_w;
1174 height = mpctx->sh_video->disp_h;
1171 1175
1172 #ifdef CONFIG_DVDREAD 1176 #ifdef CONFIG_DVDREAD
1173 if (vo_spudec == NULL && mpctx->stream->type == STREAMTYPE_DVD) { 1177 if (vo_spudec == NULL && mpctx->stream->type == STREAMTYPE_DVD) {
1174 current_module = "spudec_init_dvdread"; 1178 current_module = "spudec_init_dvdread";
1175 vo_spudec = spudec_new_scaled(((dvd_priv_t *)(mpctx->stream->priv))->cur_pgc->palette, 1179 vo_spudec = spudec_new_scaled(((dvd_priv_t *)(mpctx->stream->priv))->cur_pgc->palette,
1176 mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, 1180 width, height,
1177 NULL, 0); 1181 NULL, 0);
1178 } 1182 }
1179 #endif 1183 #endif
1180 1184
1181 #ifdef CONFIG_DVDNAV 1185 #ifdef CONFIG_DVDNAV
1182 if (vo_spudec == NULL && mpctx->stream->type == STREAMTYPE_DVDNAV) { 1186 if (vo_spudec == NULL && mpctx->stream->type == STREAMTYPE_DVDNAV) {
1183 unsigned int *palette = mp_dvdnav_get_spu_clut(mpctx->stream); 1187 unsigned int *palette = mp_dvdnav_get_spu_clut(mpctx->stream);
1184 current_module = "spudec_init_dvdnav"; 1188 current_module = "spudec_init_dvdnav";
1185 vo_spudec = spudec_new_scaled(palette, mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, NULL, 0); 1189 vo_spudec = spudec_new_scaled(palette, width, height, NULL, 0);
1186 } 1190 }
1187 #endif 1191 #endif
1188 1192
1189 if (vo_spudec == NULL) { 1193 if (vo_spudec == NULL) {
1190 sh_sub_t *sh = mpctx->d_sub->sh; 1194 sh_sub_t *sh = mpctx->d_sub->sh;
1191 current_module = "spudec_init_normal"; 1195 current_module = "spudec_init_normal";
1192 vo_spudec = spudec_new_scaled(NULL, mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, sh->extradata, sh->extradata_len); 1196 vo_spudec = spudec_new_scaled(NULL, width, height, sh->extradata, sh->extradata_len);
1193 spudec_set_font_factor(vo_spudec, font_factor); 1197 spudec_set_font_factor(vo_spudec, font_factor);
1194 } 1198 }
1195 1199
1196 if (vo_spudec != NULL) { 1200 if (vo_spudec != NULL) {
1197 mp_property_do("sub_forced_only", M_PROPERTY_SET, &forced_subs_only, mpctx); 1201 mp_property_do("sub_forced_only", M_PROPERTY_SET, &forced_subs_only, mpctx);