Mercurial > mplayer.hg
comparison mplayer.c @ 15706:c6bedab03c97
Add sub_load and sub_remove slave commands.
Patch by kiriuja [mplayer-patches at en-directo dot net]
author | reimar |
---|---|
date | Thu, 09 Jun 2005 20:13:53 +0000 |
parents | 2d1ad16b6021 |
children | 32d9c8a0a02b |
comparison
equal
deleted
inserted
replaced
15705:e7dcc698718b | 15706:c6bedab03c97 |
---|---|
3373 #ifdef USE_SUB | 3373 #ifdef USE_SUB |
3374 if (sh_video) { | 3374 if (sh_video) { |
3375 sub_visibility=1-sub_visibility; | 3375 sub_visibility=1-sub_visibility; |
3376 osd_show_sub_visibility = 9; // show state of subtitle visibility in OSD | 3376 osd_show_sub_visibility = 9; // show state of subtitle visibility in OSD |
3377 vo_osd_changed(OSDTYPE_SUBTITLE); | 3377 vo_osd_changed(OSDTYPE_SUBTITLE); |
3378 } | |
3379 #endif | |
3380 } break; | |
3381 case MP_CMD_SUB_LOAD: | |
3382 { | |
3383 #ifdef USE_SUB | |
3384 if (sh_video) { | |
3385 int n = set_of_sub_size; | |
3386 add_subtitles(cmd->args[0].v.s, sh_video->fps, 0); | |
3387 if (n != set_of_sub_size) { | |
3388 if (global_sub_indices[SUB_SOURCE_SUBS] < 0) | |
3389 global_sub_indices[SUB_SOURCE_SUBS] = global_sub_size; | |
3390 ++global_sub_size; | |
3391 } | |
3392 } | |
3393 #endif | |
3394 } break; | |
3395 case MP_CMD_SUB_REMOVE: | |
3396 { | |
3397 #ifdef USE_SUB | |
3398 if (sh_video) { | |
3399 int v = cmd->args[0].v.i; | |
3400 sub_data *subd; | |
3401 if (v < 0) { | |
3402 for (v = 0; v < set_of_sub_size; ++v) { | |
3403 subd = set_of_subtitles[v]; | |
3404 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1, subd->filename); | |
3405 sub_free(subd); | |
3406 set_of_subtitles[v] = NULL; | |
3407 } | |
3408 global_sub_indices[SUB_SOURCE_SUBS] = -1; | |
3409 global_sub_size -= set_of_sub_size; | |
3410 set_of_sub_size = 0; | |
3411 if (set_of_sub_pos >= 0) { | |
3412 global_sub_pos = -2; | |
3413 vo_sub_last = vo_sub = NULL; | |
3414 vo_osd_changed(OSDTYPE_SUBTITLE); | |
3415 vo_update_osd(sh_video->disp_w, sh_video->disp_h); | |
3416 mp_input_queue_cmd(mp_input_parse_cmd("sub_select")); | |
3417 } | |
3418 } | |
3419 else if (v < set_of_sub_size) { | |
3420 subd = set_of_subtitles[v]; | |
3421 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1, subd->filename); | |
3422 sub_free(subd); | |
3423 if (set_of_sub_pos == v) { | |
3424 global_sub_pos = -2; | |
3425 vo_sub_last = vo_sub = NULL; | |
3426 vo_osd_changed(OSDTYPE_SUBTITLE); | |
3427 vo_update_osd(sh_video->disp_w, sh_video->disp_h); | |
3428 mp_input_queue_cmd(mp_input_parse_cmd("sub_select")); | |
3429 } | |
3430 else if (set_of_sub_pos > v) { | |
3431 --set_of_sub_pos; | |
3432 --global_sub_pos; | |
3433 } | |
3434 while (++v < set_of_sub_size) | |
3435 set_of_subtitles[v - 1] = set_of_subtitles[v]; | |
3436 --set_of_sub_size; | |
3437 --global_sub_size; | |
3438 if (set_of_sub_size <= 0) | |
3439 global_sub_indices[SUB_SOURCE_SUBS] = -1; | |
3440 set_of_subtitles[set_of_sub_size] = NULL; | |
3441 } | |
3378 } | 3442 } |
3379 #endif | 3443 #endif |
3380 } break; | 3444 } break; |
3381 case MP_CMD_GET_SUB_VISIBILITY: | 3445 case MP_CMD_GET_SUB_VISIBILITY: |
3382 { | 3446 { |