1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-26 13:19:12 +00:00

core: cleanup more mp_fifo leftovers

Now only the OSX and Wayland parts are using this.
This commit is contained in:
wm4 2013-07-02 14:04:36 +02:00
parent 70a8079c8e
commit d603e73c24
11 changed files with 39 additions and 45 deletions

View File

@ -68,7 +68,6 @@
#include "screenshot.h" #include "screenshot.h"
#include "core/mp_core.h" #include "core/mp_core.h"
#include "mp_fifo.h"
static void change_video_filters(MPContext *mpctx, const char *cmd, static void change_video_filters(MPContext *mpctx, const char *cmd,
const char *arg); const char *arg);

View File

@ -38,7 +38,6 @@
#include "osdep/getch2.h" #include "osdep/getch2.h"
#include "input.h" #include "input.h"
#include "core/mp_fifo.h"
#include "keycodes.h" #include "keycodes.h"
#include "osdep/timer.h" #include "osdep/timer.h"
#include "core/mp_msg.h" #include "core/mp_msg.h"

View File

@ -185,7 +185,6 @@ static const char av_desync_help_text[] = _(
//**************************************************************************// //**************************************************************************//
//**************************************************************************// //**************************************************************************//
#include "core/mp_fifo.h"
#include "sub/ass_mp.h" #include "sub/ass_mp.h"

View File

@ -30,7 +30,6 @@
#include <windows.h> #include <windows.h>
#include "core/input/keycodes.h" #include "core/input/keycodes.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/mp_fifo.h"
#include "getch2.h" #include "getch2.h"
int mp_input_slave_cmd_func(int fd,char* dest,int size){ int mp_input_slave_cmd_func(int fd,char* dest,int size){
@ -158,11 +157,11 @@ static int getch2_internal(void)
return -1; return -1;
} }
bool getch2(struct mp_fifo *fifo) bool getch2(struct input_ctx *ctx)
{ {
int r = getch2_internal(); int r = getch2_internal();
if (r >= 0) if (r >= 0)
mplayer_put_key(fifo, r); mp_input_put_key(ctx, r);
return true; return true;
} }

View File

@ -54,7 +54,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "core/bstr.h" #include "core/bstr.h"
#include "core/mp_fifo.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/input/keycodes.h" #include "core/input/keycodes.h"
#include "getch2.h" #include "getch2.h"
@ -156,7 +155,7 @@ void get_screen_size(void){
#endif #endif
} }
bool getch2(struct mp_fifo *fifo) bool getch2(struct input_ctx *input_ctx)
{ {
int retval = read(0, &getch2_buf[getch2_len], BUF_LEN-getch2_len); int retval = read(0, &getch2_buf[getch2_len], BUF_LEN-getch2_len);
/* Return false on EOF to stop running select() on the FD, as it'd /* Return false on EOF to stop running select() on the FD, as it'd
@ -281,7 +280,7 @@ bool getch2(struct mp_fifo *fifo)
getch2_len -= len; getch2_len -= len;
for (i = 0; i < getch2_len; i++) for (i = 0; i < getch2_len; i++)
getch2_buf[i] = getch2_buf[len+i]; getch2_buf[i] = getch2_buf[len+i];
mplayer_put_key(fifo, code); mp_input_put_key(input_ctx, code);
} }
return true; return true;
} }

View File

@ -49,8 +49,8 @@ void getch2_disable(void);
void getch2_poll(void); void getch2_poll(void);
/* Read a character or a special key code (see keycodes.h) */ /* Read a character or a special key code (see keycodes.h) */
struct mp_fifo; struct input_ctx;
bool getch2(struct mp_fifo *fifo); bool getch2(struct input_ctx *ictx);
#if defined(__MINGW32__) #if defined(__MINGW32__)
// slave cmd function for Windows // slave cmd function for Windows

View File

@ -37,7 +37,6 @@
#include "vo.h" #include "vo.h"
#include "aspect.h" #include "aspect.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/mp_fifo.h"
#include "core/m_config.h" #include "core/m_config.h"
#include "core/mp_msg.h" #include "core/mp_msg.h"
#include "video/mp_image.h" #include "video/mp_image.h"

View File

@ -43,7 +43,7 @@
#include "core/input/keycodes.h" #include "core/input/keycodes.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/mp_msg.h" #include "core/mp_msg.h"
#include "core/mp_fifo.h" #include "core/input/input.h"
/* caca stuff */ /* caca stuff */
static caca_canvas_t *canvas; static caca_canvas_t *canvas;
@ -169,19 +169,19 @@ static void check_events(struct vo *vo)
resize(); resize();
break; break;
case CACA_EVENT_QUIT: case CACA_EVENT_QUIT:
mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
break; break;
case CACA_EVENT_MOUSE_MOTION: case CACA_EVENT_MOUSE_MOTION:
vo_mouse_movement(vo, cev.data.mouse.x, cev.data.mouse.y); vo_mouse_movement(vo, cev.data.mouse.x, cev.data.mouse.y);
break; break;
case CACA_EVENT_MOUSE_PRESS: case CACA_EVENT_MOUSE_PRESS:
if (!vo->opts->nomouse_input) if (!vo->opts->nomouse_input)
mplayer_put_key(vo->key_fifo, mp_input_put_key(vo->input_ctx,
(MP_MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN); (MP_MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN);
break; break;
case CACA_EVENT_MOUSE_RELEASE: case CACA_EVENT_MOUSE_RELEASE:
if (!vo->opts->nomouse_input) if (!vo->opts->nomouse_input)
mplayer_put_key(vo->key_fifo, mp_input_put_key(vo->input_ctx,
(MP_MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_STATE_UP); (MP_MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_STATE_UP);
break; break;
case CACA_EVENT_KEY_PRESS: case CACA_EVENT_KEY_PRESS:
@ -191,7 +191,7 @@ static void check_events(struct vo *vo)
const char *msg_name; const char *msg_name;
if (mpkey) if (mpkey)
mplayer_put_key(vo->key_fifo, mpkey); mp_input_put_key(vo->input_ctx, mpkey);
else else
switch (key) { switch (key) {
case 'd': case 'd':
@ -228,7 +228,7 @@ static void check_events(struct vo *vo)
default: default:
if (key <= 255) if (key <= 255)
mplayer_put_key(vo->key_fifo, key); mp_input_put_key(vo->input_ctx, key);
break; break;
} }
} }

View File

@ -32,7 +32,7 @@
#include "core/input/input.h" #include "core/input/input.h"
#include "core/input/keycodes.h" #include "core/input/keycodes.h"
#include "core/mp_fifo.h" #include "core/input/input.h"
#include "core/mp_msg.h" #include "core/mp_msg.h"
#include "core/options.h" #include "core/options.h"
@ -484,7 +484,7 @@ static void check_events(struct vo *vo)
} }
break; break;
case SDL_QUIT: case SDL_QUIT:
mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
break; break;
case SDL_TEXTINPUT: { case SDL_TEXTINPUT: {
int sdl_mod = SDL_GetModState(); int sdl_mod = SDL_GetModState();
@ -500,7 +500,7 @@ static void check_events(struct vo *vo)
struct bstr t = { struct bstr t = {
ev.text.text, strlen(ev.text.text) ev.text.text, strlen(ev.text.text)
}; };
mplayer_put_key_utf8(vo->key_fifo, mpv_mod, t); mp_input_put_key_utf8(vo->input_ctx, mpv_mod, t);
break; break;
} }
case SDL_KEYDOWN: { case SDL_KEYDOWN: {
@ -528,7 +528,7 @@ static void check_events(struct vo *vo)
keycode |= MP_KEY_MODIFIER_ALT; keycode |= MP_KEY_MODIFIER_ALT;
if (ev.key.keysym.mod & (KMOD_LGUI | KMOD_RGUI)) if (ev.key.keysym.mod & (KMOD_LGUI | KMOD_RGUI))
keycode |= MP_KEY_MODIFIER_META; keycode |= MP_KEY_MODIFIER_META;
mplayer_put_key(vo->key_fifo, keycode); mp_input_put_key(vo->input_ctx, keycode);
} }
break; break;
} }
@ -536,11 +536,11 @@ static void check_events(struct vo *vo)
vo_mouse_movement(vo, ev.motion.x, ev.motion.y); vo_mouse_movement(vo, ev.motion.x, ev.motion.y);
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
mplayer_put_key(vo->key_fifo, mp_input_put_key(vo->input_ctx,
(MP_MOUSE_BTN0 + ev.button.button - 1) | MP_KEY_STATE_DOWN); (MP_MOUSE_BTN0 + ev.button.button - 1) | MP_KEY_STATE_DOWN);
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
mplayer_put_key(vo->key_fifo, mp_input_put_key(vo->input_ctx,
(MP_MOUSE_BTN0 + ev.button.button - 1) | MP_KEY_STATE_UP); (MP_MOUSE_BTN0 + ev.button.button - 1) | MP_KEY_STATE_UP);
break; break;
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:

View File

@ -29,7 +29,7 @@
#include "vo.h" #include "vo.h"
#include "aspect.h" #include "aspect.h"
#include "w32_common.h" #include "w32_common.h"
#include "core/mp_fifo.h" #include "core/input/input.h"
#include "osdep/io.h" #include "osdep/io.h"
#include "talloc.h" #include "talloc.h"
@ -171,7 +171,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
} }
break; break;
case WM_CLOSE: case WM_CLOSE:
mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
break; break;
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
switch (wParam) { switch (wParam) {
@ -188,7 +188,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
case WM_SYSKEYDOWN: { case WM_SYSKEYDOWN: {
int mpkey = lookup_keymap_table(vk_map, wParam); int mpkey = lookup_keymap_table(vk_map, wParam);
if (mpkey) if (mpkey)
mplayer_put_key(vo->key_fifo, mpkey | mod_state(vo)); mp_input_put_key(vo->input_ctx, mpkey | mod_state(vo));
if (wParam == VK_F10) if (wParam == VK_F10)
return 0; return 0;
break; break;
@ -211,7 +211,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
&& !key_state(vo, VK_RETURN)) && !key_state(vo, VK_RETURN))
code = code - 1 + (mods & MP_KEY_MODIFIER_SHIFT ? 'A' : 'a'); code = code - 1 + (mods & MP_KEY_MODIFIER_SHIFT ? 'A' : 'a');
if (code >= 32 && code < (1<<21)) { if (code >= 32 && code < (1<<21)) {
mplayer_put_key(vo->key_fifo, code | mods); mp_input_put_key(vo->input_ctx, code | mods);
// At least with Alt+char, not calling DefWindowProcW stops // At least with Alt+char, not calling DefWindowProcW stops
// Windows from emitting a beep. // Windows from emitting a beep.
return 0; return 0;
@ -266,7 +266,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
return 0; return 0;
} }
mplayer_put_key(vo->key_fifo, mouse_button); mp_input_put_key(vo->input_ctx, mouse_button);
} }
return DefWindowProcW(hWnd, message, wParam, lParam); return DefWindowProcW(hWnd, message, wParam, lParam);
@ -313,7 +313,7 @@ int vo_w32_check_events(struct vo *vo)
MoveWindow(w32->window, 0, 0, r.right, r.bottom, FALSE); MoveWindow(w32->window, 0, 0, r.right, r.bottom, FALSE);
if (!IsWindow(WIN_ID_TO_HWND(vo->opts->WinID))) if (!IsWindow(WIN_ID_TO_HWND(vo->opts->WinID)))
// Window has probably been closed, e.g. due to program crash // Window has probably been closed, e.g. due to program crash
mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
} }
return w32->event_flags; return w32->event_flags;

View File

@ -26,7 +26,7 @@
#include "core/bstr.h" #include "core/bstr.h"
#include "core/options.h" #include "core/options.h"
#include "core/mp_msg.h" #include "core/mp_msg.h"
#include "core/mp_fifo.h" #include "core/input/input.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "x11_common.h" #include "x11_common.h"
#include "talloc.h" #include "talloc.h"
@ -639,7 +639,7 @@ void vo_x11_uninit(struct vo *vo)
struct vo_x11_state *x11 = vo->x11; struct vo_x11_state *x11 = vo->x11;
assert(x11); assert(x11);
mplayer_put_key(vo->key_fifo, MP_INPUT_RELEASE_ALL); mp_input_put_key(vo->input_ctx, MP_INPUT_RELEASE_ALL);
saver_on(x11); saver_on(x11);
if (x11->window != None) if (x11->window != None)
@ -730,17 +730,17 @@ int vo_x11_check_events(struct vo *vo)
sizeof(buf), &keySym, &status); sizeof(buf), &keySym, &status);
int mpkey = vo_x11_lookupkey(keySym); int mpkey = vo_x11_lookupkey(keySym);
if (mpkey) { if (mpkey) {
mplayer_put_key(vo->key_fifo, mpkey | modifiers); mp_input_put_key(vo->input_ctx, mpkey | modifiers);
} else if (status == XLookupChars || status == XLookupBoth) { } else if (status == XLookupChars || status == XLookupBoth) {
struct bstr t = { buf, len }; struct bstr t = { buf, len };
mplayer_put_key_utf8(vo->key_fifo, modifiers, t); mp_input_put_key_utf8(vo->input_ctx, modifiers, t);
} }
} else { } else {
XLookupString(&Event.xkey, buf, sizeof(buf), &keySym, XLookupString(&Event.xkey, buf, sizeof(buf), &keySym,
&x11->compose_status); &x11->compose_status);
int mpkey = vo_x11_lookupkey(keySym); int mpkey = vo_x11_lookupkey(keySym);
if (mpkey) if (mpkey)
mplayer_put_key(vo->key_fifo, mpkey | modifiers); mp_input_put_key(vo->input_ctx, mpkey | modifiers);
} }
break; break;
} }
@ -750,24 +750,24 @@ int vo_x11_check_events(struct vo *vo)
case KeyRelease: case KeyRelease:
{ {
if (x11->no_autorepeat) if (x11->no_autorepeat)
mplayer_put_key(vo->key_fifo, MP_INPUT_RELEASE_ALL); mp_input_put_key(vo->input_ctx, MP_INPUT_RELEASE_ALL);
break; break;
} }
case MotionNotify: case MotionNotify:
vo_mouse_movement(vo, Event.xmotion.x, Event.xmotion.y); vo_mouse_movement(vo, Event.xmotion.x, Event.xmotion.y);
break; break;
case LeaveNotify: case LeaveNotify:
mplayer_put_key(vo->key_fifo, MP_KEY_MOUSE_LEAVE); mp_input_put_key(vo->input_ctx, MP_KEY_MOUSE_LEAVE);
break; break;
case ButtonPress: case ButtonPress:
mplayer_put_key(vo->key_fifo, mp_input_put_key(vo->input_ctx,
(MP_MOUSE_BTN0 + Event.xbutton.button - 1) (MP_MOUSE_BTN0 + Event.xbutton.button - 1)
| MP_KEY_STATE_DOWN); | MP_KEY_STATE_DOWN);
break; break;
case ButtonRelease: case ButtonRelease:
mplayer_put_key(vo->key_fifo, mp_input_put_key(vo->input_ctx,
(MP_MOUSE_BTN0 + Event.xbutton.button - 1) (MP_MOUSE_BTN0 + Event.xbutton.button - 1)
| MP_KEY_STATE_UP); | MP_KEY_STATE_UP);
break; break;
case PropertyNotify: { case PropertyNotify: {
char *name = XGetAtomName(display, Event.xproperty.atom); char *name = XGetAtomName(display, Event.xproperty.atom);
@ -783,12 +783,12 @@ int vo_x11_check_events(struct vo *vo)
break; break;
case DestroyNotify: case DestroyNotify:
mp_msg(MSGT_VO, MSGL_WARN, "Our window was destroyed, exiting\n"); mp_msg(MSGT_VO, MSGL_WARN, "Our window was destroyed, exiting\n");
mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
break; break;
case ClientMessage: case ClientMessage:
if (Event.xclient.message_type == x11->XAWM_PROTOCOLS && if (Event.xclient.message_type == x11->XAWM_PROTOCOLS &&
Event.xclient.data.l[0] == x11->XAWM_DELETE_WINDOW) Event.xclient.data.l[0] == x11->XAWM_DELETE_WINDOW)
mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
break; break;
default: default:
if (Event.type == x11->ShmCompletionEvent) { if (Event.type == x11->ShmCompletionEvent) {