summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Copyright78
-rw-r--r--Makefile12
-rw-r--r--README31
-rw-r--r--README.md222
-rw-r--r--debian/changelog1030
-rw-r--r--debian/copyright340
-rw-r--r--ytdlsb-main.c664
-rw-r--r--ytdlsb-mpv.c102
-rw-r--r--ytdlsb-mpv.h8
-rw-r--r--ytdlsb-tasks.c234
-rw-r--r--ytdlsb-tasks.h39
-rw-r--r--ytdlsb-utils.h45
13 files changed, 1134 insertions, 1673 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cc78368
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.so
+*.o
diff --git a/Copyright b/Copyright
deleted file mode 100644
index 61d3a03..0000000
--- a/Copyright
+++ /dev/null
@@ -1,78 +0,0 @@
-mpv is a fork of mplayer2, which is a fork of MPlayer.
-
-mpv as a whole is licensed under the GNU General Public License GPL version 2
-or later (called GPLv2+ in this document, see LICENSE.GPL for full license
-text) by default. The mpv program is licensed the GNU Lesser General Public
-License LGPL version 2 or later (LGPLv2.1+ in this document, see LICENSE.LGPL
-for full license text) if built without using any GPL only files.
-The -Dgpl=false configure switch is provided as a convenience for excluding
-the GPL only files listed below from the build process.
-
-However, do note that the build system is provided "as is" and using the
--Dgpl=false configure switch does not in itself create a LGPLv2.1+ license
-grant.
-
-Additionally, some non-program parts, such as the documentation and some config
-files listed below, are still built and licensed under their respective licenses
-even when -Dgpl=false is used. Please consult GPLv2+ and LGPLv2.1+ license texts
-for further details on how to distribute these files.
-
-Most source files are LGPLv2.1+ or GPLv2+, but some files are available under
-more liberal licenses, such as BSD, MIT, ISC, and possibly others. Look at the
-copyright header of each source file, and grep the sources for "Copyright" if
-you need to know details. C source files without Copyright notice are usually
-licensed as LGPLv2.1+. Also see the list of files with specific licenses below
-(not all files can have a standard license header).
-
-All new contributions must be LGPLv2.1+ licensed. Using a more liberal license
-compatible to LGPLv2.1+ is also ok.
-
-Changes done to GPL code must come with the implicit/explicit agreement that the
-project can relicense the changes to LGPLv2.1+ at a later point without asking
-the contributor. This is a safeguard for making potential relicensing of
-remaining GPL code to LGPLv2.1+ easier.
-
-See DOCS/contribute.md for binding rules wrt. licensing for contributions.
-
-For information about authors and contributors, consult the git log, which
-contains the complete SVN and CVS history as well.
-
-mpv can be built as LGPLv2.1+ without using any GPL only files. To add a
-LGPL mode to mpv, MPlayer code had to be relicensed from GPLv2+ to LGPLv2.1+ by
-asking the MPlayer authors for permission. Since permission could not be
-obtained from everyone, LGPL mode disables the following features, some of them
-quite central:
-- Linux X11 video output
-- BSD audio output via OSS
-- NVIDIA/Linux hardware decoding (vdpau, although nvdec usually works)
-- minor features: jack, DVD, CDDA, DVB, CACA, legacy direct3d VO
-Some of these will be fixed in the future. The intended use for LGPL mode is
-with libmpv, and currently it's not recommended to build mpv CLI in LGPL mode
-at all.
-
-The following files are still GPL only (-Dgpl=false disables them):
-
- audio/out/ao_jack.c will stay GPL
- audio/out/ao_oss.c will stay GPL
- stream/dvb* must stay GPL
- stream/stream_cdda.c unknown
- stream/stream_dvb.* must stay GPL
- stream/stream_dvdnav.c unknown
- video/out/vo_caca.c unknown
- video/out/vo_direct3d.c unknown
- video/out/vo_vaapi.c probably impossible (some company's code)
- video/out/vo_vdpau.c probably impossible (nVidia's code)
- video/out/vo_x11.c probably impossible
- video/out/vo_xv.c probably impossible
- video/out/x11_common.* probably impossible
- video/vdpau.c hard (GPL-only parts must be ifdefed)
- video/vdpau.h unknown
- video/vdpau_mixer.* actual code must be rewritten
- DOCS/man/ GPLv2+
- etc/mplayer-input.conf unknown license, probably GPLv2+
- etc/mpv.desktop unknown license, probably GPLv2+
- etc/restore-old-bindings.conf unknown license, probably GPLv2+
-
-None of the cases listed above affect the final binary if it's built as
-LGPL. Linked libraries still can affect the final license (for example if
-FFmpeg was built as GPL).
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..dbb91e4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,12 @@
+LIBPKGS=libcjson libcurl libwebp
+CFLAGS=$(shell pkg-config --cflags mpv) \
+ $(shell pkg-config --cflags $(LIBPKGS)) \
+ -pthread \
+ -fPIC -Wall -Wno-unused-variable -Wno-parentheses -Wno-unused-function \
+ -g -O0
+LDFLAGS=$(shell pkg-config --libs $(LIBPKGS))
+
+all: ytdl-storyboard.so
+
+ytdl-storyboard.so: ytdlsb-main.c ytdlsb-tasks.c ytdlsb-mpv.c
+ gcc -o $@ $(CFLAGS) -shared $^ $(LDFLAGS)
diff --git a/README b/README
index 517c45c..30e2355 100644
--- a/README
+++ b/README
@@ -1,4 +1,29 @@
-osc.lua (moved from player/lua/) and some documentations about copyright.
-Copied from mpv 0.41.0 debian release.
+# About
-Authors are listed in debian/copyright.
+Show "storyboard" of YouTube,
+when you use mpv to play YouTube video, and hover on the seekbar.
+
+# How to use
+
+make, then copy files to your "scripts" folder.
+
+make ytdl-storyboard.so
+cp ytdl-storyboard.so osc-mod.lua ~/.config/mpv/scripts
+
+# Copyright
+
+Copyright dyknon 2025, 2026
+
+osc-mod.lua is originally written by mpv developers.
+It was taken from mpv 0.41.0. Check tag: mpv-0.41.0-osc-mod.
+There are small changes by dyknon to:
+
+* Export information about user interactins with osc to other scripts.
+* Unload built-in osc.
+
+Other files are written by dyknon.
+
+# License
+
+This program package, mpv-ytdl-storyboard is licensed under
+the GNU Lesser General Public License version 2.1 or later.
diff --git a/README.md b/README.md
deleted file mode 100644
index 0d8caf1..0000000
--- a/README.md
+++ /dev/null
@@ -1,222 +0,0 @@
-![mpv logo](https://raw.githubusercontent.com/mpv-player/mpv.io/master/source/images/mpv-logo-128.png)
-
-# mpv
-
-
-* [External links](#external-links)
-* [Overview](#overview)
-* [System requirements](#system-requirements)
-* [Downloads](#downloads)
-* [Changelog](#changelog)
-* [Compilation](#compilation)
-* [Release cycle](#release-cycle)
-* [Bug reports](#bug-reports)
-* [Contributing](#contributing)
-* [License](#license)
-* [Contact](#contact)
-
-
-## External links
-
-
-* [Wiki](https://github.com/mpv-player/mpv/wiki)
-* [User Scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts)
-* [FAQ][FAQ]
-* [Manual](https://mpv.io/manual/master/)
-
-
-## Overview
-
-
-**mpv** is a free (as in freedom) media player for the command line. It supports
-a wide variety of media file formats, audio and video codecs, and subtitle types.
-
-There is a [FAQ][FAQ].
-
-Releases can be found on the [release list][releases].
-
-## System requirements
-
-- A not too ancient Linux (usually, only the latest releases of distributions
- are actively supported), Windows 10 1607 or later, or macOS 10.15 or later.
-- A somewhat capable CPU. Hardware decoding might help if the CPU is too slow to
- decode video in realtime, but must be explicitly enabled with the `--hwdec`
- option.
-- A not too crappy GPU. mpv's focus is not on power-efficient playback on
- embedded or integrated GPUs (for example, hardware decoding is not even
- enabled by default). Low power GPUs may cause issues like tearing, stutter,
- etc. On such GPUs, it's recommended to use `--profile=fast` for smooth playback.
- The main video output uses shaders for video rendering and scaling,
- rather than GPU fixed function hardware. On Windows, you might want to make
- sure the graphics drivers are current. In some cases, ancient fallback video
- output methods can help (such as `--vo=xv` on Linux), but this use is not
- recommended or supported.
-
-mpv does not go out of its way to break on older hardware or old, unsupported
-operating systems, but development is not done with them in mind. Keeping
-compatibility with such setups is not guaranteed. If things work, consider it
-a happy accident.
-
-## Downloads
-
-
-For semi-official builds and third-party packages please see
-[mpv.io/installation](https://mpv.io/installation/).
-
-## Changelog
-
-
-There is no complete changelog; however, changes to the player core interface
-are listed in the [interface changelog][interface-changes].
-
-Changes to the C API are documented in the [client API changelog][api-changes].
-
-The [release list][releases] has a summary of most of the important changes
-on every release.
-
-Changes to the default key bindings are indicated in
-[restore-old-bindings.conf][restore-old-bindings].
-
-Changes to the default OSC bindings are indicated in
-[restore-osc-bindings.conf][restore-osc-bindings].
-
-## Compilation
-
-
-Compiling with full features requires development files for several
-external libraries. Mpv requires [meson](https://mesonbuild.com/index.html)
-to build. Meson can be obtained from your distro or PyPI.
-
-After creating your build directory (e.g. `meson setup build`), you can view a list
-of all the build options via `meson configure build`. You could also just simply
-look at the `meson_options.txt` file. Logs are stored in `meson-logs` within
-your build directory.
-
-Example:
-
- meson setup build
- meson compile -C build
- meson install -C build
-
-For libplacebo, meson can use a git check out as a subproject for a convenient
-way to compile mpv if a sufficient libplacebo version is not easily available
-in the build environment. It will be statically linked with mpv. Example:
-
- mkdir -p subprojects
- git clone https://code.videolan.org/videolan/libplacebo.git --depth=1 --recursive subprojects/libplacebo
-
-Essential dependencies (incomplete list):
-
-- gcc or clang
-- X development headers (xlib, xrandr, xext, xscrnsaver, xpresent, libvdpau,
- libGL, GLX, EGL, xv, ...)
-- Audio output development headers (libasound/ALSA, pulseaudio)
-- FFmpeg libraries (libavutil libavcodec libavformat libswscale libavfilter
- and either libswresample or libavresample)
-- libplacebo
-- zlib
-- iconv (normally provided by the system libc)
-- libass (OSD, OSC, text subtitles)
-- Lua (optional, required for the OSC pseudo-GUI and youtube-dl integration)
-- libjpeg (optional, used for screenshots only)
-- uchardet (optional, for subtitle charset detection)
-- nvdec and vaapi libraries for hardware decoding on Linux (optional)
-
-Libass dependencies (when building libass):
-
-- gcc or clang, nasm on x86 and x86_64
-- fribidi, freetype, fontconfig development headers (for libass)
-- harfbuzz (required for correct rendering of combining characters, particularly
- for correct rendering of non-English text on macOS, and Arabic/Indic scripts on
- any platform)
-
-FFmpeg dependencies (when building FFmpeg):
-
-- gcc or clang, nasm on x86 and x86_64
-- OpenSSL or GnuTLS (have to be explicitly enabled when compiling FFmpeg)
-- libx264/libmp3lame/libfdk-aac if you want to use encoding (have to be
- explicitly enabled when compiling FFmpeg)
-- For native DASH playback, FFmpeg needs to be built with --enable-libxml2
- (although there are security implications, and DASH support has lots of bugs).
-- AV1 decoding support requires dav1d.
-- For good nvidia support on Linux, make sure nv-codec-headers is installed
- and can be found by configure.
-
-Most of the above libraries are available in suitable versions on normal
-Linux distributions. For ease of compiling the latest git master of everything,
-you may wish to use the separately available build wrapper ([mpv-build][mpv-build])
-which first compiles FFmpeg libraries and libass, and then compiles the player
-statically linked against those.
-
-If you want to build a Windows binary, see [Windows compilation][windows_compilation].
-
-
-## Release cycle
-
-Once or twice a year, a release is cut off from the current development state
-and is assigned a 0.X.0 version number. No further maintenance is done, except
-in the event of security issues.
-
-The goal of releases is to make Linux distributions happy. Linux distributions
-are also expected to apply their own patches in case of bugs.
-
-Releases other than the latest release are unsupported and unmaintained.
-
-See the [release policy document][release-policy] for more information.
-
-## Bug reports
-
-
-Please use the [issue tracker][issue-tracker] provided by GitHub to send us bug
-reports or feature requests. Follow the template's instructions or the issue
-will likely be ignored or closed as invalid.
-
-Questions can be asked in the [discussions][discussions] or on IRC (see
-[Contact](#Contact) below).
-
-## Contributing
-
-
-Please read [contribute.md][contribute.md].
-
-For small changes you can just send us pull requests through GitHub. For bigger
-changes come and talk to us on IRC before you start working on them. It will
-make code review easier for both parties later on.
-
-You can check [the wiki](https://github.com/mpv-player/mpv/wiki/Stuff-to-do)
-or the [issue tracker](https://github.com/mpv-player/mpv/issues?q=is%3Aopen+is%3Aissue+label%3Ameta%3Afeature-request)
-for ideas on what you could contribute with.
-
-## License
-
-GPLv2 "or later" by default, LGPLv2.1 "or later" with `-Dgpl=false`.
-See [details.](https://github.com/mpv-player/mpv/blob/master/Copyright)
-
-## History
-
-This software is based on the MPlayer project. Before mpv existed as a project,
-the code base was briefly developed under the mplayer2 project. For details,
-see the [FAQ][FAQ].
-
-## Contact
-
-
-Most activity happens on the IRC channel and the GitHub issue tracker.
-
-- **GitHub issue tracker**: [issue tracker][issue-tracker] (report bugs here)
-- **Discussions**: [discussions][discussions]
-- **User IRC Channel**: `#mpv` on `irc.libera.chat`
-- **Developer IRC Channel**: `#mpv-devel` on `irc.libera.chat`
-
-[FAQ]: https://github.com/mpv-player/mpv/wiki/FAQ
-[releases]: https://github.com/mpv-player/mpv/releases
-[mpv-build]: https://github.com/mpv-player/mpv-build
-[issue-tracker]: https://github.com/mpv-player/mpv/issues
-[discussions]: https://github.com/mpv-player/mpv/discussions
-[release-policy]: https://github.com/mpv-player/mpv/blob/master/DOCS/release-policy.md
-[windows_compilation]: https://github.com/mpv-player/mpv/blob/master/DOCS/compile-windows.md
-[interface-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/interface-changes.rst
-[api-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/client-api-changes.rst
-[restore-old-bindings]: https://github.com/mpv-player/mpv/blob/master/etc/restore-old-bindings.conf
-[restore-osc-bindings]: https://github.com/mpv-player/mpv/blob/master/etc/restore-osc-bindings.conf
-[contribute.md]: https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index a51ee12..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,1030 +0,0 @@
-mpv (0.41.0-2) unstable; urgency=medium
-
- * debian/control: Also remove libcaca-dev and libsdl2-dev from libmpv-dev's
- Depends
-
- -- Sebastian Ramacher <sramacher@debian.org> Tue, 30 Dec 2025 21:49:08 +0100
-
-mpv (0.41.0-1) unstable; urgency=medium
-
- * New upstream version 0.41.0
- * debian/patches: Drop patches from upstream
- * debian/control: Bump Standards-Version
- * debian/:
- - Disable libcaca
- - Do not build with SDL2 due to known issues
- * debian/mpv.maintscript: Remove old conffile
-
- -- Sebastian Ramacher <sramacher@debian.org> Mon, 29 Dec 2025 21:40:36 +0100
-
-mpv (0.40.0-5) unstable; urgency=medium
-
- * debian/control: Drop RRR: no
- * debian/patches: Create missing folders for watch history (Closes: #1115938)
-
- -- Sebastian Ramacher <sramacher@debian.org> Tue, 28 Oct 2025 19:22:41 +0100
-
-mpv (0.40.0-4) unstable; urgency=medium
-
- [ Diederik de Haas ]
- * d/p: Add patch to fix compilation issue with ffmpeg 8.0 (Closes: #1115038)
- * d/copyright: Replace old FSF address with URL to licenses
- * d/watch: Upgrade to Debian watch version 5
-
- -- Sebastian Ramacher <sramacher@debian.org> Tue, 28 Oct 2025 19:09:44 +0100
-
-mpv (0.40.0-3) unstable; urgency=medium
-
- [ Diederik de Haas ]
- * d/copyright: Update for moved files
-
- [ Sebastian Ramacher ]
- * debian/control: Update dependencies of -dev package
-
- -- Sebastian Ramacher <sramacher@debian.org> Fri, 04 Apr 2025 18:43:53 +0200
-
-mpv (0.40.0-2) unstable; urgency=medium
-
- * Fix up version history
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 30 Mar 2025 13:55:36 +0200
-
-mpv (0.40.0-1) unstable; urgency=medium
-
- * New upstream version 0.40.0
- * debian/control:
- - Bump Standards-Version
- - Bump libav* build dependencies
- - Add libdisplay-info-dev to Build-Depends
- - Remove unused build dependencies
- * debian/rules: Drop some unnecessary build flags
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 30 Mar 2025 13:42:18 +0200
-
-mpv (0.39.0-1) unstable; urgency=medium
-
- [ Joachim Bauch ]
- * Re-enable sndio support (Closes: #1021761).
-
- [ Sebastian Ramacher ]
- * New upstream version 0.39.0
- * debian/control: Bump ffmpeg dependencies to 7:6.1
-
- -- Sebastian Ramacher <sramacher@debian.org> Tue, 10 Dec 2024 00:05:52 +0100
-
-mpv (0.38.0-1) unstable; urgency=medium
-
- [ Unit 193 ]
- * New upstream release.
- - Drop patch applied upstream.
- - Fix incompatibilities with ffmpeg 7.0 (Closes: #1068660)
- * Update Standards-Version to 4.7.0.
-
- [ Sebastian Ramacher ]
- * debian/rules: Disable Windows and macOS specific features
- * debian/copyright: Drop removed files
-
- -- Sebastian Ramacher <sramacher@debian.org> Wed, 01 May 2024 11:10:27 +0200
-
-mpv (0.37.0-1) unstable; urgency=medium
-
- * New upstream version 0.37.0
- * debian/patches: Refresh patches
- * debian/libmpv2.symbols: Add new symbol
- * debian/docs: Update list of installed documentation
- * debian/control:
- - Add libcdio-dev to BDs
- - Bump required libplacebo-dev BD
- - Switch to pkgconf
-
- -- Sebastian Ramacher <sramacher@debian.org> Sat, 02 Dec 2023 12:30:21 +0100
-
-mpv (0.36.0-1) unstable; urgency=medium
-
- * New upstream version 0.36.0
- * debian/patches: Refresh patches
- * debian/libmpv2.symbols: Add new symbol
-
- -- Sebastian Ramacher <sramacher@debian.org> Tue, 01 Aug 2023 22:43:12 +0200
-
-mpv (0.35.1-4) unstable; urgency=medium
-
- * Team upload.
- * rules: Restore ARCH_CONFIGURE to configuration options so that the logic
- that conditionally enables support for DVB (only on Linux) will function
- as intended (Closes: #1026060).
-
- -- Nicholas D Steeves <sten@debian.org> Tue, 18 Apr 2023 22:28:15 -0400
-
-mpv (0.35.1-3) unstable; urgency=medium
-
- * debian/patches: Remove duplicate patches
-
- -- Sebastian Ramacher <sramacher@debian.org> Thu, 06 Apr 2023 08:25:35 +0200
-
-mpv (0.35.1-2) unstable; urgency=medium
-
- * debian/patches: Apply upstream patches for yt-dlp 2023.03.04 compatibility
- (Closes: #1033595, #1033609)
-
- -- Sebastian Ramacher <sramacher@debian.org> Fri, 31 Mar 2023 20:46:51 +0200
-
-mpv (0.35.1-1) unstable; urgency=medium
-
- * New upstream version 0.35.1
- * debian/patches: Drop patches included upstream
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 29 Jan 2023 20:55:34 +0100
-
-mpv (0.35.0-5) unstable; urgency=medium
-
- * debian/patches: Apply upstream changes to add auto option to vd-lavc-dr
- (Closes: #1027455)
- * debian/control:
- - Add myself to Uploaders
- - Bump Standards-Version
- - Change (Build-)Depends from lib(e)gl1-mesa-dev to lib(e)gl-dev.
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 29 Jan 2023 11:57:26 +0100
-
-mpv (0.35.0-4) unstable; urgency=medium
-
- * Team upload
- * debian/control: Add wayland-protocols to libmpv-dev's dependencies
- (Closes: #1026624)
-
- -- Sebastian Ramacher <sramacher@debian.org> Wed, 21 Dec 2022 22:27:12 +0100
-
-mpv (0.35.0-3) unstable; urgency=medium
-
- * Team upload
- * Upload to unstable
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 27 Nov 2022 18:44:12 +0100
-
-mpv (0.35.0-2) experimental; urgency=medium
-
- * Team upload
- * debian/control: Add missing dependencies to libmpv-dev
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 13 Nov 2022 21:45:43 +0100
-
-mpv (0.35.0-1) experimental; urgency=medium
-
- * Team upload
-
- [ Debian Janitor ]
- * Set upstream metadata fields: Bug-Submit.
-
- [ Sebastian Ramacher ]
- * New upstream version 0.35.0 (Closes: #102329)
- * SONAME bump: libmpv1 -> libmpv2
- * debian/: Use meson build system
- * debian/patches:
- - Refresh patches
- - Remove waf patch
- * debian/control:
- - Add libpipewire-0.3-dev to Build-Depends
- - Add libxpresent-dev to Build-Depends
- - Bump Standards-Version
- - Remove youtube-dl recommends
- - Bump required libplacebo-dev version
- * debian/rules:
- - Disable sndio support
- - Fix location of zsh completion
- * debian/copyright: Update copyright holders and years
-
- -- Sebastian Ramacher <sramacher@debian.org> Sat, 12 Nov 2022 22:05:00 +0100
-
-mpv (0.34.1-1) unstable; urgency=medium
-
- * Team upload
- * New upstream version 0.34.1
- * debian/control: Add yt-dpl to Recommends
-
- -- Sebastian Ramacher <sramacher@debian.org> Thu, 06 Jan 2022 12:53:19 +0100
-
-mpv (0.34.0-2) unstable; urgency=medium
-
- * Team upload
- * debian/control:
- - Add Build-Depends on libffmpeg-nvenc-dev
- - Add Suggests on libcuda1
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 21 Nov 2021 20:56:13 +0100
-
-mpv (0.34.0-1) unstable; urgency=medium
-
- * Team upload
- * New upstream version 0.34.0
- * debian/patches:
- - Refresh patches
- - Remove patches for libplacebo 3.120 support
- * debian/control: Bump Build-Depends versions with upstream requirements
-
- -- Sebastian Ramacher <sramacher@debian.org> Sun, 07 Nov 2021 19:23:22 +0100
-
-mpv (0.33.1-1) unstable; urgency=medium
-
- * Team upload
- * New upstream release (Closes: #982249)
- * debian/control:
- - Bump debhelper compat to 13
- - Bump Standards-Version
- - Add new build dependencies:
- + libmujs-dev (Closes: #956480)
- + libzimg-dev
- + libsixel-dev
- + libplacebo-dev
- + libvulkan-dev
- + spirv-cross
- + libspirv-cross-c-shared-dev
- - Remove unused build dependencies (support removed upstream):
- + libsmbclient-dev (Closes: #834022)
- + libsndio-dev
- - Remove version constraints in B-D already satisfied in bullseye
- * debian/patches:
- - Apply upstream patches to support libplacebo 3.120
- - Refresh patches
- * libmpv1.symbols: Add new symbols
- * debian/rules: Honor number of parallel jobs
- * debian/copyright: Update copyright for new upstream release
-
- -- Sebastian Ramacher <sramacher@debian.org> Tue, 07 Sep 2021 11:38:01 +0200
-
-mpv (0.32.0-3) unstable; urgency=medium
-
- * debian/patches: Apply upstream fix for CVE-2021-30145 (Closes: #986839)
- Thanks to Jan Ekström.
-
- -- Sebastian Ramacher <sramacher@debian.org> Mon, 26 Apr 2021 09:10:40 +0200
-
-mpv (0.32.0-2) unstable; urgency=medium
-
- * Bug fix: "unintended code execution vulnerability", thanks to astian
- (Closes: #950816). Patch backported from upstream
-
- -- Reinhard Tartler <siretart@tauware.de> Sat, 18 Jul 2020 18:01:43 -0400
-
-mpv (0.32.0-1) unstable; urgency=medium
-
- [ James Cowgill ]
- * New upstream release.
-
- * d/copyright: Add updates for 0.32.0.
- * d/control:
- - Update libarchive dependency.
- - Bump standards version to 4.5.0.
- * d/patches: Refresh patches.
-
- [ Debian Janitor ]
- * Set upstream metadata fields:
- Bug-Database, Repository, Repository-Browse.
-
- -- James Cowgill <jcowgill@debian.org> Wed, 29 Jan 2020 01:03:08 +0000
-
-mpv (0.30.0-1) unstable; urgency=medium
-
- [ James Cowgill ]
- * New upstream release. (Closes: #945367)
-
- * d/copyright: Updates for 0.30.0.
- * d/control:
- - Use debhelper compat 12.
- - Bump minimum libwayland-dev version.
- - Drop libvulkan-dev.
- - Add build-dependency on libdrm-dev.
- - Bump standards version to 4.4.1.
- * d/libmpv1.symbols:
- - Add new symbols found in 0.30.0.
- - Add Build-Depends-Package field.
- * d/patches:
- - Drop 02_fix-config-path.patch.
- - Refresh patches.
- * d/rules:
- - Drop --enable-zsh-comp.
- - Drop --enable-libdvdread.
-
- [ Ondřej Nový ]
- * d/control: Use debhelper-compat instead of debian/compat.
-
- -- James Cowgill <jcowgill@debian.org> Sun, 24 Nov 2019 17:29:57 +0000
-
-mpv (0.29.1-1) unstable; urgency=medium
-
- * New upstream release.
- * d/control: Bump standards version to 4.2.1.
-
- -- James Cowgill <jcowgill@debian.org> Wed, 03 Oct 2018 10:00:52 +0100
-
-mpv (0.29.0-1) unstable; urgency=medium
-
- * New upstream release. (Closes: #904629)
- - player: add on_load_fail hook. (Closes: #898576)
- - ytdl_hook: fix single-entry playlists. (Closes: #898279)
-
- * debian/copyright: Update.
- * debian/libmpv1.symbols: Add new symbols.
- * debian/patches:
- - Drop 04_waf-pie.patch - hopefully not needed in recent GCC.
- - Drop 08_waf-python3.7.patch - applied in new waf.
- - Rewrite patch description for 06_ffmpeg-abi.patch.
- - Refresh patches.
- * debian/rules:
- - Remove --enable-encoding option.
-
- -- James Cowgill <jcowgill@debian.org> Sat, 28 Jul 2018 12:29:32 +0800
-
-mpv (0.28.2-3) unstable; urgency=medium
-
- * Upload to unstable.
-
- -- James Cowgill <jcowgill@debian.org> Wed, 18 Jul 2018 12:00:43 +0100
-
-mpv (0.28.2-2) experimental; urgency=medium
-
- * debian/control:
- - Add missing build-dependency on wayland-protocols.
- Thanks to Laurent Bigonville for reporting! (Closes: #903887)
- - Bump standards version to 4.1.5.
- * debian/patches:
- - Add patch to fix FTBFS with Python 3.7 as the default python3.
- (Closes: #903610)
-
- -- James Cowgill <jcowgill@debian.org> Mon, 16 Jul 2018 22:13:05 +0100
-
-mpv (0.28.2-1) experimental; urgency=medium
-
- * New upstream bugfix release.
- - Also whitelist subtitle URLs in youtube-dl hook. (Closes: #890410)
-
- * debian/rules:
- - Build-Depend on ffmpeg 4.0. (Closes: #898080)
- * debian/patches:
- - Drop patch for CVE-2018-6360 - fixed upstream.
- - Fix typo in 06_ffmpeg-abi.patch description.
-
- -- James Cowgill <jcowgill@debian.org> Sun, 06 May 2018 23:20:25 +0100
-
-mpv (0.28.0-1) experimental; urgency=medium
-
- * New upstream release.
-
- * debian/compat:
- - Use debhelper 11.
- * debian/control:
- - Set Maintainer to debian-multimedia@l.d.o.
- - Switch Vcs URLs to salsa.debian.org.
- - Drop unused dependency on libavresample-dev.
- - Add dependencies on libarchive-dev and libvulkan-dev.
- - Bump ffmpeg dependencies to 3.5.
- - Set Rules-Requires-Root: no.
- - Bump standards to 4.1.3.
- * debian/copyright:
- - Update for 0.28.
- - Use secure copyright format URL.
- * debian/patches:
- - Drop vaapi patch applied upstream.
- - Add patch for CVE-2018-6360. (Closes: #888654)
- - Refresh other patches.
-
- -- James Cowgill <jcowgill@debian.org> Sun, 04 Feb 2018 12:53:27 +0100
-
-mpv (0.27.0-2) unstable; urgency=medium
-
- * debian/control:
- - Bump standards version to 4.1.1 (no changes).
- * debian/patches:
- - Add upstream patch to fix FTBFS with libva 2.0. (Closes: #879057)
-
- -- James Cowgill <jcowgill@debian.org> Sat, 21 Oct 2017 13:35:54 +0100
-
-mpv (0.27.0-1) unstable; urgency=medium
-
- * New upstream release.
-
- * debian/control:
- - Bump standards version to 4.1.0 (no changes).
- * debian/copyright:
- - Update copyright.
- * debian/patches:
- - Refresh.
- * debian/rules:
- - Re-enable DVB. (Closes: #873294)
- - Run waf using python3 instead of python2.
-
- -- James Cowgill <jcowgill@debian.org> Fri, 15 Sep 2017 09:37:24 +0100
-
-mpv (0.26.0-3) unstable; urgency=medium
-
- * Bump ffmpeg build dependency to >= 3.3.
- - Should fix hardware decoding in 0.26.0. (Closes: #869093)
-
- -- James Cowgill <jcowgill@debian.org> Wed, 26 Jul 2017 22:55:30 +0100
-
-mpv (0.26.0-2) unstable; urgency=medium
-
- * debian/control, debian/rules:
- - Remove --enable-tv option and drop libv4l-dev build dependency. This
- functionality is now provided through ffmpeg.
- * debian/patches/07_io-stdin-used.patch:
- - Add _IO_stdin_used to mpv version script. Should fix FTBFS on alpha,
- mips* and powerpc*.
-
- -- James Cowgill <jcowgill@debian.org> Fri, 21 Jul 2017 10:03:53 +0100
-
-mpv (0.26.0-1) unstable; urgency=medium
-
- * New upstream release.
- - Fixes unfinished --audio-spdif sentence in the manpage.
- (Closes: #864908)
-
- * debian/copyright:
- - Update d/copyright and list of GPL-2 files.
- - Clarify license of distributed binaries is GPL-3+.
- * debian/patches:
- - Refresh patches.
- - Update waf to 1.9.8.
- * debian/rules:
- - Reformat and sort configure options in d/rules.
- - Fix DEB_HOST_MULTIARCH when d/rules is invoked directly.
- - Enable libsmbclient and tv (disabled upstream).
-
- -- James Cowgill <jcowgill@debian.org> Wed, 19 Jul 2017 14:59:54 +0100
-
-mpv (0.25.0-3) unstable; urgency=medium
-
- * debian/control:
- - Drop mplayer2 transitional package.
- - Build-Depend on libcaca-dev. (Closes: #865517)
-
- -- James Cowgill <jcowgill@debian.org> Thu, 22 Jun 2017 12:19:08 +0100
-
-mpv (0.25.0-2) unstable; urgency=medium
-
- * Upload to unstable.
-
- * debian/control:
- - Drop build dependencies on libenca-dev and libguess-dev.
- Thanks to Yuriy M. Kaminskiy
- - Bump standards to 4.0.0 (no changes required).
-
- -- James Cowgill <jcowgill@debian.org> Mon, 19 Jun 2017 09:11:40 +0100
-
-mpv (0.25.0-1) experimental; urgency=medium
-
- * New upstream release.
-
- * debian/compat:
- - Use debhelper compat 10.
- * debian/copyright:
- - Update various files which were relicensed from GPL to LGPL.
- * debian/patches:
- - Refresh.
- * debian/rules:
- - Re-enable dvd functionality which was disabled by default upstream.
-
- -- James Cowgill <jcowgill@debian.org> Wed, 26 Apr 2017 21:34:39 +0100
-
-mpv (0.24.0-1) experimental; urgency=medium
-
- * New upstream release.
- - Fixes segfaults on TV input. (Closes: #853798)
-
- * debian/control:
- - Enable uchardet for subtitle encoding detection. (Closes: #854788)
- * debian/copyright:
- - Update copyright dates.
-
- -- James Cowgill <jcowgill@debian.org> Sun, 12 Feb 2017 21:12:19 +0000
-
-mpv (0.23.0-1) unstable; urgency=medium
-
- * New upstream release.
-
- * debian/control:
- - Build-depend on ffmpeg 3.2.2.
- - Use https for the Homepage field.
- * debian/copyright:
- - Update for 0.23.0.
- * debian/patches:
- - Refresh.
- - Use https for BTS links in debian/patches.
-
- -- James Cowgill <jcowgill@debian.org> Tue, 27 Dec 2016 23:02:13 +0000
-
-mpv (0.22.0-1) unstable; urgency=medium
-
- * New upstream release.
-
- * Refresh patches.
- * Update debian/copyright.
-
- -- James Cowgill <jcowgill@debian.org> Sun, 20 Nov 2016 23:13:33 +0000
-
-mpv (0.21.0-2) unstable; urgency=medium
-
- * Add a transitional package for mplayer2.
- - Add symlinks for mplayer and its man page.
- - Add mplayer2.NEWS.
- - Build-Depend on dpkg-dev >= 1.17 for dpkg-parsechangelog -S.
-
- -- James Cowgill <jcowgill@debian.org> Wed, 26 Oct 2016 09:08:05 +0100
-
-mpv (0.21.0-1) unstable; urgency=medium
-
- * New upstream release.
-
- * debian/control:
- - Enable GBM and V4L2.
- * debian/libmpv-dev.examples:
- - Drop, contents now included in main mpv manpage.
- * debian/patches:
- - Refresh patches.
- - Drop 01_desktop-path.patch.
- * debian/rules:
- - Remove verbose flag from waf configure.
- - Remove dh_install override and use debian/tmp explicitly in
- mpv.install.
-
- -- James Cowgill <jcowgill@debian.org> Thu, 20 Oct 2016 11:43:36 +0100
-
-mpv (0.20.0-1) unstable; urgency=medium
-
- * New upstream release.
-
- -- James Cowgill <jcowgill@debian.org> Sat, 27 Aug 2016 00:20:40 +0100
-
-mpv (0.19.0-1) unstable; urgency=medium
-
- * New upstream release.
- * Add new mpv_stream_cb_add_ro symbol to libmpv1.symbols.
- * Update debian/copyright.
- * Refresh patches.
-
- -- James Cowgill <jcowgill@debian.org> Thu, 25 Aug 2016 22:29:49 +0100
-
-mpv (0.18.1-1) unstable; urgency=medium
-
- * New upstream release. (Closes: #833713)
-
- * debian/control:
- - Add myself to the list of uploaders.
- - Enable smbclient support. (LP: #1502533)
- * debian/patches:
- - Suppress ffmpeg version mismatch error. (Closes: #831537)
-
- -- James Cowgill <jcowgill@debian.org> Wed, 10 Aug 2016 22:03:00 +0100
-
-mpv (0.18.0-1) unstable; urgency=medium
-
- * Team upload.
-
- [ James Cowgill ]
- * New upstream release. (Closes: #815692)
- * debian/control:
- - Use cgit in the Vcs-Browser URL.
- * debian/copyright:
- - GPL-2: sort and add missing files.
- - Add files licensed under the ISC license.
-
- [ Mateusz Łukasik ]
- * debian/patches:
- - Refresh 01_desktop-path.patch.
- - Remove 05_fix-typo.patch -- included upstream.
- - Add 05_add-keywords.patch to provides keywords by desktop file.
- * debian/control:
- - Bump Standards-Version to 3.9.8.
- - Use secured links for Vcs.
- * Drop mpv-dbg and libmpv-dbg packages.
- * Update debian/copyright.
- * debian/rules:
- - Enable encoding.
- * Update debian/libmpv-dev.examples.
-
- -- James Cowgill <jcowgill@debian.org> Tue, 05 Jul 2016 13:53:51 +0200
-
-mpv (0.14.0-1) unstable; urgency=medium
-
- * New upstream release (Closes: #806183)
- * Fix spelling-error-in-binary
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 27 Dec 2015 19:27:18 +0100
-
-mpv (0.12.0-1) unstable; urgency=medium
-
- * New upstream release
- - Restore x11 video output (Closes: #800109)
-
- -- Alessandro Ghedini <ghedo@debian.org> Thu, 29 Oct 2015 11:19:56 +0100
-
-mpv (0.11.0-1) unstable; urgency=medium
-
- * New upstream release
- * Drop ladspa-sdk and libbs2b-dev from Build-Depends
- * Enable sndio audio output (Closes: #798985)
- * Re-enable PIE.
- Thanks to Simon Ruderich for the patch (Closes: #799738)
-
- -- Alessandro Ghedini <ghedo@debian.org> Thu, 24 Sep 2015 21:04:07 +0200
-
-mpv (0.10.0-1) unstable; urgency=medium
-
- * New upstream release
- * Bump versioned Build-Depends for ffmpeg
- * Update waf to v1.8.12
- * Refresh patches
- * Disable PIE to avoid build failure
- * Enable rubberband support (Closes: #797734)
-
- -- Alessandro Ghedini <ghedo@debian.org> Fri, 04 Sep 2015 10:52:31 +0200
-
-mpv (0.9.2-1) unstable; urgency=medium
-
- [ Alessandro Ghedini ]
- * New upstream release
- * Add xdg-utils to Recommends
- xdg-screensaver is used to disable the screen saver.
- * Bump versioned Build-Depends on libav
-
- [ Jérémy Bobbio ]
- * Stop recording the build date (Closes: #784267)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 30 May 2015 15:05:54 +0200
-
-mpv (0.9.1-1) unstable; urgency=medium
-
- * New upstream release
- * Update 02_fix-config-path.patch
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 03 May 2015 12:51:14 +0200
-
-mpv (0.9.0-1) unstable; urgency=medium
-
- * New upstream release
- * Bump required libass version
- * libmpg123 support was dropped upstream
- * LIRC support was dropped upstream
- * Joystick support was dropped upstream
- * Refresh patches
- * Update symbols file
-
- -- Alessandro Ghedini <ghedo@debian.org> Mon, 27 Apr 2015 10:24:25 +0200
-
-mpv (0.8.3-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Tue, 17 Mar 2015 14:53:12 +0100
-
-mpv (0.8.2-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 01 Mar 2015 13:05:37 +0100
-
-mpv (0.8.0-1) unstable; urgency=medium
-
- * New upstream release
- * Update to waf 1.8.4
- * Don't run clean if no waf is present
- * Refresh patches
- * Update symbols file
- * Only enable joystick support on linux
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 18 Feb 2015 15:12:55 +0100
-
-mpv (0.7.3-1) unstable; urgency=medium
-
- * New upstream release
- * Bump version of youtube-dl in Recommends
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 28 Jan 2015 17:18:43 +0100
-
-mpv (0.7.2-1) unstable; urgency=medium
-
- * New upstream release
- - Enable ytdl_hook script by default (Closes: #772472)
- * Enable joystick support (Closes: #773234)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 20 Dec 2014 12:31:39 +0100
-
-mpv (0.7.1-1) unstable; urgency=medium
-
- * New upstream release
- * Update 03_waf.patch to waf 1.8.1
- * Refresh patches
- * Manually set zsh completion install path
- * Remove --nocache option from waf invocation
- * Update libmpv symbols file
- * Drop libquvi support, replaced by built-in Lua script based on youtube-dl
- * Add Recommends on youtube-dl
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 03 Dec 2014 10:43:28 +0100
-
-mpv (0.6.2-2) unstable; urgency=medium
-
- * Re-enable CDDA support via libcdio (Closes: #766725)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 25 Oct 2014 15:16:57 +0200
-
-mpv (0.6.2-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Fri, 24 Oct 2014 21:16:49 +0200
-
-mpv (0.6.1-1) unstable; urgency=medium
-
- * New upstream release
- - Fix the autodetection of the input format in the vf_stereo3d filter
- (Closes: #763904)
- - Don't create 0x0 windows on X11 (Closes: #764419)
- * Remove unused build deps
- * Enable support for xrandr
- * Bump Standards-Version to 3.9.6 (no changes needed)
- * Don't install input configuration files as examples (they are now installed
- by the upstream build system as normal documentation)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 12 Oct 2014 14:39:57 +0200
-
-mpv (0.6.0-1) unstable; urgency=medium
-
- * New upstream release
- - Add video/ogg to the list of supported MIME types in the *.desktop file
- (Closes: #763173)
- * Switch to libjpeg-turbo (Closes: #763484)
-
- -- Alessandro Ghedini <ghedo@debian.org> Tue, 30 Sep 2014 21:15:03 +0200
-
-mpv (0.5.4-1) unstable; urgency=medium
-
- * New upstream release
- - Rebuild should fix warnings regarding libav libraries versions
- (Closes: #762229)
-
- -- Alessandro Ghedini <ghedo@debian.org> Tue, 23 Sep 2014 21:37:19 +0200
-
-mpv (0.5.3-1) unstable; urgency=medium
-
- * New upstream release
- * Fix wildcard-matches-nothing-in-dep5-copyright
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 10 Sep 2014 20:05:33 +0200
-
-mpv (0.5.1-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 27 Aug 2014 11:05:35 +0200
-
-mpv (0.5.0-1) unstable; urgency=medium
-
- * New upstream release
- * Update path of example Lua scripts
- * Refresh 02_fix-config-path.patch
- * Update *.symbols file
-
- -- Alessandro Ghedini <ghedo@debian.org> Tue, 12 Aug 2014 11:52:56 +0200
-
-mpv (0.4.2-1) unstable; urgency=medium
-
- * New upstream release
- - Include point releases too in the release notes (Closes: #722997)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 26 Jul 2014 12:29:29 +0200
-
-mpv (0.4.1-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Fri, 11 Jul 2014 18:11:27 +0200
-
-mpv (0.4.0-1) unstable; urgency=medium
-
- * New upstream release
- * Refresh 01_desktop-path.patch
- * Refresh 02_fix-config-path.patch
- * Enable shared libmpv client library
- * Make mpv Multi-Arch: foreign
- * Add mpv-dbg package as well
- * Disable libpostproc support (ffmpeg's libpostproc is needed)
- * Install Lua scripting examples
- * Disable cdda support
- * Bump lcms2 versioned Build-Depends
- * Build and install zsh completion script
- * Install upstream release notes as changelog (Closes: #722997)
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 25 Jun 2014 21:10:18 +0200
-
-mpv (0.3.11-1) unstable; urgency=medium
-
- * New upstream release
- * Drop gcc-4.8 Build-Depends for sparc (Closes: #751321)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 15 Jun 2014 14:35:14 +0200
-
-mpv (0.3.10-2) unstable; urgency=medium
-
- * Switch to Lua 5.2
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 28 May 2014 21:45:06 +0200
-
-mpv (0.3.10-1) unstable; urgency=medium
-
- * New upstream release
- * Enable support for libavdevice
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 25 May 2014 14:59:56 +0200
-
-mpv (0.3.9-2) unstable; urgency=low
-
- [ Reinhard Tartler ]
- * Merge branch experimental
-
- [ Alessandro Ghedini ]
- * Remove forced gcc-4.8 build depends on powerpc
- * Rebuild against libav10
-
- -- Alessandro Ghedini <ghedo@debian.org> Mon, 12 May 2014 12:06:15 +0200
-
-mpv (0.3.9-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 30 Apr 2014 13:28:31 +0200
-
-mpv (0.3.8-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Fri, 18 Apr 2014 10:56:21 +0200
-
-mpv (0.3.7-1) unstable; urgency=medium
-
- * New upstream release
- * Enable all hardening options.
- Thanks to Simon Ruderich for the patch (Closes: #741439)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 30 Mar 2014 20:00:42 +0200
-
-mpv (0.3.6-1) unstable; urgency=medium
-
- * New upstream release
- * Update 03_waf.patch to newer waf version
-
- -- Alessandro Ghedini <ghedo@debian.org> Tue, 11 Mar 2014 16:00:20 +0100
-
-mpv (0.3.5-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 12 Feb 2014 22:56:33 +0100
-
-mpv (0.3.4-1) unstable; urgency=medium
-
- * New upstream release
- * Refresh patches
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 01 Feb 2014 12:20:29 +0100
-
-mpv (0.3.3-1+exp1) experimental; urgency=low
-
- * Rebuild against libav10
-
- -- Reinhard Tartler <siretart@tauware.de> Fri, 17 Jan 2014 03:35:15 +0000
-
-mpv (0.3.3-1) unstable; urgency=medium
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Thu, 16 Jan 2014 23:34:23 +0100
-
-mpv (0.3.2-1) unstable; urgency=medium
-
- * New upstream release
- * Default to gcc-4.8 on powerpcspe too (Closes: #733924)
-
- -- Alessandro Ghedini <ghedo@debian.org> Mon, 06 Jan 2014 21:19:23 +0100
-
-mpv (0.3.1-1) unstable; urgency=medium
-
- * New upstream release
- * Drop 04_use-atomic-not-sync.patch (merged upstream)
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 01 Jan 2014 22:51:36 +0100
-
-mpv (0.3.0-2) unstable; urgency=medium
-
- * Enable ALSA on Linux only (should fix FTBFS on kfreebsd)
- * Add 04_use-atomic-not-sync.patch to fix FTBFS on mips, powerpc and sparc
- (Closes: #733632)
- * Explicitly use gcc-4.8 on powerpc and sparc
- * Use waf verbose output (shows build commands)
-
- -- Alessandro Ghedini <ghedo@debian.org> Tue, 31 Dec 2013 12:38:24 +0100
-
-mpv (0.3.0-1) unstable; urgency=medium
-
- * New upstream release
- - Fix --vf=expand example in manpage (Closes: #732271)
- * Add 03_waf.patch to provide uncompressed waf scripts and modules
- * Switch to waf build script
- * Drop libmng-dev Build-Depends (not used anymore)
- * Bump Standards-Version to 3.9.5 (no changes needed)
- * Enable support for dvdnav
- * Install more docs
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 29 Dec 2013 20:04:26 +0100
-
-mpv (0.2.4-2) unstable; urgency=medium
-
- * Use /etc/mpv instead of /usr/etc/mpv for configuration (Closes: #732214)
- - Add 02_fix-config-path.patch to update the manpage regarding
- config directories
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 15 Dec 2013 19:31:51 +0100
-
-mpv (0.2.4-1) unstable; urgency=low
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 01 Dec 2013 22:37:02 +0100
-
-mpv (0.2.3-1) unstable; urgency=low
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Fri, 08 Nov 2013 11:34:14 +0100
-
-mpv (0.2.2-1) unstable; urgency=low
-
- * New upstream release
- * Use absolute paths for (Try)Exec in mpv.desktop (Closes: #728149)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 03 Nov 2013 12:01:35 +0100
-
-mpv (0.2.1-1) unstable; urgency=low
-
- * New upstream release
- * Drop 01_spelling.patch (merged upstream)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 20 Oct 2013 17:04:17 +0200
-
-mpv (0.2.0-1) unstable; urgency=low
-
- * New upstream release
- * Install sample configuration files as examples
- * Enable Lua scripting support
- * Remove copyright for talloc (not used anymore)
- * Update installed docs list
- * Update 01_spelling.patch
- * Enable VAAPI support
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 16 Oct 2013 12:38:59 +0200
-
-mpv (0.1.7-1) unstable; urgency=low
-
- * New upstream release
- * Do not use python3 version of python-docutils
- (it seems to be having some trouble on the buildd)
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 21 Sep 2013 11:39:51 +0200
-
-mpv (0.1.6-1) unstable; urgency=low
-
- * New upstream release
- * Add 01_spelling.patch to fix spelling error found by lintian
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 14 Sep 2013 15:36:57 +0200
-
-mpv (0.1.5-1) unstable; urgency=low
-
- [ Andreas Boll ]
- * Restrict wayland support to linux-any
- * Fix Vcs-Browser url
-
- [ Alessandro Ghedini ]
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Sat, 07 Sep 2013 12:01:58 +0200
-
-mpv (0.1.4-1) unstable; urgency=low
-
- * New upstream release
-
- -- Alessandro Ghedini <ghedo@debian.org> Mon, 02 Sep 2013 13:10:37 +0200
-
-mpv (0.1.3-1) unstable; urgency=low
-
- * New upstream release
- * Enable libpostproc support
- * Tighten Build-Depends on libav libraries
-
- -- Alessandro Ghedini <ghedo@debian.org> Sun, 25 Aug 2013 10:49:15 +0200
-
-mpv (0.1.0-1) unstable; urgency=low
-
- * Initial release (Closes: #719654)
-
- -- Alessandro Ghedini <ghedo@debian.org> Wed, 14 Aug 2013 12:28:04 +0200
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index 758e13f..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,340 +0,0 @@
-Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: mpv
-Source: https://github.com/mpv-player/mpv/releases
-Comment:
- While the mpv source code is distributed mostly under the GPL-2+ or LGPL-2.1+
- licenses, the binaries are distributed under the GPL-3+ license because they
- are linked to the GPL-3+ libsmbclient library.
-
-Files: *
-Copyright:
- 1999-2000, Aaron Holtzman
- 2004-2005, Alex Beregszaszi
- 2013, Alexander Preisinger
- 2017-2018, Aman Gupta
- 2020, Andreas Kempf
- 2004, Aurelien Jacobs
- 2006, 2010, Benjamin Zores
- 2003, Dave Lambley
- 2006, Derk-Jan Hartman
- 2006, Evgeniy Stepanov
- 1991-1999, Free Software Foundation, Inc
- 2014, Hayaki Saito
- 2016, Ilya Zhuravlev
- 2006, Lennart Poettering
- 2015-2016, Matthieu Bouron
- 2004, 2006, Michael Niedermayer
- 2012, Naoya OYAMA
- 2010, Nicolas George
- 2021, Niklas Haas
- 2021, Oschowa
- 2016-2019, Philip Langdale
- 2005-2010, Reimar Döffinger
- 2005-2013, Rich Felker, standard MIT license
- 2007, Robert Juliano
- 2011-2012, Rudolf Polzer
- 2003, Sascha Sommer
- 2013, Stefano Pigozzi
- 2021, Thomas Weißschuh
- 2000, Timothy J. Wood
- 2007, Ulion
- 2009-2012, Uoti Urpala
- 2012-2015, VLC authors and VideoLAN, VideoLabs
- 2013, Wessel Dankers
- 2021, sfan5
- 2000-2022, mpv/MPlayer/mplayer2 projects
-License: LGPL-2.1+
-
-Files:
- audio/out/ao_sndio.c
- include/mpv/client.h
- include/mpv/render.h
- include/mpv/render_gl.h
- include/mpv/stream_cb.h
- misc/thread_pool.c
- misc/thread_tools.c
- osdep/win32-console-wrapper.c
- player/client.c
- player/lua/console.lua
- ta/*
-Copyright:
- 2008, Alexandre Ratchov <alex@caoua.org>
- 2021, Andrew Krasavin <noiseless-ak@yandex.ru>
- 2013, Christian Neukirchen <chneukirchen@gmail.com>
- 2013, Martin Herkt
- 2020, Rozhuk Ivan <rozhuk.im@gmail.com>
- 2017-2022, the mpv developers
-License: ISC
-
-Files:
- audio/out/ao_jack.c
- audio/out/ao_oss.c
- stream/dvb_tune.c
- stream/dvb_tune.h
- stream/stream_cdda.c
- stream/stream_dvb.c
- stream/stream_dvdnav.c
- video/out/vo_caca.c
- video/out/vo_direct3d.c
- video/out/vo_vaapi.c
- video/out/vo_vdpau.c
- video/out/vo_x11.c
- video/out/vo_xv.c
- video/out/x11_common.c
- video/out/x11_common.h
- video/vdpau.c
- video/vdpau_mixer.c
-Copyright:
- 2001-2002, Dave Chapman
- 1989-1991, Free Software Foundation, Inc
- 2008, Georgi Petrov
- 2008, NVIDIA
- 2016-2017, Rozhuk Ivan
- 2008-2009, Splitted-Desktop Systems
- 2009, Uoti Urpala
-License: GPL-2+
-
-Files: osdep/android/*
-Copyright: 2009, David Schultz <das@FreeBSD.org>
-License: BSD-2-clause
-
-Files:
- audio/filter/af_scaletempo2_internals.h
- video/out/filter_kernels.c
-Copyright:
- 2015, The Chromium Authors
- 2009-2016, Nicolas P. Rougier
-License: BSD-3-clause
-
-Files: osdep/timer-darwin.c
-Copyright: 2003-2004, Dan Villiom Podlaski Christiansen
-License: Expat
-
-Files: etc/mpv.metainfo.xml
-Copyright: 2022, mpv project
-License: CC0-1.0
-
-Files: debian/*
-Copyright:
- 2013 Alessandro Ghedini <ghedo@debian.org>
- 2016-2020 James Cowgill <jcowgill@debian.org>
-License: GPL-2+
-
-License: BSD-2-clause
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-License: BSD-3-clause
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- .
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- .
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- .
- 3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
- .
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
-License: CC0-1.0
- Statement of Purpose
- .
- The laws of most jurisdictions throughout the world automatically confer
- exclusive Copyright and Related Rights (defined below) upon the creator and
- subsequent owner(s) (each and all, an "owner") of an original work of
- authorship and/or a database (each, a "Work").
- .
- Certain owners wish to permanently relinquish those rights to a Work for the
- purpose of contributing to a commons of creative, cultural and scientific
- works ("Commons") that the public can reliably and without fear of later
- claims of infringement build upon, modify, incorporate in other works, reuse
- and redistribute as freely as possible in any form whatsoever and for any
- purposes, including without limitation commercial purposes. These owners may
- contribute to the Commons to promote the ideal of a free culture and the
- further production of creative, cultural and scientific works, or to gain
- reputation or greater distribution for their Work in part through the use and
- efforts of others.
- .
- For these and/or other purposes and motivations, and without any expectation
- of additional consideration or compensation, the person associating CC0 with a
- Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
- and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
- and publicly distribute the Work under its terms, with knowledge of his or her
- Copyright and Related Rights in the Work and the meaning and intended legal
- effect of CC0 on those rights.
- .
- 1. Copyright and Related Rights. A Work made available under CC0 may be
- protected by copyright and related or neighboring rights ("Copyright and
- Related Rights"). Copyright and Related Rights include, but are not limited
- to, the following:
- .
- the right to reproduce, adapt, distribute, perform, display, communicate,
- and translate a Work;
- .
- moral rights retained by the original author(s) and/or performer(s);
- .
- publicity and privacy rights pertaining to a person's image or likeness
- depicted in a Work;
- .
- rights protecting against unfair competition in regards to a Work, subject
- to the limitations in paragraph 4(a), below;
- .
- rights protecting the extraction, dissemination, use and reuse of data in
- a Work;
- .
- database rights (such as those arising under Directive 96/9/EC of the
- European Parliament and of the Council of 11 March 1996 on the legal
- protection of databases, and under any national implementation thereof,
- including any amended or successor version of such directive); and
- .
- other similar, equivalent or corresponding rights throughout the world
- based on applicable law or treaty, and any national implementations
- thereof.
- .
- 2. Waiver. To the greatest extent permitted by, but not in contravention of,
- applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
- unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
- and Related Rights and associated claims and causes of action, whether now
- known or unknown (including existing as well as future claims and causes of
- action), in the Work (i) in all territories worldwide, (ii) for the maximum
- duration provided by applicable law or treaty (including future time
- extensions), (iii) in any current or future medium and for any number of
- copies, and (iv) for any purpose whatsoever, including without limitation
- commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
- the Waiver for the benefit of each member of the public at large and to the
- detriment of Affirmer's heirs and successors, fully intending that such Waiver
- shall not be subject to revocation, rescission, cancellation, termination, or
- any other legal or equitable action to disrupt the quiet enjoyment of the Work
- by the public as contemplated by Affirmer's express Statement of Purpose.
- .
- 3. Public License Fallback. Should any part of the Waiver for any reason be
- judged legally invalid or ineffective under applicable law, then the Waiver
- shall be preserved to the maximum extent permitted taking into account
- Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
- is so judged Affirmer hereby grants to each affected person a royalty-free,
- non transferable, non sublicensable, non exclusive, irrevocable and
- unconditional license to exercise Affirmer's Copyright and Related Rights in
- the Work (i) in all territories worldwide, (ii) for the maximum duration
- provided by applicable law or treaty (including future time extensions), (iii)
- in any current or future medium and for any number of copies, and (iv) for any
- purpose whatsoever, including without limitation commercial, advertising or
- promotional purposes (the "License"). The License shall be deemed effective as
- of the date CC0 was applied by Affirmer to the Work. Should any part of the
- License for any reason be judged legally invalid or ineffective under
- applicable law, such partial invalidity or ineffectiveness shall not
- invalidate the remainder of the License, and in such case Affirmer hereby
- affirms that he or she will not (i) exercise any of his or her remaining
- Copyright and Related Rights in the Work or (ii) assert any associated claims
- and causes of action with respect to the Work, in either case contrary to
- Affirmer's express Statement of Purpose.
- .
- 4. Limitations and Disclaimers.
- .
- No trademark or patent rights held by Affirmer are waived, abandoned,
- surrendered, licensed or otherwise affected by this document.
- .
- Affirmer offers the Work as-is and makes no representations or warranties
- of any kind concerning the Work, express, implied, statutory or otherwise,
- including without limitation warranties of title, merchantability, fitness
- for a particular purpose, non infringement, or the absence of latent or
- other defects, accuracy, or the present or absence of errors, whether or
- not discoverable, all to the greatest extent permissible under applicable
- law.
- .
- Affirmer disclaims responsibility for clearing rights of other persons
- that may apply to the Work or any use thereof, including without
- limitation any person's Copyright and Related Rights in the Work. Further,
- Affirmer disclaims responsibility for obtaining any necessary consents,
- permissions or other rights required for any use of the Work.
- .
- Affirmer understands and acknowledges that Creative Commons is not a party
- to this document and has no duty or obligation with respect to this CC0 or
- use of the Work.
-
-License: Expat
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- .
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- .
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-
-License: GPL-2+
- This program 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.
- .
- This program 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
- along with this program. If not, see <https://www.gnu.org/licenses/>.
- .
- On Debian systems, the complete text of the GNU General
- Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
-
-License: ISC
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
- .
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-License: LGPL-2.1+
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- .
- This library 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
- Lesser General Public License for more details.
- .
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <https://www.gnu.org/licenses/>.
- .
- On Debian systems, the complete text of the GNU Lesser General Public
- License version can be found in "/usr/share/common-licenses/LGPL-2.1".
diff --git a/ytdlsb-main.c b/ytdlsb-main.c
new file mode 100644
index 0000000..4956743
--- /dev/null
+++ b/ytdlsb-main.c
@@ -0,0 +1,664 @@
+#include <mpv/client.h>
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "ytdlsb-utils.h"
+#include "ytdlsb-tasks.h"
+#include "ytdlsb-mpv.h"
+#include <cJSON.h>
+#include <curl/curl.h>
+#include <webp/decode.h>
+
+enum ytdlsb_hook{
+ YTDLSB_HOOK_PRELOADED,
+ YTDLSB_HOOK_UNLOAD
+};
+enum ytdlsb_observe{
+ YTDLSB_OBSERVE_OSC
+};
+enum ytdlsb_osd_id{
+ YTDLSB_OSD_IMG
+};
+
+enum ytdlsb_sb_state{
+ YTDLSB_SB_EMPTY = 0,
+ YTDLSB_SB_FAILED,
+ YTDLSB_SB_JPEG,
+ YTDLSB_SB_WEBP,
+ YTDLSB_SB_RAW,
+};
+struct ytdlsb_sb_fragment{
+ char *url;
+ enum ytdlsb_sb_state state;
+ char *data;
+ size_t data_len;
+ double start;
+};
+struct ytdlsb_sb{
+ double fps;
+ size_t width;
+ size_t height;
+ size_t columns;
+ size_t rows;
+ struct ytdlsb_sb_fragment *fragments;
+ size_t fragment_num;
+};
+
+enum ytdlsb_tasknum{
+ YTDLSB_TASK_MPVEV = 0,
+ YTDLSB_TASK_PRELOAD,
+ YTDLSB_TASK_NUM
+};
+
+struct ytdlsb{
+ mpv_handle *m;
+ struct ytdlsb_tasks t;
+ struct ytdlsb_sb best_sb;
+ struct ytdlsb_sb fast_sb;
+
+ struct curl_slist *preload_headers;
+ size_t preload_p;
+ CURL *preload_easy;
+ CURLM *preload_multi;
+
+ double current_sb_show;
+
+ int exit;
+};
+
+int ytdlsb_sb_some(struct ytdlsb_sb *sb){
+ return sb->fragments != NULL;
+}
+
+#define FRAG(p, sb, pp) \
+ if(p->preload_p < p->fast_sb.fragment_num){ \
+ pp = p->preload_p; \
+ sb = &p->fast_sb; \
+ }else{ \
+ pp = p->preload_p - p->fast_sb.fragment_num; \
+ assert(pp < p->best_sb.fragment_num); \
+ sb = &p->best_sb; \
+ }
+size_t ytdlsb_fragment_preload_write(
+ char *data, size_t, size_t nmemb, void *_p
+){
+ struct ytdlsb *p = _p;
+ size_t pp;
+ struct ytdlsb_sb *sb;
+ FRAG(p, sb, pp);
+
+ //eprintf("received %zubytes\n", nmemb);
+
+ struct ytdlsb_sb_fragment *f = &sb->fragments[pp];
+ if(f->data == NULL) f->data_len = 0;
+ f->data_len += nmemb;
+ CKA(f->data_len, >= nmemb);
+ f->data = CKAR(realloc(f->data, f->data_len));
+ memcpy(&f->data[f->data_len - nmemb], data, nmemb);
+ return nmemb;
+}
+int ytdlsb_start_fragment_preload(struct ytdlsb *p){
+ size_t pp;
+ struct ytdlsb_sb *sb;
+
+ FRAG(p, sb, pp);
+ assert(sb->fragments[pp].state == YTDLSB_SB_EMPTY);
+
+#define OPT(k, v) CKZ(err, curl_easy_setopt(p->preload_easy, k, v))
+ OPT(CURLOPT_URL, sb->fragments[pp].url);
+#undef OPT
+ return 0;
+err: return -1;
+}
+int ytdlsb_abort_load(struct ytdlsb *p){
+ if(p->preload_easy){
+ CKZ(err, curl_multi_remove_handle(p->preload_multi, p->preload_easy));
+ curl_easy_cleanup(p->preload_easy);
+ p->preload_easy = NULL;
+ curl_slist_free_all(p->preload_headers);
+ p->preload_headers = NULL;
+ }
+ p->t.tasks[YTDLSB_TASK_PRELOAD].process = NULL;
+ return 0;
+err: return -1;
+}
+int ytdlsb_done_fragment_preload(struct ytdlsb *p){
+ size_t max_prelp = p->fast_sb.fragment_num + p->best_sb.fragment_num;
+ while(1){
+ size_t pp;
+ struct ytdlsb_sb *sb;
+ p->preload_p++;
+ if(p->preload_p < max_prelp){
+ FRAG(p, sb, pp);
+ if(sb->fragments[pp].state == YTDLSB_SB_EMPTY) break;
+ }else{
+ break;
+ }
+ }
+ if(p->preload_p < max_prelp){
+ CKZ(err, curl_multi_remove_handle(
+ p->preload_multi, p->preload_easy));
+ ytdlsb_start_fragment_preload(p);
+ CKZ(err, curl_multi_add_handle(
+ p->preload_multi, p->preload_easy));
+ eprintf("downloading storyboard: %zu/%zu\n",
+ p->preload_p, max_prelp);
+ return 1;
+ }else{
+ eprintf("storyboard downloaded\n");
+ CKP(err, ytdlsb_abort_load(p));
+ return 0;
+ }
+err: return -1;
+}
+int ytdlsb_process_preload(struct ytdlsb_task *t){
+ struct ytdlsb *p = t->data;
+ size_t max_prelp = p->fast_sb.fragment_num + p->best_sb.fragment_num;
+ int running;
+ while(1){
+ CKZ(err, curl_multi_perform(p->preload_multi, &running));
+
+ if(!running){
+ int mq;
+ size_t pp;
+ struct ytdlsb_sb *sb;
+ FRAG(p, sb, pp);
+
+ CURLMsg *m = curl_multi_info_read(p->preload_multi, &mq);
+ assert(m != NULL);
+ assert(m->msg == CURLMSG_DONE);
+ assert(m->easy_handle == p->preload_easy);
+ assert(mq == 0);
+
+ if(m->data.result == 0){
+ long respc;
+ char *mtype;
+ CKZ(err, curl_easy_getinfo(p->preload_easy,
+ CURLINFO_RESPONSE_CODE, &respc));
+ CKZ(err, curl_easy_getinfo(p->preload_easy,
+ CURLINFO_CONTENT_TYPE, &mtype));
+ if(respc == 200){
+ if(strcmp(mtype, "image/jpeg") == 0){
+ sb->fragments[pp].state = YTDLSB_SB_JPEG;
+ }else if(strcmp(mtype, "image/webp") == 0){
+ sb->fragments[pp].state = YTDLSB_SB_WEBP;
+ }else{
+ eprintf("invalid storyboard type: %s\n", mtype);
+ sb->fragments[pp].state = YTDLSB_SB_FAILED;
+ }
+ }else{
+ eprintf("invalid storyboard response: %03ld\n", respc);
+ sb->fragments[pp].state = YTDLSB_SB_FAILED;
+ }
+ }else{
+ eprintf("storyboard download error: %d\n", (int)m->data.result);
+ sb->fragments[pp].state = YTDLSB_SB_FAILED;
+ }
+
+ if(CKP(err, ytdlsb_done_fragment_preload(p))) continue;
+ break;
+ }else{
+ break;
+ }
+ }
+ CKP(err, ytdlsb_task_fdto_from_curl(&p->t.tasks[YTDLSB_TASK_PRELOAD],
+ 0, 1, p->preload_multi));
+ return 0;
+err: return -1;
+}
+#undef FRAG
+int ytdlsb_start_preload(struct ytdlsb *p){
+ CKP(err, ytdlsb_abort_load(p));
+
+ if(!ytdlsb_sb_some(&p->fast_sb)){
+ return 0;
+ }
+
+ if(!p->preload_multi){
+ p->preload_multi = CKR(err, curl_multi_init());
+ }
+ p->preload_easy = CKR(err, curl_easy_init());
+
+ p->preload_headers = CKR(err,
+ curl_slist_append(p->preload_headers, "Accept: image/webp,*/*;q=0.1"));
+#define OPT(k, v) CKZ(err, curl_easy_setopt(p->preload_easy, k, v))
+ OPT(CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
+ OPT(CURLOPT_PROTOCOLS_STR, "http,https");
+ OPT(CURLOPT_FOLLOWLOCATION, 1l);
+ OPT(CURLOPT_NOSIGNAL, 1l);
+ OPT(CURLOPT_TIMEOUT_MS, 10000l);
+ OPT(CURLOPT_CONNECTTIMEOUT_MS, 3000l);
+ OPT(CURLOPT_HTTPHEADER, p->preload_headers);
+ OPT(CURLOPT_WRITEFUNCTION, ytdlsb_fragment_preload_write);
+ OPT(CURLOPT_WRITEDATA, (void *)p);
+#undef OPT
+
+ p->preload_p = 0;
+ ytdlsb_start_fragment_preload(p);
+ CKZ(err, curl_multi_add_handle(p->preload_multi, p->preload_easy));
+
+ p->t.tasks[YTDLSB_TASK_PRELOAD].process = ytdlsb_process_preload;
+ p->t.tasks[YTDLSB_TASK_PRELOAD].data = p;
+ ytdlsb_process_preload(&p->t.tasks[YTDLSB_TASK_PRELOAD]);
+ return 0;
+err: return -1;
+}
+int ytdlsb_cleanup_load(struct ytdlsb *p){
+ CKP(err, ytdlsb_abort_load(p));
+ if(p->preload_multi){
+ CKZ(err, curl_multi_cleanup(p->preload_multi));
+ p->preload_multi = NULL;
+ }
+ free(p->t.tasks[YTDLSB_TASK_PRELOAD].pollfd);
+ return 0;
+err: return -1;
+}
+
+void ytdlsb_sb_destroy(struct ytdlsb_sb *sb){
+ if(ytdlsb_sb_some(sb)){
+ for(size_t i = 0; i < sb->fragment_num; i++){
+ free(sb->fragments[i].url);
+ free(sb->fragments[i].data);
+ }
+ free(sb->fragments);
+ sb->fragments = NULL;
+ }
+}
+void ytdlsb_sb_dup(struct ytdlsb_sb *dst, struct ytdlsb_sb *src){
+ ytdlsb_sb_destroy(dst);
+ if(ytdlsb_sb_some(src)){
+ memcpy(dst, src, sizeof(*dst));
+ dst->fragments = CKAR(reallocarray(NULL,
+ dst->fragment_num, sizeof(*dst->fragments)));
+ for(size_t i = 0; i < dst->fragment_num; i++){
+ struct ytdlsb_sb_fragment *dstf = &dst->fragments[i];
+ struct ytdlsb_sb_fragment *srcf = &src->fragments[i];
+ dstf->url = CKAR(strdup(srcf->url));
+ dstf->start = srcf->start;
+ dstf->state = srcf->state;
+ if(srcf->data){
+ dstf->data = CKAR(malloc(srcf->data_len));
+ memcpy(dstf->data, srcf->data, srcf->data_len);
+ dstf->data_len = srcf->data_len;
+ }else{
+ dstf->data = NULL;
+ }
+ }
+ }
+}
+double ytdlsb_sb_quality(struct ytdlsb_sb *sb){
+ assert(ytdlsb_sb_some(sb));
+ return sb->width * sb->height * sb->fps;
+}
+int ytdlsb_sb_import_json(struct ytdlsb_sb *sb, cJSON *json){
+ cJSON *frag, *p;
+ double start;
+ ytdlsb_sb_destroy(sb);
+#define JSON_OI(json, key) cJSON_GetObjectItemCaseSensitive(json, key)
+#define JSON_NUM(json) \
+ CK_MSG(err, cJSON_GetNumberValue(json), == cktmp, "NaN check")
+#define JSON_STR(json) CKR(err, cJSON_GetStringValue(json))
+ char *format_id = JSON_STR(JSON_OI(json, "format_id"));
+ if(strncmp(format_id, "sb", 2) != 0) goto err;
+ if(format_id[2] < '0' || '9' < format_id[2]) goto err;
+ if(format_id[3] != 0) goto err;
+
+ sb->fps = JSON_NUM(JSON_OI(json, "fps"));
+ CK(err, sb->fps, > 0);
+#define SIZEF(f) \
+ sb->f = CK(err, TRY_NUMCAST(err, size_t, JSON_NUM(JSON_OI(json, #f))), > 0)
+ SIZEF(width);
+ SIZEF(height);
+ SIZEF(columns);
+ SIZEF(rows);
+#undef SIZEF
+ frag = JSON_OI(json, "fragments");
+ CK(err, cJSON_IsArray(frag),);
+ sb->fragment_num = CK(err, cJSON_GetArraySize(frag), > 0);
+ CK_MSG(err, sb->fragment_num, < 4096, "Too many fragments");
+ CK(err, sb->fragment_num, > 0);
+ sb->fragments = CKAR(reallocarray(NULL,
+ sb->fragment_num, sizeof(*sb->fragments)));
+ p = frag->child;
+ start = 0;
+ for(size_t i = 0; i < sb->fragment_num; i++){
+ assert(p);
+ struct ytdlsb_sb_fragment *f = &sb->fragments[i];
+ f->url = CKR(err, strdup(JSON_STR(JSON_OI(p, "url"))));
+ f->state = YTDLSB_SB_EMPTY;
+ f->data = NULL;
+ f->start = start;
+ start += JSON_NUM(JSON_OI(p, "duration"));
+ p = p->next;
+ }
+ return 0;
+#undef JSON_OI
+#undef JSON_NUM
+#undef JSON_STR
+err:
+ free(sb->fragments); sb->fragments = NULL;
+ return -1;
+}
+void ytdlsb_sb_dump(struct ytdlsb_sb *sb){
+ if(!ytdlsb_sb_some(sb)){
+ eprintf("None\n");
+ return;
+ }
+ eprintf("FPS: %f\n", sb->fps);
+ eprintf("WxH, CxR: %zux%zu, %zux%zu\n",
+ sb->width, sb->height, sb->columns, sb->rows);
+ for(size_t i = 0; i < sb->fragment_num; i++){
+ eprintf("%s\n", sb->fragments[i].url);
+ if(5 < i){
+ eprintf("...\n");
+ break;
+ }
+ }
+}
+
+// <0 = error (only on first error)
+// 0 = not loaded
+// 1 = ref
+// 2 = copy(?)
+int ytdlsb_sb_get_frame(
+ struct ytdlsb_sb *sb, double pos, char **data, size_t *len
+){
+ struct ytdlsb_sb_fragment *f = NULL;
+ for(size_t i = 0; i < sb->fragment_num; i++){
+ struct ytdlsb_sb_fragment *cf = &sb->fragments[i];
+ if(cf->start <= pos) f = cf;
+ else break;
+ }
+ //eprintf("fragment %d\n", (int)((f-sb->fragments)/sizeof(*f)));
+ if(!f || f->state == YTDLSB_SB_EMPTY) return 0;
+ //eprintf(".!!!\n");
+ if(f->state == YTDLSB_SB_WEBP){
+ //eprintf("webp!\n");
+ char *decoded;
+ int width, height;
+ if(is_little_endian()){
+ decoded = (char *)CKR(decode_failed, WebPDecodeBGRA(
+ (uint8_t *)f->data, f->data_len, &width, &height));
+ }else{
+ decoded = (char *)CKR(decode_failed, WebPDecodeRGBA(
+ (uint8_t *)f->data, f->data_len, &width, &height));
+ }
+ CK(sizemismatch, width, <= sb->columns * sb->width);
+ CK(sizemismatch, width % sb->width, == 0);
+ CK(sizemismatch, height, <= sb->rows * sb->height);
+ CK(sizemismatch, height % sb->height, == 0);
+ f->data_len = TRY_NUMCAST(sizemismatch, size_t, width)
+ * TRY_NUMCAST(sizemismatch, size_t, height) * 4;
+ free(f->data);
+ f->data = CKAR(malloc(f->data_len));
+ size_t frame = sb->width * sb->height * 4;
+ for(size_t y = 0; y < height/sb->height; y++){
+ for(size_t x = 0; x < width/sb->width; x++){
+ char *src_orig = decoded + (x*sb->width + y*sb->height*width)*4;
+ char *dest_orig = f->data + (x + y*(width/sb->width))*frame;
+ for(size_t i = 0; i < sb->height; i++){
+ assert(src_orig + i*width*4 + 4*sb->width
+ <= decoded+f->data_len);
+ assert(dest_orig + i*sb->width*4 + 4*sb->width
+ <= f->data+f->data_len);
+ memcpy(dest_orig + i*sb->width*4,
+ src_orig + i*width*4, 4*sb->width);
+ }
+ }
+ }
+ free(decoded);
+ f->state = YTDLSB_SB_RAW;
+ goto webpok;
+sizemismatch:
+ free(decoded);
+ goto decode_failed;
+webpok:
+ }else if(f->state == YTDLSB_SB_JPEG){
+ eprintf("Jpeg decoding is not implemented yet.\n");
+ goto decode_failed;
+ }
+ if(f->state == YTDLSB_SB_RAW){
+ //eprintf("raw!\n");
+ size_t frame = sb->width * sb->height * 4;
+ size_t findex = (pos - f->start) * sb->fps;
+ if(f->data_len < findex*frame+frame){
+ findex = (f->data_len - frame) / frame;
+ }
+ *data = f->data + frame*findex;
+ *len = frame;
+ return 1;
+ }
+ return 0;
+decode_failed:
+ f->state = YTDLSB_SB_FAILED;
+ return -1;
+}
+int ytdlsb_get_frame(struct ytdlsb *p, double pos,
+ char **data, size_t *w, size_t *h
+){
+ size_t len;
+ if(ytdlsb_sb_some(&p->best_sb)
+ && ytdlsb_sb_get_frame(&p->best_sb, pos, data, &len) == 1
+ ){
+ assert(p->best_sb.width * p->best_sb.height * 4 == len);
+ *w = p->best_sb.width;
+ *h = p->best_sb.height;
+ return 1;
+ }
+ if(ytdlsb_sb_some(&p->fast_sb)
+ && ytdlsb_sb_get_frame(&p->fast_sb, pos, data, &len) == 1
+ ){
+ assert(p->fast_sb.width * p->fast_sb.height * 4 == len);
+ *w = p->fast_sb.width;
+ *h = p->fast_sb.height;
+ return 1;
+ }
+ return 0;
+}
+
+int ytdlsb_hook_on_preloaded(struct ytdlsb *p){
+ ytdlsb_sb_destroy(&p->best_sb);
+ ytdlsb_sb_destroy(&p->fast_sb);
+ char *ytjson_w, *ytjson;
+ cJSON *yt_w, *yt, *yt_formats, *fmt;
+ ytjson_w = mpv_get_property_string(
+ p->m, "user-data/mpv/ytdl/json-subprocess-result");
+ if(!ytjson_w) goto noytdl;
+ yt_w = CKR(broken_json_w, cJSON_Parse(ytjson_w));
+ ytjson = CKR(broken_json,
+ cJSON_GetStringValue(cJSON_GetObjectItemCaseSensitive(yt_w, "stdout")));
+ yt = CKR(broken_json, cJSON_Parse(ytjson));
+ yt_formats = CKR(end_json,
+ cJSON_GetObjectItemCaseSensitive(yt, "formats"));
+ CKT(end_json, cJSON_IsArray(yt_formats));
+ while(fmt = cJSON_DetachItemFromArray(yt_formats, 0)){
+ struct ytdlsb_sb sb = {0};
+ if(ytdlsb_sb_import_json(&sb, fmt) >= 0){
+ int refed = 0;
+ if(!ytdlsb_sb_some(&p->best_sb)
+ || ytdlsb_sb_quality(&p->best_sb) < ytdlsb_sb_quality(&sb)
+ ){
+ ytdlsb_sb_destroy(&p->best_sb);
+ memcpy(&p->best_sb, &sb, sizeof(sb));
+ refed = 1;
+ }
+ if(!ytdlsb_sb_some(&p->fast_sb)
+ || ytdlsb_sb_quality(&p->fast_sb) > ytdlsb_sb_quality(&sb)
+ ){
+ ytdlsb_sb_destroy(&p->fast_sb);
+ if(refed){
+ ytdlsb_sb_dup(&p->fast_sb, &sb);
+ }else{
+ memcpy(&p->fast_sb, &sb, sizeof(sb));
+ refed = 1;
+ }
+ }
+ if(!refed) ytdlsb_sb_destroy(&sb);
+ }
+ cJSON_Delete(fmt);
+ }
+ ytdlsb_start_preload(p);
+ ytdlsb_sb_dump(&p->fast_sb);
+ ytdlsb_sb_dump(&p->best_sb);
+end_json:
+ cJSON_Delete(yt);
+broken_json:
+ cJSON_Delete(yt_w);
+broken_json_w:
+ mpv_free(ytjson_w);
+noytdl:
+ return 0;
+}
+
+int ytdlsb_hook_on_unload(struct ytdlsb *p){
+ ytdlsb_abort_load(p);
+ ytdlsb_sb_destroy(&p->best_sb);
+ ytdlsb_sb_destroy(&p->fast_sb);
+ return 0;
+}
+int ytdlsb_propchange_osc(struct ytdlsb *p, mpv_event_property *ep){
+ char *image;
+ size_t width, height;
+ double pos;
+ char *osc_activeelem;
+ int osc_visible;
+ int ret = -1;
+
+#define GETPROP(key, ty, ptr, def) { \
+ int getres = mpv_get_property(p->m, key, ty, ptr); \
+ if(getres < 0 && getres != MPV_ERROR_PROPERTY_NOT_FOUND \
+ && getres != MPV_ERROR_PROPERTY_UNAVAILABLE \
+ ){ \
+ goto err; \
+ }else if(getres < 0){ \
+ *(ptr) = def; \
+ } \
+}
+ GETPROP("user-data/osc/visible",
+ MPV_FORMAT_FLAG, &osc_visible, 0);
+ GETPROP("user-data/osc/active-element",
+ MPV_FORMAT_STRING, &osc_activeelem, NULL);
+ GETPROP("user-data/osc/seekbar/possec",
+ MPV_FORMAT_DOUBLE, &pos, -1);
+#undef GETPROP
+
+ if(!osc_visible) pos = -1;
+ if(!osc_activeelem || strcmp(osc_activeelem, "\"seekbar\"")) pos = -1;
+ if(pos >= 0 && CKP(err, ytdlsb_get_frame(p, pos, &image, &width, &height))){
+ CKP(err, ytdlsb_mpv_overlay_add(p->m,
+ YTDLSB_OSD_IMG, 0, 0,
+ image, 0, width, height, width*4,
+ width, height
+ ));
+ p->current_sb_show = pos;
+ }else{
+ CKP(err, ytdlsb_mpv_overlay_remove(p->m, YTDLSB_OSD_IMG));
+ p->current_sb_show = -1;
+ }
+ ret = 0;
+err:
+ mpv_free(osc_activeelem);
+ return ret;
+}
+
+int ytdlsb_ev(struct ytdlsb *p, mpv_event *ev){
+ switch(ev->event_id){
+ case MPV_EVENT_HOOK:
+ mpv_event_hook *hook = ev->data;
+ switch(ev->reply_userdata){
+ case YTDLSB_HOOK_PRELOADED:
+ CKP(err, ytdlsb_hook_on_preloaded(p));
+ break;
+ case YTDLSB_HOOK_UNLOAD:
+ CKP(err, ytdlsb_hook_on_unload(p));
+ break;
+ }
+ CKM(err, mpv_hook_continue(p->m, hook->id));
+ return 0;
+ case MPV_EVENT_PROPERTY_CHANGE:
+ switch(ev->reply_userdata){
+ case YTDLSB_OBSERVE_OSC:
+ CKP(err, ytdlsb_propchange_osc(p, ev->data));
+ break;
+ }
+ return 0;
+ default:
+ return 0;
+ }
+err:
+ return -1;
+}
+
+void ytdlsb_mpvev_waker(void *_p){
+ struct ytdlsb *p = _p;
+ CKAP(ytdlsb_task_event_wake(&p->t.tasks[YTDLSB_TASK_MPVEV]));
+}
+int ytdlsb_mpvev(void *_p){
+ struct ytdlsb *p = _p;
+
+ while(1){
+ mpv_event *ev = CKR(err, mpv_wait_event(p->m, 0));
+ if(ev->event_id == MPV_EVENT_SHUTDOWN){
+ p->exit = 1;
+ break;
+ }else if(ev->event_id == MPV_EVENT_NONE){
+ break;
+ }else{
+ CKP(err, ytdlsb_ev(p, ev));
+ }
+ }
+
+ return 0;
+err:
+ return -1;
+}
+
+int mpv_open_cplugin(mpv_handle *h){
+ int ret = -1;
+ struct ytdlsb p = {0};
+ struct ytdlsb_task tasks[YTDLSB_TASK_NUM] = {{0}};
+ curl_version_info_data *curl_v;
+
+ curl_v = CKR(err, curl_version_info(CURLVERSION_NOW));
+ // Main thread of mpv is blocked here.
+ // I think it is safe enough to call this.
+ // (But can make conflicts with other plugins...)
+ CKZ(err, curl_global_init(CURL_GLOBAL_ALL));
+
+ p.m = h;
+ p.t.tasks = tasks;
+ p.t.task_num = YTDLSB_TASK_NUM;
+ p.current_sb_show = -1;
+ CKM(err, mpv_hook_add(p.m, YTDLSB_HOOK_PRELOADED, "on_preloaded", 0));
+ CKM(err, mpv_hook_add(p.m, YTDLSB_HOOK_UNLOAD, "on_unload", 0));
+ CKM(err, mpv_observe_property(p.m, YTDLSB_OBSERVE_OSC,
+ "user-data/osc/visible", MPV_FORMAT_NONE));
+ CKM(err, mpv_observe_property(p.m, YTDLSB_OBSERVE_OSC,
+ "user-data/osc/active-element", MPV_FORMAT_NONE));
+ CKM(err, mpv_observe_property(p.m, YTDLSB_OBSERVE_OSC,
+ "user-data/osc/seekbar/possec", MPV_FORMAT_NONE));
+
+ CKP(err, ytdlsb_task_event_init(&tasks[YTDLSB_TASK_MPVEV],
+ ytdlsb_mpvev, &p));
+ mpv_set_wakeup_callback(h, ytdlsb_mpvev_waker, &p);
+ CKP(err, ytdlsb_task_event_wake(&tasks[YTDLSB_TASK_MPVEV]));
+
+ while(!p.exit){
+ CKP(err, ytdlsb_tasks_step(&p.t));
+ }
+
+ CKP(err, ytdlsb_cleanup_load(&p));
+ ytdlsb_task_event_destroy(&tasks[YTDLSB_TASK_MPVEV]);
+ ytdlsb_sb_destroy(&p.best_sb);
+ ytdlsb_sb_destroy(&p.fast_sb);
+
+ if(curl_v->features & CURL_VERSION_THREADSAFE){
+ // If it is not thread-safe, not clean.
+ // It may lead to memory leaks. Better than UB.
+ curl_global_cleanup();
+ }
+ ret = 0;
+err:
+ return ret;
+}
diff --git a/ytdlsb-mpv.c b/ytdlsb-mpv.c
new file mode 100644
index 0000000..f5f7600
--- /dev/null
+++ b/ytdlsb-mpv.c
@@ -0,0 +1,102 @@
+#include "ytdlsb-mpv.h"
+#include "ytdlsb-utils.h"
+#include <stdio.h>
+#include <assert.h>
+
+int ytdlsb_mpv_overlay_add(mpv_handle *m,
+ int id, int x, int y,
+ char *buf, size_t off, size_t w, size_t h, size_t stride,
+ size_t dw, size_t dh
+){
+ char *command_keys[] = {
+ "name", "id", "x", "y",
+ "file", "offset", "fmt", "w", "h", "stride",
+ "dw", "dh",
+ };
+ char filename[32]; // enough for 64bit int + 1byte prefix
+ CKA(snprintf(filename, 32, "&%tu", (ptrdiff_t)((void *)buf - NULL)), < 32);
+ mpv_node command_vals[] = {
+ {
+ .format = MPV_FORMAT_STRING,
+ .u.string = "overlay-add",
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, id),
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, x),
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, y),
+ }, {
+ .format = MPV_FORMAT_STRING,
+ .u.string = filename,
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, off),
+ }, {
+ .format = MPV_FORMAT_STRING,
+ .u.string = "bgra",
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, w),
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, h),
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, stride),
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, dw),
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, dh),
+ },
+ };
+ assert(sizeof(command_keys)/sizeof(command_keys[0])
+ == sizeof(command_vals)/sizeof(command_vals[0]));
+ mpv_node_list command_list = {
+ .num = sizeof(command_keys)/sizeof(command_keys[0]),
+ .values = command_vals,
+ .keys = command_keys,
+ };
+ mpv_node command = {
+ .format = MPV_FORMAT_NODE_MAP,
+ .u.list = &command_list,
+ };
+ CKM(err, mpv_command_node(m, &command, NULL));
+ return 0;
+a:
+ abort();
+err:
+ return -1;
+}
+
+int ytdlsb_mpv_overlay_remove(mpv_handle *m, int id){
+ char *command_keys[] = {"name", "id"};
+ mpv_node command_vals[] = {
+ {
+ .format = MPV_FORMAT_STRING,
+ .u.string = "overlay-remove",
+ }, {
+ .format = MPV_FORMAT_INT64,
+ .u.int64 = TRY_NUMCAST(a, int64_t, id),
+ },
+ };
+ assert(sizeof(command_keys)/sizeof(command_keys[0])
+ == sizeof(command_vals)/sizeof(command_vals[0]));
+ mpv_node_list command_list = {
+ .num = sizeof(command_keys)/sizeof(command_keys[0]),
+ .values = command_vals,
+ .keys = command_keys,
+ };
+ mpv_node command = {
+ .format = MPV_FORMAT_NODE_MAP,
+ .u.list = &command_list,
+ };
+ CKM(err, mpv_command_node(m, &command, NULL));
+ return 0;
+a: abort();
+err: return -1;
+}
diff --git a/ytdlsb-mpv.h b/ytdlsb-mpv.h
new file mode 100644
index 0000000..11a0562
--- /dev/null
+++ b/ytdlsb-mpv.h
@@ -0,0 +1,8 @@
+#include <mpv/client.h>
+
+int ytdlsb_mpv_overlay_add(mpv_handle *m,
+ int id, int x, int y,
+ char *buf, size_t off, size_t w, size_t h, size_t stride,
+ size_t dw, size_t dh
+);
+int ytdlsb_mpv_overlay_remove(mpv_handle *m, int id);
diff --git a/ytdlsb-tasks.c b/ytdlsb-tasks.c
new file mode 100644
index 0000000..0e97a94
--- /dev/null
+++ b/ytdlsb-tasks.c
@@ -0,0 +1,234 @@
+#define _GNU_SOURCE
+#include "ytdlsb-tasks.h"
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+#include <curl/curl.h>
+
+static void get_now(struct timespec *t){
+ CKAP(clock_gettime(CLOCK_MONOTONIC, t));
+}
+static void set_time_ms(struct timespec *dst, int ms){
+ dst->tv_sec = ms / 1000;
+ dst->tv_nsec = ms % 1000 * 1000 * 1000;
+}
+static int get_time_ms(struct timespec *src){
+ if((INT_MAX - 999) / 1000 < src->tv_sec){
+ return (INT_MAX - 999) / 1000 * 1000; // lazy saturation
+ }
+ return (int)src->tv_sec * 1000 + src->tv_nsec / 1000 / 1000;
+}
+static void copy_time(struct timespec *dst, struct timespec *src){
+ memcpy(dst, src, sizeof(*dst));
+}
+static void add_time(struct timespec *dst, struct timespec *src){
+ dst->tv_sec += src->tv_sec;
+ dst->tv_nsec -= 1000 * 1000 * 1000;
+ dst->tv_nsec += src->tv_nsec;
+ if(dst->tv_nsec < 0) dst->tv_nsec += 1000 * 1000 * 1000;
+ else dst->tv_sec += 1;
+}
+static void sub_time(struct timespec *dst, struct timespec *src){
+ dst->tv_sec -= src->tv_sec;
+ dst->tv_nsec -= src->tv_nsec;
+ if(src->tv_nsec < 0){
+ dst->tv_sec -= 1;
+ dst->tv_nsec += 1000 * 1000 * 1000;
+ }
+}
+static int lt_time(struct timespec *lt, struct timespec *gt){
+ return lt->tv_sec < gt->tv_sec
+ || lt->tv_sec == gt->tv_sec && lt->tv_nsec < gt->tv_nsec;
+}
+
+int ytdlsb_task_timeout_ms(struct ytdlsb_task *task, int ms){
+ struct timespec a;
+ set_time_ms(&a, ms);
+ get_now(&task->timeout);
+ add_time(&task->timeout, &a);
+ return 0;
+}
+int ytdlsb_task_timeout_ms_min(struct ytdlsb_task *task, int ms){
+ struct timespec a, now;
+ get_now(&now);
+ set_time_ms(&a, ms);
+ add_time(&a, &now);
+ if(get_time_ms(&task->timeout) == 0 || lt_time(&a, &task->timeout)){
+ copy_time(&task->timeout, &a);
+ }
+ return 0;
+}
+int ytdlsb_task_timeout_unset(struct ytdlsb_task *task){
+ set_time_ms(&task->timeout, 0);
+ return 0;
+}
+int ytdlsb_tasks_step(struct ytdlsb_tasks *tasks){
+ int ret = -1;
+ struct pollfd *fds = NULL;
+ size_t *fdso = NULL;
+ struct timespec now;
+ size_t last_fd = 0;
+ get_now(&now);
+ fdso = CKAR(reallocarray(NULL, tasks->task_num, sizeof(*fdso)));
+ int timeout = -1;
+ nfds_t nfds = 0;
+ for(size_t i = 0; i < tasks->task_num; i++){
+ struct ytdlsb_task *t = &tasks->tasks[i];
+ if(!t->process){
+ fdso[i] = nfds;
+ continue;
+ }
+
+ if(get_time_ms(&t->timeout) == 0){
+ // do nothing
+ }else if(lt_time(&t->timeout, &now)){
+ timeout = 0;
+ }else{
+ struct timespec tdiff;
+ copy_time(&tdiff, &t->timeout);
+ sub_time(&tdiff, &now);
+ int ms = get_time_ms(&tdiff);
+ if(timeout == -1 || timeout < ms) timeout = ms;
+ }
+
+ fdso[i] = nfds + t->pollfd_num;
+ if(t->pollfd_num){
+ nfds += t->pollfd_num;
+ fds = CKAR(reallocarray(fds, nfds, sizeof(*fds)));
+ for(size_t j = 0; j < t->pollfd_num; j++){
+ struct pollfd *dst = &fds[nfds - t->pollfd_num + j];
+ dst->fd = t->pollfd[j].fd;
+ dst->events = t->pollfd[j].events;
+ }
+ }
+ }
+ CKP(err, poll(fds, nfds, timeout));
+ get_now(&now);
+ for(size_t i = 0; i < tasks->task_num; i++){
+ struct ytdlsb_task *t = &tasks->tasks[i];
+ int want_call = 0;
+ if(get_time_ms(&t->timeout) && lt_time(&t->timeout, &now))
+ want_call |= 1;
+ for(size_t j = last_fd; !want_call && j < fdso[i]; j++){
+ short er = fds[j].events;
+ short re = fds[j].revents;
+ CK(err, re & POLLNVAL, == 0);
+ want_call |= re&POLLHUP || re&POLLERR;
+ want_call |= er&POLLIN && re&POLLIN;
+ want_call |= er&POLLOUT && re&POLLOUT;
+ want_call |= er&POLLPRI && re&POLLPRI;
+ }
+ if(t->process && want_call){
+ CKP(err, t->process(t));
+ }
+ last_fd = fdso[i];
+ }
+ ret = 0;
+err:
+ free(fds);
+ free(fdso);
+ return ret;
+}
+
+struct ytdlsb_task_event{
+ int pipe[2];
+ int (*cb)(void *);
+ void *data;
+};
+static int ytdlsb_task_event_cb(struct ytdlsb_task *t){
+ struct ytdlsb_task_event *e = t->data;
+ ssize_t rs;
+ while(1){
+ int buf;
+ rs = read(e->pipe[0], &buf, sizeof(buf));
+ if(rs == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) break;
+ CK_MSG(err, rs, > 0, "pipe read error");
+ }
+ return e->cb(e->data) < 0 ? -1 : 0;
+err: return -1;
+}
+int ytdlsb_task_event_init(
+ struct ytdlsb_task *task, int (*cb)(void *), void *data
+){
+ int ret = -1;
+ struct ytdlsb_task_event *e;
+ e = CKAR(malloc(sizeof(*e)));
+ CKP(err, pipe2(e->pipe, O_CLOEXEC|O_NONBLOCK));
+ e->cb = cb;
+ e->data = data;
+ task->process = ytdlsb_task_event_cb;
+ task->pollfd = CKAR(malloc(sizeof(*task->pollfd)));
+ task->pollfd[0].fd = e->pipe[0];
+ task->pollfd[0].events = YTDLSB_POLLIN;
+ task->pollfd_num = 1;
+ task->data = e;
+ e = NULL;
+ ret = 0;
+err:
+ free(e);
+ return ret;
+}
+void ytdlsb_task_event_destroy(struct ytdlsb_task *task){
+ struct ytdlsb_task_event *e = task->data;
+ CKAP(close(e->pipe[0]));
+ CKAP(close(e->pipe[1]));
+ free(e);
+ free(task->pollfd);
+}
+int ytdlsb_task_event_wake(struct ytdlsb_task *task){
+ struct ytdlsb_task_event *e = task->data;
+ ssize_t ws = write(e->pipe[1], "\n", 1);
+ if(ws == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) return 0;
+ CK_MSG(err, ws, > 0, "pipe write error");
+ return 0;
+err:
+ return -1;
+}
+
+int ytdlsb_task_fdto_from_curl(
+ struct ytdlsb_task *task, size_t off, int overwrite_timeout, CURLM* cm
+){
+ int ret = -1;
+ unsigned int ncfds = 0;
+ struct curl_waitfd *cfds = NULL;
+ long timeout;
+
+ CKZ(err, curl_multi_timeout(cm, &timeout));
+ if(overwrite_timeout && timeout < 0){
+ CKP(err, ytdlsb_task_timeout_unset(task));
+ }else if(overwrite_timeout){
+ CKP(err, ytdlsb_task_timeout_ms(task, TRY_NUMCAST(err, int, timeout)));
+ }else{
+ CKP(err, ytdlsb_task_timeout_ms_min(task,
+ TRY_NUMCAST(err, int, timeout)));
+ }
+
+ CKZ(err, curl_multi_waitfds(cm, NULL, 0, &ncfds));
+ if(ncfds == 0){
+ task->pollfd_num = off;
+ return 0;
+ }
+ cfds = CKAR(reallocarray(NULL, ncfds, sizeof(*cfds)));
+ CKZ(err, curl_multi_waitfds(cm, cfds, ncfds, NULL));
+ task->pollfd = CKAR(reallocarray(task->pollfd,
+ off+ncfds, sizeof(*task->pollfd)));
+ for(size_t i = 0; i < ncfds; i++){
+ task->pollfd[off+i].fd = cfds[i].fd;
+ task->pollfd[off+i].events = 0;
+#define PT(t) if(cfds[i].fd & CURL_WAIT_POLL ## t) \
+ task->pollfd[off+i].events |= YTDLSB_POLL ## t
+ PT(IN);
+ PT(PRI);
+ PT(OUT);
+#undef PT
+ }
+ task->pollfd_num = off + ncfds;
+ ret = ncfds;
+err:
+ free(cfds);
+ return ret;
+}
diff --git a/ytdlsb-tasks.h b/ytdlsb-tasks.h
new file mode 100644
index 0000000..86d3070
--- /dev/null
+++ b/ytdlsb-tasks.h
@@ -0,0 +1,39 @@
+#include <poll.h>
+#include <time.h>
+#include <curl/curl.h>
+#include "ytdlsb-utils.h"
+
+typedef int ytdlsb_sock;
+#define YTDLSB_POLLIN POLLIN
+#define YTDLSB_POLLPRI POLLPRI
+#define YTDLSB_POLLOUT POLLOUT
+
+struct ytdlsb_pollfd{
+ ytdlsb_sock fd;
+ short events;
+ short revents;
+};
+struct ytdlsb_task{
+ int (*process)(struct ytdlsb_task *);
+ struct ytdlsb_pollfd *pollfd;
+ size_t pollfd_num;
+ struct timespec timeout;
+ void *data;
+};
+struct ytdlsb_tasks{
+ struct ytdlsb_task *tasks;
+ size_t task_num;
+};
+
+int ytdlsb_tasks_step(struct ytdlsb_tasks *tasks);
+int ytdlsb_task_timeout_ms(struct ytdlsb_task *task, int ms);
+int ytdlsb_task_timeout_ms_min(struct ytdlsb_task *task, int ms);
+int ytdlsb_task_timeout_unset(struct ytdlsb_task *task);
+
+int ytdlsb_task_event_init(struct ytdlsb_task *task,
+ int (*cb)(void *), void *data);
+void ytdlsb_task_event_destroy(struct ytdlsb_task *task);
+int ytdlsb_task_event_wake(struct ytdlsb_task *task);
+
+int ytdlsb_task_fdto_from_curl(
+ struct ytdlsb_task *task, size_t off, int overwrite_timeout, CURLM* cm);
diff --git a/ytdlsb-utils.h b/ytdlsb-utils.h
new file mode 100644
index 0000000..abb581b
--- /dev/null
+++ b/ytdlsb-utils.h
@@ -0,0 +1,45 @@
+#ifndef YTDLSB_UTILS_H
+#define YTDLSB_UTILS_H
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <inttypes.h>
+
+inline static int is_little_endian(){
+ int i = 1;
+ return *(char *)(void *)&i;
+}
+
+#define eprintf(fmt, ...) fprintf(stderr, "\n" fmt, ##__VA_ARGS__)
+#define CK_INNER(errproc, expr, cond, msg, ...) ({ \
+ typeof(expr) cktmp = (expr); \
+ if(!(cktmp cond)){ \
+ eprintf("E%"PRIdPTR" at %s:%d(%s): assert(%s)" msg "\n", \
+ (intptr_t)cktmp, __FILE__, __LINE__, __func__, \
+ #expr " " #cond, ##__VA_ARGS__); \
+ errproc; \
+ } \
+ cktmp; \
+})
+
+#define CK(label, expr, cond) CK_INNER(goto label, expr, cond, "")
+#define CKT(label, expr) CK(label, expr, )
+#define CKP(label, expr) CK(label, expr, >= 0)
+#define CKZ(label, expr) CK(label, expr, == 0)
+#define CKM(label, expr) CKZ(label, expr)
+#define CKR(label, expr) CK(label, expr, != NULL)
+#define CKA(expr, cond) CK_INNER(abort(), expr, cond, "")
+#define CKAR(expr) CKA(expr, != NULL)
+#define CKAP(expr) CKA(expr, >= 0)
+#define CK_WARN(expr, cond) CK_INNER(, expr, cond, "")
+#define CK_MSG(label, expr, cond, msg, ...) \
+ CK_INNER(goto label, expr, cond, ": " msg, ##__VA_ARGS__)
+#define TRY_NUMCAST(label, type, expr) ({ \
+ typeof(expr) cktmp = (expr); \
+ if((type)cktmp != cktmp) goto label; \
+ if(cktmp < 0 && 0 < (type)-1) goto label; \
+ (type)cktmp; \
+})
+
+#endif //YTDLSB_UTILS_H