summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-07-31 21:33:26 +0200
committerwm4 <wm4@nowhere>2012-07-31 21:33:26 +0200
commit89a17bcda6c166e98861723b8adc9989f2724c34 (patch)
treef89e05ea12d48c92b04c90c5d447521d29db711c /input
parent6e020e66e0e454e8c7f1eeb17e85b90262e95386 (diff)
downloadmpv-89a17bcda6c166e98861723b8adc9989f2724c34.tar.bz2
mpv-89a17bcda6c166e98861723b8adc9989f2724c34.tar.xz
mplayer: turn playtree into a list, and change per-file option handling
Summary: - There is no playtree anymore. It's reduced to a simple list. - Options are now always global. You can still have per-file options, but these are optional and require special syntax. - The slave command pt_step has been removed, and playlist_next and playlist_prev added. (See etc/input.conf changes.) This is a user visible incompatible change, and will break slave-mode applications. - The pt_clear slave command is renamed to playlist_clear. - Playtree entries could have multiple files. This is not the case anymore, and playlist entries have always exactly one entry. Whenever something adds more than one file (like ASX playlists or dvd:// or dvdnav:// on the command line), all files are added as separate playlist entries. Note that some of the changes are quite deep and violent. Expect regressions. The playlist parsing code in particular is of low quality. I didn't try to improve it, and merely spent to least effort necessary to keep it somehow working. (Especially ASX playlist handling.) The playtree code was complicated and bloated. It was also barely used. Most users don't even know that mplayer manages the playlist as tree, or how to use it. The most obscure features was probably specifying a tree on command line (with '{' and '}' to create/close tree nodes). It filled the player code with complexity and confused users with weird slave commands like pt_up. Replace the playtree with a simple flat playlist. Playlist parsers that actually return trees are changed to append all files to the playlist pre-order. It used to be the responsibility of the playtree code to change per-file config options. Now this is done by the player core, and the playlist code is free of such details. Options are not per-file by default anymore. This was a very obscure and complicated feature that confused even experienced users. Consider the following command line: mplayer file1.mkv file2.mkv --no-audio file3.mkv This will disable the audio for file2.mkv only, because options are per-file by default. To make the option affect all files, you're supposed to put it before the first file. This is bad, because normally you don't need per-file options. They are very rarely needed, and the only reasonable use cases I can imagine are use of the encode backend (mplayer encode branch), or for debugging. The normal use case is made harder, and the feature is perceived as bug. Even worse, correct usage is hard to explain for users. Make all options global by default. The position of an option isn't significant anymore (except for options that compensate each other, consider --shuffle --no-shuffle). One other important change is that no options are reset anymore if a new file is started. If you change settings with slave mode commands, they will not be changed by playing a new file. (Exceptions include settings that are too file specific, like audio/subtitle stream selection.) There is still some need for per-file options. Debugging and encoding are use cases that profit from per-file options. Per-file profiles (as well as per-protocol and per-VO/AO options) need the implementation related mechanisms to backup and restore options when the playback file changes. Simplify the save-slot stuff, which is possible because there is no hierarchical play tree anymore. Now there's a simple backup field. Add a way to specify per-file options on command line. Example: mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3 will have the following options per file set: f1.mkv, f4.mkv: -o0 -o3 f2.mkv, f3.mkv: -o0 -o3 -o1 -o2 The options --{ and --} start and end per-file options. All files inside the { } will be affected by the options equally (similar to how global options and multiple files are handled). When playback of a file starts, the per-file options are set according to the command line. When playback ends, the per-file options are restored to the values when playback started.
Diffstat (limited to 'input')
-rw-r--r--input/input.c32
-rw-r--r--input/input.h10
2 files changed, 19 insertions, 23 deletions
diff --git a/input/input.c b/input/input.c
index dbc29d964f..836c9df14a 100644
--- a/input/input.c
+++ b/input/input.c
@@ -108,9 +108,8 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_STOP, "stop", },
{ MP_CMD_PAUSE, "pause", },
{ MP_CMD_FRAME_STEP, "frame_step", },
- { MP_CMD_PLAY_TREE_STEP, "pt_step", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_PLAY_TREE_UP_STEP, "pt_up_step", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_PLAY_ALT_SRC_STEP, "alt_src_step", { ARG_INT } },
+ { MP_CMD_PLAYLIST_NEXT, "playlist_next", { OARG_INT(0) } },
+ { MP_CMD_PLAYLIST_PREV, "playlist_prev", { OARG_INT(0) } },
{ MP_CMD_LOOP, "loop", { ARG_INT, OARG_INT(0) } },
{ MP_CMD_SUB_DELAY, "sub_delay", { ARG_FLOAT, OARG_INT(0) } },
{ MP_CMD_SUB_STEP, "sub_step", { ARG_INT, OARG_INT(0) } },
@@ -193,7 +192,7 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_SWITCH_VSYNC, "switch_vsync", { OARG_INT(0) } },
{ MP_CMD_LOADFILE, "loadfile", { ARG_STRING, OARG_INT(0) } },
{ MP_CMD_LOADLIST, "loadlist", { ARG_STRING, OARG_INT(0) } },
- { MP_CMD_PLAY_TREE_CLEAR, "pt_clear", },
+ { MP_CMD_PLAYLIST_CLEAR, "playlist_clear", },
{ MP_CMD_RUN, "run", { ARG_STRING } },
{ MP_CMD_CAPTURING, "capturing", },
{ MP_CMD_VF_CHANGE_RECTANGLE, "change_rectangle", { ARG_INT, ARG_INT } },
@@ -444,13 +443,9 @@ static const struct cmd_bind def_cmd_binds[] = {
{ { 'p', 0 }, "pause" },
{ { ' ', 0 }, "pause" },
{ { '.', 0 }, "frame_step" },
- { { KEY_HOME, 0 }, "pt_up_step 1" },
- { { KEY_END, 0 }, "pt_up_step -1" },
- { { '>', 0 }, "pt_step 1" },
- { { KEY_ENTER, 0 }, "pt_step 1 1" },
- { { '<', 0 }, "pt_step -1" },
- { { KEY_INS, 0 }, "alt_src_step 1" },
- { { KEY_DEL, 0 }, "alt_src_step -1" },
+ { { '>', 0 }, "playlist_next" },
+ { { KEY_ENTER, 0 }, "playlist_next 1" },
+ { { '<', 0 }, "playlist_prev" },
{ { 'o', 0 }, "osd" },
{ { 'I', 0 }, "osd_show_property_text \"${filename}\"" },
{ { 'P', 0 }, "osd_show_progression" },
@@ -537,8 +532,8 @@ static const struct cmd_bind def_cmd_binds[] = {
{ { KEY_STOP, 0 }, "quit" },
{ { KEY_FORWARD, 0 }, "seek 60" },
{ { KEY_REWIND, 0 }, "seek -60" },
- { { KEY_NEXT, 0 }, "pt_step 1" },
- { { KEY_PREV, 0 }, "pt_step -1" },
+ { { KEY_NEXT, 0 }, "playlist_next" },
+ { { KEY_PREV, 0 }, "playlist_prev" },
{ { KEY_VOLUME_UP, 0 }, "volume 1" },
{ { KEY_VOLUME_DOWN, 0 }, "volume -1" },
{ { KEY_MUTE, 0 }, "mute" },
@@ -709,13 +704,12 @@ static char *get_key_combo_name(int *keys, int max)
return ret;
}
-static bool is_abort_cmd(int cmd_id)
+bool mp_input_is_abort_cmd(int cmd_id)
{
switch (cmd_id) {
case MP_CMD_QUIT:
- case MP_CMD_PLAY_TREE_STEP:
- case MP_CMD_PLAY_TREE_UP_STEP:
- case MP_CMD_PLAY_ALT_SRC_STEP:
+ case MP_CMD_PLAYLIST_NEXT:
+ case MP_CMD_PLAYLIST_PREV:
return true;
}
return false;
@@ -732,7 +726,7 @@ static int queue_count_cmds(struct cmd_queue *queue)
static bool queue_has_abort_cmds(struct cmd_queue *queue)
{
for (struct mp_cmd *cmd = queue->first; cmd; cmd = cmd->queue_next) {
- if (is_abort_cmd(cmd->id))
+ if (mp_input_is_abort_cmd(cmd->id))
return true;
}
return false;
@@ -1339,7 +1333,7 @@ void mp_input_feed_key(struct input_ctx *ictx, int code)
return;
struct cmd_queue *queue = &ictx->key_cmd_queue;
if (queue_count_cmds(queue) >= ictx->key_fifo_size &&
- (!is_abort_cmd(cmd->id) || queue_has_abort_cmds(queue)))
+ (!mp_input_is_abort_cmd(cmd->id) || queue_has_abort_cmds(queue)))
return;
queue_add(queue, cmd, false);
}
diff --git a/input/input.h b/input/input.h
index 977901b6d3..922cc21bbc 100644
--- a/input/input.h
+++ b/input/input.h
@@ -28,9 +28,8 @@ enum mp_command_type {
MP_CMD_QUIT,
MP_CMD_PAUSE,
MP_CMD_GRAB_FRAMES, // deprecated: was a no-op command for years
- MP_CMD_PLAY_TREE_STEP,
- MP_CMD_PLAY_TREE_UP_STEP,
- MP_CMD_PLAY_ALT_SRC_STEP,
+ MP_CMD_PLAYLIST_NEXT,
+ MP_CMD_PLAYLIST_PREV,
MP_CMD_SUB_DELAY,
MP_CMD_OSD,
MP_CMD_VOLUME,
@@ -52,7 +51,7 @@ enum mp_command_type {
MP_CMD_MUTE,
MP_CMD_LOADFILE,
MP_CMD_LOADLIST,
- MP_CMD_PLAY_TREE_CLEAR,
+ MP_CMD_PLAYLIST_CLEAR,
MP_CMD_VF_CHANGE_RECTANGLE,
MP_CMD_GAMMA,
MP_CMD_SUB_VISIBILITY,
@@ -201,6 +200,9 @@ typedef struct mp_cmd {
} mp_cmd_t;
+// Executing this command will abort playback (play something else, or quit).
+bool mp_input_is_abort_cmd(int cmd_id);
+
/* Add a new command input source.
* "fd" is a file descriptor (use a negative value if you don't use any fd)
* "select" tells whether to use select() on the fd to determine when to