Mercurial > mplayer.hg
comparison mplayer.c @ 21140:b42f1c1ef651
Make compilation depending on USE_SUB unconditional.
USE_SUB was hardcoded to true in configure, manually turning it off
would break compilation, and there's no apparent reason why having all
subtitle code under #ifdefs (even working ones) would be worth the
clutter.
author | uau |
---|---|
date | Tue, 21 Nov 2006 20:48:17 +0000 |
parents | f508dff0bd43 |
children | ad7747bce52d |
comparison
equal
deleted
inserted
replaced
21139:65d41a1f8fc4 | 21140:b42f1c1ef651 |
---|---|
48 #include "m_config.h" | 48 #include "m_config.h" |
49 #include "m_property.h" | 49 #include "m_property.h" |
50 | 50 |
51 #include "cfg-mplayer-def.h" | 51 #include "cfg-mplayer-def.h" |
52 | 52 |
53 #ifdef USE_SUB | |
54 #include "subreader.h" | 53 #include "subreader.h" |
55 #endif | |
56 | 54 |
57 #include "libvo/video_out.h" | 55 #include "libvo/video_out.h" |
58 | 56 |
59 #include "libvo/font_load.h" | 57 #include "libvo/font_load.h" |
60 #include "libvo/sub.h" | 58 #include "libvo/sub.h" |
338 int sub_auto = 1; | 336 int sub_auto = 1; |
339 char *vobsub_name=NULL; | 337 char *vobsub_name=NULL; |
340 /*DSP!!char *dsp=NULL;*/ | 338 /*DSP!!char *dsp=NULL;*/ |
341 int subcc_enabled=0; | 339 int subcc_enabled=0; |
342 int suboverlap_enabled = 1; | 340 int suboverlap_enabled = 1; |
343 #ifdef USE_SUB | 341 |
344 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES]; | 342 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES]; |
345 int set_of_sub_size = 0; | 343 int set_of_sub_size = 0; |
346 int set_of_sub_pos = -1; | 344 int set_of_sub_pos = -1; |
347 double sub_last_pts = -303; | 345 double sub_last_pts = -303; |
348 #endif | 346 |
349 int global_sub_size = 0; // this encompasses all subtitle sources | 347 int global_sub_size = 0; // this encompasses all subtitle sources |
350 int global_sub_pos = -1; // this encompasses all subtitle sources | 348 int global_sub_pos = -1; // this encompasses all subtitle sources |
351 #define SUB_SOURCE_SUBS 0 | 349 #define SUB_SOURCE_SUBS 0 |
352 #define SUB_SOURCE_VOBSUB 1 | 350 #define SUB_SOURCE_VOBSUB 1 |
353 #define SUB_SOURCE_DEMUX 2 | 351 #define SUB_SOURCE_DEMUX 2 |
961 } | 959 } |
962 } | 960 } |
963 return source; | 961 return source; |
964 } | 962 } |
965 | 963 |
966 #ifdef USE_SUB | |
967 | |
968 sub_data* subdata = NULL; | 964 sub_data* subdata = NULL; |
969 static subtitle* vo_sub_last = NULL; | 965 static subtitle* vo_sub_last = NULL; |
970 | 966 |
971 void add_subtitles(char *filename, float fps, int silent) | 967 void add_subtitles(char *filename, float fps, int silent) |
972 { | 968 { |
1027 else if (set_of_sub_size <= 0 && subdata != NULL) { // *subdata was added | 1023 else if (set_of_sub_size <= 0 && subdata != NULL) { // *subdata was added |
1028 set_of_subtitles[set_of_sub_pos=set_of_sub_size] = subdata; | 1024 set_of_subtitles[set_of_sub_pos=set_of_sub_size] = subdata; |
1029 ++set_of_sub_size; | 1025 ++set_of_sub_size; |
1030 } | 1026 } |
1031 } | 1027 } |
1032 #endif /* USE_SUB */ | |
1033 | 1028 |
1034 void init_vo_spudec(void) { | 1029 void init_vo_spudec(void) { |
1035 if (vo_spudec) | 1030 if (vo_spudec) |
1036 spudec_free(vo_spudec); | 1031 spudec_free(vo_spudec); |
1037 inited_flags &= ~INITED_SPUDEC; | 1032 inited_flags &= ~INITED_SPUDEC; |
1257 guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter); | 1252 guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter); |
1258 #endif | 1253 #endif |
1259 return result; | 1254 return result; |
1260 } | 1255 } |
1261 | 1256 |
1262 #ifdef USE_SUB | |
1263 /** | 1257 /** |
1264 * \brief Log the currently displayed subtitle to a file | 1258 * \brief Log the currently displayed subtitle to a file |
1265 * | 1259 * |
1266 * Logs the current or last displayed subtitle together with filename | 1260 * Logs the current or last displayed subtitle together with filename |
1267 * and time information to ~/.mplayer/subtitle_log | 1261 * and time information to ~/.mplayer/subtitle_log |
1292 for (i = 0; i < vo_sub_last->lines; i++) { | 1286 for (i = 0; i < vo_sub_last->lines; i++) { |
1293 fprintf(f, "%s\n", vo_sub_last->text[i]); | 1287 fprintf(f, "%s\n", vo_sub_last->text[i]); |
1294 } | 1288 } |
1295 fclose(f); | 1289 fclose(f); |
1296 } | 1290 } |
1297 #endif /* USE_SUB */ | |
1298 | 1291 |
1299 /// \defgroup OSDMsgStack OSD message stack | 1292 /// \defgroup OSDMsgStack OSD message stack |
1300 /// | 1293 /// |
1301 ///@{ | 1294 ///@{ |
1302 | 1295 |
2201 /// \ingroup Properties | 2194 /// \ingroup Properties |
2202 ///@{ | 2195 ///@{ |
2203 | 2196 |
2204 /// Text subtitle position (RW) | 2197 /// Text subtitle position (RW) |
2205 static int mp_property_sub_pos(m_option_t* prop,int action,void* arg) { | 2198 static int mp_property_sub_pos(m_option_t* prop,int action,void* arg) { |
2206 #ifdef USE_SUB | |
2207 if(!sh_video) return M_PROPERTY_UNAVAILABLE; | 2199 if(!sh_video) return M_PROPERTY_UNAVAILABLE; |
2208 | 2200 |
2209 switch(action) { | 2201 switch(action) { |
2210 case M_PROPERTY_SET: | 2202 case M_PROPERTY_SET: |
2211 if(!arg) return M_PROPERTY_ERROR; | 2203 if(!arg) return M_PROPERTY_ERROR; |
2213 case M_PROPERTY_STEP_DOWN: | 2205 case M_PROPERTY_STEP_DOWN: |
2214 vo_osd_changed(OSDTYPE_SUBTITLE); | 2206 vo_osd_changed(OSDTYPE_SUBTITLE); |
2215 default: | 2207 default: |
2216 return m_property_int_range(prop,action,arg,&sub_pos); | 2208 return m_property_int_range(prop,action,arg,&sub_pos); |
2217 } | 2209 } |
2218 #else | |
2219 return M_PROPERTY_UNAVAILABLE; | |
2220 #endif | |
2221 } | 2210 } |
2222 | 2211 |
2223 /// Selected subtitles (RW) | 2212 /// Selected subtitles (RW) |
2224 static int mp_property_sub(m_option_t* prop,int action,void* arg) { | 2213 static int mp_property_sub(m_option_t* prop,int action,void* arg) { |
2225 int source = -1, reset_spu = 0; | 2214 int source = -1, reset_spu = 0; |
2235 case M_PROPERTY_PRINT: | 2224 case M_PROPERTY_PRINT: |
2236 if(!arg) return M_PROPERTY_ERROR; | 2225 if(!arg) return M_PROPERTY_ERROR; |
2237 *(char**)arg = malloc(64); | 2226 *(char**)arg = malloc(64); |
2238 (*(char**)arg)[63] = 0; | 2227 (*(char**)arg)[63] = 0; |
2239 sub_name = 0; | 2228 sub_name = 0; |
2240 #ifdef USE_SUB | |
2241 if(subdata) | 2229 if(subdata) |
2242 sub_name = subdata->filename; | 2230 sub_name = subdata->filename; |
2243 #endif | |
2244 #ifdef USE_ASS | 2231 #ifdef USE_ASS |
2245 if (ass_track && ass_track->name) | 2232 if (ass_track && ass_track->name) |
2246 sub_name = ass_track->name; | 2233 sub_name = ass_track->name; |
2247 #endif | 2234 #endif |
2248 #if defined(USE_SUB) || defined(USE_ASS) | |
2249 if(sub_name) { | 2235 if(sub_name) { |
2250 char *tmp,*tmp2; | 2236 char *tmp,*tmp2; |
2251 tmp = sub_name; | 2237 tmp = sub_name; |
2252 if ((tmp2 = strrchr(tmp, '/'))) | 2238 if ((tmp2 = strrchr(tmp, '/'))) |
2253 tmp = tmp2+1; | 2239 tmp = tmp2+1; |
2256 set_of_sub_pos + 1, | 2242 set_of_sub_pos + 1, |
2257 strlen(tmp) < 20 ? "" : "...", | 2243 strlen(tmp) < 20 ? "" : "...", |
2258 strlen(tmp) < 20 ? tmp : tmp+strlen(tmp)-19); | 2244 strlen(tmp) < 20 ? tmp : tmp+strlen(tmp)-19); |
2259 return M_PROPERTY_OK; | 2245 return M_PROPERTY_OK; |
2260 } | 2246 } |
2261 #endif | |
2262 if (demuxer->type == DEMUXER_TYPE_MATROSKA && dvdsub_id >= 0) { | 2247 if (demuxer->type == DEMUXER_TYPE_MATROSKA && dvdsub_id >= 0) { |
2263 char lang[40] = MSGTR_Unknown; | 2248 char lang[40] = MSGTR_Unknown; |
2264 demux_mkv_get_sub_lang(demuxer, dvdsub_id, lang, 9); | 2249 demux_mkv_get_sub_lang(demuxer, dvdsub_id, lang, 9); |
2265 snprintf(*(char**)arg, 63, "(%d) %s", dvdsub_id, lang); | 2250 snprintf(*(char**)arg, 63, "(%d) %s", dvdsub_id, lang); |
2266 return M_PROPERTY_OK; | 2251 return M_PROPERTY_OK; |
2326 global_sub_size, global_sub_indices[SUB_SOURCE_VOBSUB], | 2311 global_sub_size, global_sub_indices[SUB_SOURCE_VOBSUB], |
2327 global_sub_indices[SUB_SOURCE_SUBS], | 2312 global_sub_indices[SUB_SOURCE_SUBS], |
2328 global_sub_indices[SUB_SOURCE_DEMUX], | 2313 global_sub_indices[SUB_SOURCE_DEMUX], |
2329 global_sub_pos, source); | 2314 global_sub_pos, source); |
2330 | 2315 |
2331 #ifdef USE_SUB | |
2332 set_of_sub_pos = -1; | 2316 set_of_sub_pos = -1; |
2333 subdata = NULL; | 2317 subdata = NULL; |
2334 vo_sub_last = vo_sub = NULL; | 2318 vo_sub_last = vo_sub = NULL; |
2335 #endif | 2319 |
2336 vobsub_id = -1; | 2320 vobsub_id = -1; |
2337 dvdsub_id = -1; | 2321 dvdsub_id = -1; |
2338 if (d_dvdsub) { | 2322 if (d_dvdsub) { |
2339 if(d_dvdsub->id > -2) reset_spu = 1; | 2323 if(d_dvdsub->id > -2) reset_spu = 1; |
2340 d_dvdsub->id = -2; | 2324 d_dvdsub->id = -2; |
2343 ass_track = 0; | 2327 ass_track = 0; |
2344 #endif | 2328 #endif |
2345 | 2329 |
2346 if (source == SUB_SOURCE_VOBSUB) { | 2330 if (source == SUB_SOURCE_VOBSUB) { |
2347 vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB]; | 2331 vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB]; |
2348 #ifdef USE_SUB | |
2349 } else if (source == SUB_SOURCE_SUBS) { | 2332 } else if (source == SUB_SOURCE_SUBS) { |
2350 set_of_sub_pos = global_sub_pos - global_sub_indices[SUB_SOURCE_SUBS]; | 2333 set_of_sub_pos = global_sub_pos - global_sub_indices[SUB_SOURCE_SUBS]; |
2351 #ifdef USE_ASS | 2334 #ifdef USE_ASS |
2352 if (ass_enabled && set_of_ass_tracks[set_of_sub_pos]) | 2335 if (ass_enabled && set_of_ass_tracks[set_of_sub_pos]) |
2353 ass_track = set_of_ass_tracks[set_of_sub_pos]; | 2336 ass_track = set_of_ass_tracks[set_of_sub_pos]; |
2355 #endif | 2338 #endif |
2356 { | 2339 { |
2357 subdata = set_of_subtitles[set_of_sub_pos]; | 2340 subdata = set_of_subtitles[set_of_sub_pos]; |
2358 vo_osd_changed(OSDTYPE_SUBTITLE); | 2341 vo_osd_changed(OSDTYPE_SUBTITLE); |
2359 } | 2342 } |
2360 #endif | |
2361 } else if (source == SUB_SOURCE_DEMUX) { | 2343 } else if (source == SUB_SOURCE_DEMUX) { |
2362 dvdsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_DEMUX]; | 2344 dvdsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_DEMUX]; |
2363 if (d_dvdsub) { | 2345 if (d_dvdsub) { |
2364 #ifdef USE_DVDREAD | 2346 #ifdef USE_DVDREAD |
2365 if (vo_spudec && stream->type == STREAMTYPE_DVD) { | 2347 if (vo_spudec && stream->type == STREAMTYPE_DVD) { |
2389 ass_track = sh->ass_track; | 2371 ass_track = sh->ass_track; |
2390 #endif | 2372 #endif |
2391 } | 2373 } |
2392 } | 2374 } |
2393 } else { // off | 2375 } else { // off |
2394 #ifdef USE_SUB | |
2395 vo_osd_changed(OSDTYPE_SUBTITLE); | 2376 vo_osd_changed(OSDTYPE_SUBTITLE); |
2396 #endif | |
2397 if(vo_spudec) vo_osd_changed(OSDTYPE_SPU); | 2377 if(vo_spudec) vo_osd_changed(OSDTYPE_SPU); |
2398 } | 2378 } |
2399 #ifdef USE_DVDREAD | 2379 #ifdef USE_DVDREAD |
2400 if (vo_spudec && stream->type == STREAMTYPE_DVD && dvdsub_id < 0 && reset_spu) { | 2380 if (vo_spudec && stream->type == STREAMTYPE_DVD && dvdsub_id < 0 && reset_spu) { |
2401 dvdsub_id = -2; | 2381 dvdsub_id = -2; |
2413 return m_property_delay(prop,action,arg,&sub_delay); | 2393 return m_property_delay(prop,action,arg,&sub_delay); |
2414 } | 2394 } |
2415 | 2395 |
2416 /// Alignment of text subtitles (RW) | 2396 /// Alignment of text subtitles (RW) |
2417 static int mp_property_sub_alignment(m_option_t* prop,int action,void* arg) { | 2397 static int mp_property_sub_alignment(m_option_t* prop,int action,void* arg) { |
2418 #ifdef USE_SUB | |
2419 char* name[] = { MSGTR_Top, MSGTR_Center, MSGTR_Bottom }; | 2398 char* name[] = { MSGTR_Top, MSGTR_Center, MSGTR_Bottom }; |
2420 | 2399 |
2421 if(!sh_video || global_sub_pos < 0 || sub_source() != SUB_SOURCE_SUBS) | 2400 if(!sh_video || global_sub_pos < 0 || sub_source() != SUB_SOURCE_SUBS) |
2422 return M_PROPERTY_UNAVAILABLE; | 2401 return M_PROPERTY_UNAVAILABLE; |
2423 | 2402 |
2433 case M_PROPERTY_STEP_DOWN: | 2412 case M_PROPERTY_STEP_DOWN: |
2434 vo_osd_changed(OSDTYPE_SUBTITLE); | 2413 vo_osd_changed(OSDTYPE_SUBTITLE); |
2435 default: | 2414 default: |
2436 return m_property_choice(prop,action,arg,&sub_alignment); | 2415 return m_property_choice(prop,action,arg,&sub_alignment); |
2437 } | 2416 } |
2438 #else | |
2439 return M_PROPERTY_UNAVAILABLE; | |
2440 #endif | |
2441 } | 2417 } |
2442 | 2418 |
2443 /// Subtitle visibility (RW) | 2419 /// Subtitle visibility (RW) |
2444 static int mp_property_sub_visibility(m_option_t* prop,int action,void* arg) { | 2420 static int mp_property_sub_visibility(m_option_t* prop,int action,void* arg) { |
2445 #ifdef USE_SUB | |
2446 if(!sh_video) return M_PROPERTY_UNAVAILABLE; | 2421 if(!sh_video) return M_PROPERTY_UNAVAILABLE; |
2447 | 2422 |
2448 switch(action) { | 2423 switch(action) { |
2449 case M_PROPERTY_SET: | 2424 case M_PROPERTY_SET: |
2450 if(!arg) return M_PROPERTY_ERROR; | 2425 if(!arg) return M_PROPERTY_ERROR; |
2453 vo_osd_changed(OSDTYPE_SUBTITLE); | 2428 vo_osd_changed(OSDTYPE_SUBTITLE); |
2454 if(vo_spudec) vo_osd_changed(OSDTYPE_SPU); | 2429 if(vo_spudec) vo_osd_changed(OSDTYPE_SPU); |
2455 default: | 2430 default: |
2456 return m_property_flag(prop,action,arg,&sub_visibility); | 2431 return m_property_flag(prop,action,arg,&sub_visibility); |
2457 } | 2432 } |
2458 #else | |
2459 return M_PROPERTY_UNAVAILABLE; | |
2460 #endif | |
2461 } | 2433 } |
2462 | 2434 |
2463 /// Show only forced subtitles (RW) | 2435 /// Show only forced subtitles (RW) |
2464 static int mp_property_sub_forced_only(m_option_t* prop,int action,void* arg) { | 2436 static int mp_property_sub_forced_only(m_option_t* prop,int action,void* arg) { |
2465 if(!vo_spudec) return M_PROPERTY_UNAVAILABLE; | 2437 if(!vo_spudec) return M_PROPERTY_UNAVAILABLE; |
2897 audio_out->get_delay(); | 2869 audio_out->get_delay(); |
2898 } | 2870 } |
2899 | 2871 |
2900 static void update_subtitles(void) | 2872 static void update_subtitles(void) |
2901 { | 2873 { |
2902 #ifdef USE_SUB | |
2903 // find sub | 2874 // find sub |
2904 if (subdata) { | 2875 if (subdata) { |
2905 double pts = sh_video->pts; | 2876 double pts = sh_video->pts; |
2906 if (sub_fps==0) sub_fps = sh_video->fps; | 2877 if (sub_fps==0) sub_fps = sh_video->fps; |
2907 current_module = "find_sub"; | 2878 current_module = "find_sub"; |
2911 if (vo_sub) vo_sub_last = vo_sub; | 2882 if (vo_sub) vo_sub_last = vo_sub; |
2912 // FIXME! frame counter... | 2883 // FIXME! frame counter... |
2913 sub_last_pts = pts; | 2884 sub_last_pts = pts; |
2914 } | 2885 } |
2915 } | 2886 } |
2916 #endif | |
2917 | 2887 |
2918 // DVD sub: | 2888 // DVD sub: |
2919 if (vo_config_count && vo_spudec) { | 2889 if (vo_config_count && vo_spudec) { |
2920 unsigned char* packet=NULL; | 2890 unsigned char* packet=NULL; |
2921 int len, timestamp; | 2891 int len, timestamp; |
4417 | 4387 |
4418 // Apply current settings for forced subs | 4388 // Apply current settings for forced subs |
4419 if (vo_spudec!=NULL) | 4389 if (vo_spudec!=NULL) |
4420 spudec_set_forced_subs_only(vo_spudec,forced_subs_only); | 4390 spudec_set_forced_subs_only(vo_spudec,forced_subs_only); |
4421 | 4391 |
4422 #ifdef USE_SUB | |
4423 if(sh_video) { | 4392 if(sh_video) { |
4424 // after reading video params we should load subtitles because | 4393 // after reading video params we should load subtitles because |
4425 // we know fps so now we can adjust subtitle time to ~6 seconds AST | 4394 // we know fps so now we can adjust subtitle time to ~6 seconds AST |
4426 // check .sub | 4395 // check .sub |
4427 current_module="read_subtitles_file"; | 4396 current_module="read_subtitles_file"; |
4444 // setup global sub numbering | 4413 // setup global sub numbering |
4445 global_sub_indices[SUB_SOURCE_SUBS] = global_sub_size; // the global # of the first sub. | 4414 global_sub_indices[SUB_SOURCE_SUBS] = global_sub_size; // the global # of the first sub. |
4446 global_sub_size += set_of_sub_size; | 4415 global_sub_size += set_of_sub_size; |
4447 } | 4416 } |
4448 } | 4417 } |
4449 #endif /* USE_SUB */ | |
4450 | 4418 |
4451 if (global_sub_size) { | 4419 if (global_sub_size) { |
4452 // find the best sub to use | 4420 // find the best sub to use |
4453 if (vobsub_id >= 0) { | 4421 if (vobsub_id >= 0) { |
4454 // if user asks for a vobsub id, use that first. | 4422 // if user asks for a vobsub id, use that first. |
4986 eof = PT_PREV_SRC; | 4954 eof = PT_PREV_SRC; |
4987 } | 4955 } |
4988 brk_cmd = 1; | 4956 brk_cmd = 1; |
4989 } break; | 4957 } break; |
4990 case MP_CMD_SUB_STEP : { | 4958 case MP_CMD_SUB_STEP : { |
4991 #ifdef USE_SUB | |
4992 if (sh_video) { | 4959 if (sh_video) { |
4993 int movement = cmd->args[0].v.i; | 4960 int movement = cmd->args[0].v.i; |
4994 step_sub(subdata, sh_video->pts, movement); | 4961 step_sub(subdata, sh_video->pts, movement); |
4995 #ifdef USE_ASS | 4962 #ifdef USE_ASS |
4996 if (ass_track) | 4963 if (ass_track) |
4997 sub_delay += ass_step_sub(ass_track, (sh_video->pts + sub_delay) * 1000 + .5, movement) / 1000.; | 4964 sub_delay += ass_step_sub(ass_track, (sh_video->pts + sub_delay) * 1000 + .5, movement) / 1000.; |
4998 #endif | 4965 #endif |
4999 set_osd_msg(OSD_MSG_SUB_DELAY,1,osd_duration, | 4966 set_osd_msg(OSD_MSG_SUB_DELAY,1,osd_duration, |
5000 MSGTR_OSDSubDelay, ROUND(sub_delay*1000)); | 4967 MSGTR_OSDSubDelay, ROUND(sub_delay*1000)); |
5001 } | 4968 } |
5002 #endif | |
5003 } break; | 4969 } break; |
5004 case MP_CMD_SUB_LOG : { | 4970 case MP_CMD_SUB_LOG : { |
5005 #ifdef USE_SUB | |
5006 log_sub(); | 4971 log_sub(); |
5007 #endif | |
5008 } break; | 4972 } break; |
5009 case MP_CMD_OSD : { | 4973 case MP_CMD_OSD : { |
5010 int v = cmd->args[0].v.i; | 4974 int v = cmd->args[0].v.i; |
5011 int max = use_term_osd ? MAX_TERM_OSD_LEVEL : MAX_OSD_LEVEL; | 4975 int max = use_term_osd ? MAX_TERM_OSD_LEVEL : MAX_OSD_LEVEL; |
5012 if(osd_level > max) osd_level = max; | 4976 if(osd_level > max) osd_level = max; |
5201 tv_step_chanlist((tvi_handle_t*)(demuxer->priv)); | 5165 tv_step_chanlist((tvi_handle_t*)(demuxer->priv)); |
5202 } break; | 5166 } break; |
5203 #endif /* USE_TV */ | 5167 #endif /* USE_TV */ |
5204 case MP_CMD_SUB_LOAD: | 5168 case MP_CMD_SUB_LOAD: |
5205 { | 5169 { |
5206 #ifdef USE_SUB | |
5207 if (sh_video) { | 5170 if (sh_video) { |
5208 int n = set_of_sub_size; | 5171 int n = set_of_sub_size; |
5209 add_subtitles(cmd->args[0].v.s, sh_video->fps, 0); | 5172 add_subtitles(cmd->args[0].v.s, sh_video->fps, 0); |
5210 if (n != set_of_sub_size) { | 5173 if (n != set_of_sub_size) { |
5211 if (global_sub_indices[SUB_SOURCE_SUBS] < 0) | 5174 if (global_sub_indices[SUB_SOURCE_SUBS] < 0) |
5212 global_sub_indices[SUB_SOURCE_SUBS] = global_sub_size; | 5175 global_sub_indices[SUB_SOURCE_SUBS] = global_sub_size; |
5213 ++global_sub_size; | 5176 ++global_sub_size; |
5214 } | 5177 } |
5215 } | 5178 } |
5216 #endif | |
5217 } break; | 5179 } break; |
5218 case MP_CMD_SUB_REMOVE: | 5180 case MP_CMD_SUB_REMOVE: |
5219 { | 5181 { |
5220 #ifdef USE_SUB | |
5221 if (sh_video) { | 5182 if (sh_video) { |
5222 int v = cmd->args[0].v.i; | 5183 int v = cmd->args[0].v.i; |
5223 sub_data *subd; | 5184 sub_data *subd; |
5224 if (v < 0) { | 5185 if (v < 0) { |
5225 for (v = 0; v < set_of_sub_size; ++v) { | 5186 for (v = 0; v < set_of_sub_size; ++v) { |
5261 if (set_of_sub_size <= 0) | 5222 if (set_of_sub_size <= 0) |
5262 global_sub_indices[SUB_SOURCE_SUBS] = -1; | 5223 global_sub_indices[SUB_SOURCE_SUBS] = -1; |
5263 set_of_subtitles[set_of_sub_size] = NULL; | 5224 set_of_subtitles[set_of_sub_size] = NULL; |
5264 } | 5225 } |
5265 } | 5226 } |
5266 #endif /* USE_SUB */ | |
5267 } break; | 5227 } break; |
5268 case MP_CMD_GET_SUB_VISIBILITY: | 5228 case MP_CMD_GET_SUB_VISIBILITY: |
5269 { | 5229 { |
5270 #ifdef USE_SUB | |
5271 if (sh_video) { | 5230 if (sh_video) { |
5272 mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_SUB_VISIBILITY=%d\n", sub_visibility); | 5231 mp_msg(MSGT_GLOBAL,MSGL_INFO, "ANS_SUB_VISIBILITY=%d\n", sub_visibility); |
5273 } | 5232 } |
5274 #endif | |
5275 } break; | 5233 } break; |
5276 case MP_CMD_SCREENSHOT : | 5234 case MP_CMD_SCREENSHOT : |
5277 if(vo_config_count){ | 5235 if(vo_config_count){ |
5278 mp_msg(MSGT_CPLAYER,MSGL_INFO,"sending VFCTRL_SCREENSHOT!\n"); | 5236 mp_msg(MSGT_CPLAYER,MSGL_INFO,"sending VFCTRL_SCREENSHOT!\n"); |
5279 if(CONTROL_OK!=((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SCREENSHOT, &cmd->args[0].v.i)) | 5237 if(CONTROL_OK!=((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SCREENSHOT, &cmd->args[0].v.i)) |
5675 } | 5633 } |
5676 | 5634 |
5677 // time to uninit all, except global stuff: | 5635 // time to uninit all, except global stuff: |
5678 uninit_player(INITED_ALL-(INITED_GUI+INITED_INPUT+(fixed_vo?INITED_VO:0))); | 5636 uninit_player(INITED_ALL-(INITED_GUI+INITED_INPUT+(fixed_vo?INITED_VO:0))); |
5679 | 5637 |
5680 #ifdef USE_SUB | |
5681 if ( set_of_sub_size > 0 ) | 5638 if ( set_of_sub_size > 0 ) |
5682 { | 5639 { |
5683 current_module="sub_free"; | 5640 current_module="sub_free"; |
5684 for (i = 0; i < set_of_sub_size; ++i) { | 5641 for (i = 0; i < set_of_sub_size; ++i) { |
5685 sub_free( set_of_subtitles[i] ); | 5642 sub_free( set_of_subtitles[i] ); |
5692 } | 5649 } |
5693 vo_sub_last = vo_sub=NULL; | 5650 vo_sub_last = vo_sub=NULL; |
5694 subdata=NULL; | 5651 subdata=NULL; |
5695 #ifdef USE_ASS | 5652 #ifdef USE_ASS |
5696 ass_track = NULL; | 5653 ass_track = NULL; |
5697 #endif | |
5698 #endif | 5654 #endif |
5699 | 5655 |
5700 if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) { | 5656 if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) { |
5701 eof = eof == PT_NEXT_ENTRY ? 1 : -1; | 5657 eof = eof == PT_NEXT_ENTRY ? 1 : -1; |
5702 if(play_tree_iter_step(playtree_iter,play_tree_step,0) == PLAY_TREE_ITER_ENTRY) { | 5658 if(play_tree_iter_step(playtree_iter,play_tree_step,0) == PLAY_TREE_ITER_ENTRY) { |