From 215035b31abc4bc17e0af231952f410b4165e00c Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 21 Mar 2012 02:23:35 +0200 Subject: input.c: simplify command definitions Change command definitions to allow writing the command definition table in more readable format. --- input/input.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'input/input.h') diff --git a/input/input.h b/input/input.h index 4058ce3d99..4cd006fa9a 100644 --- a/input/input.h +++ b/input/input.h @@ -19,6 +19,8 @@ #ifndef MPLAYER_INPUT_H #define MPLAYER_INPUT_H +#include + // All command IDs enum mp_command_type { MP_CMD_SEEK, @@ -153,14 +155,11 @@ enum mp_command_type { }; // The arg types -#define MP_CMD_ARG_INT 0 -#define MP_CMD_ARG_FLOAT 1 -#define MP_CMD_ARG_STRING 2 -#define MP_CMD_ARG_VOID 3 +#define MP_CMD_ARG_INT 1 +#define MP_CMD_ARG_FLOAT 2 +#define MP_CMD_ARG_STRING 3 -#ifndef MP_CMD_MAX_ARGS #define MP_CMD_MAX_ARGS 10 -#endif // Error codes for the drivers @@ -180,19 +179,19 @@ struct input_ctx; struct mp_cmd_arg { int type; + bool optional; union { int i; float f; char *s; - void *v; } v; }; typedef struct mp_cmd { int id; char *name; - int nargs; struct mp_cmd_arg args[MP_CMD_MAX_ARGS]; + int nargs; int pausing; struct mp_cmd *queue_prev; struct mp_cmd *queue_next; -- cgit v1.2.3 From a0de4bc5000823c058aab6b02a7fdfb48275cb32 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 25 Mar 2012 22:58:48 +0300 Subject: ao_pulse, core: make pulse thread wake up core for more data For ao_pulse, the current latency is not a good indicator of how soon the AO requires new data to avoid underflow. Add an internal pipe that can be used to wake up the input loop from select(), and make the pulseaudio main loop (which runs in a separate thread) use this mechanism when pulse requests more data. The wakeup signal currently contains no information about the reason for the wakup, but audio buffers are always filled when the event loop wakes up. Also, request a latency of 1 second from the Pulseaudio server. The default is normally significantly higher. We don't need low latency, while higher latency helps prevent underflows reduces need for wakeups. --- input/input.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'input/input.h') diff --git a/input/input.h b/input/input.h index 4cd006fa9a..c5f6940990 100644 --- a/input/input.h +++ b/input/input.h @@ -272,6 +272,9 @@ void mp_input_uninit(struct input_ctx *ictx); struct m_config; void mp_input_register_options(struct m_config *cfg); +// Wake up sleeping input loop from another thread. +void mp_input_wakeup(struct input_ctx *ictx); + // Interruptible usleep: (used by libmpdemux) int mp_input_check_interrupt(struct input_ctx *ictx, int time); -- cgit v1.2.3