%global debug_package %{nil}
%global gituser mpv-player
%global gitname mpv
%global commit befe1e73a2494c2534c6ca9a494fd78d575b6828
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global gitcounter 39
Name: mpv
Version: 0.41.0.git.%{gitcounter}
Release: %{shortcommit}%{?dist}
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Summary: Movie player playing most video formats and DVDs
URL: https://github.com/%{gituser}/%{gitname}
Source0: %{url}/tarball/%{commit}#/%{gituser}-%{name}-%{shortcommit}.tar.gz
# Patch1: %%{url}/pull/15121.patch#/use_libplacebo338_functions_15121.patch
BuildRequires: desktop-file-utils
BuildRequires: gcc
BuildRequires: libappstream-glib
BuildRequires: libatomic
BuildRequires: meson
BuildRequires: python3-docutils
BuildRequires: perl(Encode)
BuildRequires: perl(Math::BigInt)
BuildRequires: perl(Math::BigRat)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(caca)
BuildRequires: pkgconfig(dvdnav)
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(ffnvcodec)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(jack)
BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(libarchive) >= 3.4.0
BuildRequires: pkgconfig(libass)
BuildRequires: pkgconfig(libavcodec) >= 59.27.100
BuildRequires: pkgconfig(libavdevice) >= 58.13.100
BuildRequires: pkgconfig(libavfilter) >= 7.110.100
BuildRequires: pkgconfig(libavformat) >= 59.24.100
BuildRequires: pkgconfig(libavutil) >= 57.24.100
BuildRequires: pkgconfig(libbluray)
BuildRequires: pkgconfig(libcdio)
BuildRequires: pkgconfig(libcdio_paranoia)
BuildRequires: pkgconfig(libdisplay-info)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libpipewire-0.3) >= 0.3.19
BuildRequires: pkgconfig(libplacebo) >= 5.264.1
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libswresample) >= 3.9.100
BuildRequires: pkgconfig(libswscale) >= 5.9.100
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(lua-5.1)
BuildRequires: pkgconfig(mujs)
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(rubberband)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(uchardet) >= 0.0.5
BuildRequires: pkgconfig(vapoursynth)
BuildRequires: pkgconfig(vdpau)
BuildRequires: pkgconfig(vulkan)
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-cursor)
BuildRequires: pkgconfig(wayland-egl)
BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: pkgconfig(wayland-scanner)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xdamage)
BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xpresent)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xscrnsaver)
BuildRequires: pkgconfig(xv)
BuildRequires: pkgconfig(zimg) >= 2.9
BuildRequires: pkgconfig(zlib)
#
BuildRequires: devscripts
Requires: hicolor-icon-theme
Provides: mplayer-backend
Recommends: yt-dlp
Suggests: yt-dlp
%description
Mpv is a movie player based on MPlayer and mplayer2. It supports a wide variety
of video file formats, audio and video codecs, and subtitle types. Special
input URL types are available to read input from a variety of sources other
than disk files. Depending on platform, a variety of different video and audio
output methods are supported.
Mpv has an OpenGL, Vulkan, and D3D11 based video output that is capable of many
features loved by videophiles, such as video scaling with popular high quality
algorithms, color management, frame timing, interpolation, HDR, and more.
While mpv strives for minimalism and provides no real GUI, it has a small
controller on top of the video for basic control.
Mpv can leverage most hardware decoding APIs on all platforms. Hardware
decoding can be enabled at runtime on demand.
Powerful scripting capabilities can make the player do almost anything. There
is a large selection of user scripts on the wiki.
A straightforward C API was designed from the ground up to make mpv usable as
a library and facilitate easy integration into other applications.
%package libs
Summary: Dynamic library for Mpv frontends
Recommends: yt-dlp
Suggests: yt-dlp
%description libs
This package contains the dynamic library libmpv, which provides access to Mpv.
%package devel
Summary: Development package for libmpv
Provides: %{name}-libs-devel = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: %{name}-libs-devel < %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel
This package contains development header files and libraries for Mpv.
%prep
%autosetup -p1 -n %{gituser}-%{gitname}-%{shortcommit}
cat > revert_min_libplacebo.patch << EOF
--- b/meson.build
+++ a/meson.build
@@ -26,7 +26,7 @@
libswresample = dependency('libswresample', version: '>= 4.12.100')
libswscale = dependency('libswscale', version: '>= 7.5.100')
+libplacebo = dependency('libplacebo', version: '>=6.338.2',
-libplacebo = dependency('libplacebo', version: '>=7.360.1',
default_options: ['default_library=static', 'demos=false'])
libass = dependency('libass', version: '>= 0.12.2')
--- b/player/command.c
+++ a/player/command.c
@@ -2422,9 +2422,16 @@
for (int i = 0; i < desc.num_planes; i++)
bpp += desc.bpp[i] >> (desc.xs[i] + desc.ys[i]);
+#if PL_API_VER >= 344
// If PL_ALPHA_NONE is supported, use it directly, unless in auto mode.
if ((desc.flags & MP_IMGFLAG_ALPHA) && alpha == PL_ALPHA_UNKNOWN)
alpha = PL_ALPHA_INDEPENDENT;
+#else
+ // Alpha type is not supported by FFmpeg, so PL_ALPHA_UNKNOWN may mean alpha
+ // is of an unknown type, or simply not present. Normalize to AUTO=no alpha.
+ if (!!(desc.flags & MP_IMGFLAG_ALPHA) != (alpha != PL_ALPHA_UNKNOWN))
+ alpha = (desc.flags & MP_IMGFLAG_ALPHA) ? PL_ALPHA_INDEPENDENT : PL_ALPHA_UNKNOWN;
+#endif
}
const struct pl_hdr_metadata *hdr = &p->color.hdr;
--- b/video/csputils.c
+++ a/video/csputils.c
@@ -43,8 +43,10 @@
{"rgb", PL_COLOR_SYSTEM_RGB},
{"xyz", PL_COLOR_SYSTEM_XYZ},
{"ycgco", PL_COLOR_SYSTEM_YCGCO},
+#if PL_API_VER >= 358
{"ycgco-re", PL_COLOR_SYSTEM_YCGCO_RE},
{"ycgco-ro", PL_COLOR_SYSTEM_YCGCO_RO},
+#endif
{0}
};
@@ -125,7 +127,9 @@
{"auto", PL_ALPHA_UNKNOWN},
{"straight", PL_ALPHA_INDEPENDENT},
{"premul", PL_ALPHA_PREMULTIPLIED},
+#if PL_API_VER >= 344
{"none", PL_ALPHA_NONE},
+#endif
{0}
};
--- b/video/mp_image.c
+++ a/video/mp_image.c
@@ -196,7 +196,11 @@
mpi->imgfmt = hw_fmt;
mpi->num_planes = fmt.num_planes;
mpi->params.repr.alpha = (fmt.flags & MP_IMGFLAG_ALPHA) ? PL_ALPHA_INDEPENDENT
+#if PL_API_VER >= 344
: PL_ALPHA_NONE;
+#else
+ : PL_ALPHA_UNKNOWN;
+#endif
// Calculate bit encoding from all components (excluding alpha)
struct pl_bit_encoding bits = {0};
const int num_comps = mp_imgfmt_desc_get_num_comps(&fmt);
@@ -974,9 +978,11 @@
params->repr.sys != PL_COLOR_SYSTEM_BT_2100_HLG &&
params->repr.sys != PL_COLOR_SYSTEM_DOLBYVISION &&
params->repr.sys != PL_COLOR_SYSTEM_SMPTE_240M &&
+ params->repr.sys != PL_COLOR_SYSTEM_YCGCO
+#if PL_API_VER >= 358
+ && params->repr.sys != PL_COLOR_SYSTEM_YCGCO_RE
+ && params->repr.sys != PL_COLOR_SYSTEM_YCGCO_RO
+#endif
- params->repr.sys != PL_COLOR_SYSTEM_YCGCO &&
- params->repr.sys != PL_COLOR_SYSTEM_YCGCO_RE &&
- params->repr.sys != PL_COLOR_SYSTEM_YCGCO_RO
) {
// Makes no sense, so guess instead
// YCGCO should be separate, but libavcodec disagrees
@@ -1124,12 +1130,12 @@
dst->params.stereo3d = p->stereo3d;
// Might be incorrect if colorspace changes.
dst->params.light = p->light;
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(60, 11, 100) || PL_API_VER < 356
-#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(60, 11, 100)
dst->params.repr.alpha = p->repr.alpha;
#endif
}
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(60, 11, 100) && PL_API_VER >= 356
-#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(60, 11, 100)
// mp_image_setfmt sets to PL_ALPHA_INDEPENDENT, if format has alpha.
if (dst->params.repr.alpha == PL_ALPHA_INDEPENDENT)
dst->params.repr.alpha = pl_alpha_from_av(src->alpha_mode);
@@ -1177,8 +1183,17 @@
if (header->disable_residual_flag) {
dst->dovi = dovi = av_buffer_alloc(sizeof(struct pl_dovi_metadata));
MP_HANDLE_OOM(dovi);
+#if PL_API_VER >= 343
pl_map_avdovi_metadata(&dst->params.color, &dst->params.repr,
(void *)dst->dovi->data, metadata);
+#else
+ struct pl_frame frame;
+ frame.repr = dst->params.repr;
+ frame.color = dst->params.color;
+ pl_frame_map_avdovi_metadata(&frame, (void *)dst->dovi->data, metadata);
+ dst->params.repr = frame.repr;
+ dst->params.color = frame.color;
+#endif
}
#endif
}
--- b/video/out/d3d11/context.c
+++ a/video/out/d3d11/context.c
@@ -597,6 +597,7 @@
struct priv *p = ra->priv;
int fmt = p->opts->output_format;
+#if PL_API_VER >= 360
switch (fmt) {
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_B8G8R8A8_UNORM:
@@ -617,6 +618,10 @@
default:
params->alpha_bits = ra->opts.want_alpha ? 8 : 0;
};
+#else
+ if (fmt == DXGI_FORMAT_R8G8B8A8_UNORM || fmt == DXGI_FORMAT_B8G8R8A8_UNORM)
+ params->disable_10bit_sdr = true;
+#endif
}
#endif
--- b/video/out/vo_gpu_next.c
+++ a/video/out/vo_gpu_next.c
@@ -200,8 +200,12 @@
{"none", BACKGROUND_NONE},
{"color", BACKGROUND_COLOR},
{"tiles", BACKGROUND_TILES}
+#if PL_API_VER < 355
+ )},
+#else
,{"blur", BACKGROUND_BLUR})},
{"background-blur-radius", OPT_FLOAT(background_blur_radius)},
+#endif
{"corner-rounding", OPT_FLOAT(corner_rounding), M_RANGE(0, 1)},
{"interpolation-preserve", OPT_BOOL(inter_preserve)},
{"lut", OPT_STRING(lut.opt), .flags = M_OPT_FILE},
@@ -938,13 +942,17 @@
static bool set_colorspace_hint(struct priv *p, struct pl_color_space *hint)
{
struct ra_swapchain *sw = p->ra_ctx->swapchain;
+ enum pl_alpha_mode alpha = PL_ALPHA_UNKNOWN;
+#if PL_API_VER >= 344
+ alpha = PL_ALPHA_NONE;
+#endif
struct mp_image_params params = {
.color = hint ? *hint : pl_color_space_srgb,
.repr = {
.sys = PL_COLOR_SYSTEM_RGB,
.levels = p->output_levels ? p->output_levels : PL_COLOR_LEVELS_FULL,
+ .alpha = p->ra_ctx->opts.want_alpha ? PL_ALPHA_INDEPENDENT : alpha,
- .alpha = p->ra_ctx->opts.want_alpha ? PL_ALPHA_INDEPENDENT : PL_ALPHA_NONE,
},
};
@@ -1234,8 +1242,10 @@
.pts = frame->current->pts + pts_offset,
.radius = pl_frame_mix_radius(¶ms),
.vsync_duration = can_interpolate ? frame->ideal_frame_vsync_duration : 0,
- .drift_compensation = 0,
);
+#if PL_API_VER >= 340
+ qparams.drift_compensation = 0;
+#endif
pl_queue_update(p->queue, NULL, &qparams);
}
return VO_FALSE;
@@ -1313,8 +1323,10 @@
.radius = pl_frame_mix_radius(¶ms),
.vsync_duration = can_interpolate ? frame->ideal_frame_vsync_duration : 0,
.interpolation_threshold = opts->interpolation_threshold,
- .drift_compensation = 0,
);
+#if PL_API_VER >= 340
+ qparams.drift_compensation = 0;
+#endif
// Depending on the vsync ratio, we may be up to half of the vsync
// duration before the current frame time. This works fine because
@@ -1574,8 +1586,10 @@
enum pl_queue_status status;
struct pl_queue_params qparams = *pl_queue_params(
.pts = p->last_pts,
- .drift_compensation = 0,
);
+#if PL_API_VER >= 340
+ qparams.drift_compensation = 0;
+#endif
status = pl_queue_update(p->queue, &mix, &qparams);
mp_assert(status != PL_QUEUE_EOF);
if (status == PL_QUEUE_ERR) {
@@ -2483,15 +2497,23 @@
pars->params.disable_linear_scaling = !opts->linear_downscaling && !opts->linear_upscaling;
pars->params.disable_fbos = opts->dumb_mode == 1;
+#if PL_API_VER >= 346
static const int map_background_types[] = {
[BACKGROUND_NONE] = PL_CLEAR_SKIP,
[BACKGROUND_COLOR] = PL_CLEAR_COLOR,
[BACKGROUND_TILES] = PL_CLEAR_TILES,
+#if PL_API_VER >= 355
[BACKGROUND_BLUR] = PL_CLEAR_BLUR,
+#endif
};
pars->params.background = map_background_types[opts->background];
pars->params.border = map_background_types[p->next_opts->border_background];
+#if PL_API_VER >= 355
pars->params.blur_radius = p->next_opts->background_blur_radius;
+#endif
+#else
+ pars->params.blend_against_tiles = opts->background == BACKGROUND_TILES;
+#endif
pars->params.tile_size = opts->background_tile_size * 2;
for (int i = 0; i < 2; ++i) {
pars->params.tile_colors[i][0] = opts->background_tile_color[i].r / 255.0f;
--- b/video/out/vulkan/context.c
+++ a/video/out/vulkan/context.c
@@ -425,7 +425,9 @@
.surface = vk->surface,
.present_mode = preferred_mode,
.swapchain_depth = ctx->vo->opts->swapchain_depth,
+#if PL_API_VER >= 359
.alpha_bits = ctx->opts.want_alpha ? 8 : 0,
+#endif
};
if (p->opts->swap_mode >= 0) // user override
EOF
patch -p1 < revert_min_libplacebo.patch
%build
# -Dsdl2=enabled
%meson --auto-features=auto \
-Dalsa=enabled \
-Dbuild-date=false \
-Dcaca=enabled \
-Dcdda=enabled \
-Dcplayer=true \
-Dcplugins=enabled \
-Dcuda-hwaccel=enabled \
-Dcuda-interop=enabled \
-Ddmabuf-wayland=enabled \
-Ddrm=enabled \
-Ddvbin=enabled \
-Ddvdnav=enabled \
-Degl-drm=enabled \
-Degl-wayland=enabled \
-Degl-x11=enabled \
-Degl=enabled \
-Dgbm=enabled \
-Dgl-x11=enabled \
-Dgl=enabled \
-Dhtml-build=enabled \
-Diconv=enabled \
-Djack=enabled \
-Djavascript=enabled \
-Djpeg=enabled \
-Dlcms2=enabled \
-Dlibarchive=enabled \
-Dlibavdevice=enabled \
-Dlibbluray=enabled \
-Dlibmpv=true \
-Dlua=enabled \
-Dmanpage-build=enabled \
-Dopenal=enabled \
-Dopensles=disabled \
-Doss-audio=disabled \
-Dpipewire=enabled \
-Dplain-gl=enabled \
-Dpulse=enabled \
-Drubberband=enabled \
-Dsdl2-audio=enabled \
-Dsdl2-gamepad=enabled \
-Dsdl2-video=enabled \
-Dshaderc=disabled \
-Dsndio=disabled \
-Dspirv-cross=disabled \
-Duchardet=enabled \
-Dvaapi-drm=enabled \
-Dvaapi-wayland=enabled \
-Dvaapi-x11=enabled \
-Dvaapi=enabled \
-Dvapoursynth=enabled \
-Dvdpau-gl-x11=enabled \
-Dvdpau=enabled \
-Dvector=enabled \
-Dvulkan=enabled \
-Dwayland=enabled \
-Dwerror=false \
-Dx11=enabled \
-Dxv=enabled \
-Dzimg=enabled \
-Dzlib=enabled
%meson_build
%install
%meson_install
%check
hardening-check -v --nobranchprotection %{buildroot}%{_bindir}/%{name}
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{name}.metainfo.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
%files
%docdir %{_docdir}/%{name}/
%license LICENSE.GPL LICENSE.LGPL Copyright
%{_docdir}/%{name}/
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}*.*
%{bash_completions_dir}/%{name}
%{zsh_completions_dir}/_%{name}
%{fish_completions_dir}/%{name}.fish
%{_mandir}/man1/%{name}.*
%{_metainfodir}/%{name}.metainfo.xml
# %%dir %%{_sysconfdir}/%%{name}/
# %%config(noreplace) %%{_sysconfdir}/%%{name}/encoding-profiles.conf
%files libs
%license LICENSE.GPL LICENSE.LGPL Copyright
%{_libdir}/lib%{name}.so.2{,.*}
%files devel
%{_includedir}/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Sat Oct 12 2024 samoht0 git-master
- use git-master due to format upload fixes
* Fri Oct 04 2024 samoht0 0.39.0
- fix some regressions
* Tue Sep 24 2024 samoht0 0.39.0
- update 0.39.0
- history cleanup