summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-01 22:57:56 +0200
committerwm4 <wm4@nowhere>2014-08-01 22:57:56 +0200
commitbf5b1e9a0517b357b93ffaef7b6d96ad8b9917b0 (patch)
treec689fb6dc891f72b44eb7895dc57f9c376add0ed
parent6aac17cebbcec645a9c07043b78d57a9b04f2578 (diff)
downloadmpv-bf5b1e9a0517b357b93ffaef7b6d96ad8b9917b0.tar.bz2
mpv-bf5b1e9a0517b357b93ffaef7b6d96ad8b9917b0.tar.xz
Remove the last remains of slave mode
Almost nothing was left of it. The only thing this commit actually removes is support for reading input commands from stdin. But you can emulate this via: --input-file=/dev/stdin --input-terminal=no However, this won't work on Windows. Just use a named pipe.
-rw-r--r--DOCS/man/changes.rst18
-rw-r--r--DOCS/man/options.rst24
-rw-r--r--common/msg.c2
-rw-r--r--options/options.c1
-rw-r--r--options/options.h1
-rw-r--r--osdep/terminal-unix.c6
-rw-r--r--osdep/terminal-win.c25
-rw-r--r--osdep/terminal.h3
-rw-r--r--player/main.c11
9 files changed, 15 insertions, 76 deletions
diff --git a/DOCS/man/changes.rst b/DOCS/man/changes.rst
index f1f336ac7c..df6fe9adef 100644
--- a/DOCS/man/changes.rst
+++ b/DOCS/man/changes.rst
@@ -308,28 +308,28 @@ input.conf and Slave Commands
Slave mode
~~~~~~~~~~
-* Slave mode is broken. This mode is entirely insane in the ``old`` versions of
- MPlayer. A proper slave mode application needed tons of code and hacks to get
+* Slave mode was removed. A proper slave mode application needed tons of code
+ and hacks to get
it right. The main problem is that slave mode is a bad and incomplete
interface, and to get around that, applications parsed output messages
intended for users. It is hard to know which messages exactly are parsed by
slave mode applications. This makes it virtually impossible to improve
terminal output intended for users without possibly breaking something.
- This is absolutely insane, and **mpv** will not try to keep slave mode
- compatible. If you are a developer of a slave mode application, contact us,
- and a new and better protocol can be developed.
+ This is absolutely insane, and since initial improvements to **mpv** quickly
+ made slave mode incompatible to most applications, it was removed as useless
+ cruft. The client API (see below) is provided instead.
- ``--identify`` was already removed (``TOOLS/mpv_identify.sh`` is provided
- instead), and ``--slave-broken`` might be removed in the future.
+ ``--identify`` was replaced by the ``TOOLS/mpv_identify.sh`` wrapper script.
+
+* A JSON RPC protocol giving access to the client API is planned, but nothing
+ has emerged yet.
* **mpv** also provides a client API, which can be used to embed the player
by loading it as shared library. (See ``libmpv/client.h`` in the sources.)
It might also be possible to implement a custom slave mode-like protocol
using Lua scripting.
-* A slave protocol is planned, but nothing has emerged yet.
-
Policy for Removed Features
---------------------------
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 9f67523f66..e3cef52f99 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1191,8 +1191,7 @@ OPTIONS
``--idle``
Makes mpv wait idly instead of quitting when there is no file to play.
- Mostly useful in slave mode, where mpv can be controlled through input
- commands (see also ``--slave-broken``).
+ Useful with ``--force-window``, or for client API.
``--index=<mode>``
Controls how to seek in files. Note that if the index is missing from a
@@ -1252,7 +1251,6 @@ OPTIONS
``--input-file=<filename>``
Read commands from the given file. Mostly useful with a FIFO.
- See also ``--slave-broken``.
.. note::
@@ -2102,24 +2100,6 @@ OPTIONS
- ``mpv --slang=jpn example.mkv`` plays a Matroska file with Japanese
subtitles.
-``--slave-broken``
- Switches on the old slave mode. This is for testing only, and incompatible
- to the removed ``--slave`` switch.
-
- .. attention::
- Changes incompatible to slave mode applications have been made. In
- particular, the status line output was changed, which is used by some
- applications to determine the current playback position. This switch
- has been renamed to prevent these applications from working with this
- version of mpv, because it would lead to buggy and confusing behavior
- only. Moreover, the slave mode protocol is so horribly bad that it
- should not be used for new programs, nor should existing programs
- attempt to adapt to the changed output and use the ``--slave-broken``
- switch. Instead, a new, saner protocol should be developed (and will be,
- if there is enough interest).
-
- This affects most third-party GUI frontends.
-
``--softsleep``
Time frames by repeatedly checking the current time instead of asking
the kernel to wake up mpv at the correct time. Useful if your kernel
@@ -2860,8 +2840,6 @@ OPTIONS
as parent. The window will always be resized to cover the parent window
fully, and will add black bars to compensate for the video aspect ratio.
- See also ``--slave-broken``.
-
``--no-window-dragging``
Don't move the window when clicking on it and moving the mouse pointer.
diff --git a/common/msg.c b/common/msg.c
index 4f9bd886a5..d1c2530c2c 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -429,7 +429,7 @@ void mp_msg_update_msglevels(struct mpv_global *global)
root->show_time = opts->msg_time;
if (root->use_terminal) {
root->color = opts->msg_color && isatty(fileno(stdout));
- root->termosd = !opts->slave_mode && isatty(fileno(stderr));
+ root->termosd = isatty(fileno(stderr));
}
talloc_free(root->msglevels);
diff --git a/options/options.c b/options/options.c
index 0d7f426606..ff817bdc1f 100644
--- a/options/options.c
+++ b/options/options.c
@@ -509,7 +509,6 @@ const m_option_t mp_opts[] = {
OPT_STRING("term-status-msg", status_msg, 0),
OPT_STRING("osd-status-msg", osd_status_msg, 0),
- OPT_FLAG("slave-broken", slave_mode, CONF_GLOBAL),
OPT_FLAG("idle", player_idle_mode, M_OPT_GLOBAL),
OPT_FLAG("input-terminal", consolecontrols, CONF_GLOBAL),
diff --git a/options/options.h b/options/options.h
index b7db8b08ce..20b35d6864 100644
--- a/options/options.h
+++ b/options/options.h
@@ -147,7 +147,6 @@ typedef struct MPOpts {
char *heartbeat_cmd;
float heartbeat_interval;
int player_idle_mode;
- int slave_mode;
int consolecontrols;
struct m_rel_time play_start;
struct m_rel_time play_end;
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index 844054e1bd..21ed42cb68 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -466,6 +466,7 @@ static int read_keys(void *ctx, int fd)
void terminal_setup_getch(struct input_ctx *ictx)
{
mp_input_add_fd(ictx, 0, 1, NULL, read_keys, NULL, ictx);
+ getch2_enable();
}
static volatile int getch2_active = 0;
@@ -624,11 +625,6 @@ void terminal_set_foreground_color(FILE *stream, int c)
}
}
-void terminal_setup_stdin_cmd_input(struct input_ctx *ictx)
-{
- mp_input_add_fd(ictx, 0, 1, input_default_read_cmd, NULL, NULL, NULL);
-}
-
int terminal_init(void)
{
use_terminal = isatty(1);
diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c
index 918a073a17..19603d87d1 100644
--- a/osdep/terminal-win.c
+++ b/osdep/terminal-win.c
@@ -54,30 +54,6 @@ static const unsigned char ansi2win32[8] = {
FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED,
};
-static int mp_input_slave_cmd_func(void *ctx, int fd, char *dest, int size)
-{
- DWORD retval;
- HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
- if (PeekNamedPipe(in, NULL, size, &retval, NULL, NULL)) {
- if (size > retval)
- size = retval;
- } else {
- if (WaitForSingleObject(in, 0))
- size = 0;
- }
- if (!size)
- return MP_INPUT_NOTHING;
- ReadFile(in, dest, size, &retval, NULL);
- if (retval)
- return retval;
- return MP_INPUT_NOTHING;
-}
-
-void terminal_setup_stdin_cmd_input(struct input_ctx *ictx)
-{
- mp_input_add_fd(ictx, 0, 0, mp_input_slave_cmd_func, NULL, NULL, NULL);
-}
-
void get_screen_size(void)
{
CONSOLE_SCREEN_BUFFER_INFO cinfo;
@@ -170,6 +146,7 @@ static int read_keys(void *ctx, int fd)
void terminal_setup_getch(struct input_ctx *ictx)
{
mp_input_add_fd(ictx, 0, 1, NULL, read_keys, NULL, ictx);
+ getch2_enable();
}
void getch2_poll(void)
diff --git a/osdep/terminal.h b/osdep/terminal.h
index 651e31ed71..4495bfb471 100644
--- a/osdep/terminal.h
+++ b/osdep/terminal.h
@@ -39,9 +39,6 @@ extern char *terminal_cursor_up;
/* Global initialization for terminal output. */
int terminal_init(void);
-/* Setup ictx to read input commands from stdin (slave mode) */
-void terminal_setup_stdin_cmd_input(struct input_ctx *ictx);
-
/* Setup ictx to read keys from the terminal */
void terminal_setup_getch(struct input_ctx *ictx);
diff --git a/player/main.c b/player/main.c
index aebfa06fb1..13ecff9f9e 100644
--- a/player/main.c
+++ b/player/main.c
@@ -402,15 +402,8 @@ int mp_initialize(struct MPContext *mpctx)
}
#endif
- if (opts->use_terminal) {
- if (mpctx->opts->slave_mode)
- terminal_setup_stdin_cmd_input(mpctx->input);
- else if (mpctx->opts->consolecontrols)
- terminal_setup_getch(mpctx->input);
-
- if (opts->consolecontrols)
- getch2_enable();
- }
+ if (opts->use_terminal && opts->consolecontrols)
+ terminal_setup_getch(mpctx->input);
#if HAVE_LIBASS
mpctx->ass_log = mp_log_new(mpctx, mpctx->global->log, "!libass");