From 8bd8aba37a9e9046905e7baf20568910c17b8fa7 Mon Sep 17 00:00:00 2001 From: siretart Date: Fri, 23 Apr 2010 10:04:56 +0000 Subject: include sys/kd.h on non-Linux architectures correctly git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31058 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_directfb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c index e69c7ae932..e8b7f46e7a 100644 --- a/libvo/vo_directfb2.c +++ b/libvo/vo_directfb2.c @@ -35,9 +35,9 @@ #include #ifdef __linux__ -#include -#else #include +#else +#include #endif #include "config.h" -- cgit v1.2.3 From 9cef48bac77cbeefe7dade7cb38fb3a00a16733a Mon Sep 17 00:00:00 2001 From: siretart Date: Fri, 23 Apr 2010 10:22:44 +0000 Subject: rename 'struct keymap' -> 'struct mp_keymap' This avoids the compilation failure on kFreeBSD (at least amd64): In file included from libvo/vo_directfb2.c:44: libvo/video_out.h:267: error: redefinition of 'struct keymap' This is because libvo/vo_directfb2.c #includes sys/kd.h, which in turn includes sys/kbio.h, which defines another 'struct keymap'. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31059 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/osx_common.c | 2 +- libvo/video_out.c | 2 +- libvo/video_out.h | 4 ++-- libvo/vo_kva.c | 6 +++--- libvo/w32_common.c | 2 +- libvo/x11_common.c | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'libvo') diff --git a/libvo/osx_common.c b/libvo/osx_common.c index 3ceef2fece..b89a5e3d5c 100644 --- a/libvo/osx_common.c +++ b/libvo/osx_common.c @@ -76,7 +76,7 @@ #define kVK_UpArrow 0x7e #endif /* MAC_OS_X_VERSION_MAX_ALLOWED <= 1040 */ -static const struct keymap keymap[] = { +static const struct mp_keymap keymap[] = { // special keys {0x34, KEY_ENTER}, // Enter key on some iBooks? {kVK_Return, KEY_ENTER}, diff --git a/libvo/video_out.c b/libvo/video_out.c index ec7872c0e5..c1786d27ba 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -371,7 +371,7 @@ int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height, * \result translation corresponding to key or "to" value of last mapping * if not found. */ -int lookup_keymap_table(const struct keymap *map, int key) { +int lookup_keymap_table(const struct mp_keymap *map, int key) { while (map->from && map->from != key) map++; return map->to; } diff --git a/libvo/video_out.h b/libvo/video_out.h index 1fce2c2877..4e8716f13e 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -269,11 +269,11 @@ extern char *monitor_hfreq_str; extern char *monitor_vfreq_str; extern char *monitor_dotclock_str; -struct keymap { +struct mp_keymap { int from; int to; }; -int lookup_keymap_table(const struct keymap *map, int key); +int lookup_keymap_table(const struct mp_keymap *map, int key); struct vo_rect { int left, right, top, bottom, width, height; }; diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c index dd604fdeb5..29a739eac7 100644 --- a/libvo/vo_kva.c +++ b/libvo/vo_kva.c @@ -70,7 +70,7 @@ const LIBVO_EXTERN(kva) #define HWNDFROMWINID(wid) ((wid) + 0x80000000UL) -static const struct keymap m_vk_map[] = { +static const struct mp_keymap m_vk_map[] = { {VK_NEWLINE, KEY_ENTER}, {VK_TAB, KEY_TAB}, {VK_SPACE, ' '}, // control keys @@ -92,7 +92,7 @@ static const struct keymap m_vk_map[] = { {0, 0} }; -static const struct keymap m_keypad_map[] = { +static const struct mp_keymap m_keypad_map[] = { // keypad keys {0x52, KEY_KP0}, {0x4F, KEY_KP1}, {0x50, KEY_KP2}, {0x51, KEY_KP3}, {0x4B, KEY_KP4}, {0x4C, KEY_KP5}, {0x4D, KEY_KP6}, {0x47, KEY_KP7}, @@ -101,7 +101,7 @@ static const struct keymap m_keypad_map[] = { {0, 0} }; -static const struct keymap m_mouse_map[] = { +static const struct mp_keymap m_mouse_map[] = { {WM_BUTTON1DOWN, MOUSE_BTN0}, {WM_BUTTON3DOWN, MOUSE_BTN1}, {WM_BUTTON2DOWN, MOUSE_BTN2}, diff --git a/libvo/w32_common.c b/libvo/w32_common.c index a0ffd9fb98..ba47f37e7c 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -60,7 +60,7 @@ static HMONITOR (WINAPI* myMonitorFromWindow)(HWND, DWORD); static BOOL (WINAPI* myGetMonitorInfo)(HMONITOR, LPMONITORINFO); static BOOL (WINAPI* myEnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM); -static const struct keymap vk_map[] = { +static const struct mp_keymap vk_map[] = { // special keys {VK_ESCAPE, KEY_ESC}, {VK_BACK, KEY_BS}, {VK_TAB, KEY_TAB}, {VK_CONTROL, KEY_CTRL}, diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 5c21fee975..08252198d3 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -561,7 +561,7 @@ void vo_uninit(void) #include "wskeys.h" #ifdef XF86XK_AudioPause -static const struct keymap keysym_map[] = { +static const struct mp_keymap keysym_map[] = { {XF86XK_MenuKB, KEY_MENU}, {XF86XK_AudioPlay, KEY_PLAY}, {XF86XK_AudioPause, KEY_PAUSE}, {XF86XK_AudioStop, KEY_STOP}, {XF86XK_AudioPrev, KEY_PREV}, {XF86XK_AudioNext, KEY_NEXT}, @@ -577,7 +577,7 @@ static void vo_x11_putkey_ext(int keysym) } #endif -static const struct keymap keymap[] = { +static const struct mp_keymap keymap[] = { // special keys {wsEscape, KEY_ESC}, {wsBackSpace, KEY_BS}, {wsTab, KEY_TAB}, {wsEnter, KEY_ENTER}, -- cgit v1.2.3 From ca555e249f6efda85239cd5ac18e6c53d72a4b8a Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 24 Apr 2010 10:47:53 +0000 Subject: Remove unnecessary kd.h #include. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31060 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_directfb2.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c index e8b7f46e7a..f6daf8bce7 100644 --- a/libvo/vo_directfb2.c +++ b/libvo/vo_directfb2.c @@ -33,12 +33,7 @@ #include #include #include - -#ifdef __linux__ -#include -#else -#include -#endif +//#include #include "config.h" #include "video_out.h" -- cgit v1.2.3 From 976d35bc6b7f677956bd4f227326a834622ab1eb Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 24 Apr 2010 10:50:21 +0000 Subject: 10l: Remove leftover commented-out #include. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31061 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_directfb2.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libvo') diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c index f6daf8bce7..20c4045198 100644 --- a/libvo/vo_directfb2.c +++ b/libvo/vo_directfb2.c @@ -33,7 +33,6 @@ #include #include #include -//#include #include "config.h" #include "video_out.h" -- cgit v1.2.3 From 6e4458ffa394553b8d5e21f6b3a536d5be48b787 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 16:46:47 +0000 Subject: First steps to support -vo gl with SDL-based Window handling. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31062 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 39 +++++++++++++++++++++++++++++++++++++++ libvo/gl_common.h | 1 + 2 files changed, 40 insertions(+) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index e8b66e1ccc..91281a3c00 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1842,8 +1842,36 @@ static int x11_check_events(void) { } #endif +#ifdef CONFIG_GL_SDL +#ifdef CONFIG_SDL_SDL_H +#include +#else +#include +#endif + +static void swapGlBuffers_sdl(MPGLContext *ctx) { + SDL_GL_SwapBuffers(); +} + +#endif + +static int setGlWindow_dummy(MPGLContext *ctx) { + getFunctions(setNull, NULL); + return SET_WINDOW_OK; +} + +static void releaseGlContext_dummy(MPGLContext *ctx) { +} + +static int dummy_check_events(void) { + return 0; +} + int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { memset(ctx, 0, sizeof(*ctx)); + ctx->setGlWindow = setGlWindow_dummy; + ctx->releaseGlContext = releaseGlContext_dummy; + ctx->check_events = dummy_check_events; ctx->type = type; switch (ctx->type) { #ifdef CONFIG_GL_WIN32 @@ -1869,6 +1897,12 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { ctx->fullscreen = vo_x11_fullscreen; ctx->ontop = vo_x11_ontop; return vo_init(); +#endif +#ifdef CONFIG_GL_SDL + case GLTYPE_SDL: + SDL_Init(SDL_INIT_VIDEO); + ctx->swapGlBuffers = swapGlBuffers_sdl; + return 1; #endif default: return 0; @@ -1887,6 +1921,11 @@ void uninit_mpglcontext(MPGLContext *ctx) { case GLTYPE_X11: vo_x11_uninit(); break; +#endif +#ifdef CONFIG_GL_SDL + case GLTYPE_SDL: + SDL_QuitSubSystem(SDL_INIT_VIDEO); + break; #endif } memset(ctx, 0, sizeof(*ctx)); diff --git a/libvo/gl_common.h b/libvo/gl_common.h index ef38f58808..f6f6a4f234 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -372,6 +372,7 @@ void glDisableYUVConversion(GLenum target, int type); enum MPGLType { GLTYPE_W32, GLTYPE_X11, + GLTYPE_SDL, }; typedef struct MPGLContext { -- cgit v1.2.3 From 29e713ba4b0eebf3ef459082799ccec6b1515d48 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 16:49:46 +0000 Subject: Some crash-resilience fixes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31063 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 91281a3c00..e31b0e3749 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1384,6 +1384,8 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) { */ int glAutodetectYUVConversion(void) { const char *extensions = mpglGetString(GL_EXTENSIONS); + if (!extensions || !mpglMultiTexCoord2f) + return YUV_CONVERSION_NONE; if (strstr(extensions, "GL_ARB_fragment_program")) return YUV_CONVERSION_FRAGMENT; if (strstr(extensions, "GL_ATI_text_fragment_shader")) -- cgit v1.2.3 From abfa4e2ae99093ef4cd813bb0045b57e0c6f4faf Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 16:52:06 +0000 Subject: SDL support with related crash-resilience fixes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31064 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index b2e74c7bf7..55c272b88c 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -37,6 +37,14 @@ #include "fastmemcpy.h" #include "libass/ass_mp.h" +#ifdef CONFIG_GL_SDL +#ifdef CONFIG_SDL_SDL_H +#include +#else +#include +#endif +#endif + static const vo_info_t info = { "OpenGL", @@ -469,7 +477,7 @@ static void autodetectGlExtensions(void) { const char *extensions = mpglGetString(GL_EXTENSIONS); const char *vendor = mpglGetString(GL_VENDOR); const char *version = mpglGetString(GL_VERSION); - int is_ati = strstr(vendor, "ATI") != NULL; + int is_ati = vendor && strstr(vendor, "ATI") != NULL; int ati_broken_pbo = 0; mp_msg(MSGT_VO, MSGL_V, "[gl] Running on OpenGL by '%s', versions '%s'\n", vendor, version); if (is_ati && strncmp(version, "2.1.", 4) == 0) { @@ -478,8 +486,10 @@ static void autodetectGlExtensions(void) { ati_broken_pbo = ver && ver < 8395; } if (ati_hack == -1) ati_hack = ati_broken_pbo; - if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0; - if (use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0; + if (extensions && force_pbo == -1) + force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0; + if (extensions && use_rectangle == -1) + use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0; if (use_yuv == -1) use_yuv = glAutodetectYUVConversion(); if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2)) @@ -583,6 +593,17 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone), "gl", title); } +#endif +#ifdef CONFIG_GL_SDL + if (glctx.type == GLTYPE_SDL) { + SDL_Surface *s = SDL_SetVideoMode(d_width, d_height, 0, SDL_OPENGL | SDL_RESIZABLE); + if (!s) { + mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + return -1; + } + vo_dwidth = s->w; + vo_dheight = s->h; + } #endif return 0; } @@ -1076,8 +1097,11 @@ static const opt_t subopts[] = { static int preinit_internal(const char *arg, int allow_sw) { - enum MPGLType gltype = GLTYPE_X11; + enum MPGLType gltype = GLTYPE_SDL; // set defaults +#ifdef CONFIG_GL_X11 + gltype = GLTYPE_X11; +#endif #ifdef CONFIG_GL_WIN32 gltype = GLTYPE_W32; #endif @@ -1317,6 +1341,8 @@ static int control(uint32_t request, void *data, ...) } break; case VOCTRL_UPDATE_SCREENINFO: + if (!glctx.update_xinerama_info) + break; glctx.update_xinerama_info(); return VO_TRUE; } -- cgit v1.2.3 From 5c4cc997caeeb87675cfc7b9c97206bc4d9568ff Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 16:58:24 +0000 Subject: Disable OSD support by default if the necessary OpenGL functionality is missing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31065 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 55c272b88c..7d48e35d22 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -490,6 +490,8 @@ static void autodetectGlExtensions(void) { force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0; if (extensions && use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0; + if (use_osd == -1) + use_osd = mpglBindTexture != NULL; if (use_yuv == -1) use_yuv = glAutodetectYUVConversion(); if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2)) @@ -1106,7 +1108,7 @@ static int preinit_internal(const char *arg, int allow_sw) gltype = GLTYPE_W32; #endif many_fmts = 1; - use_osd = 1; + use_osd = -1; scaled_osd = 0; use_aspect = 1; use_ycbcr = 0; -- cgit v1.2.3 From ccc269a00a6b1fe091703d9d585421a49243a1a8 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 17:02:50 +0000 Subject: Try harder to find linked OpenGL functions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31066 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index e31b0e3749..8cdc42766a 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -349,8 +349,24 @@ int glFindFormat(uint32_t fmt, int *bpp, GLint *gl_texfmt, return supported; } -static void *setNull(const GLubyte *s) { - return NULL; +#ifdef HAVE_LIBDL +#include +#endif +/** + * \brief find address of a linked function + * \param s name of function to find + * \return address of function or NULL if not found + */ +static void *getdladdr(const char *s) { + void *ret = NULL; +#ifdef HAVE_LIBDL + void *handle = dlopen(NULL, RTLD_LAZY); + if (!handle) + return NULL; + ret = dlsym(handle, s); + dlclose(handle); +#endif + return ret; } typedef struct { @@ -460,7 +476,7 @@ static void getFunctions(void *(*getProcAddress)(const GLubyte *), char *allexts; if (!getProcAddress) - getProcAddress = setNull; + getProcAddress = (void *)getdladdr; // special case, we need glGetString before starting to find the other functions mpglGetString = getProcAddress("glGetString"); @@ -1670,26 +1686,7 @@ static void swapGlBuffers_w32(MPGLContext *ctx) { } #endif #ifdef CONFIG_GL_X11 -#ifdef HAVE_LIBDL -#include -#endif #include "x11_common.h" -/** - * \brief find address of a linked function - * \param s name of function to find - * \return address of function or NULL if not found - */ -static void *getdladdr(const char *s) { - void *ret = NULL; -#ifdef HAVE_LIBDL - void *handle = dlopen(NULL, RTLD_LAZY); - if (!handle) - return NULL; - ret = dlsym(handle, s); - dlclose(handle); -#endif - return ret; -} /** * \brief Returns the XVisualInfo associated with Window win. @@ -1789,8 +1786,6 @@ static int setGlWindow_x11(MPGLContext *ctx) getProcAddress = getdladdr("glXGetProcAddress"); if (!getProcAddress) getProcAddress = getdladdr("glXGetProcAddressARB"); - if (!getProcAddress) - getProcAddress = (void *)getdladdr; glXExtStr = getdladdr("glXQueryExtensionsString"); if (glXExtStr) appendstr(&glxstr, glXExtStr(mDisplay, DefaultScreen(mDisplay))); @@ -1803,10 +1798,10 @@ static int setGlWindow_x11(MPGLContext *ctx) getFunctions(getProcAddress, glxstr); if (!mpglGenPrograms && mpglGetString && - getProcAddress != (void *)getdladdr && + getProcAddress && strstr(mpglGetString(GL_EXTENSIONS), "GL_ARB_vertex_program")) { mp_msg(MSGT_VO, MSGL_WARN, "Broken glXGetProcAddress detected, trying workaround\n"); - getFunctions((void *)getdladdr, glxstr); + getFunctions(NULL, glxstr); } free(glxstr); @@ -1858,7 +1853,7 @@ static void swapGlBuffers_sdl(MPGLContext *ctx) { #endif static int setGlWindow_dummy(MPGLContext *ctx) { - getFunctions(setNull, NULL); + getFunctions(NULL, NULL); return SET_WINDOW_OK; } -- cgit v1.2.3 From d5d3c203d3b0681c724c2ea1c170c06b97aa31ad Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 17:15:28 +0000 Subject: Remove code to work around bugs in ancient libSDL versions, the code has been accidentally disabled since some time and there were no complaints. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31067 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_sdl.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index 17ab0239b1..c5dbcadc30 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -48,8 +48,6 @@ /* define to enable surface locks, this might be needed on SMP machines */ #undef SDL_ENABLE_LOCKS -//#define BUGGY_SDL //defined by configure - /* MONITOR_ASPECT MUST BE FLOAT */ #define MONITOR_ASPECT 4.0/3.0 @@ -457,13 +455,11 @@ static int sdl_open (void *plugin, void *name) * We use SDL_KEYUP cause SDL_KEYDOWN seems to cause problems * with keys need to be pressed twice, to be recognized. */ -#ifndef BUGGY_SDL SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); // SDL_EventState(SDL_QUIT, SDL_IGNORE); SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); SDL_EventState(SDL_USEREVENT, SDL_IGNORE); -#endif /* Success! */ return 0; @@ -1141,26 +1137,7 @@ static void check_events (void) break; /* graphics mode selection shortcuts */ -#ifdef BUGGY_SDL - case SDL_KEYDOWN: - switch(event.key.keysym.sym) { - case SDLK_UP: mplayer_put_key(KEY_UP); break; - case SDLK_DOWN: mplayer_put_key(KEY_DOWN); break; - case SDLK_LEFT: mplayer_put_key(KEY_LEFT); break; - case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT); break; - case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; - case SDLK_GREATER: mplayer_put_key('>'); break; - case SDLK_ASTERISK: - case SDLK_KP_MULTIPLY: - case SDLK_SLASH: - case SDLK_KP_DIVIDE: - default: break; - } - break; - case SDL_KEYUP: -#else case SDL_KEYDOWN: -#endif keypressed = event.key.keysym.sym; mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Key pressed: '%i'\n", keypressed); @@ -1219,17 +1196,6 @@ static void check_events (void) case SDLK_TAB: mplayer_put_key('\t');break; case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; -#ifdef BUGGY_SDL - case SDLK_UP: - case SDLK_DOWN: - case SDLK_LEFT: - case SDLK_RIGHT: - case SDLK_ASTERISK: - case SDLK_KP_MULTIPLY: - case SDLK_SLASH: - case SDLK_KP_DIVIDE: - break; -#else case SDLK_UP: mplayer_put_key(KEY_UP);break; case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; @@ -1240,7 +1206,6 @@ static void check_events (void) case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; case SDLK_SLASH: case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; -#endif case SDLK_KP0: mplayer_put_key(KEY_KP0); break; case SDLK_KP1: mplayer_put_key(KEY_KP1); break; case SDLK_KP2: mplayer_put_key(KEY_KP2); break; -- cgit v1.2.3 From f81cd34fe0f145702ac225f13c5de7007b9d7320 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 22:13:57 +0000 Subject: Add workaroound for yuv=7 mode - does hurt speed but not much and this code should only be used when it is the only option. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31068 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 8cdc42766a..a25a3ba9d4 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1510,12 +1510,16 @@ void glDisableYUVConversion(GLenum target, int type) { mpglDisable(GL_FRAGMENT_SHADER_ATI); break; case YUV_CONVERSION_TEXT_FRAGMENT: + mpglDisable(GL_TEXT_FRAGMENT_SHADER_ATI); + // HACK: at least the 10.5 Radeon drivers are broken + // and without this disable the texture units while + // the program is still running + mpglFlush(); mpglActiveTexture(GL_TEXTURE1); mpglDisable(target); mpglActiveTexture(GL_TEXTURE2); mpglDisable(target); mpglActiveTexture(GL_TEXTURE0); - mpglDisable(GL_TEXT_FRAGMENT_SHADER_ATI); break; case YUV_CONVERSION_FRAGMENT_LOOKUP3D: case YUV_CONVERSION_FRAGMENT_LOOKUP: -- cgit v1.2.3 From 37da18aaf96541418f1dc55d7aeaf2cc125309a3 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 22:34:38 +0000 Subject: Slightly more correct ifdefs for vo_gl2. Compiling with both win32 and x11 backend still will not work though. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31069 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl2.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index a1d0506a99..61339dcbce 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -476,8 +476,9 @@ static int config_w32(uint32_t width, uint32_t height, uint32_t d_width, uint32_ return 0; } -#else +#endif +#ifdef CONFIG_GL_X11 static int choose_glx_visual(Display *dpy, int scr, XVisualInfo *res_vi) { XVisualInfo template, *vi_list; @@ -641,7 +642,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin #endif #ifdef CONFIG_GL_WIN32 if (config_w32(width, height, d_width, d_height, flags, title, format) == -1) -#else +#endif +#ifdef CONFIG_GL_X11 if (config_glx(width, height, d_width, d_height, flags, title, format) == -1) #endif return -1; @@ -689,7 +691,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin return 0; } -#ifndef CONFIG_GL_WIN32 +#ifdef CONFIG_GL_X11 static int gl_handlekey(int key) { if(key=='a'||key=='A') { @@ -706,7 +708,7 @@ static int gl_handlekey(int key) static void check_events(void) { int e; -#ifndef CONFIG_GL_WIN32 +#ifdef CONFIG_GL_X11 XEvent Event; char buf[100]; KeySym keySym; @@ -887,7 +889,8 @@ static int preinit(const char *arg) if (use_yuv == -1) { #ifdef CONFIG_GL_WIN32 if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1) -#else +#endif +#ifdef CONFIG_GL_X11 if (config_glx(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1) #endif goto err_out; @@ -930,7 +933,7 @@ static int control(uint32_t request, void *data, ...) case VOCTRL_SET_PANSCAN: resize(vo_dwidth, vo_dheight); return VO_TRUE; -#ifndef CONFIG_GL_WIN32 +#ifdef CONFIG_GL_X11 case VOCTRL_SET_EQUALIZER: { va_list ap; -- cgit v1.2.3 From e9ef1cbda0dd652c41459571dc9026325dac1f83 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 22:35:39 +0000 Subject: Missing gl.h include for SDL backend. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31070 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libvo') diff --git a/libvo/gl_common.h b/libvo/gl_common.h index f6f6a4f234..f40cadda89 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -39,6 +39,9 @@ #include #include "x11_common.h" #endif +#ifdef CONFIG_GL_SDL +#include +#endif // workaround for some gl.h headers #ifndef GLAPIENTRY -- cgit v1.2.3 From 56af15374be7788e56d358e411ab6d9944624775 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 06:14:25 +0000 Subject: Clarify that the GL_TEXT_FRAGMENT_SHADER_ATI bug workaround is for OSX, and which versions are known good/known bad. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31071 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index a25a3ba9d4..ca45d4d5ee 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1511,9 +1511,9 @@ void glDisableYUVConversion(GLenum target, int type) { break; case YUV_CONVERSION_TEXT_FRAGMENT: mpglDisable(GL_TEXT_FRAGMENT_SHADER_ATI); - // HACK: at least the 10.5 Radeon drivers are broken - // and without this disable the texture units while - // the program is still running + // HACK: at least the Mac OS X 10.5 PPC Radeon drivers are broken and + // without this disable the texture units while the program is still + // running (10.4 PPC seems to work without this though). mpglFlush(); mpglActiveTexture(GL_TEXTURE1); mpglDisable(target); -- cgit v1.2.3 From 7fc3b782eab00e27f0b9eb260b52b1dc1dabb9c2 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 06:52:13 +0000 Subject: Update copyright and email address. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31072 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index ca45d4d5ee..c0c414f812 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1,7 +1,7 @@ /* * common OpenGL routines * - * copyleft (C) 2005 Reimar Döffinger + * copyleft (C) 2005-2010 Reimar Döffinger * Special thanks go to the xine team and Matthias Hopf, whose video_out_opengl.c * gave me lots of good ideas. * -- cgit v1.2.3 From 5cdca550058a667f8f5aa643dc0ef9f1099605db Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 07:32:42 +0000 Subject: Use SDL_GL_ProcAddress to work around conflicts between -lGL and -framework OpenGL. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31073 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index c0c414f812..e21d40f9d2 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1854,6 +1854,15 @@ static void swapGlBuffers_sdl(MPGLContext *ctx) { SDL_GL_SwapBuffers(); } +static void *sdlgpa(const GLubyte *name) { + return SDL_GL_GetProcAddress(name); +} + +static int setGlWindow_sdl(MPGLContext *ctx) { + SDL_GL_LoadLibrary(NULL); + getFunctions(sdlgpa, NULL); + return SET_WINDOW_OK; +} #endif static int setGlWindow_dummy(MPGLContext *ctx) { @@ -1902,6 +1911,7 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { #ifdef CONFIG_GL_SDL case GLTYPE_SDL: SDL_Init(SDL_INIT_VIDEO); + ctx->setGlWindow = setGlWindow_sdl; ctx->swapGlBuffers = swapGlBuffers_sdl; return 1; #endif -- cgit v1.2.3 From 7c2bef4bb5a3275dc2e3fb75dfeb03ac1f1b5755 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 08:17:23 +0000 Subject: Add sdl_common file and use it to share the input handling between -vo gl with SDL backend and -vo sdl. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31074 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 17 +++++--- libvo/sdl_common.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ libvo/sdl_common.h | 32 +++++++++++++++ libvo/vo_sdl.c | 81 ++------------------------------------ 4 files changed, 159 insertions(+), 83 deletions(-) create mode 100644 libvo/sdl_common.c create mode 100644 libvo/sdl_common.h (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index e21d40f9d2..2c4c001c00 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1844,11 +1844,7 @@ static int x11_check_events(void) { #endif #ifdef CONFIG_GL_SDL -#ifdef CONFIG_SDL_SDL_H -#include -#else -#include -#endif +#include "sdl_common.h" static void swapGlBuffers_sdl(MPGLContext *ctx) { SDL_GL_SwapBuffers(); @@ -1863,6 +1859,16 @@ static int setGlWindow_sdl(MPGLContext *ctx) { getFunctions(sdlgpa, NULL); return SET_WINDOW_OK; } + +static int sdl_check_events(void) { + int res = 0; + SDL_Event event; + while (SDL_PollEvent(&event)) { + res |= sdl_default_handle_event(&event); + } + return res; +} + #endif static int setGlWindow_dummy(MPGLContext *ctx) { @@ -1913,6 +1919,7 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { SDL_Init(SDL_INIT_VIDEO); ctx->setGlWindow = setGlWindow_sdl; ctx->swapGlBuffers = swapGlBuffers_sdl; + ctx->check_events = sdl_check_events; return 1; #endif default: diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c new file mode 100644 index 0000000000..9116bcbe55 --- /dev/null +++ b/libvo/sdl_common.c @@ -0,0 +1,112 @@ +/* + * common SDL routines + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "sdl_common.h" +#include "mp_msg.h" +#include "mp_fifo.h" +#include "osdep/keycodes.h" +#include "input/input.h" +#include "input/mouse.h" +#include "video_out.h" + +#define shift_key (event->key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) +int sdl_default_handle_event(SDL_Event *event) +{ + SDLKey keypressed = SDLK_UNKNOWN; + switch (event->type) { + case SDL_VIDEORESIZE: + vo_dwidth = event->resize.w; + vo_dheight = event->resize.h; + return VO_EVENT_RESIZE; + case SDL_MOUSEBUTTONDOWN: + if(vo_nomouse_input) + break; + mplayer_put_key((MOUSE_BTN0 + event->button.button - 1) | MP_KEY_DOWN); + break; + + case SDL_MOUSEBUTTONUP: + if(vo_nomouse_input) + break; + mplayer_put_key(MOUSE_BTN0 + event->button.button - 1); + break; + + case SDL_KEYDOWN: + keypressed = event->key.keysym.sym; + mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Key pressed: '%i'\n", keypressed); + switch(keypressed) { + case SDLK_RETURN: mplayer_put_key(KEY_ENTER);break; + case SDLK_ESCAPE: mplayer_put_key(KEY_ESC);break; + case SDLK_q: mplayer_put_key('q');break; + case SDLK_F1: mplayer_put_key(KEY_F+1);break; + case SDLK_F2: mplayer_put_key(KEY_F+2);break; + case SDLK_F3: mplayer_put_key(KEY_F+3);break; + case SDLK_F4: mplayer_put_key(KEY_F+4);break; + case SDLK_F5: mplayer_put_key(KEY_F+5);break; + case SDLK_F6: mplayer_put_key(KEY_F+6);break; + case SDLK_F7: mplayer_put_key(KEY_F+7);break; + case SDLK_F8: mplayer_put_key(KEY_F+8);break; + case SDLK_F9: mplayer_put_key(KEY_F+9);break; + case SDLK_F10: mplayer_put_key(KEY_F+10);break; + case SDLK_F11: mplayer_put_key(KEY_F+11);break; + case SDLK_F12: mplayer_put_key(KEY_F+12);break; + /*case SDLK_o: mplayer_put_key('o');break; + case SDLK_SPACE: mplayer_put_key(' ');break; + case SDLK_p: mplayer_put_key('p');break;*/ + case SDLK_7: mplayer_put_key(shift_key?'/':'7');break; + case SDLK_PLUS: mplayer_put_key(shift_key?'*':'+');break; + case SDLK_KP_PLUS: mplayer_put_key('+');break; + case SDLK_MINUS: + case SDLK_KP_MINUS: mplayer_put_key('-');break; + case SDLK_TAB: mplayer_put_key('\t');break; + case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; + case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; + case SDLK_UP: mplayer_put_key(KEY_UP);break; + case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; + case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; + case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; + case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; + case SDLK_GREATER: mplayer_put_key('>'); break; + case SDLK_ASTERISK: + case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; + case SDLK_SLASH: + case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; + case SDLK_KP0: mplayer_put_key(KEY_KP0); break; + case SDLK_KP1: mplayer_put_key(KEY_KP1); break; + case SDLK_KP2: mplayer_put_key(KEY_KP2); break; + case SDLK_KP3: mplayer_put_key(KEY_KP3); break; + case SDLK_KP4: mplayer_put_key(KEY_KP4); break; + case SDLK_KP5: mplayer_put_key(KEY_KP5); break; + case SDLK_KP6: mplayer_put_key(KEY_KP6); break; + case SDLK_KP7: mplayer_put_key(KEY_KP7); break; + case SDLK_KP8: mplayer_put_key(KEY_KP8); break; + case SDLK_KP9: mplayer_put_key(KEY_KP9); break; + case SDLK_KP_PERIOD: mplayer_put_key(KEY_KPDEC); break; + case SDLK_KP_ENTER: mplayer_put_key(KEY_KPENTER); break; + default: + //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); + mplayer_put_key(keypressed); + } + + break; + + case SDL_QUIT: mplayer_put_key(KEY_CLOSE_WIN);break; + } + return 0; +} diff --git a/libvo/sdl_common.h b/libvo/sdl_common.h new file mode 100644 index 0000000000..b83161bfc1 --- /dev/null +++ b/libvo/sdl_common.h @@ -0,0 +1,32 @@ +/* + * common SDL routines + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_SDL_COMMON_H +#define MPLAYER_SDL_COMMON_H + +#include "config.h" +#ifdef CONFIG_SDL_SDL_H +#include +#else +#include +#endif +int sdl_default_handle_event(SDL_Event *event); + +#endif diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index c5dbcadc30..913ff03533 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -73,10 +73,7 @@ #include "x11_common.h" #endif -#include "input/input.h" -#include "input/mouse.h" #include "subopt-helper.h" -#include "mp_fifo.h" static const vo_info_t info = { @@ -88,11 +85,7 @@ static const vo_info_t info = const LIBVO_EXTERN(sdl) -#ifdef CONFIG_SDL_SDL_H -#include -#else -#include -#endif +#include "sdl_common.h" //#include @@ -1098,9 +1091,6 @@ static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) * returns : doesn't return **/ -#include "osdep/keycodes.h" - -#define shift_key (event.key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) static void check_events (void) { struct sdl_priv_s *priv = &sdl_priv; @@ -1124,18 +1114,6 @@ static void check_events (void) mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Window resize\n"); break; - case SDL_MOUSEBUTTONDOWN: - if(vo_nomouse_input) - break; - mplayer_put_key((MOUSE_BTN0+event.button.button-1) | MP_KEY_DOWN); - break; - - case SDL_MOUSEBUTTONUP: - if(vo_nomouse_input) - break; - mplayer_put_key(MOUSE_BTN0+event.button.button-1); - break; - /* graphics mode selection shortcuts */ case SDL_KEYDOWN: keypressed = event.key.keysym.sym; @@ -1169,66 +1147,13 @@ static void check_events (void) } } - else switch(keypressed){ - case SDLK_RETURN: mplayer_put_key(KEY_ENTER);break; - case SDLK_ESCAPE: mplayer_put_key(KEY_ESC);break; - case SDLK_q: mplayer_put_key('q');break; - case SDLK_F1: mplayer_put_key(KEY_F+1);break; - case SDLK_F2: mplayer_put_key(KEY_F+2);break; - case SDLK_F3: mplayer_put_key(KEY_F+3);break; - case SDLK_F4: mplayer_put_key(KEY_F+4);break; - case SDLK_F5: mplayer_put_key(KEY_F+5);break; - case SDLK_F6: mplayer_put_key(KEY_F+6);break; - case SDLK_F7: mplayer_put_key(KEY_F+7);break; - case SDLK_F8: mplayer_put_key(KEY_F+8);break; - case SDLK_F9: mplayer_put_key(KEY_F+9);break; - case SDLK_F10: mplayer_put_key(KEY_F+10);break; - case SDLK_F11: mplayer_put_key(KEY_F+11);break; - case SDLK_F12: mplayer_put_key(KEY_F+12);break; - /*case SDLK_o: mplayer_put_key('o');break; - case SDLK_SPACE: mplayer_put_key(' ');break; - case SDLK_p: mplayer_put_key('p');break;*/ - case SDLK_7: mplayer_put_key(shift_key?'/':'7');break; - case SDLK_PLUS: mplayer_put_key(shift_key?'*':'+');break; - case SDLK_KP_PLUS: mplayer_put_key('+');break; - case SDLK_MINUS: - case SDLK_KP_MINUS: mplayer_put_key('-');break; - case SDLK_TAB: mplayer_put_key('\t');break; - case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; - case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; - case SDLK_UP: mplayer_put_key(KEY_UP);break; - case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; - case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; - case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; - case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; - case SDLK_GREATER: mplayer_put_key('>'); break; - case SDLK_ASTERISK: - case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; - case SDLK_SLASH: - case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; - case SDLK_KP0: mplayer_put_key(KEY_KP0); break; - case SDLK_KP1: mplayer_put_key(KEY_KP1); break; - case SDLK_KP2: mplayer_put_key(KEY_KP2); break; - case SDLK_KP3: mplayer_put_key(KEY_KP3); break; - case SDLK_KP4: mplayer_put_key(KEY_KP4); break; - case SDLK_KP5: mplayer_put_key(KEY_KP5); break; - case SDLK_KP6: mplayer_put_key(KEY_KP6); break; - case SDLK_KP7: mplayer_put_key(KEY_KP7); break; - case SDLK_KP8: mplayer_put_key(KEY_KP8); break; - case SDLK_KP9: mplayer_put_key(KEY_KP9); break; - case SDLK_KP_PERIOD: mplayer_put_key(KEY_KPDEC); break; - case SDLK_KP_ENTER: mplayer_put_key(KEY_KPENTER); break; - default: - //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); - mplayer_put_key(keypressed); - } + else sdl_default_handle_event(&event); break; - case SDL_QUIT: mplayer_put_key(KEY_CLOSE_WIN);break; + default: sdl_default_handle_event(&event); break; } } } -#undef shift_key /* Erase (paint it black) the rectangle specified by x, y, w and h in the surface or overlay which is used for OSD -- cgit v1.2.3 From a83117e972f528ceead87b70b249a5e233d4f13b Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 08:35:35 +0000 Subject: Window resizing support for -vo gl with SDL backend. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31075 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 4 ++++ libvo/sdl_common.c | 12 ++++++++++++ libvo/sdl_common.h | 2 ++ libvo/vo_gl.c | 9 ++------- 4 files changed, 20 insertions(+), 7 deletions(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 2c4c001c00..0df3a16abc 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1855,6 +1855,8 @@ static void *sdlgpa(const GLubyte *name) { } static int setGlWindow_sdl(MPGLContext *ctx) { + if (sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE) < 0) + return SET_WINDOW_FAILED; SDL_GL_LoadLibrary(NULL); getFunctions(sdlgpa, NULL); return SET_WINDOW_OK; @@ -1866,6 +1868,8 @@ static int sdl_check_events(void) { while (SDL_PollEvent(&event)) { res |= sdl_default_handle_event(&event); } + if (res & VO_EVENT_RESIZE) + sdl_set_mode(0, SDL_OPENGL | SDL_RESIZABLE); return res; } diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c index 9116bcbe55..4ef83a7e24 100644 --- a/libvo/sdl_common.c +++ b/libvo/sdl_common.c @@ -26,6 +26,18 @@ #include "input/mouse.h" #include "video_out.h" +int sdl_set_mode(int bpp, uint32_t flags) +{ + SDL_Surface *s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags); + if (!s) { + mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + return -1; + } + vo_dwidth = s->w; + vo_dheight = s->h; + return 0; +} + #define shift_key (event->key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) int sdl_default_handle_event(SDL_Event *event) { diff --git a/libvo/sdl_common.h b/libvo/sdl_common.h index b83161bfc1..7f4112276e 100644 --- a/libvo/sdl_common.h +++ b/libvo/sdl_common.h @@ -27,6 +27,8 @@ #else #include #endif + +int sdl_set_mode(int bpp, uint32_t flags); int sdl_default_handle_event(SDL_Event *event); #endif diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 7d48e35d22..e6b14eb0e6 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -598,13 +598,8 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co #endif #ifdef CONFIG_GL_SDL if (glctx.type == GLTYPE_SDL) { - SDL_Surface *s = SDL_SetVideoMode(d_width, d_height, 0, SDL_OPENGL | SDL_RESIZABLE); - if (!s) { - mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); - return -1; - } - vo_dwidth = s->w; - vo_dheight = s->h; + vo_dwidth = d_width; + vo_dheight = d_height; } #endif return 0; -- cgit v1.2.3 From 8b8fd879ac48ee1472facc04ac4daeaeff48c18f Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 08:40:28 +0000 Subject: Set SDL window title. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31076 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libvo') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index e6b14eb0e6..3c621d00c7 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -598,6 +598,7 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co #endif #ifdef CONFIG_GL_SDL if (glctx.type == GLTYPE_SDL) { + SDL_WM_SetCaption(title, NULL); vo_dwidth = d_width; vo_dheight = d_height; } -- cgit v1.2.3 From 25b9185f17ea8ebb0cf167362ae9fed4d96165c2 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 09:24:30 +0000 Subject: Fullscreen support for -vo gl using SDL. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31077 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 13 +++++++++++++ libvo/sdl_common.c | 27 ++++++++++++++++++++++++++- libvo/sdl_common.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 0df3a16abc..3de2e5450c 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -34,6 +34,7 @@ #include #include "gl_common.h" #include "csputils.h" +#include "aspect.h" void (GLAPIENTRY *mpglBegin)(GLenum); void (GLAPIENTRY *mpglEnd)(void); @@ -1887,10 +1888,21 @@ static int dummy_check_events(void) { return 0; } +static void dummy_update_xinerama_info(void) { + if (vo_screenwidth <= 0 || vo_screenheight <= 0) { + mp_msg(MSGT_VO, MSGL_ERR, "You must specify the screen dimensions" + "with -screenw and -screenh\n"); + vo_screenwidth = 1280; + vo_screenheight = 768; + } + aspect_save_screenres(vo_screenwidth, vo_screenheight); +} + int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { memset(ctx, 0, sizeof(*ctx)); ctx->setGlWindow = setGlWindow_dummy; ctx->releaseGlContext = releaseGlContext_dummy; + ctx->update_xinerama_info = dummy_update_xinerama_info; ctx->check_events = dummy_check_events; ctx->type = type; switch (ctx->type) { @@ -1924,6 +1936,7 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { ctx->setGlWindow = setGlWindow_sdl; ctx->swapGlBuffers = swapGlBuffers_sdl; ctx->check_events = sdl_check_events; + ctx->fullscreen = vo_sdl_fullscreen; return 1; #endif default: diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c index 4ef83a7e24..d45382698b 100644 --- a/libvo/sdl_common.c +++ b/libvo/sdl_common.c @@ -26,9 +26,34 @@ #include "input/mouse.h" #include "video_out.h" +static int old_w; +static int old_h; +static int mode_flags; + +void vo_sdl_fullscreen(void) +{ + if (vo_fs) { + vo_dwidth = old_w; + vo_dheight = old_h; + } else { + old_w = vo_dwidth; + old_h = vo_dheight; + vo_dwidth = vo_screenwidth; + vo_dheight = vo_screenheight; + } + vo_fs = !vo_fs; + sdl_set_mode(0, mode_flags); +} + int sdl_set_mode(int bpp, uint32_t flags) { - SDL_Surface *s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags); + SDL_Surface *s; + mode_flags = flags; + if (vo_fs) flags |= SDL_FULLSCREEN; + // doublebuf with opengl creates flickering + if (vo_doublebuffering && !(flags & SDL_OPENGL)) + flags |= SDL_DOUBLEBUF; + s = SDL_SetVideoMode(vo_dwidth, vo_dheight, bpp, flags); if (!s) { mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); return -1; diff --git a/libvo/sdl_common.h b/libvo/sdl_common.h index 7f4112276e..a0fa956db9 100644 --- a/libvo/sdl_common.h +++ b/libvo/sdl_common.h @@ -28,6 +28,7 @@ #include #endif +void vo_sdl_fullscreen(void); int sdl_set_mode(int bpp, uint32_t flags); int sdl_default_handle_event(SDL_Event *event); -- cgit v1.2.3 From e0183c56b1f879a76788697f2a5ccfc02aa1d5e2 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 09:25:23 +0000 Subject: Remove unnecessary check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31078 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 3c621d00c7..e376e260f4 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1339,8 +1339,6 @@ static int control(uint32_t request, void *data, ...) } break; case VOCTRL_UPDATE_SCREENINFO: - if (!glctx.update_xinerama_info) - break; glctx.update_xinerama_info(); return VO_TRUE; } -- cgit v1.2.3 From 9661a675e50a18e0a098a5644e275e7806e910a9 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 09:52:01 +0000 Subject: Share SDL initialization code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31079 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 4 ++-- libvo/sdl_common.c | 24 ++++++++++++++++++++++++ libvo/sdl_common.h | 2 ++ libvo/vo_sdl.c | 20 ++------------------ 4 files changed, 30 insertions(+), 20 deletions(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 3de2e5450c..c37172b382 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1937,7 +1937,7 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) { ctx->swapGlBuffers = swapGlBuffers_sdl; ctx->check_events = sdl_check_events; ctx->fullscreen = vo_sdl_fullscreen; - return 1; + return vo_sdl_init(); #endif default: return 0; @@ -1959,7 +1959,7 @@ void uninit_mpglcontext(MPGLContext *ctx) { #endif #ifdef CONFIG_GL_SDL case GLTYPE_SDL: - SDL_QuitSubSystem(SDL_INIT_VIDEO); + vo_sdl_uninit(); break; #endif } diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c index d45382698b..6d1944db8c 100644 --- a/libvo/sdl_common.c +++ b/libvo/sdl_common.c @@ -30,6 +30,30 @@ static int old_w; static int old_h; static int mode_flags; +int vo_sdl_init(void) +{ + if (!SDL_WasInit(SDL_INIT_VIDEO) && + SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0) + return 0; + + // Setup Keyrepeats (500/30 are defaults) + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); + + // We don't want those in our event queue. + SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); + SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); + SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); + SDL_EventState(SDL_USEREVENT, SDL_IGNORE); + + return 1; +} + +void vo_sdl_uninit(void) +{ + if (SDL_WasInit(SDL_INIT_VIDEO)) + SDL_QuitSubSystem(SDL_INIT_VIDEO); +} + void vo_sdl_fullscreen(void) { if (vo_fs) { diff --git a/libvo/sdl_common.h b/libvo/sdl_common.h index a0fa956db9..be9e254b31 100644 --- a/libvo/sdl_common.h +++ b/libvo/sdl_common.h @@ -28,6 +28,8 @@ #include #endif +int vo_sdl_init(void); +void vo_sdl_uninit(void); void vo_sdl_fullscreen(void); int sdl_set_mode(int bpp, uint32_t flags); int sdl_default_handle_event(SDL_Event *event); diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index 913ff03533..dbf634934e 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -397,9 +397,6 @@ static int sdl_open (void *plugin, void *name) priv->sdlflags |= SDL_DOUBLEBUF; #endif - /* Setup Keyrepeats (500/30 are defaults) */ - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); - /* get information about the graphics adapter */ vidInfo = SDL_GetVideoInfo (); @@ -444,16 +441,6 @@ static int sdl_open (void *plugin, void *name) priv->bpp = 16; } - /* We don't want those in our event queue. - * We use SDL_KEYUP cause SDL_KEYDOWN seems to cause problems - * with keys need to be pressed twice, to be recognized. - */ - SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); - SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); -// SDL_EventState(SDL_QUIT, SDL_IGNORE); - SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); - SDL_EventState(SDL_USEREVENT, SDL_IGNORE); - /* Success! */ return 0; } @@ -1407,8 +1394,7 @@ uninit(void) sdl_close(); /* Cleanup SDL */ - if(SDL_WasInit(SDL_INIT_VIDEO)) - SDL_QuitSubSystem(SDL_INIT_VIDEO); + vo_sdl_uninit(); mp_msg(MSGT_VO,MSGL_DBG3, "SDL: Closed Plugin\n"); @@ -1458,12 +1444,10 @@ static int preinit(const char *arg) priv->bpp = 0; /* initialize the SDL Video system */ - if (!SDL_WasInit(SDL_INIT_VIDEO)) { - if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) { + if (!vo_sdl_init()) { mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_InitializationFailed, SDL_GetError()); return -1; - } } SDL_VideoDriverName(priv->driver, 8); -- cgit v1.2.3 From 12d11bbd3add8f00d7d9afacf7ddddba997c0e72 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 09:57:52 +0000 Subject: Make uppercase characters and in general all ASCII characters work properly with SDL. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31080 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/sdl_common.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'libvo') diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c index 6d1944db8c..e53f6b0cf3 100644 --- a/libvo/sdl_common.c +++ b/libvo/sdl_common.c @@ -39,6 +39,9 @@ int vo_sdl_init(void) // Setup Keyrepeats (500/30 are defaults) SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); + // Easiest way to get uppercase characters + SDL_EnableUNICODE(1); + // We don't want those in our event queue. SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); @@ -114,7 +117,6 @@ int sdl_default_handle_event(SDL_Event *event) switch(keypressed) { case SDLK_RETURN: mplayer_put_key(KEY_ENTER);break; case SDLK_ESCAPE: mplayer_put_key(KEY_ESC);break; - case SDLK_q: mplayer_put_key('q');break; case SDLK_F1: mplayer_put_key(KEY_F+1);break; case SDLK_F2: mplayer_put_key(KEY_F+2);break; case SDLK_F3: mplayer_put_key(KEY_F+3);break; @@ -127,13 +129,7 @@ int sdl_default_handle_event(SDL_Event *event) case SDLK_F10: mplayer_put_key(KEY_F+10);break; case SDLK_F11: mplayer_put_key(KEY_F+11);break; case SDLK_F12: mplayer_put_key(KEY_F+12);break; - /*case SDLK_o: mplayer_put_key('o');break; - case SDLK_SPACE: mplayer_put_key(' ');break; - case SDLK_p: mplayer_put_key('p');break;*/ - case SDLK_7: mplayer_put_key(shift_key?'/':'7');break; - case SDLK_PLUS: mplayer_put_key(shift_key?'*':'+');break; case SDLK_KP_PLUS: mplayer_put_key('+');break; - case SDLK_MINUS: case SDLK_KP_MINUS: mplayer_put_key('-');break; case SDLK_TAB: mplayer_put_key('\t');break; case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; @@ -142,11 +138,7 @@ int sdl_default_handle_event(SDL_Event *event) case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; - case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; - case SDLK_GREATER: mplayer_put_key('>'); break; - case SDLK_ASTERISK: case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; - case SDLK_SLASH: case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; case SDLK_KP0: mplayer_put_key(KEY_KP0); break; case SDLK_KP1: mplayer_put_key(KEY_KP1); break; @@ -162,7 +154,8 @@ int sdl_default_handle_event(SDL_Event *event) case SDLK_KP_ENTER: mplayer_put_key(KEY_KPENTER); break; default: //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); - mplayer_put_key(keypressed); + if (event->key.keysym.unicode > 0 && event->key.keysym.unicode < 128) + mplayer_put_key(event->key.keysym.unicode); } break; -- cgit v1.2.3 From b2d00967836acd046b8482df8bd407b87af74bc3 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 09:59:43 +0000 Subject: Use the proper define for translating the tab key. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31081 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/sdl_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c index e53f6b0cf3..1b8398b49d 100644 --- a/libvo/sdl_common.c +++ b/libvo/sdl_common.c @@ -131,7 +131,7 @@ int sdl_default_handle_event(SDL_Event *event) case SDLK_F12: mplayer_put_key(KEY_F+12);break; case SDLK_KP_PLUS: mplayer_put_key('+');break; case SDLK_KP_MINUS: mplayer_put_key('-');break; - case SDLK_TAB: mplayer_put_key('\t');break; + case SDLK_TAB: mplayer_put_key(KEY_TAB);break; case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; case SDLK_UP: mplayer_put_key(KEY_UP);break; -- cgit v1.2.3 From 2d8e13c4eaa22d5ef3d07a343aff4f564fe6f08c Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 10:09:01 +0000 Subject: Simplify SDL key symbol mapping. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31082 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/sdl_common.c | 74 +++++++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 48 deletions(-) (limited to 'libvo') diff --git a/libvo/sdl_common.c b/libvo/sdl_common.c index 1b8398b49d..3f5c85e2e8 100644 --- a/libvo/sdl_common.c +++ b/libvo/sdl_common.c @@ -90,10 +90,27 @@ int sdl_set_mode(int bpp, uint32_t flags) return 0; } -#define shift_key (event->key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) +static const struct mp_keymap keysym_map[] = { + {SDLK_RETURN, KEY_ENTER}, {SDLK_ESCAPE, KEY_ESC}, + {SDLK_F1, KEY_F+1}, {SDLK_F2, KEY_F+2}, {SDLK_F3, KEY_F+3}, + {SDLK_F4, KEY_F+4}, {SDLK_F5, KEY_F+5}, {SDLK_F6, KEY_F+6}, + {SDLK_F7, KEY_F+7}, {SDLK_F8, KEY_F+8}, {SDLK_F9, KEY_F+9}, + {SDLK_F10, KEY_F+10}, {SDLK_F11, KEY_F+11}, {SDLK_F12, KEY_F+12}, + {SDLK_KP_PLUS, '+'}, {SDLK_KP_MINUS, '-'}, {SDLK_TAB, KEY_TAB}, + {SDLK_PAGEUP, KEY_PAGE_UP}, {SDLK_PAGEDOWN, KEY_PAGE_DOWN}, + {SDLK_UP, KEY_UP}, {SDLK_DOWN, KEY_DOWN}, + {SDLK_LEFT, KEY_LEFT}, {SDLK_RIGHT, KEY_RIGHT}, + {SDLK_KP_MULTIPLY, '*'}, {SDLK_KP_DIVIDE, '/'}, + {SDLK_KP0, KEY_KP0}, {SDLK_KP1, KEY_KP1}, {SDLK_KP2, KEY_KP2}, + {SDLK_KP3, KEY_KP3}, {SDLK_KP4, KEY_KP4}, {SDLK_KP5, KEY_KP5}, + {SDLK_KP6, KEY_KP6}, {SDLK_KP7, KEY_KP7}, {SDLK_KP8, KEY_KP8}, + {SDLK_KP9, KEY_KP9}, + {SDLK_KP_PERIOD, KEY_KPDEC}, {SDLK_KP_ENTER, KEY_KPENTER}, +}; + int sdl_default_handle_event(SDL_Event *event) { - SDLKey keypressed = SDLK_UNKNOWN; + int mpkey; switch (event->type) { case SDL_VIDEORESIZE: vo_dwidth = event->resize.w; @@ -112,52 +129,13 @@ int sdl_default_handle_event(SDL_Event *event) break; case SDL_KEYDOWN: - keypressed = event->key.keysym.sym; - mp_msg(MSGT_VO,MSGL_DBG2, "SDL: Key pressed: '%i'\n", keypressed); - switch(keypressed) { - case SDLK_RETURN: mplayer_put_key(KEY_ENTER);break; - case SDLK_ESCAPE: mplayer_put_key(KEY_ESC);break; - case SDLK_F1: mplayer_put_key(KEY_F+1);break; - case SDLK_F2: mplayer_put_key(KEY_F+2);break; - case SDLK_F3: mplayer_put_key(KEY_F+3);break; - case SDLK_F4: mplayer_put_key(KEY_F+4);break; - case SDLK_F5: mplayer_put_key(KEY_F+5);break; - case SDLK_F6: mplayer_put_key(KEY_F+6);break; - case SDLK_F7: mplayer_put_key(KEY_F+7);break; - case SDLK_F8: mplayer_put_key(KEY_F+8);break; - case SDLK_F9: mplayer_put_key(KEY_F+9);break; - case SDLK_F10: mplayer_put_key(KEY_F+10);break; - case SDLK_F11: mplayer_put_key(KEY_F+11);break; - case SDLK_F12: mplayer_put_key(KEY_F+12);break; - case SDLK_KP_PLUS: mplayer_put_key('+');break; - case SDLK_KP_MINUS: mplayer_put_key('-');break; - case SDLK_TAB: mplayer_put_key(KEY_TAB);break; - case SDLK_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break; - case SDLK_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break; - case SDLK_UP: mplayer_put_key(KEY_UP);break; - case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; - case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; - case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; - case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; - case SDLK_KP_DIVIDE: mplayer_put_key('/'); break; - case SDLK_KP0: mplayer_put_key(KEY_KP0); break; - case SDLK_KP1: mplayer_put_key(KEY_KP1); break; - case SDLK_KP2: mplayer_put_key(KEY_KP2); break; - case SDLK_KP3: mplayer_put_key(KEY_KP3); break; - case SDLK_KP4: mplayer_put_key(KEY_KP4); break; - case SDLK_KP5: mplayer_put_key(KEY_KP5); break; - case SDLK_KP6: mplayer_put_key(KEY_KP6); break; - case SDLK_KP7: mplayer_put_key(KEY_KP7); break; - case SDLK_KP8: mplayer_put_key(KEY_KP8); break; - case SDLK_KP9: mplayer_put_key(KEY_KP9); break; - case SDLK_KP_PERIOD: mplayer_put_key(KEY_KPDEC); break; - case SDLK_KP_ENTER: mplayer_put_key(KEY_KPENTER); break; - default: - //printf("got scancode: %d keysym: %d mod: %d %d\n", event.key.keysym.scancode, keypressed, event.key.keysym.mod); - if (event->key.keysym.unicode > 0 && event->key.keysym.unicode < 128) - mplayer_put_key(event->key.keysym.unicode); - } - + mpkey = lookup_keymap_table(keysym_map, event->key.keysym.sym); + if (!mpkey && + event->key.keysym.unicode > 0 && + event->key.keysym.unicode < 128) + mpkey = event->key.keysym.unicode; + if (mpkey) + mplayer_put_key(mpkey); break; case SDL_QUIT: mplayer_put_key(KEY_CLOSE_WIN);break; -- cgit v1.2.3 From 63c3c67294f6ab9b1d7644c15557975c7eb030f4 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 10:12:39 +0000 Subject: Missing space in error message. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31083 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index c37172b382..c8d949e689 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1890,7 +1890,7 @@ static int dummy_check_events(void) { static void dummy_update_xinerama_info(void) { if (vo_screenwidth <= 0 || vo_screenheight <= 0) { - mp_msg(MSGT_VO, MSGL_ERR, "You must specify the screen dimensions" + mp_msg(MSGT_VO, MSGL_ERR, "You must specify the screen dimensions " "with -screenw and -screenh\n"); vo_screenwidth = 1280; vo_screenheight = 768; -- cgit v1.2.3 From 4121ce1747db3ddb7336805aaa7bcfebf7044de5 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 10:34:58 +0000 Subject: Handle SDL expose events with -vo gl. git-svn-id: svn:/