summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-19 18:06:06 +0200
committerwm4 <wm4@nowhere>2012-09-07 16:06:36 +0200
commit1fb275b7de1f58a14182594996930860295af6c4 (patch)
treecd9580d665920bc782eda89637c46205cb761233
parent330c90cbb8583ac41547bcd3d7259bc7b9e6a3b5 (diff)
downloadmpv-1fb275b7de1f58a14182594996930860295af6c4.tar.bz2
mpv-1fb275b7de1f58a14182594996930860295af6c4.tar.xz
command: remove sub_remove command
This messes deeply with the subtitle bookkeeping data structures, and would have to be reimplemented anyway. It's not sure what this was even useful for. Possibly for slave mode.
-rw-r--r--command.c68
-rw-r--r--input/input.c1
-rw-r--r--input/input.h1
3 files changed, 0 insertions, 70 deletions
diff --git a/command.c b/command.c
index 0e33ac3c64..3b8053c303 100644
--- a/command.c
+++ b/command.c
@@ -2486,64 +2486,6 @@ static const char *property_error_string(int error_value)
return "UNKNOWN";
}
-static void remove_subtitle_range(MPContext *mpctx, int start, int count)
-{
- int idx;
- int end = start + count;
- int after = mpctx->set_of_sub_size - end;
- sub_data **subs = mpctx->set_of_subtitles;
-#ifdef CONFIG_ASS
- struct ass_track **ass_tracks = mpctx->set_of_ass_tracks;
-#endif
- if (count < 0 || count > mpctx->set_of_sub_size ||
- start < 0 || start > mpctx->set_of_sub_size - count) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR,
- "Cannot remove invalid subtitle range %i +%i\n", start, count);
- return;
- }
- for (idx = start; idx < end; idx++) {
- sub_data *subd = subs[idx];
- char *filename = "";
- if (subd)
- filename = subd->filename;
-#ifdef CONFIG_ASS
- if (!subd)
- filename = ass_tracks[idx]->name;
-#endif
- mp_msg(MSGT_CPLAYER, MSGL_STATUS,
- "SUB: Removed subtitle file (%d): %s\n", idx + 1, filename);
- sub_free(subd);
- subs[idx] = NULL;
-#ifdef CONFIG_ASS
- if (ass_tracks[idx])
- ass_free_track(ass_tracks[idx]);
- ass_tracks[idx] = NULL;
-#endif
- }
-
- mpctx->global_sub_size -= count;
- mpctx->set_of_sub_size -= count;
- if (mpctx->set_of_sub_size <= 0)
- mpctx->sub_counts[SUB_SOURCE_SUBS] = 0;
-
- memmove(subs + start, subs + end, after * sizeof(*subs));
- memset(subs + start + after, 0, count * sizeof(*subs));
-#ifdef CONFIG_ASS
- memmove(ass_tracks + start, ass_tracks + end, after * sizeof(*ass_tracks));
- memset(ass_tracks + start + after, 0, count * sizeof(*ass_tracks));
-#endif
-
- if (mpctx->set_of_sub_pos >= start && mpctx->set_of_sub_pos < end) {
- mpctx->global_sub_pos = -2;
- mpctx->subdata = NULL;
- mpctx->osd->ass_track = NULL;
- mp_input_queue_cmd(mpctx->input, mp_input_parse_cmd("sub_select"));
- } else if (mpctx->set_of_sub_pos >= end) {
- mpctx->set_of_sub_pos -= count;
- mpctx->global_sub_pos -= count;
- }
-}
-
static char *format_time(double time)
{
int h, m, s = time;
@@ -3145,16 +3087,6 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
break;
- case MP_CMD_SUB_REMOVE:
- if (sh_video) {
- int v = cmd->args[0].v.i;
- if (v < 0)
- remove_subtitle_range(mpctx, 0, mpctx->set_of_sub_size);
- else if (v < mpctx->set_of_sub_size)
- remove_subtitle_range(mpctx, v, 1);
- }
- break;
-
case MP_CMD_GET_SUB_VISIBILITY:
if (sh_video) {
mp_msg(MSGT_GLOBAL, MSGL_INFO,
diff --git a/input/input.c b/input/input.c
index 34b8f019b8..4ea9e0c531 100644
--- a/input/input.c
+++ b/input/input.c
@@ -132,7 +132,6 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_SUB_ALIGNMENT, "sub_alignment", { OARG_INT(-1) } },
{ MP_CMD_SUB_VISIBILITY, "sub_visibility", { OARG_INT(-1) } },
{ MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } },
- { MP_CMD_SUB_REMOVE, "sub_remove", { OARG_INT(-1) } },
{ MP_CMD_SUB_SELECT, "vobsub_lang", { OARG_INT(-2) } }, // for compatibility
{ MP_CMD_SUB_SELECT, "sub_select", { OARG_INT(-2) } },
{ MP_CMD_SUB_SOURCE, "sub_source", { OARG_INT(-2) } },
diff --git a/input/input.h b/input/input.h
index 2460492df7..e1e333c486 100644
--- a/input/input.h
+++ b/input/input.h
@@ -84,7 +84,6 @@ enum mp_command_type {
MP_CMD_SWITCH_AUDIO,
MP_CMD_GET_TIME_POS,
MP_CMD_SUB_LOAD,
- MP_CMD_SUB_REMOVE,
MP_CMD_KEYDOWN_EVENTS,
MP_CMD_VO_BORDER,
MP_CMD_SET_PROPERTY,