SUMMARY="Command line media player"
--
Takashi Yano <[email protected]>
NAME="mpv"
VERSION=0.39.0
RELEASE=1
LICENSE="GPL-2.0-or-later AND LGPL-2.1-or-later"
HOMEPAGE="https://github.com/mpv-player/mpv"
SUMMARY="Command line media player"
CATEGORY="Audio Video"
GIT_URI="https://github.com/mpv-player/mpv.git"
GIT_TAG="v${VERSION}"
inherit git meson
CYGMESON_ARGS="
--auto-features=auto
-Dd3d11=enabled
-Dgl-win32=disabled
-Dgl-x11=enabled
-Dsdl2=enabled
-Dsdl2-video=enabled
-Dshaderc=enabled
-Dspirv-cross=enabled
-Dwin32-threads=disabled
-Dsndio=disabled
-Djack=disabled
"
BUILD_REQUIRES="shaderc-devel SPIRV-Cross-devel libplacebo-devel"
--- origsrc/mpv/audio/out/ao_pcm.c 2025-02-13 14:42:11.000000000 +0900
+++ src/mpv/audio/out/ao_pcm.c 2025-02-14 09:31:00.897987400 +0900
@@ -25,6 +25,10 @@
#include <libavutil/common.h>
+#ifdef __CYGWIN__
+#undef _WIN32
+#endif
+
#include "mpv_talloc.h"
#include "options/m_option.h"
--- origsrc/mpv/audio/out/ao_pulse.c 2025-02-13 14:42:11.000000000 +0900
+++ src/mpv/audio/out/ao_pulse.c 2025-02-14 09:31:00.900986900 +0900
@@ -804,7 +804,7 @@ const struct ao_driver audio_out_pulse =
.priv_size = sizeof(struct priv),
.priv_defaults = &(const struct priv) {
.cfg_buffer = 100,
- .cfg_latency_hacks = true,
+ .cfg_latency_hacks = false,
},
.options = (const struct m_option[]) {
{"host", OPT_STRING(cfg_host)},
--- origsrc/mpv/audio/out/ao_wasapi_utils.c 2025-02-13 14:42:11.000000000
+0900
+++ src/mpv/audio/out/ao_wasapi_utils.c 2025-02-14 09:31:00.904986200 +0900
@@ -26,10 +26,19 @@
#include <mmreg.h>
#include <ksguid.h>
#else
+#ifdef __CYGWIN__
+#include <mmreg.h>
+#include <ks.h>
+#include <ksguid.h>
+DEFINE_GUID(KSDATAFORMAT_SPECIFIER_NONE,
+ 0xf6417d6, 0xc318, 0x11d0, 0xa4, 0x3f,
+ 0, 0xa0, 0xc9, 0x22, 0x31, 0x96);
+#else
#include <ks.h>
#include <ksguid.h>
#include <mmreg.h>
#endif
+#endif
#include <mmsystem.h>
#include <ksmedia.h>
#include <avrt.h>
--- origsrc/mpv/input/ipc-win.c 2025-02-13 14:42:11.000000000 +0900
+++ src/mpv/input/ipc-win.c 2025-02-14 09:31:00.907986800 +0900
@@ -17,6 +17,9 @@
#include <windows.h>
#include <sddl.h>
+#ifdef __CYGWIN__
+#include <io.h>
+#endif
#include "osdep/io.h"
#include "osdep/threads.h"
--- origsrc/mpv/meson.build 2025-02-13 14:42:11.000000000 +0900
+++ src/mpv/meson.build 2025-02-14 10:25:31.254201000 +0900
@@ -301,7 +301,7 @@ endif
darwin = host_machine.system() == 'darwin'
win32 = host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
-posix = not win32
+posix = not win32 or host_machine.system() == 'cygwin'
features += {'darwin': darwin}
features += {'posix': posix}
@@ -490,7 +490,7 @@ endif
features += {'win32-executable': win32 and get_option('cplayer')}
if win32
- timer_source = files('osdep/timer-win32.c')
+ #timer_source = files('osdep/timer-win32.c')
sources += files('osdep/w32_keyboard.c',
'osdep/windows_utils.c')
endif
@@ -512,16 +512,16 @@ if features['win32-desktop']
cc.find_library('uxtheme'),
cc.find_library('version')]
dependencies += win32_desktop_libs
- path_source = files('osdep/path-win.c')
- sources += files('input/ipc-win.c',
- 'osdep/language-win.c',
- 'osdep/subprocess-win.c',
- 'osdep/terminal-win.c',
+ #path_source = files('osdep/path-win.c')
+ sources += files(#'input/ipc-win.c',
+ #'osdep/language-win.c',
+ #'osdep/subprocess-win.c',
+ #'osdep/terminal-win.c',
'video/out/w32_common.c',
'video/out/win32/displayconfig.c',
'video/out/win32/droptarget.c',
'video/out/win32/menu.c')
- main_fn_source = files('osdep/main-fn-win.c')
+ #main_fn_source = files('osdep/main-fn-win.c')
endif
if not posix and not features['win32-desktop']
@@ -1062,9 +1062,9 @@ x11_opt = get_option('x11').require(
)
x11 = {
'deps': [dependency('x11', version: '>= 1.0.0', required: x11_opt),
- dependency('xscrnsaver', version: '>= 1.0.0', required: x11_opt),
+ #dependency('xscrnsaver', version: '>= 1.0.0', required: x11_opt),
dependency('xext', version: '>= 1.0.0', required: x11_opt),
- dependency('xpresent', version: '>= 1.0.0', required: x11_opt),
+ #dependency('xpresent', version: '>= 1.0.0', required: x11_opt),
dependency('xrandr', version: '>= 1.4.0', required: x11_opt)],
}
x11_deps = true
@@ -1105,8 +1105,8 @@ features += {'gl': false}
GL = dependency('', required: false)
if darwin
GL = dependency('appleframeworks', modules: 'OpenGL', required:
get_option('gl-cocoa'))
-elif features['win32-desktop']
- GL = dependency('GL', required: get_option('gl-win32'))
+#elif features['win32-desktop']
+ #GL = dependency('GL', required: get_option('gl-win32'))
elif features['x11']
GL = dependency('GL', required: get_option('gl-x11'))
endif
@@ -1816,8 +1816,8 @@ if get_option('cplayer')
# Older meson versions generate this in the player subdirectory.
if win32 and meson.version().version_compare('>= 1.3.0')
wrapper_sources= 'osdep/win32-console-wrapper.c'
- executable('mpv', wrapper_sources, c_args: '-municode', link_args:
'-municode',
- name_suffix: 'com', install: true)
+ #executable('mpv', wrapper_sources, c_args: '-municode', link_args:
'-municode',
+ #name_suffix: 'com', install: true)
endif
if darwin
--- origsrc/mpv/osdep/io.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/osdep/io.c 2025-02-14 09:31:00.914558400 +0900
@@ -110,7 +110,7 @@ void mp_flush_wakeup_pipe(int pipe_end)
#endif
}
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h>
#include <wchar.h>
--- origsrc/mpv/osdep/io.h 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/osdep/io.h 2025-02-14 09:31:00.917569300 +0900
@@ -95,6 +95,10 @@ char *mp_to_utf8(void *talloc_ctx, const
#endif
+#ifdef __CYGWIN__
+#undef _WIN32
+#endif
+
#if defined(_WIN32) && !defined(__MINGW32__)
#include <io.h>
#include "dirent-win.h"
@@ -233,12 +237,14 @@ int msync(void *addr, size_t length, int
#define glob(...) mp_glob(__VA_ARGS__)
#define globfree(...) mp_globfree(__VA_ARGS__)
+#ifndef __CYGWIN__
// These are stubs since there is not anything that helps with this on Windows.
#define locale_t int
#define LC_CTYPE_MASK 0
locale_t newlocale(int, const char *, locale_t);
locale_t uselocale(locale_t);
void freelocale(locale_t);
+#endif
#else /* __MINGW32__ */
--- origsrc/mpv/osdep/subprocess-win.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/osdep/subprocess-win.c 2025-02-14 09:31:00.920570100 +0900
@@ -17,6 +17,9 @@
#include <windows.h>
#include <string.h>
+#ifdef __CYGWIN__
+#include <io.h>
+#endif
#include "osdep/subprocess.h"
--- origsrc/mpv/osdep/terminal-win.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/osdep/terminal-win.c 2025-02-14 09:31:00.923571000 +0900
@@ -42,6 +42,12 @@
#define DISABLE_NEWLINE_AUTO_RETURN 0x0008
#endif
+#ifdef __CYGWIN__
+extern int _open_osfhandle (intptr_t osfhandle, int flags);
+#define _O_RDONLY O_RDONLY
+#define _O_WRONLY O_WRONLY
+#endif
+
// Note: the DISABLE_NEWLINE_AUTO_RETURN docs say it enables delayed-wrap, but
// it's wrong. It does only what its names suggests - and we want it unset:
// https://github.com/microsoft/terminal/issues/4126#issuecomment-571418661
--- origsrc/mpv/osdep/windows_utils.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/osdep/windows_utils.c 2025-02-14 09:31:00.926569800 +0900
@@ -27,6 +27,10 @@
#include <ole2.h>
#include <shobjidl.h>
+#ifdef __CYGWIN__
+#include <vfwmsgs.h>
+#endif
+
#include "common/common.h"
#include "windows_utils.h"
#include "mpv_talloc.h"
@@ -164,6 +168,7 @@ char *mp_HRESULT_to_str_buf(char *buf, s
return buf;
}
+#ifndef __CYGWIN__
bool mp_w32_create_anon_pipe(HANDLE *server, HANDLE *client,
struct w32_create_anon_pipe_opts *opts)
{
@@ -230,6 +235,7 @@ error:
*server = *client = INVALID_HANDLE_VALUE;
return false;
}
+#endif
wchar_t *mp_w32_get_shell_link_target(wchar_t *path)
{
--- origsrc/mpv/player/playloop.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/player/playloop.c 2025-02-14 09:31:00.930569600 +0900
@@ -375,6 +375,7 @@ static void mp_seek(MPContext *mpctx, st
clear_audio_output_buffers(mpctx);
reset_playback_state(mpctx);
+ mpctx->num_next_frames = -3; /* Workaround for buggy decoder seek */
demux_block_reading(mpctx->demuxer, false);
for (int t = 0; t < mpctx->num_tracks; t++) {
--- origsrc/mpv/player/video.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/player/video.c 2025-02-14 09:31:00.938572000 +0900
@@ -534,7 +534,21 @@ static int video_output_image(struct MPC
mpctx->hrseek_backstep = false;
}
mp_image_unrefp(&mpctx->saved_frame);
- add_new_frame(mpctx, img);
+ /* Workaround for buggy decoder seek */
+#if 1
+ double seek_tolerance = 0.5;
+#else
+ double seek_tolerance = 1e4;
+#endif
+ if (mpctx->num_next_frames < 0 &&
+ fabs(mpctx->last_seek_pts - img->pts) > seek_tolerance) {
+ mpctx->num_next_frames++;
+ /* Skip add_new_frame() */
+ } else {
+ if (mpctx->num_next_frames < 0)
+ mpctx->num_next_frames = 0;
+ add_new_frame(mpctx, img);
+ }
img = NULL;
}
talloc_free(img);
--- origsrc/mpv/stream/stream_file.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/stream/stream_file.c 2025-02-14 09:31:00.942576500 +0900
@@ -25,6 +25,10 @@
#include <fcntl.h>
#include <errno.h>
+#ifdef __CYGWIN__
+#undef _WIN32
+#endif
+
#ifndef _WIN32
#include <poll.h>
#endif
--- origsrc/mpv/video/out/d3d11/ra_d3d11.c 2025-02-13 14:42:12.000000000
+0900
+++ src/mpv/video/out/d3d11/ra_d3d11.c 2025-02-14 09:31:00.946574000 +0900
@@ -1999,7 +1999,7 @@ static void timer_destroy(struct ra *ra,
talloc_free(timer);
}
-static ra_timer *timer_create(struct ra *ra)
+static ra_timer *timer_create_d3d(struct ra *ra)
{
struct ra_d3d11 *p = ra->priv;
if (!p->has_timestamp_queries)
@@ -2280,7 +2280,7 @@ static struct ra_fns ra_fns_d3d11 = {
.renderpass_create = renderpass_create,
.renderpass_destroy = renderpass_destroy,
.renderpass_run = renderpass_run,
- .timer_create = timer_create,
+ .timer_create = timer_create_d3d,
.timer_destroy = timer_destroy,
.timer_start = timer_start,
.timer_stop = timer_stop,
--- origsrc/mpv/video/out/opengl/context_glx.c 2025-02-13 14:42:12.000000000
+0900
+++ src/mpv/video/out/opengl/context_glx.c 2025-02-14 09:31:00.949571800
+0900
@@ -40,6 +40,10 @@
#include "osdep/timer.h"
#include "video/out/present_sync.h"
#include "video/out/x11_common.h"
+#ifdef __CYGWIN__
+#undef HAVE_GL_WIN32
+#define HAVE_GL_WIN32 0
+#endif
#include "context.h"
#include "utils.h"
--- origsrc/mpv/video/out/opengl/context_x11egl.c 2025-02-13
14:42:12.000000000 +0900
+++ src/mpv/video/out/opengl/context_x11egl.c 2025-02-14 09:31:00.952571600
+0900
@@ -17,6 +17,9 @@
#include <assert.h>
+#ifdef __CYGWIN__
+#undef _WIN32
+#endif
#include <X11/Xlib.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -24,6 +27,10 @@
#include "common/common.h"
#include "video/out/present_sync.h"
#include "video/out/x11_common.h"
+#ifdef __CYGWIN__
+#undef HAVE_GL_WIN32
+#define HAVE_GL_WIN32 0
+#endif
#include "context.h"
#include "egl_helpers.h"
#include "utils.h"
--- origsrc/mpv/video/out/w32_common.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/video/out/w32_common.c 2025-02-14 10:23:11.052025700 +0900
@@ -2488,9 +2488,11 @@ void vo_w32_set_transparency(struct vo *
}
}
+#ifndef __CYGWIN__
BOOL WINAPI DllMain(HANDLE dll, DWORD reason, LPVOID reserved)
{
if (reason == DLL_PROCESS_DETACH && window_class)
UnregisterClassW(MPV_WINDOW_CLASS_NAME, HINST_THISCOMPONENT);
return TRUE;
}
+#endif
--- origsrc/mpv/video/out/x11_common.c 2025-02-13 14:42:12.000000000 +0900
+++ src/mpv/video/out/x11_common.c 2025-02-14 09:31:00.960572900 +0900
@@ -34,7 +34,9 @@
#include <X11/XKBlib.h>
#include <X11/XF86keysym.h>
+#ifndef __CYGWIN__
#include <X11/extensions/scrnsaver.h>
+#endif
#include <X11/extensions/dpms.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/Xrandr.h>
@@ -42,7 +44,9 @@
#ifndef PRESENT_FUTURE_VERSION
#define PRESENT_FUTURE_VERSION 0
#endif
+#ifndef __CYGWIN__
#include <X11/extensions/Xpresent.h>
+#endif
#include "misc/bstr.h"
#include "options/options.h"
@@ -394,6 +398,7 @@ static int vo_wm_detect(struct vo *vo)
static void xpresent_set(struct vo_x11_state *x11)
{
+#ifndef __CYGWIN__
int present = x11->opts->x11_present;
x11->use_present = x11->present_code &&
((x11->has_mesa && !x11->has_nvidia && present) ||
@@ -403,6 +408,7 @@ static void xpresent_set(struct vo_x11_s
} else {
MP_VERBOSE(x11, "XPresent disabled.\n");
}
+#endif
}
static void xrandr_read(struct vo_x11_state *x11)
@@ -1384,6 +1390,7 @@ void vo_x11_check_events(struct vo *vo)
}
break;
case GenericEvent: {
+#ifndef __CYGWIN__
XGenericEventCookie *cookie = (XGenericEventCookie
*)&Event.xcookie;
if (cookie->extension == x11->present_code && x11->use_present)
{
@@ -1397,6 +1404,7 @@ void vo_x11_check_events(struct vo *vo)
}
}
XFreeEventData(x11->display, cookie);
+#endif
break;
}
default:
@@ -1628,6 +1636,7 @@ static void vo_x11_create_window(struct
Atom protos[1] = {XA(x11, WM_DELETE_WINDOW)};
XSetWMProtocols(x11->display, x11->window, protos, 1);
+#ifndef __CYGWIN__
if (!XPresentQueryExtension(x11->display, &x11->present_code, NULL, NULL))
{
MP_VERBOSE(x11, "The XPresent extension is not supported.\n");
} else {
@@ -1635,6 +1644,7 @@ static void vo_x11_create_window(struct
XPresentSelectInput(x11->display, x11->window,
PresentCompleteNotifyMask);
}
xpresent_set(x11);
+#endif
x11->mouse_cursor_set = false;
x11->mouse_cursor_visible = true;
@@ -2268,9 +2278,11 @@ int vo_x11_control(struct vo *vo, int *e
void vo_x11_present(struct vo *vo)
{
+#ifndef __CYGWIN__
struct vo_x11_state *x11 = vo->x11;
XPresentNotifyMSC(x11->display, x11->window,
0, 0, 1, 0);
+#endif
}
void vo_x11_wakeup(struct vo *vo)
@@ -2299,6 +2311,7 @@ void vo_x11_wait_events(struct vo *vo, i
static void xscreensaver_heartbeat(struct vo_x11_state *x11)
{
+#ifndef __CYGWIN__
double time = mp_time_sec();
if (x11->display && !x11->screensaver_enabled &&
@@ -2307,8 +2320,10 @@ static void xscreensaver_heartbeat(struc
x11->screensaver_time_last = time;
XResetScreenSaver(x11->display);
}
+#endif
}
+#ifndef __CYGWIN__
static int xss_suspend(Display *mDisplay, Bool suspend)
{
int event, error, major, minor;
@@ -2320,9 +2335,11 @@ static int xss_suspend(Display *mDisplay
XScreenSaverSuspend(mDisplay, suspend);
return 1;
}
+#endif
static void set_screensaver(struct vo_x11_state *x11, bool enabled)
{
+#ifndef __CYGWIN__
Display *mDisplay = x11->display;
if (!mDisplay || x11->screensaver_enabled == enabled)
return;
@@ -2350,6 +2367,7 @@ static void set_screensaver(struct vo_x1
MP_WARN(x11, "DPMS state could not be set.\n");
}
}
+#endif
}
static void vo_x11_selectinput_witherr(struct vo *vo,