Compare commits

..
29 Commits
Author SHA1 Message Date
Martin Herkt 10a005df0c Release 0.23.0 2016-12-25 14:12:38 +01:00
Martin Herkt b3d670a3e1 Merge branch 'master' into release/current 2016-12-25 13:28:05 +01:00
Martin Herkt 1d4273cfb5 Release 0.22.0 2016-11-20 18:16:02 +01:00
Martin Herkt 8700700de8 Merge branch 'master' into release/current 2016-11-20 18:15:08 +01:00
Martin Herkt e6b85c9170 Release 0.21.0 2016-10-19 23:10:13 +02:00
Martin Herkt 5d74fa7dc0 Merge branch 'master' into release/current 2016-10-19 19:09:00 +02:00
Martin Herkt c226bc7616 Release 0.20.0 2016-08-26 19:40:58 +02:00
Martin Herkt e60a36bd4e Merge branch 'master' into release/current 2016-08-26 19:15:57 +02:00
Martin Herkt ef2d6ed125 Release 0.19.0 2016-08-15 16:10:59 +02:00
Martin Herkt fd1bc95b48 Merge branch 'master' into release/current 2016-08-15 15:19:29 +02:00
Martin Herkt 1e00bcc14c Release 0.18.1 2016-07-10 02:20:08 +02:00
Martin Herkt 7635438592 Merge branch 'master' into release/current 2016-07-10 01:06:17 +02:00
Martin Herkt 69e7b0d3ea Release 0.18.0 2016-06-25 03:23:40 +02:00
Martin Herkt ad56f2c46a Merge branch 'master' into release/current 2016-06-25 02:25:44 +02:00
Martin Herkt 0536841647 Release 0.17.0 2016-04-11 19:10:54 +02:00
Martin Herkt 0803f4ad21 Merge branch 'master' into release/current 2016-04-11 17:42:55 +02:00
Martin Herkt 9d2980dab7 Release 0.16.0 2016-02-29 00:22:04 +01:00
Martin Herkt 21cd4ff05b Merge branch 'master' into release/current 2016-02-28 23:31:51 +01:00
Martin Herkt d1d6257731 Release 0.15.0 2016-01-18 07:28:12 +01:00
Martin Herkt ba9b2f1e49 Merge branch 'master' into release/current 2016-01-18 07:27:03 +01:00
Martin Herkt e1993d5ad2 Release 0.14.0 2015-12-11 19:20:29 +01:00
Martin Herkt 0607dcebff Merge branch 'master' into release/current 2015-12-11 18:33:38 +01:00
Martin Herkt a33a44cf4e Release 0.13.0 2015-11-10 19:14:14 +01:00
Martin Herkt 273607c1c6 Merge branch 'master' into release/current 2015-11-10 18:45:08 +01:00
Martin Herkt 5b7d0fbab3 Release 0.12.0 2015-10-29 03:49:43 +01:00
Martin Herkt ec567d8a77 Merge branch 'master' into release/current 2015-10-29 02:56:49 +01:00
Martin Herkt f8c57433b9 Release 0.11.0 2015-09-23 01:13:22 +02:00
Martin Herkt ead2933792 Merge branch 'master' into release/current 2015-09-23 01:12:42 +02:00
Martin Herkt 181e1377b2 Release 0.10.0 2015-09-03 19:59:59 +02:00
522 changed files with 17895 additions and 32377 deletions

No files matched your search

+1 -3
View File
@@ -1,7 +1,6 @@
### mpv version and platform
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
@@ -16,8 +15,7 @@ http://sprunge.us or a similar site, and replace this text with a link to it.
Providing a log file is strongly encouraged. It is very helpful for reproducing
bugs or getting important technical context. Without a log it might not be
possible to analyze and fix certain bugs, and your bug report will be closed
or ignored.
possible to analyze and fix certain bugs.
### Sample files
+4 -2
View File
@@ -2,9 +2,10 @@ language: c
os:
- linux
#- osx
- osx
env:
matrix:
- LIBAV=libav-stable
- LIBAV=libav-git
- LIBAV=ffmpeg-stable
- LIBAV=ffmpeg-git
@@ -25,6 +26,8 @@ branches:
matrix:
exclude:
- os: osx
env: LIBAV=libav-stable
- os: osx
env: LIBAV=libav-git
- os: osx
@@ -41,7 +44,6 @@ script:
- ./bootstrap.py
- ./waf configure
- ./waf build
after_failure: cat ./build/config.log
after_script: TOOLS/travis-rebuild-website
notifications:
+1 -325
View File
@@ -4,9 +4,7 @@ mpv as a whole is licensed as GPL version 2 or later (see LICENSE). Most source
files are GPLv2+, but some files are available under a more liberal license,
such as LGPLv2.1+, 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 licensed as
LGPLv2.1+. Also see the list of files with specific licenses below (not all
files can have a standard license header).
to know details. Files without Copyright notice are licensed as LGPLv2.1+.
All new contributions must be LGPLv2.1+ licensed, or if the changes are done on
GPL code, must come with the implicit agreement that the project can relicense
@@ -27,325 +25,3 @@ In particular, this affects the file libmpdemux/demux_ty_osd.c. It is disabled
under mplayer2, and has been removed from mpv.
"v2.1+" in this context means "version 2.1 or later".
Some libraries are GPLv2+ or GPLv3+ only. Building mpv with Samba support makes
it GPLv3+.
Source files with specific licenses:
- etc/input.conf is LGPLv2.1+
- etc/builtin.conf is LGPLv2.1+
- etc/encoding-profiles.conf is LGPLv2.1+
- all mpv icons and derived files are LGPLv2.1+ (mpv-icon-8bit-16x16.png etc.)
- everything else under etc/ is unknown
- everything under DOCS/man/ is GPLv2+
- sub/osd_font.otf is LGPLv2.1+
- version.sh is LGPLv2+
- bootstrap.py is unknown (probably GPLv2+ or LGPLv2+)
- the build system (wscript, waftools/*) is LGPLv2+, some parts BSD
Some files are marked with "Almost LGPL." These files are GPL, but all authors
have agreed to relicense them to LGPL. the problem is that one of the authors is
Michael Niedermayer, who cited the following conditions for relicensing:
http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2016-September/073535.html
We assume the first 3 conditions are fulfilled. The last condition can be
interpreted as that his code can be changed to LGPL only as soon as the "core"
of mpv changes to LGPL. We interpret "core" as something minimal, that can
actually be built and run, with all GPL code disabled.
Some files are LGPLv3+. This is due to the contributions of a single developer
going by the SVN username "iive". The chosen license of this project is
LGPLv2.1+. The affected files will be changed to LGPLv2.1+ at the earliest
opportunity, for example if his contributions disappear by being replaced
or removed. All new contributions to these files are implied to be LGPLv2.1+.
LGPL relicensing status. Files which require some sort of action to get a basic
LGPL player core (relicensing, replacement, or partial/full rewrites) are marked
with an "x".
audio/decode/ad.h LGPL
audio/decode/ad_lavc.c LGPL
audio/decode/ad_spdif.c LGPL
audio/decode/dec_audio.* LGPL
x audio/filter/af.* must be killed (main author disagreed)
(required for LGPL core: a new filter chain must be written)
audio/filter/af_channel.c must be killed (main author disagreed)
audio/filter/af_equalizer.c must be killed (main author disagreed)
audio/filter/af_pan.c must be killed (main author disagreed)
audio/filter/af_volume.c must be killed (main author disagreed)
audio/filter/equalizer.h must be killed (main author disagreed)
audio/filter/tools.c must be killed (main author disagreed)
audio/filter/af_format.c LGPL
audio/filter/af_lavc3enc.c LGPL
audio/filter/af_lavfi.c LGPL
audio/filter/af_scaletempo.c LGPL
audio/filter/af_rubberband.c LGPL
audio/out/ao.c LGPL
audio/out/ao.h LGPL
audio/out/ao_alsa.c extremely hard (original author did not decide)
audio/out/ao_audiounit.m LGPL
audio/out/ao_coreaudio.c LGPL
audio/out/ao_coreaudio_chmap.c LGPL
audio/out/ao_coreaudio_chmap.h LGPL
audio/out/ao_coreaudio_exclusiv LGPL
audio/out/ao_coreaudio_properti LGPL
audio/out/ao_coreaudio_properti LGPL
audio/out/ao_coreaudio_utils.c LGPL
audio/out/ao_coreaudio_utils.h LGPL
audio/out/ao_jack.c will stay GPL
audio/out/ao_lavc.c LGPL
audio/out/ao_null.c LGPL
audio/out/ao_openal.c LGPL
audio/out/ao_opensles.c LGPL
audio/out/ao_oss.c will stay GPL
audio/out/ao_pcm.c LGPL
audio/out/ao_pulse.c LGPL
audio/out/ao_rsound.c LGPL
audio/out/ao_sdl.c LGPL
audio/out/ao_sndio.c LGPL (BSD)
audio/out/ao_wasapi.c LGPL
audio/out/ao_wasapi_changenotif LGPL
audio/out/ao_wasapi.h LGPL
audio/out/ao_wasapi_utils.c LGPL
audio/out/internal.h LGPL
audio/out/pull.c LGPL
audio/out/push.c LGPL
x audio/audio.* very hard (mp_audio based of anders' af_audio)
(required for LGPL core: determine if the struct can be used anyway, or
devise a cheap AVFrame wrapper)
audio/audio_buffer.* LGPL
audio/chmap.* LGPL
audio/chmap_sel.* LGPL
audio/fmt-conversion.* LGPL
audio/format.* LGPL
common/av_common.* LGPL
common/av_log.c almost LGPL
common/av_log.h LGPL
common/codecs.* LGPL
common/common.* LGPL
common/encode.h LGPL
common/encode_lavc.* LGPL
common/global.h LGPL
common/msg.c almost LGPL
common/msg_control.h LGPL
common/msg.h LGPL
common/playlist.* LGPL
common/recorder.* LGPL
common/tags.* LGPL
common/version.c LGPL
demux/codec_tags.* LGPL
demux/cue.* LGPL
demux/demux.* LGPL
demux/demux_cue.c LGPL
demux/demux_disc.c LGPL
demux/demux_edl.c LGPL
demux/demux_lavf.c almost LGPL
demux/demux_libarchive.c LGPL
demux/demux_mf.c LGPLv3+
demux/demux_mkv.c LGPL (mostly)
demux/demux_mkv_timeline.c LGPL
demux/demux_null.c LGPL
demux/demux_playlist.c LGPL
demux/demux_rar.c LGPL
demux/demux_raw.c almost LGPL
demux/demux_timeline.c LGPL
demux/demux_tv.c will stay GPL
demux/ebml.* LGPL
demux/matroska.h LGPL
demux/packet.* LGPL
demux/stheader.h LGPL
demux/timeline.* LGPL
input/cmd_* LGPL
input/event.* LGPL
input/input.* LGPL
input/ipc.c LGPL
input/ipc-unix.c LGPL
input/ipc-win.c LGPL
input/keycodes.* LGPL
input/pipe-win32.c LGPL
libmpv/*.* LGPL
misc/*.* LGPL
options/m_config.* LGPL
options/m_option.c almost LGPL
options/m_option.h LGPL
options/m_property.* LGPL
options/options.* LGPL
options/parse_commandline.* LGPL
options/parse_configfile.* LGPL
options/path.* LGPL
osdep/android/* LGPL (BSD)
osdep/ar/* LGPL (BSD)
osdep/atomic.h LGPL
osdep/compiler.h LGPL
osdep/endian.h LGPL
osdep/glob-win.c LGPL
osdep/io.* LGPL
osdep/macosx_application.h LGPL
osdep/macosx_application.m LGPL
osdep/macosx_application_objc.h LGPL
osdep/macosx_compat.h LGPL
osdep/macosx_events.* LGPL
osdep/macosx_events_objc.h LGPL
osdep/macosx_touchbar.* LGPL
osdep/macosx_versions.h LGPL
osdep/main-fn-cocoa.c LGPL
osdep/main-fn.h LGPL
osdep/main-fn-unix.c LGPL
osdep/main-fn-win.c LGPL
osdep/mpv.exe.manifest LGPL
osdep/mpv.rc LGPL
osdep/path.h LGPL
osdep/path-macosx.m LGPL
osdep/path-unix.c LGPL
osdep/path-win.c LGPL
osdep/semaphore.h LGPL
osdep/semaphore_osx.c LGPL
osdep/strnlen.h LGPL
osdep/subprocess.* LGPL
osdep/subprocess-posix.c LGPL
osdep/subprocess-win.c LGPL
osdep/terminal.h LGPL
osdep/terminal-unix.c LGPL
osdep/terminal-win.c LGPL
osdep/threads.* LGPL
osdep/timer.c LGPL
osdep/timer.h LGPL
osdep/timer-darwin.c LGPL (MIT)
osdep/timer-linux.c LGPL
osdep/timer-win2.c LGPL
osdep/w32_keyboard.c LGPL
osdep/w32_keyboard.h LGPL
osdep/win32-console-wrapper.c LGPL (BSD)
osdep/win32/* LGPL (ISC)
osdep/windows_utils.* LGPL
x player/audio.c LGPL (dysfunctional due to libaf)
player/client.* LGPL (ISC)
player/command.c LGPL
player/command.h LGPL
player/configfiles.c LGPL
player/core.h LGPL
player/external_files.* LGPL
player/lavfi.* LGPL
player/loadfile.c LGPL
player/lua/*.* LGPL
player/lua.c LGPL
player/misc.c LGPL
player/osd.c LGPL
player/playloop.c LGPL
player/screenshot.* LGPL
player/scripting.* LGPL
player/sub.c LGPL
player/video.c LGPL
stream/ai_* will stay GPL (TV code)
stream/audio_in.* will stay GPL (TV code)
stream/cache.c LGPLv3+
stream/cache_file.c LGPL
stream/cookies.* LGPL
stream/dvb* must stay GPL
stream/frequencies.* must stay GPL
stream/rar.* LGPL
stream/stream_avdevice.c LGPL
stream/stream_bluray.c LGPL
stream/stream.* LGPL
stream/stream_cb.c LGPL
stream/stream_cdda.c unknown
stream/stream_dvb.* must stay GPL
stream/stream_dvd.c unknown
stream/stream_dvd_common.* unknown
stream/stream_dvdnav.c unknown
stream/stream_edl.c LGPL
stream/stream_file.c LGPL
stream/stream_lavf.c LGPL
stream/stream_libarchive.* LGPL
stream/stream_memory.c LGPL
stream/stream_mf.c LGPL
stream/stream_null.c LGPL
stream/stream_rar.c LGPL
stream/stream_smb.c will stay GPLv3
stream/stream_tv.c will stay GPL
stream/tv* will stay GPL
sub/* LGPL
ta/* LGPL (ISC)
video/decode/d3d.* LGPL
video/decode/dec_video.* almost LGPL
video/decode/hw_cuda.c LGPL
video/decode/hw_d3d11va.c LGPL
video/decode/hw_dxva2.c LGPL
video/decode/hw_videotoolbox.c LGPL
video/decode/lavc.h almost LGPLv3+
video/decode/vd.h LGPL
video/decode/vd_lavc.c almost LGPLv3+
video/filter/refqueue.* LGPL
video/filter/vf.c LGPL
video/filter/vf.h LGPL (mostly)
video/filter/vf_buffer.c LGPL
video/filter/vf_crop.c will be deleted
video/filter/vf_d3d11vpp.c LGPL
video/filter/vf_dsize.c will be deleted
video/filter/vf_expand.c will be deleted
video/filter/vf_flip.c will be deleted
video/filter/vf_format.c will be deleted
video/filter/vf_gradfun.c will be deleted
video/filter/vf_lavfi.* LGPL
video/filter/vf_mirror.c will be deleted
video/filter/vf_noformat.c will be deleted
video/filter/vf_pullup.c will be deleted
video/filter/vf_rotate.c will be deleted
video/filter/vf_scale.c will be deleted
video/filter/vf_stereo3d.c will be deleted
video/filter/vf_sub.c will be deleted
video/filter/vf_vapoursynth.c LGPL
video/filter/vf_vavpp.c LGPL
video/filter/vf_vdpaupp.c LGPL
video/filter/vf_yadif.c will be deleted
video/csputils.* LGPL
video/fmt-conversion.* LGPL
video/gpu_memcpy.* will be deleted
video/hwdec.* LGPL
video/image_writer.* LGPL
video/img_format.* LGPL
video/mp_image.* almost LGPL
video/mp_image_pool.* LGPL
video/out/aspect.* LGPL
video/out/bitmap_packer.* LGPL
video/out/cocoa* LGPL
video/out/d3d_shader_420p.h LGPL
video/out/d3d_shader_nv12.h LGPL
video/out/d3d_shader_yuv.hlsl LGPL
video/out/dither.* LGPL
video/out/drm_common.* LGPL
video/out/filter_kernels.* LGPL (BSD)
video/out/opengl/hwdec_vaglx.c GPL
video/out/opengl/* LGPL
video/out/vo.c LGPL
video/out/vo.h LGPL
video/out/vo_caca.c unknown
video/out/vo_direct3d.c unknown
video/out/vo_drm.c LGPL
video/out/vo_image.c LGPL
video/out/vo_lavc.c LGPL
video/out/vo_null.c LGPL
video/out/vo_opengl.c LGPL
video/out/vo_opengl_cb.c LGPL
video/out/vo_rpi.c LGPL
video/out/vo_sdl.c LGPL
video/out/vo_tct.c LGPL
video/out/vo_vaapi.c probably impossible (some company's code)
video/out/vo_vdpau.c probably impossible (nVidia's code)
video/out/vo_wayland.c LGPL
video/out/vo_x11.c probably impossible
video/out/vo_xv.c probably impossible
video/out/w32_common.* LGPL
video/out/wayland* LGPL
video/out/win32/* LGPL
video/out/win_state.* LGPL
video/out/x11_common.* probably impossible
video/out/x11_icon.bin LGPL
video/sws_utils.* almost LGPL
video/vaapi.* hard (GPL-only parts must be ifdefed)
video/vdpau.c hard (GPL-only parts must be ifdefed)
video/vdpau_functions.inc LGPL
video/vdpau.h unknown
video/vdpau_mixer.* actual code must be rewritten
video/vt.* LGPL
-6
View File
@@ -32,12 +32,6 @@ API changes
::
--- mpv 0.27.0 ---
1.25 - remove setting "no-" options via mpv_set_option*(). (See corresponding
deprecation in 0.23.0.)
--- mpv 0.25.0 ---
1.24 - add a MPV_ENABLE_DEPRECATED preprocessor symbol, which can be defined
by the user to exclude deprecated API symbols from the C headers
--- mpv 0.23.0 ---
1.24 - the deprecated mpv_suspend() and mpv_resume() APIs now do nothing.
--- mpv 0.22.0 ---
+3
View File
@@ -165,6 +165,9 @@ Or, compile and install both libmpv and mpv:
```bash
./waf configure CC=gcc.exe --check-c-compiler=gcc --enable-libmpv-shared --prefix=/mingw64
./waf install
# waf installs libmpv dll to the wrong directory, so fix it up
mv -f /mingw64/lib/mpv-1.dll /mingw64/bin/
```
Linking libmpv with MSVC programs
+19 -54
View File
@@ -17,14 +17,6 @@ Sending patches
- All new code must be LGPLv2.1+ licensed, or come with the implicit agreement
that it will be relicensed to LGPLv2.1+ later (see ``Copyright`` in the
repository root directory).
- You must be either the exclusive author of the patch, or acknowledge all
authors involved in the commit message. If you take 3rd party code, authorship
and copyright must be properly acknowledged. If the license of the code is not
LGPLv2.1+, this must be mentioned.
- Don't use fake names (something that looks like an actual names, and may be
someone else's name, but is not your legal name). Using a pseudonyms is
allowed if it can be used to identify or contact you, even if whatever
account you used to submit the patch dies.
- When creating pull requests, be sure to test your changes. If you didn't,
please say so in the pull request message.
- Write informative commit messages. Use present tense to describe the
@@ -32,9 +24,8 @@ Sending patches
the change.
- The subject line (the first line in a commit message) should contain a
prefix identifying the sub system, followed by a short description what
impact this commit has. This subject line and the commit message body
shouldn't be longer than 72 characters per line, because it messes up the
output of many git tools otherwise.
impact this commit has. This subject line shouldn't be longer than 72
characters, because it messes up the output of many git tools otherwise.
For example, you fixed a crash in af_volume.c:
@@ -63,14 +54,11 @@ Sending patches
additional cosmetic changes in the same file you're working on. But don't do
something like reformatting a whole file, and hiding an actual functional
change in the same commit.
- Changes to command line options (addition/modification/removal) must be
documented in options.rst. Changes to input properties or input commands must
be documented in input.rst. All changes to the user interface (options,
properties, commands) must be documented with a small note in
interface-changes.rst (although documenting additions is optional, and
obscure corner cases and potentially be skipped too). Changes to the libmpv
API must be reflected in the libmpv's headers doxygen, and should be
documented in client-api-changes.rst.
- If you add a new command line option, document it in options.rst. If you
add a new input property, document it in input.rst. Changes to the user
interface (options, properties, commands) should be documented in
interface-changes.rst. Changes to libmpv should be documented in
client-api-changes.rst.
Code formatting
---------------
@@ -113,16 +101,18 @@ mpv uses C99 with K&R formatting, with some exceptions.
do_something();
}
```
- If the if has an else branch, both branches should use braces, even if they're
technically redundant.
- If the body of an if statement uses braces, the else branch should also
use braces (and reverse).
Example:
```C
if (a) {
one_line();
// do something
something();
something_else();
} else {
one_other_line();
one_line();
}
```
- If an if condition spans multiple physical lines, then put the opening brace
@@ -140,9 +130,12 @@ mpv uses C99 with K&R formatting, with some exceptions.
...
}
```
(If the if body is simple enough, this rule can be skipped.)
- Remove any trailing whitespace.
- If the file you're editing uses formatting different from from what is
described here, it's probably an old file from times when nobody followed a
consistent style. You're free to use the existing style, or the new style, or
to send a patch to reformat the file to the new style before making functional
changes.
General coding
--------------
@@ -158,35 +151,7 @@ General coding
- Prefer fusing declaration and initialization, rather than putting declarations
on the top of a block. Obvious data flow is more important than avoiding
mixing declarations and statements, which is just a C90 artifact.
- tech-overview.txt might help to get an overview how mpv is structured.
- If you add features that require intrusive changes, discuss them on the dev
channel first. There might be a better way to add a feature and it can avoid
wasted work.
Rules for git push access
-------------------------
Push access to the main git repository is handed out on an arbitrary basis. If
you got access, the following rules must be followed:
- You are expected to follow the general development rules as outlined in this
whole document.
- You must be present on the IRC dev channel when you push something.
- Anyone can push small fixes: typo corrections, small/obvious/uncontroversial
bug fixes, edits to the user documentation or code comments, and so on.
- You can freely make changes to parts of the code which you maintain. For
larger changes, it's recommended to let others review the changes first.
- You automatically maintain code if you wrote or modified most of it before
(e.g. you made larger changes to it before, did partial or full rewrites, did
major bug fixes, or you're the original author of the code). If there is more
than one maintainer, you may need to come to an agreement with the others how
to handle this to avoid conflict.
- As a maintainer, you can approve pushes by others to "your" code.
- If you approve or merge 3rd party changes, make sure they follow the general
development rules.
- Changes to user interface and public API must always be approved by the
project leader.
- Seasoned project members are allowed to revert commits that broke the build,
or broke basic functionality in a catastrophic way, and the developer who
broke it is unavailable. (Depending on severity.)
- Adhere to the CoC.
- The project leader is not bound by these rules.
+3 -40
View File
@@ -51,8 +51,7 @@ The rest of the lines belong to one of these classes:
1) An empty or commented line. A comment starts with ``#``, which must be the
first character in the line. The rest of the line (up until the next line
break) is ignored. An empty line has 0 bytes between two line feed bytes.
2) A header entry if the line starts with ``!``.
3) A segment entry in all other cases.
2) A segment entry in all other cases.
Each segment entry consists of a list of named or unnamed parameters.
Parameters are separated with ``,``. Named parameters consist of a name,
@@ -64,8 +63,8 @@ Syntax::
segment_entry ::= <param> ( <param> ',' )*
param ::= [ <name> '=' ] ( <value> | '%' <number> '%' <valuebytes> )
The ``name`` string can consist of any characters, except ``=%,;\n!``. The
``value`` string can consist of any characters except of ``,;\n!``.
The ``name`` string can consist of any characters, except ``=%,;\n``. The
``value`` string can consist of any characters except of ``,;\n``.
The construct starting with ``%`` allows defining any value with arbitrary
contents inline, where ``number`` is an integer giving the number of bytes in
@@ -95,42 +94,6 @@ to ``20``, ``param3`` to ``value,escaped``, ``param4`` to ``value2``.
Instead of line breaks, the character ``;`` can be used. Line feed bytes and
``;`` are treated equally.
Header entries start with ``!`` as first character after a line break. Header
entries affect all other file entries in the EDL file. Their format is highly
implementation specific. They should generally follow the file header, and come
before any file entries.
MP4 DASH
========
This is a header that helps implementing DASH, although it only provides a low
level mechanism.
If this header is set, the given url designates an mp4 init fragment. It's
downloaded, and every URL in the EDL is prefixed with the init fragment on the
byte stream level. This is mostly for use by mpv's internal ytdl support. The
ytdl script will call youtube-dl, which in turn actually processes DASH
manifests. It may work only for this very specific purpose and fail to be
useful in other scenarios. It can be removed or changed in incompatible ways
at any times.
Example::
!mp4_dash,init=url
The ``url`` is encoded as parameter value as defined in the general EDL syntax.
It's expected to point to an "initialization fragment", which will be prefixed
to every entry in the EDL on the byte stream level.
The current implementation will
- ignore stream start times
- use durations as hint for seeking only
- not adjust source timestamps
- open and close segments (i.e. fragments) as needed
- not add segment boundaries as chapter points
- require full compatibility between all segments (same codec etc.)
Timestamp format
================
+2 -6
View File
@@ -95,16 +95,12 @@ As the options for various devices can get complex, profiles can be used.
An example profile file for encoding is provided in
etc/encoding-profiles.conf in the source tree. This file is installed and loaded
by default. If you want to modify it, you can replace and it with your own copy
by doing::
by default (if libavfilter is enabled at compilation). If you want to modify
it, you can replace and it with your own copy by doing::
mkdir -p ~/.mpv
cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
Keep in mind that the default profile is the playback one. If you want to add
options that apply only in encoding mode, put them into a ``[encoding]``
section.
Refer to the top of that file for more comments - in a nutshell, the following
options are added by it::
-134
View File
@@ -19,140 +19,6 @@ Interface changes
::
--- mpv 0.27.0 ---
- drop previously deprecated --field-dominance option
- drop previously deprecated "osd" command
- remove client API compatibility handling for "script", "sub-file",
"audio-file", "external-file" (these cases used to log a deprecation
warning)
- drop deprecated --video-aspect-method=hybrid option choice
- rename --hdr-tone-mapping to --tone-mapping (and generalize it)
- --opengl-fbo-format changes from a choice to a string. Also, its value
will be checked only on renderer initialization, rather than when the
option is set.
- Using opengl-cb now always assumes 8 bit per component depth, and dithers
to this size. Before, it tried to figure out the depth of the first
framebuffer that was ever passed to the renderer. Having GL framebuffers
with a size larger than 8 bit per component is quite rare. If you need
it, set the --dither-depth option instead.
- --lavfi-complex can now be set during runtime. If you set this in
expectation it would be applied only after a reload, you might observe
weird behavior.
- add --track-auto-selection to help with scripts/applications that
make exclusive use of --lavfi-complex.
- undeprecate --loop, and map it from --loop-playlist to --loop-file (the
deprecation was to make sure no API user gets broken by a sudden behavior
change)
- remove previously deprecated vf_eq
- remove that hardware deinterlace filters (vavpp, d3d11vpp, vdpaupp)
changed their deinterlacing-enabled setting depending on what the
--deinterlace option or property was set to. Now, a filter always does
what its filter options and defaults imply. The --deinterlace option and
property strictly add/remove its own filters. For example, if you run
"mpv --vf=vavpp --deinterlace=yes", this will insert another, redundant
filter, which is probably not what you want. For toggling a deinterlace
filter manually, use the "vf toggle" command, and do not set the
deinterlace option/property. To customize the filter that will be
inserted automatically, use --vf-defaults. Details how this works will
probably change in the future.
- remove deinterlace=auto (this was not deprecated, but had only a very
obscure use that stopped working with the change above. It was also
prone to be confused with a feature not implemented by it: auto did _not_
mean that deinterlacing was enabled on demand.)
- add shortened mnemonic names for mouse button bindings, eg. mbtn_left
the old numeric names (mouse_btn0) are deprecated
- remove mouse_btn3_dbl and up, since they are only generated for buttons
0-2 (these now print an error when sent from the 'mouse' command)
- rename the axis bindings to wheel_up/down/etc. axis scrolling and mouse
wheel scrolling are now conceptually the same thing
the old axis_up/down names remain as deprecated aliases
--- mpv 0.26.0 ---
- remove remaining deprecated audio device options, like --alsa-device
Some of them were removed in earlier releases.
- introduce --replaygain... options, which replace the same functionality
provided by the deprecated --af=volume:replaygain... mechanism.
- drop the internal "mp-rawvideo" codec (used by --demuxer=rawvideo)
- rename --sub-ass-style-override to --sub-ass-override, and rename the
`--sub-ass-override=signfs` setting to `--sub-ass-override=scale`.
- change default of --video-aspect-method to "bitstream". The "hybrid"
method (old default) is deprecated.
- remove property "video-params/nom-peak"
- remove option --target-brightness
- replace vf_format's `peak` suboption by `sig-peak`, which is relative to
the reference white level instead of in cd/m^2
- renamed the TRCs `st2084` and `std-b67` to `pq` and `hlg` respectively
- the "osd" command is deprecated (use "cycle osd-level")
- --field-dominance is deprecated (use --vf=setfield=bff or tff)
- --really-quiet subtle behavior change
- the deprecated handling of setting "no-" options via client API is dropped
- the following options change to append-by-default (and possibly separator):
--script
also, the following options are deprecated:
--sub-paths => --sub-file-paths
the following options are deprecated for setting via API:
"script" (use "scripts")
"sub-file" (use "sub-files")
"audio-file" (use "audio-files")
"external-file" (use "external-files")
(the compatibility hacks for this will be removed after this release)
- remove property `vo-performance`, and add `vo-passes` as a more general
replacement
- deprecate passing multiple arguments to -add/-pre options (affects the
vf/af commands too)
- remove --demuxer-lavf-cryptokey. Use --demux-lavf-o=cryptokey=<hex> or
--demux-lavf-o=decryption_key=<hex> instead (whatever fits your situation).
- rename --opengl-dumb-mode=no to --opengl-dumb-mode=auto, and make `no`
always disable it (unless forced on by hardware limitation).
- generalize --scale-clamp, --cscale-clamp etc. to accept a float between
0.0 and 1.0 instead of just being a flag. A value of 1.0 corresponds to
the old `yes`, and a value of 0.0 corresponds to the old `no`.
--- mpv 0.25.0 ---
- remove opengl-cb dxva2 dummy hwdec interop
(see git "vo_opengl: remove dxva2 dummy hwdec backend")
- remove ppm, pgm, pgmyuv, tga choices from the --screenshot-format and
--vo-image-format options
- the "jpeg" choice in the option above now leads to a ".jpg" file extension
- --af=drc is gone (you can use e.g. lavfi/acompressor instead)
- remove image_size predefined uniform from OpenGL user shaders. Use
input_size instead
- add --sub-filter-sdh
- add --sub-filter-sdh-harder
- remove --input-app-events option (macOS)
- deprecate most --vf and --af filters. Only some filters not in libavfilter
will be kept.
Also, you can use libavfilter filters directly (e.g. you can use
--vf=name=opts instead of --vf=lavfi=[name=opts]), as long as the
libavfilter filter's name doesn't clash with a mpv builtin filter.
In the long term, --vf/--af syntax might change again, but if it does, it
will switch to libavfilter's native syntax. (The above mentioned direct
support for lavfi filters still has some differences, such as how strings
are escaped.) If this happens, the non-deprecated builtin filters might be
moved to "somewhere else" syntax-wise.
- deprecate --loop - after a deprecation period, it will be undeprecated,
but changed to alias --loop-file
- add --keep-open-pause=no
- deprecate --demuxer-max-packets
- change --audio-file-auto default from "exact" to "no" (mpv won't load
files with the same filename as the video, but different extension, as
audio track anymore)
--- mpv 0.24.0 ---
- deprecate --hwdec-api and replace it with --opengl-hwdec-interop.
The new option accepts both --hwdec values, as well as named backends.
A minor difference is that --hwdec-api=no (which used to be the default)
now actually does not preload any interop layer, while the new default
("") uses the value of --hwdec.
- drop deprecated --ad/--vd features
- drop deprecated --sub-codepage syntax
- rename properties:
- "drop-frame-count" to "decoder-frame-drop-count"
- "vo-drop-frame-count" to "frame-drop-count"
The old names still work, but are deprecated.
- remove the --stream-capture option and property. No replacement.
(--record-file might serve as alternative)
- add --sub-justify
- add --sub-ass-justify
- internally there's a different way to enable the demuxer cache now
it can be auto-enabled even if the stream cache remains disabled
--- mpv 0.23.0 ---
- remove deprecated vf_vdpaurb (use "--hwdec=vdpau-copy" instead)
- the following properties now have new semantics:
+45 -9
View File
@@ -4,8 +4,8 @@ AUDIO FILTERS
Audio filters allow you to modify the audio stream and its properties. The
syntax is:
``--af=...``
Setup a chain of audio filters. See ``--vf`` for the syntax.
``--af=<filter1[=parameter1:parameter2:...],filter2,...>``
Setup a chain of audio filters.
.. note::
@@ -15,11 +15,27 @@ syntax is:
wrapper, which gives you access to most of libavfilter's filters. This
includes all filters that have been ported from MPlayer to libavfilter.
The ``--vf`` description describes how libavfilter can be used and how to
workaround deprecated mpv filters.
You can also set defaults for each filter. The defaults are applied before the
normal filter parameters.
See ``--vf`` group of options for info on how ``--af-defaults``, ``--af-add``,
``--af-pre``, ``--af-del``, ``--af-clr``, and possibly others work.
``--af-defaults=<filter1[=parameter1:parameter2:...],filter2,...>``
Set defaults for each filter.
Audio filters are managed in lists. There are a few commands to manage the
filter list:
``--af-add=<filter1[,filter2,...]>``
Appends the filters given as arguments to the filter list.
``--af-pre=<filter1[,filter2,...]>``
Prepends the filters given as arguments to the filter list.
``--af-del=<index1[,index2,...]>``
Deletes the filters at the given indexes. Index numbers start at 0,
negative numbers address the end of the list (-1 is the last).
``--af-clr``
Completely empties the filter list.
Available filters are:
@@ -211,9 +227,6 @@ Available filters are:
best to use the *Master* volume control of your sound card or the volume
knob on your amplifier.
*WARNING*: This filter is deprecated. Use the top-level options like
``--volume`` and ``--replaygain...`` instead.
*NOTE*: This filter is not reentrant and can therefore only be enabled
once for every audio stream.
@@ -306,6 +319,29 @@ Available filters are:
the mixing matrix at runtime, without reinitializing the entire filter
chain.
``drc[=method:target]``
Applies dynamic range compression. This maximizes the volume by compressing
the audio signal's dynamic range. (Formerly called ``volnorm``.)
``<method>``
Sets the used method.
1
Use a single sample to smooth the variations via the standard
weighted mean over past samples (default).
2
Use several samples to smooth the variations via the standard
weighted mean over past samples.
``<target>``
Sets the target amplitude as a fraction of the maximum for the sample
type (default: 0.25).
.. note::
This filter can cause distortion with audio signals that have a very
large dynamic range.
``scaletempo[=option1:option2:...]``
Scales audio tempo without altering pitch, optionally synced to playback
speed (default).
+50 -13
View File
@@ -41,6 +41,9 @@ Available audio output drivers are:
The following global options are supported by this audio output:
``--oss-device``
Sets the audio output device (default: ``/dev/dsp``).
Deprecated, use ``--audio-device``.
``--oss-mixer-device``
Sets the audio mixer device (default: ``/dev/mixer``).
``--oss-mixer-channel``
@@ -95,14 +98,11 @@ Available audio output drivers are:
setting in the ``Audio Devices`` dialog in the ``Audio MIDI Setup``
utility. Note that this does not affect the selected speaker setup.
``--coreaudio-spdif-hack=<yes|no>``
Try to pass through AC3/DTS data as PCM. This is useful for drivers
which do not report AC3 support. It converts the AC3 data to float,
and assumes the driver will do the inverse conversion, which means
a typical A/V receiver will pick it up as compressed IEC framed AC3
stream, ignoring that it's marked as PCM. This disables normal AC3
passthrough (even if the device reports it as supported). Use with
extreme care.
``--coreaudio-exclusive``
Deprecated, use ``--audio-exclusive``.
Use exclusive mode access. This merely redirects to
``coreaudio_exclusive``, but should be preferred over using that AO
directly.
``coreaudio_exclusive`` (Mac OS X only)
@@ -120,9 +120,11 @@ Available audio output drivers are:
The following global options are supported by this audio output:
``--pulse-host=<host>``
Specify the host to use. An empty <host> string uses a local connection,
"localhost" uses network transfer (most likely not what you want).
``--pulse-host=<host>``, ``--pulse-sink=<sink>``
Specify the host and optionally output sink to use. An empty <host>
string uses a local connection, "localhost" uses network transfer
(most likely not what you want).
Deprecated, use ``--audio-device``.
``--pulse-buffer=<1-2000|native>``
Set the audio buffer size in milliseconds. A higher value buffers
@@ -216,13 +218,25 @@ Available audio output drivers are:
it will write a WAVE header every time the file is opened.
``rsound``
Audio output to an RSound daemon. Use ``--audio-device=rsound/<hostname>``
to set the host name (with ``<hostname>`` replaced, without the ``< >``).
Audio output to an RSound daemon
.. note:: Completely useless, unless you intend to run RSound. Not to be
confused with RoarAudio, which is something completely
different.
The following global options are supported by this audio output:
``--rsound-host=<name/path>``
Set the address of the server (default: localhost). Can be either a
network hostname for TCP connections or a Unix domain socket path
starting with '/'.
``--rsound-port=<number>``
Set the TCP port used for connecting to the server (default: 12345).
Not used if connecting to a Unix domain socket.
These options are deprecated. If anyone cares enough, their functionality
can be added back using ``--audio-device``.
``sndio``
Audio output to the OpenBSD sndio sound system
@@ -231,5 +245,28 @@ Available audio output drivers are:
(Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel
layouts.)
The following global options are supported by this audio output:
``--ao-sndio-device=<device>``
sndio device to use (default: ``$AUDIODEVICE``, resp. ``snd0``).
Deprecated, use ``--audio-device``.
``wasapi``
Audio output to the Windows Audio Session API.
The following global options are supported by this audio output:
``--ao-wasapi-exclusive``
Deprecated, use ``--audio-exclusive``.
Requests exclusive, direct hardware access. By definition prevents
sound playback of any other program until mpv exits.
``--ao-wasapi-device=<id>``
Deprecated, use ``--audio-device``.
Uses the requested endpoint instead of the system's default audio
endpoint. Both an ordinal number (0,1,2,...) and the GUID
String are valid; the GUID string is guaranteed to not change
unless the driver is uninstalled.
Also supports searching active devices by human-readable name. If more
than one device matches the name, refuses loading it.
+57 -130
View File
@@ -159,10 +159,10 @@ List of Input Commands
``multiply <property> <factor>``
Multiplies the value of a property with the numeric factor.
``screenshot [subtitles|video|window|single|each-frame]``
``screenshot [subtitles|video|window|- [single|each-frame]]``
Take a screenshot.
Multiple flags are available (some can be combined with ``+``):
First argument:
<subtitles> (default)
Save the video image, in its original resolution, and with subtitles.
@@ -182,16 +182,6 @@ List of Input Commands
frame was dropped. This flag can be combined with the other flags,
e.g. ``video+each-frame``.
Older mpv versions required passing ``single`` and ``each-frame`` as
second argument (and did not have flags). This syntax is still understood,
but deprecated and might be removed in the future.
Setting the ``async`` flag will make encoding and writing the actual image
file asynchronous in most cases. (``each-frame`` mode ignores this flag
currently.) Requesting async screenshots too early or too often could lead
to the same filenames being chosen, and overwriting each others in undefined
order.
``screenshot-to-file "<filename>" [subtitles|video|window]``
Take a screenshot and save it to a given file. The format of the file will
be guessed by the extension (and ``--screenshot-format`` is ignored - the
@@ -204,9 +194,6 @@ List of Input Commands
Like all input command parameters, the filename is subject to property
expansion as described in `Property Expansion`_.
The ``async`` flag has an effect on this command (see ``screenshot``
command).
``playlist-next [weak|force]``
Go to the next entry on the playlist.
@@ -346,6 +333,10 @@ List of Input Commands
events that have already been displayed, or are within a short prefetch
range.
``osd [<level>]``
Toggle OSD level. If ``<level>`` is specified, set the OSD mode
(see ``--osd-level`` for valid values).
``print-text "<string>"``
Print text to stdout. The string can contain properties (see
`Property Expansion`_).
@@ -362,11 +353,6 @@ List of Input Commands
<level>
The minimum OSD level to show the text at (see ``--osd-level``).
``expand-text "<string>"``
Property-expand the argument and return the expanded string. This can be
used only through the client API or from a script using
``mp.command_native``. (see `Property Expansion`_).
``show-progress``
Show the progress bar, the elapsed time and the total duration of the file
on the OSD.
@@ -462,10 +448,6 @@ Input Commands that are Possibly Subject to Change
(If several filters are passed to the command, this is done for
each filter.)
A special variant is combining this with labels, and using ``@name``
without filter name and parameters as filter entry. This toggles the
enable/disable flag.
del
Remove the given filters from the video chain. Unlike in the other
cases, the second parameter is a comma separated list of filter names
@@ -501,16 +483,6 @@ Input Commands that are Possibly Subject to Change
- ``b vf set ""`` remove all video filters on ``b``
- ``c vf toggle lavfi=gradfun`` toggle debanding on ``c``
.. admonition:: Example how to toggle disabled filters at runtime
- Add something ``vf-add=@deband:!lavfi=[gradfun]`` to ``mpv.conf``. The
``@deband:`` is the label, and ``deband`` is an arbitrary, user-given
name for this filter entry. The ``!`` before the filter name disables
the filter by default. Everything after this is the normal filter name
and the filter parameters.
- Add ``a vf toggle @deband`` to ``input.conf``. This toggles the
"disabled" flag for the filter identified with ``deband``.
``cycle-values ["!reverse"] <property> "<value1>" "<value2>" ...``
Cycle through a list of values. Each invocation of the command will set the
given property to the next value in the list. The command maintains an
@@ -701,12 +673,11 @@ Input Commands that are Possibly Subject to Change
``screenshot-raw [subtitles|video|window]``
Return a screenshot in memory. This can be used only through the client
API. The MPV_FORMAT_NODE_MAP returned by this command has the ``w``, ``h``,
``stride`` fields set to obvious contents. The ``format`` field is set to
``stride`` fields set to obvious contents. A ``format`` field is set to
``bgr0`` by default. This format is organized as ``B8G8R8X8`` (where ``B``
is the LSB). The contents of the padding ``X`` are undefined. The ``data``
is the LSB). The contents of the padding ``X`` is undefined. The ``data``
field is of type MPV_FORMAT_BYTE_ARRAY with the actual image data. The image
is freed as soon as the result mpv_node is freed. As usual with client API
semantics, you are not allowed to write to the image data.
is freed as soon as the result node is freed.
``vf-command "<label>" "<cmd>" "<args>"``
Send a command to the filter with the given ``<label>``. Use ``all`` to send
@@ -811,10 +782,8 @@ Input Command Prefixes
These prefixes are placed between key name and the actual command. Multiple
prefixes can be specified. They are separated by whitespace.
``osd-auto``
Use the default behavior for this command. This is the default for
``input.conf`` commands. Some libmpv/scripting/IPC APIs do not use this as
default, but use ``no-osd`` instead.
``osd-auto`` (default)
Use the default behavior for this command.
``no-osd``
Do not use any OSD for this command.
``osd-bar``
@@ -828,20 +797,11 @@ prefixes can be specified. They are separated by whitespace.
Combine osd-bar and osd-msg.
``raw``
Do not expand properties in string arguments. (Like ``"${property-name}"``.)
This is the default for some libmpv/scripting/IPC APIs.
``expand-properties``
``expand-properties`` (default)
All string arguments are expanded as described in `Property Expansion`_.
This is the default for ``input.conf`` commands.
``repeatable``
For some commands, keeping a key pressed doesn't run the command repeatedly.
This prefix forces enabling key repeat in any case.
``async``
Allow asynchronous execution (if possible). Note that only a few commands
will support this (usually this is explicitly documented). Some commands
are asynchronous by default (or rather, their effects might manifest
after completion of the command). The semantics of this flag might change
in the future. Set it only if you don't rely on the effects of this command
being fully realized when it returns.
All of the osd prefixes are still overridden by the global ``--osd-level``
settings.
@@ -980,19 +940,15 @@ Property list
Total A-V sync correction done. Unavailable if audio or video is
disabled.
``decoder-frame-drop-count``
``drop-frame-count``
Video frames dropped by decoder, because video is too far behind audio (when
using ``--framedrop=decoder``). Sometimes, this may be incremented in other
situations, e.g. when video packets are damaged, or the decoder doesn't
follow the usual rules. Unavailable if video is disabled.
``drop-frame-count`` is a deprecated alias.
``frame-drop-count``
``vo-drop-frame-count``
Frames dropped by VO (when using ``--framedrop=vo``).
``vo-drop-frame-count`` is a deprecated alias.
``mistimed-frame-count``
Number of video frames that were not timed correctly in display-sync mode
for the sake of keeping A/V sync. This does not include external
@@ -1259,17 +1215,6 @@ Property list
Returns ``yes`` if the demuxer is idle, which means the demuxer cache is
filled to the requested amount, and is currently not reading more data.
``demuxer-via-network``
Returns ``yes`` if the stream demuxed via the main demuxer is most likely
played via network. What constitutes "network" is not always clear, might
be used for other types of untrusted streams, could be wrong in certain
cases, and its definition might be changing. Also, external files (like
separate audio files or streams) do not influence the value of this
property (currently).
``demuxer-start-time`` (R)
Returns the start time reported by the demuxer in fractional seconds.
``paused-for-cache``
Returns ``yes`` when playback is paused because of waiting for the cache.
@@ -1386,8 +1331,8 @@ Property list
This is known only once the VO has opened (and possibly later). With some
VOs (like ``opengl``), this might be never known in advance, but only when
the decoder attempted to create the hw decoder successfully. (Using
``--opengl-hwdec-interop`` can load it eagerly.) If there are multiple
drivers loaded, they will be separated by ``,``.
``--hwdec-preload`` can load it eagerly.) If there are multiple drivers
loaded, they will be separated by ``,``.
If no VO is active or no interop driver is known, this property is
unavailable.
@@ -1396,9 +1341,6 @@ Property list
multiple interop drivers for the same hardware decoder, depending on
platform and VO.
This is somewhat similar to the ``--opengl-hwdec-interop`` option, but
it returns the actually loaded backend, not the value of this option.
``video-format``
Video format as string.
@@ -1452,12 +1394,12 @@ Property list
``video-params/gamma``
The gamma function in use as string. (Exact values subject to change.)
``video-params/nom-peak``
The video encoding's nominal peak brightness as float.
``video-params/sig-peak``
The video file's tagged signal peak as float.
``video-params/light``
The light type in use as a string. (Exact values subject to change.)
``video-params/chroma-location``
Chroma location as string. (Exact values subject to change.)
@@ -1485,8 +1427,8 @@ Property list
"colorlevels" MPV_FORMAT_STRING
"primaries" MPV_FORMAT_STRING
"gamma" MPV_FORMAT_STRING
"nom-peak" MPV_FORMAT_DOUBLE
"sig-peak" MPV_FORMAT_DOUBLE
"light" MPV_FORMAT_STRING
"chroma-location" MPV_FORMAT_STRING
"rotate" MPV_FORMAT_INT64
"stereo-in" MPV_FORMAT_STRING
@@ -1603,6 +1545,10 @@ Property list
This property is experimental and might be removed in the future.
``stream-capture`` (RW)
A filename, see ``--stream-capture``. Setting this will start capture using
the given filename. Setting it to an empty string will stop it.
``tv-brightness``, ``tv-contrast``, ``tv-saturation``, ``tv-hue`` (RW)
TV stuff.
@@ -1822,7 +1768,6 @@ Property list
MPV_FORMAT_NODE_MAP (for each filter entry)
"name" MPV_FORMAT_STRING
"label" MPV_FORMAT_STRING [optional]
"enabled" MPV_FORMAT_FLAG [optional]
"params" MPV_FORMAT_NODE_MAP [optional]
"key" MPV_FORMAT_STRING
"value" MPV_FORMAT_STRING
@@ -1879,43 +1824,32 @@ Property list
whether the video window is visible. If the ``--force-window`` option is
used, this is usually always returns ``yes``.
``vo-passes``
Contains introspection about the VO's active render passes and their
execution times. Not implemented by all VOs.
``vo-performance``
Some video output performance metrics. Not implemented by all VOs. This has
a number of sup-properties, of the form ``vo-performance/<metric>-<value>``,
all of them in milliseconds.
This is further subdivided into two frame types, ``vo-passes/fresh`` for
fresh frames (which have to be uploaded, scaled, etc.) and
``vo-passes/redraw`` for redrawn frames (which only have to be re-painted).
The number of passes for any given subtype can change from frame to frame,
and should not be relied upon.
``<metric>`` refers to one of:
Each frame type has a number of further sub-properties. Replace ``TYPE``
with the frame type, ``N`` with the 0-based pass index, and ``M`` with the
0-based sample index.
``upload``
Time needed to make the frame available to the GPU (if necessary).
``render``
Time needed to perform all necessary video postprocessing and rendering
passes (if necessary).
``present``
Time needed to present a rendered frame on-screen.
``vo-passes/TYPE/count``
Number of passes.
When a step is unnecessary or skipped, it will have the value 0.
``vo-passes/TYPE/N/desc``
Human-friendy description of the pass.
``<value>`` refers to one of:
``vo-passes/TYPE/N/last``
Last measured execution time, in nanoseconds.
``vo-passes/TYPE/N/avg``
Average execution time of this pass, in nanoseconds. The exact
timeframe varies, but it should generally be a handful of seconds.
``vo-passes/TYPE/N/peak``
The peak execution time (highest value) within this averaging range, in
nanoseconds.
``vo-passes/TYPE/N/count``
The number of samples for this pass.
``vo-passes/TYPE/N/samples/M``
The raw execution time of a specific sample for this pass, in
nanoseconds.
``last``
Last measured value.
``avg``
Average over a fixed number of past samples. (The exact timeframe
varies, but it should generally be a handful of seconds)
``peak``
The peak (highest value) within this averaging range.
When querying the property with the client API using ``MPV_FORMAT_NODE``,
or with Lua ``mp.get_property_native``, this will return a mpv_node with
@@ -1924,18 +1858,9 @@ Property list
::
MPV_FORMAT_NODE_MAP
"TYPE" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"desc" MPV_FORMAT_STRING
"last" MPV_FORMAT_INT64
"avg" MPV_FORMAT_INT64
"peak" MPV_FORMAT_INT64
"count" MPV_FORMAT_INT64
"samples" MPV_FORMAT_NODE_ARRAY
MP_FORMAT_INT64
"<metric>-<value>" MPV_FORMAT_INT64
Note that directly accessing this structure via subkeys is not supported,
the only access is through aforementioned ``MPV_FORMAT_NODE``.
(One entry for each ``<metric>`` and ``<value>`` combination)
``video-bitrate``, ``audio-bitrate``, ``sub-bitrate``
Bitrate values calculated on the packet level. This works by dividing the
@@ -2167,12 +2092,22 @@ caveats with some properties (due to historical reasons):
Option changes at runtime are affected by this as well.
``deinterlace``
While video is active, this behaves differently from the option. It will
never return the ``auto`` value (but the state as observed by the video
chain). If you set ``auto``, the property will set this as the option value,
and will return the actual video chain state as observed instead of auto.
``video-aspect``
While video is active, always returns the effective aspect ratio. Setting
a special value (like ``no``, values ``<= 0``) will make the property
set this as option, and return whatever actual aspect was derived from the
option setting.
``brightness`` (and other color options)
If ``--vo=xv`` is used, these properties may return the adapter's current
values instead of the option values.
``display-fps``
If a VO is created, this will return either the actual display FPS, or
an invalid value, instead of the option value.
@@ -2216,14 +2151,6 @@ caveats with some properties (due to historical reasons):
These properties behave different from the deprecated options with the same
names.
``profile``, ``include``
These are write-only, and will perform actions as they are written to,
exactly as if they were used on the mpv CLI commandline. Their only use is
when using libmpv before ``mpv_initialize()``, which in turn is probably
only useful in encoding mode. Normal libmpv users should use other
mechanisms, such as the ``apply-profile`` command, and the
``mpv_load_config_file`` API function. Avoid these properties.
Property Expansion
------------------
-8
View File
@@ -201,14 +201,6 @@ extra commands can also be used as part of the protocol:
{ "error": "success" }
{ "event": "property-change", "id": 1, "data": 52.0, "name": "volume" }
.. warning::
If the connection is closed, the IPC client is destroyed internally,
and the observed properties are unregistered. This happens for example
when sending commands to a socket with separate ``socat`` invocations.
This can make it seem like property observation does not work. You must
keep the IPC connection open to make it work.
``observe_property_string``
Like ``observe_property``, but the resulting data will always be a string.
-337
View File
@@ -1,337 +0,0 @@
JAVASCRIPT
==========
JavaScript support in mpv is near identical to its Lua support. Use this section
as reference on differences and availability of APIs, but otherwise you should
refer to the Lua documentation for API details and general scripting in mpv.
Example
-------
JavaScript code which leaves fullscreen mode when the player is paused:
::
function on_pause_change(name, value) {
if (value == true)
mp.set_property("fullscreen", "no");
}
mp.observe_property("pause", "bool", on_pause_change);
Similarities with Lua
---------------------
mpv tries to load a script file as JavaScript if it has a ``.js`` extension, but
otherwise, the documented Lua options, script directories, loading, etc apply to
JavaScript files too.
Script initialization and lifecycle is the same as with Lua, and most of the Lua
functions at the modules ``mp``, ``mp.utils`` and ``mp.msg`` are available to
JavaScript with identical APIs - including running commands, getting/setting
properties, registering events/key-bindings/property-changes/hooks, etc.
Differences from Lua
--------------------
No need to load modules. ``mp``, ``mp.utils`` and ``mp.msg`` are preloaded, and
you can use e.g. ``var cwd = mp.utils.getcwd();`` without prior setup.
``mp.options`` is currently not implemented, but ``mp.get_opt(...)`` is.
Errors are slightly different. Where the Lua APIs return ``nil`` for error,
the JavaScript ones return ``undefined``. Where Lua returns ``something, error``
JavaScript returns only ``something`` - and makes ``error`` available via
``mp.last_error()``. Note that only some of the functions have this additional
``error`` value - typically the same ones which have it in Lua.
Standard APIs are preferred. For instance ``setTimeout`` and ``JSON.stringify``
are available, but ``mp.add_timeout`` and ``mp.utils.format_json`` are not.
No standard library. This means that interaction with anything outside of mpv is
limited to the available APIs, typically via ``mp.utils``. However, some file
functions were added, and CommonJS ``require`` is available too - where the
loaded modules have the same privileges as normal scripts.
Language features - ECMAScript 5
--------------------------------
The scripting backend which mpv currently uses is MuJS - a compatible minimal
ES5 interpreter. As such, ``String.substring`` is implemented for instance,
while the common but non-standard ``String.substr`` is not. Please consult the
MuJS pages on language features and platform support - http://mujs.com .
Unsupported Lua APIs and their JS alternatives
----------------------------------------------
``mp.add_timeout(seconds, fn)`` JS: ``id = setTimeout(fn, ms)``
``mp.add_periodic_timer(seconds, fn)`` JS: ``id = setInterval(fn, ms)``
``mp.register_idle(fn)`` JS: ``id = setTimeout(fn)``
``mp.unregister_idle(fn)`` JS: ``clearTimeout(id)``
``utils.parse_json(str [, trail])`` JS: ``JSON.parse(str)``
``utils.format_json(v)`` JS: ``JSON.stringify(v)``
``utils.to_string(v)`` see ``dump`` below.
``mp.suspend()`` JS: none (deprecated).
``mp.resume()`` JS: none (deprecated).
``mp.resume_all()`` JS: none (deprecated).
``mp.get_next_timeout()`` see event loop below.
``mp.dispatch_events([allow_wait])`` see event loop below.
``mp.options`` module is not implemented currently for JS.
Scripting APIs - identical to Lua
---------------------------------
(LE) - Last-Error, indicates that ``mp.last_error()`` can be used after the
call to test for success (empty string) or failure (non empty reason string).
Otherwise, where the Lua APIs return ``nil`` on error, JS returns ``undefined``.
``mp.command(string)`` (LE)
``mp.commandv(arg1, arg2, ...)`` (LE)
``mp.command_native(table [,def])`` (LE)
``mp.get_property(name [,def])`` (LE)
``mp.get_property_osd(name [,def])`` (LE)
``mp.get_property_bool(name [,def])`` (LE)
``mp.get_property_number(name [,def])`` (LE)
``mp.get_property_native(name [,def])`` (LE)
``mp.set_property(name, value)`` (LE)
``mp.set_property_bool(name, value)`` (LE)
``mp.set_property_number(name, value)`` (LE)
``mp.set_property_native(name, value)`` (LE)
``mp.get_time()``
``mp.add_key_binding(key, name|fn [,fn [,flags]])``
``mp.add_forced_key_binding(...)``
``mp.remove_key_binding(name)``
``mp.register_event(name, fn)``
``mp.unregister_event(fn)``
``mp.observe_property(name, type, fn)``
``mp.unobserve_property(fn)``
``mp.get_opt(key)``
``mp.get_script_name()``
``mp.osd_message(text [,duration])``
``mp.get_wakeup_pipe()``
``mp.enable_messages(level)``
``mp.register_script_message(name, fn)``
``mp.unregister_script_message(name)``
``mp.msg.log(level, ...)``
``mp.msg.fatal(...)``
``mp.msg.error(...)``
``mp.msg.warn(...)``
``mp.msg.info(...)``
``mp.msg.verbose(...)``
``mp.msg.debug(...)``
``mp.utils.getcwd()`` (LE)
``mp.utils.readdir(path [, filter])`` (LE)
``mp.utils.split_path(path)``
``mp.utils.join_path(p1, p2)``
``mp.utils.subprocess(t)``
``mp.utils.subprocess_detached(t)``
``mp.add_hook(type, priority, fn)``
Additional utilities
--------------------
``mp.last_error()``
If used after an API call which updates last error, returns an empty string
if the API call succeeded, or a non-empty error reason string otherwise.
``Error.stack`` (string)
When using ``try { ... } catch(e) { ... }``, then ``e.stack`` is the stack
trace of the error - if it was created using the ``Error(...)`` constructor.
``print`` (global)
A convenient alias to ``mp.msg.info``.
``dump`` (global)
Like ``print`` but also expands objects and arrays recursively.
``mp.utils.getenv(name)``
Returns the value of the host environment variable ``name``, or
``undefined`` if the variable is not defined.
``mp.utils.get_user_path(path)``
Expands (mpv) meta paths like ``~/x``, ``~~/y``, ``~~desktop/z`` etc.
``read_file``, ``write_file`` and ``require`` already use this internaly.
``mp.utils.read_file(fname [,max])``
Returns the content of file ``fname`` as string. If ``max`` is provided and
not negative, limit the read to ``max`` bytes.
``mp.utils.write_file(fname, str)``
(Over)write file ``fname`` with text content ``str``. ``fname`` must be
prefixed with ``file://`` as simple protection against accidental arguments
switch, e.g. ``mp.utils.write_file("file://~/abc.txt", "hello world")``.
Note: ``read_file`` and ``write_file`` throw on errors, allow text content only.
``mp.get_time_ms()``
Same as ``mp.get_time()`` but in ms instead of seconds.
``mp.get_script_file()``
Returns the file name of the current script.
``exit()`` (global)
Make the script exit at the end of the current event loop iteration.
Note: please reomve added key bindings before calling ``exit()``.
``mp.utils.compile_js(fname, content_str)``
Compiles the JS code ``content_str`` as file name ``fname`` (without loading
anything from the filesystem), and returns it as a function. Very similar
to a ``Function`` constructor, but shows at stack traces as ``fname``.
Timers (global)
---------------
The standard HTML/node.js timers are available:
``id = setTimeout(fn [,duration [,arg1 [,arg2...]]])``
``id = setTimeout(code_string [,duration])``
``clearTimeout(id)``
``id = setInterval(fn [,duration [,arg1 [,arg2...]]])``
``id = setInterval(code_string [,duration])``
``clearInterval(id)``
``setTimeout`` and ``setInterval`` return id, and later call ``fn`` (or execute
``code_string``) after ``duration`` ms. Interval also repeat every ``duration``.
``duration`` has a minimum and default value of 0, ``code_string`` is
a plain string which is evaluated as JS code, and ``[,arg1 [,arg2..]]`` are used
as arguments (if provided) when calling back ``fn``.
The ``clear...(id)`` functions cancel timer ``id``, and are irreversible.
Note: timers always call back asynchronously, e.g. ``setTimeout(fn)`` will never
call ``fn`` before returning. ``fn`` will be called either at the end of this
event loop iteration or at a later event loop iteration. This is true also for
intervals - which also never call back twice at the same event loop iteration.
Additionally, timers are processed after the event queue is empty, so it's valid
to use ``setTimeout(fn)`` instead of Lua's ``mp.register_idle(fn)``.
CommonJS modules and ``require(id)``
------------------------------------
CommonJS Modules are a standard system where scripts can export common functions
for use by other scripts. A module is a script which adds properties (functions,
etc) to its invisible ``exports`` object, which another script can access by
loading it with ``require(module-id)`` - which returns that ``exports`` object.
Modules and ``require`` are supported, standard compliant, and generally similar
to node.js. However, most node.js modules won't run due to missing modules such
as ``fs``, ``process``, etc, but some node.js modules with minimal dependencies
do work. In general, this is for mpv modules and not a node.js replacement.
A ``.js`` file extension is always added to ``id``, e.g. ``require("./foo")``
will load the file ``./foo.js`` and return its ``exports`` object.
An id is relative (to the script which ``require``'d it) if it starts with
``./`` or ``../``. Otherwise, it's considered a "top-level id" (CommonJS term).
Top level id is evaluated as absolute filesystem path if possible (e.g. ``/x/y``
or ``~/x``). Otherwise, it's searched at ``scripts/modules.js/`` in mpv config
dirs - in normal config search order. E.g. ``require("x")`` is searched as file
``x.js`` at those dirs, and id ``foo/x`` is searched as file ``foo/x.js``.
No ``global`` variable, but a module's ``this`` at its top lexical scope is the
global object - also in strict mode. If you have a module which needs ``global``
as the global object, you could do ``this.global = this;`` before ``require``.
Functions and variables declared at a module don't pollute the global object.
The event loop
--------------
The event loop poll/dispatch mpv events as long as the queue is not empty, then
processes the timers, then waits for the next event, and repeats this forever.
You could put this code at your script to replace the built-in event loop, and
also print every event which mpv sends to your script:
::
function mp_event_loop() {
var wait = 0;
do {
var e = mp.wait_event(wait);
dump(e); // there could be a lot of prints...
if (e.event != "none") {
mp.dispatch_event(e);
wait = 0;
} else {
wait = mp.process_timers() / 1000;
}
} while (mp.keep_running);
}
``mp_event_loop`` is a name which mpv tries to call after the script loads.
The internal implementation is similar to this (without ``dump`` though..).
``e = mp.wait_event(wait)`` returns when the next mpv event arrives, or after
``wait`` seconds if positive and no mpv events arrived. ``wait`` value of 0
returns immediately (with ``e.event == "none"`` if the queue is empty).
``mp.dispatch_event(e)`` calls back the handlers registered for ``e.event``,
if there are such (event handlers, property observers, script messages, etc).
``mp.process_timers()`` calls back the already-added, non-canceled due timers,
and returns the duration in ms till the next due timer (possibly 0), or -1 if
there are no pending timers. Must not be called recursively.
Note: ``exit()`` is also registered for the ``shutdown`` event, and its
implementation is a simple ``mp.keep_running = false``.
-59
View File
@@ -14,62 +14,3 @@ mpv, further documentation is spread over a few places:
- http://mpv.io/manual/master/#list-of-input-commands
- http://mpv.io/manual/master/#properties
- https://github.com/mpv-player/mpv-examples/tree/master/libmpv
C PLUGINS
=========
You can write C plugins for mpv. These use the libmpv API, although they do not
use the libmpv library itself.
Currently, they must be explicitly enabled at build time with
``--enable-cplugins``. They are available on Linux/BSD platforms only.
C plugins location
------------------
C plugins are put into the mpv scripts directory in its config directory
(see the `FILES`_ section for details). They must have a ``.so`` file extension.
They can also be explicitly loaded with the ``--script`` option.
API
---
A C plugin must export the following function::
int mpv_open_cplugin(mpv_handle *handle)
The plugin function will be called on loading time. This function does not
return as long as your plugin is loaded (it runs in its own thread). The
``handle`` will be deallocated as soon as the plugin function returns.
The return value is interpreted as error status. A value of ``0`` is
interpreted as success, while ``-1`` signals an error. In the latter case,
the player prints an uninformative error message that loading failed.
Return values other than ``0`` and ``-1`` are reserved, and trigger undefined
behavior.
Within the plugin function, you can call libmpv API functions. The ``handle``
is created by ``mpv_create_client()`` (or actually an internal equivalent),
and belongs to you. You can call ``mpv_wait_event()`` to wait for things
happening, and so on.
Note that the player might block until your plugin calls ``mpv_wait_event()``
for the first time. This gives you a chance to install initial hooks etc.
before playback begins.
The details are quite similar to Lua scripts.
Linkage to libmpv
-----------------
The current implementation requires that your plugins are **not** linked against
libmpv. What your plugins uses are not symbols from a libmpv binary, but
symbols from the mpv host binary.
Examples
--------
See:
- https://github.com/mpv-player/mpv-examples/tree/master/cplugins
+2 -7
View File
@@ -240,7 +240,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
This will print the message ``the key was pressed`` when ``x`` was pressed.
The user can remap these key bindings. Then the user has to put the
following into their input.conf to remap the command to the ``y`` key:
following into his input.conf to remap the command to the ``y`` key:
::
@@ -259,7 +259,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
``mp.add_forced_key_binding(...)``
This works almost the same as ``mp.add_key_binding``, but registers the
key binding in a way that will overwrite the user's custom bindings in their
key binding in a way that will overwrite the user's custom bindings in his
input.conf. (``mp.add_key_binding`` overwrites default key bindings only,
but not those by the user's input.conf.)
@@ -451,11 +451,6 @@ are useful only in special situations.
multiple properties at once, you might not want to act on each property
change, but only when all change notifications have been received.
``mp.unregister_idle(fn)``
Undo ``mp.register_idle(fn)``. This removes all idle handlers that
are equal to the ``fn`` parameter. This uses normal Lua ``==`` comparison,
so be careful when dealing with closures.
``mp.enable_messages(level)``
Set the minimum log level of which mpv message output to receive. These
messages are normally printed to the terminal. By calling this function,
+17 -97
View File
@@ -140,12 +140,12 @@ L
Toggle infinite looping.
Ctrl + and Ctrl -
Adjust audio delay (A/V sync) by +/- 0.1 seconds.
Adjust audio delay by +/- 0.1 seconds.
u
Switch between applying no style overrides to SSA/ASS subtitles, and
overriding them almost completely with the normal subtitle style. See
``--sub-ass-override`` for more info.
``--sub-ass-style-override`` for more info.
V
Toggle subtitle VSFilter aspect compatibility mode. See
@@ -165,6 +165,9 @@ Ctrl s
Take a screenshot, as the window shows it (with subtitles, OSD, and scaled
video).
I
Show filename on the OSD.
PGUP and PGDWN
Seek to the beginning of the previous/next chapter. In most cases,
"previous" will actually go to the beginning of the current chapter; see
@@ -218,9 +221,14 @@ STOP
PREVIOUS and NEXT
Seek backward/forward 1 minute.
(The following keys are only valid if you compiled with TV or DVB input
support.)
If you miss some older key bindings, look at ``etc/restore-old-bindings.conf``
in the mpv git repository.
h and k
Select previous/next tv-channel.
H and K
Select previous/next dvb-channel.
Mouse Control
-------------
@@ -416,36 +424,6 @@ file stops playing. If option ``--c`` is changed during playback of
file-local options. The option ``--a`` is never reset here.
List Options
------------
Some options which store lists of option values can have action suffixes. For
example, you can set a ``,``-separated list of filters with ``--vf``, but the
option also allows you to append filters with ``--vf-append``.
Options for filenames do not use ``,`` as separator, but ``:`` (Unix) or ``;``
(Windows).
============= ===============================================
Suffix Meaning
============= ===============================================
-add Append 1 or more items (may become alias for -append)
-append Append single item (avoids need for escaping)
-clr Clear the option
-del Delete an existing item by integer index
-pre Prepend 1 or more items
-set Set a list of items
============= ===============================================
Although some operations allow specifying multiple ``,``-separated items, using
this is strongly discouraged and deprecated, except for ``-set``.
Without suffix, the action taken is normally ``-set``.
Some options (like ``--sub-file``, ``--audio-file``, ``--opengl-shader``) are
aliases for the proper option with ``-append`` action. For example,
``--sub-file`` is an alias for ``--sub-files-append``.
Playing DVDs
------------
@@ -461,7 +439,7 @@ specifying the path to the local copy: ``--dvd-device=PATH``.
Alternatively, running ``mpv PATH`` should auto-detect a DVD directory
tree and play the longest title.
.. note:: DVD library choices
.. note::
mpv uses a different default DVD library than MPlayer. MPlayer
uses libdvdread by default, and mpv uses libdvdnav by default.
@@ -474,12 +452,8 @@ tree and play the longest title.
when using libdvdnav, in which playback gets stuck in a DVD menu
stream. These problems are reported to go away when auto-selecting
the title (``dvd://`` rather than ``dvd://1``) or when using
libdvdread (e.g. ``dvdread://0``). There are also outstanding bugs
in libdvdnav with seeking backwards and forwards in a video
stream. Specify ``dvdread://...`` to fix such problems.
libdvdread (e.g. ``dvdread://0``).
.. note:: DVD subtitles
DVDs use image-based subtitles. Image subtitles are implemented as
a bitmap video stream which can be superimposed over the main
movie. mpv's subtitle styling and positioning options and keyboard
@@ -691,7 +665,6 @@ PROTOCOLS
=========
``http://...``, ``https://``, ...
Many network protocols are supported, but the protocol prefix must always
be specified. mpv will never attempt to guess whether a filename is
actually a network address. A protocol prefix is always required.
@@ -700,12 +673,7 @@ PROTOCOLS
either aliases to documented protocols, or are just redirections to
protocols implemented and documented in FFmpeg.
``data:`` is supported in FFmpeg (not in Libav), but needs to be in the
format ``data://``. This is done to avoid ambiguity with filenames. You
can also prefix it with ``lavf://`` or ``ffmpeg://``.
``ytdl://...``
By default, the youtube-dl hook script (enabled by default for mpv CLI)
only looks at http URLs. Prefixing an URL with ``ytdl://`` forces it to
be always processed by the script. This can also be used to invoke special
@@ -715,26 +683,17 @@ PROTOCOLS
and you have to use ``--ytdl-raw-options`` instead.
``-``
Play data from stdin.
``smb://PATH``
Play a path from Samba share.
``bd://[title][/device]`` ``--bluray-device=PATH``
Play a Blu-ray disc. Currently, this does not accept ISO files. Instead,
you must mount the ISO file as filesystem, and point ``--bluray-device``
to the mounted directory directly.
``title`` can be: ``longest`` or ``first`` (selects the default
playlist); ``mpls/<number>`` (selects <number>.mpls playlist);
``<number>`` (select playlist with the same index). You can list
the available playlists with ``--msg-level=bd=v``.
``dvd://[title|[starttitle]-endtitle][/device]`` ``--dvd-device=PATH``
Play a DVD. DVD menus are not supported. If no title is given, the longest
title is auto-selected.
@@ -742,39 +701,30 @@ PROTOCOLS
thing.
``dvdread://...:``
Play a DVD using the old libdvdread code. This is what MPlayer and
older mpv versions use for ``dvd://``. Use is discouraged. It's
provided only for compatibility and for transition, and to work
around outstanding dvdnav bugs (see "DVD library choices" above).
Play a DVD using the old libdvdread code. This is what MPlayer and older
mpv versions use for ``dvd://``. Use is discouraged. It's provided only
for compatibility and for transition.
``tv://[channel][/input_id]`` ``--tv-...``
Analogue TV via V4L. Also useful for webcams. (Linux only.)
``pvr://`` ``--pvr-...``
PVR. (Linux only.)
``dvb://[cardnumber@]channel`` ``--dvbin-...``
Digital TV via DVB. (Linux only.)
``mf://[filemask|@listfile]`` ``--mf-...``
Play a series of images as video.
``cdda://[device]`` ``--cdrom-device=PATH`` ``--cdda-...``
Play CD.
``lavf://...``
Access any FFmpeg/Libav libavformat protocol. Basically, this passed the
string after the ``//`` directly to libavformat.
``av://type:options``
This is intended for using libavdevice inputs. ``type`` is the libavdevice
demuxer name, and ``options`` is the (pseudo-)filename passed to the
demuxer.
@@ -786,37 +736,26 @@ PROTOCOLS
``avdevice://`` is an alias.
``file://PATH``
A local path as URL. Might be useful in some special use-cases. Note that
``PATH`` itself should start with a third ``/`` to make the path an
absolute path.
``fd://123``
Read data from the given file descriptor (for example 123). This is similar
to piping data to stdin via ``-``, but can use an arbitrary file descriptor.
``fdclose://123``
Like ``fd://``, but the file descriptor is closed after use. When using this
you need to ensure that the same fd URL will only be used once.
``edl://[edl specification as in edl-mpv.rst]``
Stitch together parts of multiple files and play them.
``null://``
Simulate an empty file. If opened for writing, it will discard all data.
The ``null`` demuxer will specifically pass autoprobing if this protocol
is used (while it's not automatically invoked for empty files).
``memory://data``
Use the ``data`` part as source data.
``hex://data``
Like ``memory://``, but the string is interpreted as hexdump.
PSEUDO GUI MODE
@@ -879,8 +818,6 @@ works like in older mpv releases. The profiles are currently defined as follows:
.. include:: lua.rst
.. include:: javascript.rst
.. include:: ipc.rst
.. include:: changes.rst
@@ -1030,23 +967,6 @@ For Windows-specifics, see `FILES ON WINDOWS`_ section.
``~/.config/mpv/input.conf``
key bindings (see `INPUT.CONF`_ section)
``~/.config/mpv/fonts.conf``
Fontconfig fonts.conf that is customized for mpv. You should include system
fonts.conf in this file or mpv would not know about fonts that you already
have in the system.
Only available when libass is built with fontconfig.
``~/.config/mpv/subfont.ttf``
fallback subtitle font
``~/.config/mpv/fonts/``
Font files in this directory are used by mpv/libass for subtitles. Useful
if you do not want to install fonts to your system. Note that files in this
directory are loaded into memory before being used by mpv. If you have a
lot of fonts, consider using fonts.conf (see above) to include additional
fonts, which is more memory-efficient.
``~/.config/mpv/scripts/``
All files in this directory are loaded as if they were passed to the
``--script`` option. They are loaded in alphabetical order, and sub-directories
+251 -707
View File
File diff suppressed because it is too large. Load diff
+7 -33
View File
@@ -20,12 +20,12 @@ The Interface
::
+---------+----------+------------------------------------------+----------+
| pl prev | pl next | title | cache |
+------+--+---+------+---------+-----------+------+-------+-----+-----+----+
| play | skip | skip | time | seekbar | time | audio | sub | vol | fs |
| | back | frwd | elapsed | | left | | | | |
+------+------+------+---------+-----------+------+-------+-----+-----+----+
+---------+----------+----------------------------+-------------+
| pl prev | pl next | title | cache |
+------+--+---+------+---------+-----------+------+-------+-----+
| play | skip | skip | time | seekbar | time | audio | sub |
| | back | frwd | elapsed | | left | | |
+------+------+------+---------+-----------+------+-------+-----+
pl prev
@@ -43,7 +43,7 @@ pl next
============= ================================================
title
| Displays current media-title, filename, or custom title
| Displays current media-title or filename
============= ================================================
left-click show playlist position and length and full title
@@ -102,17 +102,6 @@ audio and sub
shift+L-click show available audio/sub tracks
============= ================================================
vol
============= ================================================
left-click toggle mute
mouse wheel volume up/down
============= ================================================
fs
============= ================================================
left-click toggle fullscreen
============= ================================================
Key Bindings
~~~~~~~~~~~~
@@ -250,13 +239,6 @@ Configurable Options
Duration of fade out in ms, 0 = no fade
``title``
Default: ${media-title}
String that supports property expansion that will be displayed as
OSC title.
ASS tags are escaped, and newlines and trailing slashes are stripped.
``tooltipborder``
Default: 1
@@ -277,14 +259,6 @@ Configurable Options
Also supports ``never`` and ``always``
``boxmaxchars``
Default: 80
Max chars for the osc title at the box layout. mpv does not measure the
text width on screen and so it needs to limit it by number of chars. The
default is conservative to allow wide fonts to be used without overflow.
However, with many common fonts a bigger number can be used. YMMV.
Script Commands
~~~~~~~~~~~~~~~
+62 -99
View File
@@ -5,41 +5,7 @@ Video filters allow you to modify the video stream and its properties. The
syntax is:
``--vf=<filter1[=parameter1:parameter2:...],filter2,...>``
Setup a chain of video filters. This consists on the filter name, and an
option list of parameters after ``=``. The parameters are separated by
``:`` (not ``,``, as that starts a new filter entry).
Before the filter name, a label can be specified with ``@name:``, where
name is an arbitrary user-given name, which identifies the filter. This
is only needed if you want to toggle the filter at runtime.
A ``!`` before the filter name means the filter is enabled by default. It
will be skipped on filter creation. This is also useful for runtime filter
toggling.
See the ``vf`` command (and ``toggle`` sub-command) for further explanations
and examples.
The general filter entry syntax is:
``["@"<label-name>":"] ["!"] <filter-name> [ "=" <filter-parameter-list> ]``
or for the special "toggle" syntax (see ``vf`` command):
``"@"<label-name>``
and the ``filter-parameter-list``:
``<filter-parameter> | <filter-parameter> "," <filter-parameter-list>``
and ``filter-parameter``:
``( <param-name> "=" <param-value> ) | <param-value>``
``param-value`` can further be quoted in ``[`` / ``]`` in case the value
contains characters like ``,`` or ``=``. This is used in particular with
the ``lavfi`` filter, which uses a very similar syntax as mpv (MPlayer
historically) to specify filters and their parameters.
Setup a chain of video filters.
You can also set defaults for each filter. The defaults are applied before the
normal filter parameters.
@@ -49,29 +15,12 @@ normal filter parameters.
.. note::
To get a full list of available video filters, see ``--vf=help`` and
http://ffmpeg.org/ffmpeg-filters.html .
To get a full list of available video filters, see ``--vf=help``.
Also, keep in mind that most actual filters are available via the ``lavfi``
wrapper, which gives you access to most of libavfilter's filters. This
includes all filters that have been ported from MPlayer to libavfilter.
Most builtin filters are deprecated in some ways, unless they're only available
in mpv (such as filters which deal with mpv specifics, or which are
implemented in mpv only).
If a filter is not builtin, the ``lavfi-bridge`` will be automatically
tried. This bridge does not support help output, and does not verify
parameters before the filter is actually used. Although the mpv syntax
is rather similar to libavfilter's, it's not the same. (Which means not
everything accepted by vf_lavfi's ``graph`` option will be accepted by
``--vf``.)
You can also prefix the filter name with ``lavfi-`` to force the wrapper.
This is helpful if the filter name collides with a deprecated mpv builtin
filter. For example ``--vf=lavfi-scale=args`` would use libavfilter's
``scale`` filter over mpv's deprecated builtin one.
Video filters are managed in lists. There are a few commands to manage the
filter list.
@@ -98,7 +47,7 @@ With filters that support it, you can access parameters by their name.
Sets a named parameter to the given value. Use on and off or yes and no to
set flag parameters.
Available mpv-only filters are:
Available filters are:
``crop[=w:h:x:y]``
Crops the given part of the image and discards the rest. Useful to remove
@@ -363,34 +312,17 @@ Available mpv-only filters are:
:gamma2.2: Pure power curve (gamma 2.2)
:gamma2.8: Pure power curve (gamma 2.8)
:prophoto: ProPhoto RGB (ROMM) curve
:pq: ITU-R BT.2100 PQ (Perceptual quantizer) curve
:hlg: ITU-R BT.2100 HLG (Hybrid Log-gamma) curve
:st2084: SMPTE ST2084 (HDR) curve
:std-b67: ARIB STD-B67 (Hybrid Log-gamma) curve
:v-log: Panasonic V-Log transfer curve
:s-log1: Sony S-Log1 transfer curve
:s-log2: Sony S-Log2 transfer curve
``<sig-peak>``
Reference peak illumination for the video file, relative to the
signal's reference white level. This is mostly interesting for HDR, but
it can also be used tone map SDR content to simulate a different
exposure. Normally inferred from tags such as MaxCLL or mastering
metadata.
``<peak>``
Reference peak illumination for the video file. This is mostly
interesting for HDR, but it can also be used tone map SDR content
to a darker or brighter exposure.
The default of 0.0 will default to the source's nominal peak luminance.
``<light>``
Light type of the scene. This is mostly correctly inferred based on the
gamma function, but it can be useful to override this when viewing raw
camera footage (e.g. V-Log), which is normally scene-referred instead
of display-referred.
Available light types are:
:auto: Automatic selection (default)
:display: Display-referred light (most content)
:hlg: Scene-referred using the HLG OOTF (e.g. HLG content)
:709-1886: Scene-referred using the BT709+BT1886 interaction
:gamma1.2: Scene-referred using a pure power OOTF (gamma=1.2)
The default of 0.0 will default to the display's reference brightness
for SDR and the source's reference brightness for HDR.
``<stereo-in>``
Set the stereo mode the video is assumed to be encoded in. Takes the
@@ -414,16 +346,6 @@ Available mpv-only filters are:
but values such as ``[16:9]`` can be passed too (``[...]`` for quoting
to prevent the option parser from interpreting the ``:`` character).
``<spherical-type>``
Type of the spherical projection:
:auto: As indicated by the file (default)
:none: Normal video
:equirect: Equirectangular
:unknown: Unknown projection
``<spherical-yaw>``, ``<spherical-pitch>``, ``<spherical-roll>``
Reference angle in degree, if spherical video is used.
``noformat[=fmt]``
Restricts the color space for the next filter without doing any conversion.
@@ -484,6 +406,32 @@ Available mpv-only filters are:
``'--vf=lavfi=yadif:o="threads=2,thread_type=slice"'``
forces a specific threading configuration.
``eq[=gamma:contrast:brightness:saturation:rg:gg:bg:weight]``
Software equalizer that uses lookup tables (slow), allowing gamma correction
in addition to simple brightness and contrast adjustment. The parameters are
given as floating point values.
``<0.1-10>``
initial gamma value (default: 1.0)
``<-2-2>``
initial contrast, where negative values result in a negative image
(default: 1.0)
``<-1-1>``
initial brightness (default: 0.0)
``<0-3>``
initial saturation (default: 1.0)
``<0.1-10>``
gamma value for the red component (default: 1.0)
``<0.1-10>``
gamma value for the green component (default: 1.0)
``<0.1-10>``
gamma value for the blue component (default: 1.0)
``<0-1>``
The weight parameter can be used to reduce the effect of a high gamma
value on bright image areas, e.g. keep them from getting overamplified
and just plain white. A value of 0.0 turns the gamma correction all
the way down while 1.0 leaves it at its full strength (default: 1.0).
``pullup[=jl:jr:jt:jb:sb:mp]``
Pulldown reversal (inverse telecine) filter, capable of handling mixed
hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
@@ -643,6 +591,29 @@ Available mpv-only filters are:
size of the filter in percent of the image diagonal size. This is
used to calculate the final radius size (default: 1).
``dlopen=dll[:a0[:a1[:a2[:a3]]]]``
Loads an external library to filter the image. The library interface
is the ``vf_dlopen`` interface specified using ``libmpcodecs/vf_dlopen.h``.
.. warning:: This filter is deprecated.
``dll=<library>``
Specify the library to load. This may require a full file system path
in some cases. This argument is required.
``a0=<string>``
Specify the first parameter to pass to the library.
``a1=<string>``
Specify the second parameter to pass to the library.
``a2=<string>``
Specify the third parameter to pass to the library.
``a3=<string>``
Specify the fourth parameter to pass to the library.
``vapoursynth=file:buffered-frames:concurrent-frames``
Loads a VapourSynth filter script. This is intended for streamed
processing: mpv actually provides a source filter, instead of using a
@@ -771,7 +742,7 @@ Available mpv-only filters are:
no
Don't perform deinterlacing.
first-field
Show only first field.
Show only first field (going by ``--field-dominance``).
bob
bob deinterlacing (default).
weave, motion-adaptive, motion-compensated
@@ -783,15 +754,6 @@ Available mpv-only filters are:
:no: Deinterlace all frames.
:yes: Only deinterlace frames marked as interlaced (default).
``reversal-bug=<yes|no>``
:no: Use the API as it was interpreted by older Mesa drivers. While
this interpretation was more obvious and inuitive, it was
apparently wrong, and not shared by Intel driver developers.
:yes: Use Intel interpretation of surface forward and backwards
references (default). This is what Intel drivers and newer Mesa
drivers expect. Matters only for the advanced deinterlacing
algorithms.
``vdpaupp``
VDPAU video post processing. Works with ``--vo=vdpau`` and ``--vo=opengl``
only. This filter is automatically inserted if deinterlacing is requested
@@ -812,6 +774,7 @@ Available mpv-only filters are:
the mode selected with ``deint-mode``.
``deint-mode=<first-field|bob|temporal|temporal-spatial>``
Select deinterlacing mode (default: temporal).
All modes respect ``--field-dominance``.
Note that there's currently a mechanism that allows the ``vdpau`` VO to
change the ``deint-mode`` of auto-inserted ``vdpaupp`` filters. To avoid
+20 -3
View File
@@ -323,8 +323,9 @@ Available video output drivers are:
``vaapi``
Intel VA API video output driver with support for hardware decoding. Note
that there is absolutely no reason to use this, other than compatibility.
This is low quality, and has issues with OSD.
that there is absolutely no reason to use this, other than wanting to use
hardware decoding to save power on laptops, or possibly preventing video
tearing with some setups.
.. note:: This driver is for compatibility with crappy systems. You can
use vaapi hardware decoding with ``--vo=opengl`` too.
@@ -356,7 +357,7 @@ Available video output drivers are:
no
Don't allow deinterlacing (default for newer libva).
first-field
Show only first field.
Show only first field (going by ``--field-dominance``).
bob
bob deinterlacing (default for older libva).
@@ -418,6 +419,14 @@ Available video output drivers are:
JPEG files, extension .jpeg.
png
PNG files.
ppm
Portable bitmap format.
pgm
Portable graymap format.
pgmyuv
Portable graymap format, using the YV12 pixel format.
tga
Truevision TGA.
``--vo-image-png-compression=<0-9>``
PNG compression factor (speed vs. file size tradeoff) (default: 7)
@@ -426,8 +435,16 @@ Available video output drivers are:
3 = average; 4 = Paeth; 5 = mixed) (default: 5)
``--vo-image-jpeg-quality=<0-100>``
JPEG quality factor (default: 90)
``--vo-image-jpeg-progressive=<yes|no>``
Specify standard or progressive JPEG (default: no).
``--vo-image-jpeg-baseline=<yes|no>``
Specify use of JPEG baseline or not (default: yes).
``--vo-image-jpeg-optimize=<0-100>``
JPEG optimization factor (default: 100)
``--vo-image-jpeg-smooth=<0-100>``
smooth factor (default: 0)
``--vo-image-jpeg-dpi=<1->``
JPEG DPI (default: 72)
``--vo-image-outdir=<dirname>``
Specify the directory to save the image files to (default: ``./``).
+2 -5
View File
@@ -8,10 +8,7 @@ behaves. Although there are still many similarities to its ancestors, **mpv**
should generally be treated as a completely different program.
.. admonition:: Warning
This document is **not updated** anymore, and is **incomplete** and
**outdated**. If you look for old option replacements, always check with
the current mpv manpage, as the options could have changed meanwhile.
This document is not updated anymore, and is incomplete and outdated.
General Changes from MPlayer to mpv
-----------------------------------
@@ -212,7 +209,7 @@ Command Line Switches
``-no<opt>`` ``--no-<opt>`` (add a dash)
``-a52drc level`` ``--ad-lavc-ac3drc=level``
``-ac spdifac3`` ``--ad=spdif:ac3`` (see ``--ad=help``)
``-af volnorm`` (removed; use acompressor ffmpeg filter instead)
``-af volnorm`` ``--af=drc`` (renamed)
``-afm hwac3`` ``--ad=spdif:ac3,spdif:dts``
``-ao alsa:device=hw=0.3`` ``--ao=alsa:device=[hw:0,3]``
``-aspect`` ``--video-aspect``
+7 -10
View File
@@ -7,7 +7,8 @@ contains breaking changes, such as changed options or added/removed features,
and Y is incremented if a release contains only bugfixes and other minor
changes.
Releases are tagged on the master branch and will not be maintained separately.
There is only one release branch that keeps track of the latest version and
will not be maintained separately.
The goal of releases is to provide Linux distributions with something to
package. If you want the newest features, just use the master branch.
@@ -18,22 +19,18 @@ Releases other than the latest release are unsupported and unmaintained.
Release procedure
-----------------
While on master:
- Merge master into branch release/current.
- Update the `RELEASE_NOTES` file.
- Create and/or update the `RELEASE_NOTES` file.
- Update the `VERSION` file.
- Create and/or update the `VERSION` file.
- Update `DOCS/client-api-changes.rst` and `DOCS/interface-changes.rst`
(in particular, update the last version numbers if necessary)
- Commit changes.
- Create tag v0.X.Y.
- Create signed tag v0.X.Y.
- Add -UNKNOWN suffix to version in `VERSION` file.
- Commit changes, push branch and tag to GitHub.
- Push branch and tag to GitHub.
- Create a new GitHub release using the content of `RELEASE_NOTES` related to
the new version.
+50 -26
View File
@@ -46,7 +46,9 @@ player/*.c:
- most state is in MPContext (core.h), which is not available to the
subsystems
- the currently played tracks are in mpctx->current_tracks, and decoder
state in track.d_video/d_audio/d_sub
state in d_video/d_audio/d_sub
- the timeline stuff is used only with MKV ordered chapters (and some other
minor features: cue, edl)
- the other subsystems rarely call back into the frontend, and the frontend
polls them instead (probably a good thing)
- one exceptions are wakeup callbacks, which notify a "higher" component
@@ -54,15 +56,23 @@ player/*.c:
I like to call the player/*.c files the "frontend".
ta.h & ta.c:
Hierarchical memory manager inspired by talloc from Samba. It's like a
malloc() with more features. Most importantly, each talloc allocation can
have a parent, and if the parent is free'd, all children will be free'd as
well. The parent is an arbitrary talloc allocation. It's either set by the
allocation call by passing a talloc parent, usually as first argument to the
allocation function. It can also be set or reset later by other calls (at
least talloc_steal()). A talloc allocation that is used as parent is often
called a talloc context.
talloc.h & talloc.c:
Hierarchical memory manager copied from Samba. It's like a malloc() with
more features. Most importantly, each talloc allocation can have a parent,
and if the parent is free'd, all children will be free'd as well. The
parent is an arbitrary talloc allocation. It's either set by the allocation
call by passing a talloc parent, usually as first argument to the allocation
function. It can also be set or reset later by other calls (at least
talloc_steal()). A talloc allocation that is used as parent is often called
a talloc context.
Lots of code still uses malloc() proper, and you should be careful what
type of allocation you're dealing with when returning or free'ing an
allocation. (Needless to say, talloc_free() and free() are completely
different things.)
The copy in mpv has been modified to abort on OOM conditions. An
allocation call will never return NULL.
One very useful feature of talloc is fast tracking of memory leaks. ("Fast"
as in it doesn't require valgrind.) You can enable it by setting the
@@ -73,14 +83,16 @@ ta.h & ta.c:
Documentation can be found here:
http://git.samba.org/?p=samba.git;a=blob;f=lib/talloc/talloc.h;hb=HEAD
For some reason, we're still using API-compatible wrappers instead of TA
directly. The talloc wrapper has only a subset of the functionality, and
in particular the wrappers abort() on memory allocation failure.
Note: unlike tcmalloc, jemalloc, etc., talloc() is not actually a malloc
replacement. It works on top of system malloc and provides additional
features that are supposed to make memory management easier.
Warning: actually, we're not using talloc anymore. talloc in mpv has been
replaced by a custom re-implementation (TA in ta/). It provides
some talloc emulation (just the parts needed by mpv). We will get
rid of the talloc emulation later and use TA natively.
(See ta/README for details.)
player/command.c:
This contains the implementation for client API commands and properties.
Properties are essentially dynamic variables changed by certain commands.
@@ -108,7 +120,7 @@ options/options.h, options/options.c
their own sub-option tables separate from MPOpts.
The actual option parser is spread over m_option.c, m_config.c, and
parse_commandline.c, and uses the option table in options.c.
parser-mpcmd.c, and uses the option table in options.c.
input/input.c:
This translates keyboard input coming from VOs and other sources (such
@@ -149,7 +161,8 @@ demux/:
Most demuxers have been removed from this fork, and the only important and
"actual" demuxers left are demux_mkv.c and demux_lavf.c (uses libavformat).
There are some pseudo demuxers like demux_cue.c.
There are some pseudo demuxers like demux_cue.c, which exist only to invoke
other frontend code (tl_cue.c in this case).
The main interface is in demux.h. The stream headers are in stheader.h.
There is a stream header for each audio/video/sub stream, and each of them
@@ -163,8 +176,8 @@ video/:
internally.
video/decode/:
vd_*.c are video decoders. (There's only vd_lavc.c left.) dec_video.c
handles most of connecting the frontend with the actual decoder.
vd_*.c are video decoders. (There's only vd_lavc.c left.) dec_video.c/vd.c
handle most of connecting the frontend with the actual decoder.
video/filter/:
vf_*.c and vf.c form the video filter chain. They are fed by the video
@@ -180,23 +193,24 @@ video/out/:
vo_opengl can pick a windowing system at runtime, e.g. the same binary can
provide both X11 and Cocoa support on OSX.
VOs can be reconfigured at runtime. A vo_reconfig() call can change the video
VOs can be reconfigured at runtime. A vo_config() call can change the video
resolution and format, without destroying the window.
vo_opengl should be taken as reference.
vo_vdpau and vo_opengl should be taken as reference.
audio/:
format.h/format.c define the uncompressed audio formats. (As well as some
compressed formats used for spdif.)
audio/decode/:
ad_*.c and dec_audio.c handle audio decoding. ad_lavc.c is the
ad_*.c and dec_audio.c/ad.c handle audio decoding. ad_lavc.c is the
decoder using ffmpeg. ad_spdif.c is not really a decoder, but is used for
compressed audio passthrough.
audio/filter/:
Audio filter chain. af_lavrresample is inserted if any form of conversion
between audio formats is needed.
between audio formats is needed. (af_convert24.c and af_convertsignendian.c
are also used for some formats not directly supported by FFmpeg.)
audio/out/:
Audio outputs.
@@ -230,12 +244,22 @@ sub/:
The subtitles are passed to dec_sub.c and the subtitle decoders in sd_*.c
as they are demuxed. All text subtitles are rendered by sd_ass.c. If text
subtitles are not in the ASS format, the libavcodec subtitle converters are
used (lavc_conv.c).
subtitles are not in the ASS format, subtitle converters are inserted, for
example sd_srt.c, which is used to convert SRT->ASS. sd_srt.c is also used
as general converter for text->ASS (to prevent interpretation of text as
ASS tags).
Text subtitles can be preloaded, in which case they are read fully as soon
as the subtitle is selected. In this case, they are effectively stored in
sd_ass.c's internal state.
as the subtitle is selected, and then effectively stored in an ASS_Track.
It's used for external text subtitles, and required to make codepage
detection as well as timing postprocessing work. (Timing postprocessing
removes tiny gaps or overlaps between subtitle events.)
player/timeline/:
A timeline is the abstraction used by loadfile.c to combine several files
into one seemingly linear video. It's mainly used for ordered chapters
playback. The high level code to find and load other files containing the
segments for playing an ordered chapters file is in tl_matroska.c.
etc/:
The file input.conf is actually integrated into the mpv binary by the
+1 -1
View File
@@ -146,7 +146,7 @@ mpv's custom build step on top of waf
Build step is pretty much vanilla waf. The only difference being that the list
of source files can contain both strings or tuples. If a tuple is found,
the second element in the tuple will be used to match the features detected
the second element in the tuple will the used to match the features detected
in the configure step (the ``name`` field described above). If this feature
was not enabled during configure, the source file will not be compiled in.
+38 -43
View File
@@ -33,12 +33,14 @@ Releases can be found on the [release list][releases].
- A not too ancient Linux, or Windows Vista or later, or OSX 10.8 or later.
- A somewhat capable CPU. Hardware decoding might sometimes help if the CPU
is too slow to decode video realtime, but must be explicitly enabled with
the `--hwdec` option.
the `--hwdec` option. On Windows, a CPU with SSE4 instruction set is required
to get decent hardware decoding performance.
- A not too crappy GPU. mpv is not intended to be used with bad GPUs. There are
many caveats with drivers or system compositors causing tearing, stutter,
etc. 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.
current, especially OpenGL. In some cases, ancient fallback video output
methods can help (such as `--vo=xv` on Linux), but this use is not
recommended or supported.
## Downloads
@@ -50,7 +52,7 @@ For semi-official builds and third-party packages please see
## Changelog
There is no complete changelog; however, changes to the player core interface
There is no completely 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].
@@ -58,7 +60,7 @@ 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
Changes to the default key bindings are inidcated in
[restore-old-bindings.conf][restore-old-bindings].
## Compilation
@@ -67,7 +69,7 @@ Changes to the default key bindings are indicated in
Compiling with full features requires development files for several
external libraries. Below is a list of some important requirements.
The mpv build system uses *waf*, but we don't store it in your source tree. The
The mpv build system uses *waf* but we don't store it in your source tree. The
script './bootstrap.py' will download the latest version of waf that was tested
with the build system.
@@ -86,24 +88,14 @@ To build the software you can use `./waf build`: the result of the compilation
will be located in `build/mpv`. You can use `./waf install` to install mpv
to the *prefix* after it is compiled.
Example:
./bootstrap.py
./waf configure
./waf
./waf install
Essential dependencies (incomplete list):
- gcc or clang
- X development headers (xlib, xrandr, xext, xscrnsaver, xinerama, libvdpau,
libGL, GLX, EGL, xv, ...)
- X development headers (xlib, X extensions, libvdpau, libGL, libXv, ...)
- Audio output development headers (libasound/ALSA, pulseaudio)
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libavfilter
and either libswresample or libavresample)
At least FFmpeg 3.2.2 or Libav 12 is required.
For hardware decoding with vaapi and vdpau, FFmpeg 3.3 or Libav git is
required.
- zlib
- iconv (normally provided by the system libc)
- libass (OSD, OSC, text subtitles)
@@ -111,7 +103,6 @@ Essential dependencies (incomplete list):
- libjpeg (optional, used for screenshots only)
- uchardet (optional, for subtitle charset detection)
- vdpau and vaapi libraries for hardware decoding on Linux (optional)
(FFmpeg 3.3 or Libav git is also required.)
Libass dependencies:
@@ -124,21 +115,20 @@ Libass dependencies:
FFmpeg dependencies:
- gcc or clang, yasm 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)
- OpenSSL (has to be explicitly enabled when compiling ffmpeg)
- libx264/libmp3lame/libfdk-aac if you want to use encoding (has to be
explicitly enabled when compiling ffmpeg)
- Libav also works, but some features will not work. (See section below.)
Most of the above libraries are available in suitable versions on normal
Linux distributions. However, FFmpeg is an exception (distro versions may be
too old to work well or at all). For that reason you may want to use
the separately available build wrapper ([mpv-build][mpv-build]) that first
compiles FFmpeg libraries and libass, and then compiles the player statically
linked against those.
Linux distributions. However FFmpeg is an exception (distro versions may be
too old to work at all or work well). For that reason you may want to use
the separately available build wrapper ([mpv-build][mpv-build]) that first compiles FFmpeg
libraries and libass, and then compiles the player statically linked against
those.
If you want to build a Windows binary, you either have to use MSYS2 and MinGW,
or cross-compile from Linux with MinGW. See
[Windows compilation][windows_compilation].
or cross-compile from Linux with MinGW. See [Windows compilation][windows_compilation].
## FFmpeg vs. Libav
@@ -160,7 +150,7 @@ versions for no rational reason.
If you want to use a stable FFmpeg release, use the latest release, which has
most likely the best maintenance out of all stable releases. Older releases
are for distros, and at best receive basic changes, like fixing critical security
are for distros, and at best receive basic changes like fixing critical security
issues or build fixes, and at worst are completely abandoned.
## FFmpeg ABI compatibility
@@ -194,11 +184,7 @@ See the [release policy document][release-policy] for more information.
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.
Using the bug tracker as place for simple questions is fine but IRC is
recommended (see [Contact](#Contact) below).
reports or feature requests.
## Contributing
@@ -207,24 +193,33 @@ 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%3A%22feature+request%22)
for ideas on what you could contribute with.
## Relation to MPlayer and mplayer2
mpv is a fork of MPlayer. Much has changed, and in general, mpv should be
considered a completely new program, rather than a MPlayer drop-in replacement.
For details see [FAQ entry](https://github.com/mpv-player/mpv/wiki/FAQ#How_is_mpv_related_to_MPlayer).
mpv is based on mplayer2, which in turn is based on the original MPlayer
(also called mplayer, mplayer-svn, mplayer1). Many changes have been made, a
large part of which is incompatible or completely changes how the player
behaves. Although there are still many similarities to its ancestors, mpv
should generally be treated as a completely different program.
mpv was forked because we wanted to modernize MPlayer. This includes
removing cruft (including features which stopped making sense 10 years ago),
and of course adding modern features. Such huge and intrusive changes made it
infeasible to work directly with MPlayer, which is mostly focused on
preservation, so a fork had to be made. (Actually, mpv is based on mplayer2,
which already started this process of removing cruft.)
In general, mpv should be considered a completely new program, rather than a
MPlayer drop-in replacement.
If you are wondering what's different from mplayer2 and MPlayer, an incomplete
and largely unmaintained list of changes is located [here][mplayer-changes].
and now unmaintained list of changes is located [here][mplayer-changes].
## Contact
Most activity happens on the IRC channel and the github issue tracker.
Most activity happens on the IRC channel and the github issue tracker. The
mailing lists are mostly unused.
- **GitHub issue tracker**: [issue tracker][issue-tracker] (report bugs here)
- **User IRC Channel**: `#mpv` on `irc.freenode.net`
-536
View File
@@ -1,539 +1,3 @@
Release 0.27.1
==============
This releaes fixes CVE-2018-6360.
Fixes and Minor Enhancements
----------------------------
- ytdl_hook: whitelist protocols from urls retrieved from youtube-dl (#5456)
Release 0.27.0
==============
Features
--------
Added
~~~~~
- Windows: handle media keys
- libmpv: options: add a thread-safe way to notify option updates
- vd_lavc/vo_opengl: support embedded ICC profiles
- vo: rendering API abstraction for future non-GL video outputs
- vo_opengl: add a gamut warning feature to highlight out-of-gamut colors (--gamut-warning)
- vo_opengl: add direct rendering support (--vd-lavc-dr)
- vo_opengl: implement (faster) compute shader based EWA kernel
- vo_opengl: implement HLG OOTF inverse
- vo_opengl: support HDR peak detection (--hdr-compute-peak)
- vo_opengl: support float input pixel formats
- vo_opengl: support loading custom user textures (#4586)
- vo_opengl: support user compute shaders
Removed
~~~~~~~
- Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and vo_xv (GPL, not worth the effort to support legacy VOs)
Options and Commands
--------------------
Added
~~~~~
- macOS: add --no-native-fs option to disable the native macOS fullscreen (#4014)
- player: add --track-auto-selection option
Changed
~~~~~~~
- input: use mnemonic names for mouse buttons, same as Qt: https://doc.qt.io/qt-5/qt.html#MouseButton-enum
- options: change --loop semantics
- player: make --lavfi-complex changeable at runtime
- vf_eq: remove this filter (GPL; uses libavfilter’s eq filter now, with changed semantics)
- video: change --deinterlace behavior
- vo_opengl: generalize HDR tone mapping to gamut mapping, --hdr-tone-mapping → --tone-mapping
Removed
~~~~~~~
- --field-dominance (GPL-only author, no chance of relicensing)
- input: drop deprecated "osd" command
- options: drop --video-aspect-method=hybrid (GPL-only)
Fixes and Minor Enhancements
----------------------------
- TOOLS/autocrop.lua: fix cropdetect black limit for 10-bit videos
- TOOLS/lua/autodeint: update to lavfi-bridge
- TOOLS/lua/status-line: improve and update
- af_lavrresample: don't call swr_set_compensation() unless necessary (#4716)
- ao_oss: fix period_size calculation (#4642)
- ao_rsound: allow setting the host
- audio: fix spdif mode
- filter_kernels: correct spline64 kernel
- macOS: fix media keys input when other Apps steal the priority (#4834)
- macOS: fix the support of multiple renderers (GPU switch) (#2371)
- macOS: remove the standard "Show Tab Bar" menu item
- options: fix --include (#4673)
- player: fix --end with large values (#4650)
- player: fix confusion in audio resync code (#4688)
- player: make refresh seeks slightly more robust (#4757)
- player: readd smi subtitle extension (#4626)
- vd_lavc: change auto-probe order to prefer cuda over vdpau-copy
- vd_lavc: fix device leak with copy-mode hwaccels (#4735)
- vd_lavc: fix hwdec compatibility with yuvj420p formats
- vd_lavc: fix mid-stream hwdec fallback
- vf_vapoursynth: fix inverted sign and restore 10 bit support (#4720)
- video: increase --monitorpixelaspect range
- vo_opengl: adjust the rules for linearization (#4631)
- vo_opengl: scale deband-grain to the signal range
- vo_opengl: tone map on the maximum signal component
- x11: fix that window could be resized when using embedding (#4784)
- ytdl_hook: resolve relative paths when joining segment urls (#4827)
- ytdl_hook: support fragments with relative paths, fixes segmented DASH
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log v0.26.0..v0.27.0`
in the git repository or by visiting either
https://github.com/mpv-player/mpv/compare/v0.26.0...v0.27.0 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.26.0..v0.27.0
Release 0.26.0
==============
VA-API/VDPAU hardware decoding now requires FFmpeg > 3.2.
DVB support is disabled by default since it does not work with some older kernels.
Built-in V4L TV support is disabled by default. av://v4l2 can be used instead.
Support for C plugins is now enabled by default (#4491).
Many more parts of the player are now licensed under LGPL, see Copyright file.
Thanks to all contributors who have agreed to relicensing of their changes!
See #2033 for details.
Features
--------
Added
~~~~~
- Universal Windows Plaform (UWP) support (libmpv only)
- csputils: implement sony s-gamut
- js: add javascript scripting support using MuJS
See DOCS/man/javascript.rst for more details
- vo_opengl: add new HDR tone mapping algorithm (mobius, now default)
- vo_opengl: hwdec_cuda: Support separate decode and display devices
- vo_opengl: implement sony s-log1 and s-log2 trc
- vo_opengl: implement support for OOTFs and non-display referred content
Removed
~~~~~~~
- vf_dlopen: remove this filter
Options and Commands
--------------------
Added
~~~~~
- vo_opengl: add --tone-mapping-desaturate
- vo_opengl: support tone-mapping-param for `clip`
- ytdl_hook: add option to exclude URLs from being parsed
Changed
~~~~~~~
- allow setting profile option with libmpv
- audio: move replaygain control to top-level options
- external_files: parse ~ in --{sub,audio}-paths
- options: change --sub-fix-timing default to no (#4484)
- options: expose string list actions for --sub-file option
- options: slight cleanup of --sub-ass-style-override
* signfs → scale
* --sub-ass-style-override → --sub-ass-override
- renamed the HDR TRCs `st2084` and `std-b67` to `pq` and `hlg` respectively
- replace vf_format's `peak` suboption by `sig-peak`, which is relative to the reference white level instead of in cd/m^2
- the following options change to append-by-default (and possibly separator):
* --script
- video: change --video-aspect-method default value to `container`
Deprecated
~~~~~~~~~~
- m_option: deprecate multiple items for -add etc.
- player: deprecate "osd" command
- --audio-file-paths => --audio-file-path
- --sub-paths => --sub-file-path
- --opengl-shaders => --opengl-shader
- --sub-paths => --sub-file-paths
- the following options are deprecated for setting via API:
* "script" (use "scripts")
* "sub-file" (use "sub-files")
* "audio-file" (use "audio-files")
* "external-file" (use "external-files")
(the compatibility hacks for this will be removed after this release)
Removed
~~~~~~~
- chmap: remove misleading "downmix" channel layout name (#4545)
- demux_lavf: remove --demuxer-lavf-cryptokey option (#4579)
- input.conf: drop TV/DVB bindings
- options: remove remaining deprecated audio device selection options
* --alsa-device
* --oss-device
* --coreaudio-exclusive
* --pulse-sink
* --rsound-host/--rsound-port
* --ao-sndio-device
* --ao-wasapi-exclusive
* --ao-wasapi-device
- remove option --target-brightness
- remove property "video-params/nom-peak"
Fixes and Minor Enhancements
----------------------------
- TOOLS/lua/autoload.lua: actually sort files case insensitive (#4398)
- TOOLS/lua/autoload.lua: ignores all files starting with "."
- ao_openal: kill off device listing (#4311)
- ao_pulse: reorder format choice to prefer float and S32 over S16 as fallback format
- ao_wasapi: try correct initial format (#4582)
- command: add missing change notification for playlist-shuffle (#4573)
- demux_disc: fix bluray subtitle language retrieval (#4611)
- demux_mkv: fix alpha with vp9 + libvpx
- demux_mkv: support FFmpeg A_MS/ACM extensions
- ipc-unix: don’t truncate the message on EAGAIN (#4452)
- ipc: raise json nesting limit (#4394)
- macOS: fix mpv-wrapper.sh when used with csh or tcsh shell
- macOS: properly unhide Dock when quitting during System fs animation
- mpv_identify: replace deprecated fps property (#4550)
- options/path: fallback to USERPROFILE if HOME isn't set
- player: close audio device on no audio track
- player: fix potential segfault when playing dvd:// with DVD disabled (#4393)
- player: prevent seek position to jump around adjacent keyframes, e.g. when dragging the OSC bar on short videos (#4183)
- vo_opengl: bump up SHADER_MAX_HOOKS and MAX_TEXTURE_HOOKS to 64
- vo_opengl: correct off-by-one in scale=oversample
- vo_opengl: do not use vaapi-over-GLX (#4555)
- vo_opengl: fall back to ordered dither instead of blowing up (#4519)
- vo_opengl: tone map in linear XYZ instead of RGB
- x11: add 128x128 sized icon support
- ytdl_hook: add a header to support geo-bypass
- ytdl_hook: don't override start time set by saved state
- ytdl_hook: don't override user-set start time
- ytdl_hook: treat single-entry playlists as a single video
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log v0.25.0..v0.26.0`
in the git repository or by visiting either
https://github.com/mpv-player/mpv/compare/v0.25.0...v0.26.0 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.25.0..v0.26.0
Release 0.25.0
==============
This release drops support for OS X 10.7 and earlier.
Support for some optical media functionality (DVD/CD) is now disabled by default.
More parts of the player are now licensed under LGPL. In particular:
* OSD symbol font
* ass_mp, sd_ass
* common.h
* demux/packet
* demux_mkv (with minor exceptions), ebml, matroska.h
* sd_lavc
* sub/osd
Thanks to all contributors who have agreed to relicensing of their changes!
See #2033 for details.
Starting with this release, releases will be tagged on the master branch.
The release/current branch is thus abandoned.
Features
--------
Added
~~~~~
- TOOLS: add acompressor.lua script for runtime acompressor ffmpeg filter control
- dvb: add support for DVB-T2
- lavfi: support hwdec filters for --lavfi-complex
- macOS: initial Touch Bar support
- osc: add volume button (mouse wheel to change volume)
- sub: add SDH subtitle filter
- vo_opengl: add experimental vdpauglx backend
- vo_opengl: implement videotoolbox hwdec on iOS
Removed
~~~~~~~
- image_writer: remove useless formats (PPM, PGM, TGA)
- af_drc: remove (use --af=acompressor instead; higher quality)
Options and Commands
--------------------
Added
~~~~~
- --demuxer-lavf-probe-info
- --sub-filter-sdh, --sub-filter-sdh-harder
- add automatic libavfilter bridges to option parsing
- command: add better runtime filter toggling method
- command: add demux-start-time property
- command: add property notifications for hwdec properties (#4289)
- input: add "async" flag
- osc: add user_opts.boxmaxchars for box layout title limit
- player: add --keep-open-pause=no option
- va_vavpp: reversal-bug=no
- vo_opengl: --opengl-es=force2
- vo_opengl: add --opengl-shader-cache-dir option for caching shaders on disk (mostly for ANGLE)
- vo_opengl: angle: add --angle-flip to set the ANGLE present model
Changed
~~~~~~~
- command: update sub-fps etc. options on runtime changes
- vo_opengl: prefer X11 backends over Wayland backends
- options: change --audio-file-auto default to not to load any files
Deprecated
~~~~~~~~~~
- audio: deprecate most non-lavfi audio filters
(channels, equalizer, pan, volume)
- video: deprecate almost all non-lavfi video filters
(buffer, crop, dlopen, dsize, eq, expand, flip, gradfun, mirror, noformat,
pullup, rotate, scale, stereo3d, sub, yadif)
- options: deprecate --loop semantics (planned alias to --loop-file)
Fixes and Minor Enhancements
----------------------------
- Windows: demux_cue: fix UTF-8 paths
- Windows: fix mismatched free/talloc_free (#4315)
- Windows: fix undefined behaviour when toggling fullscreen
- ao_alsa: close lost audio devices (#4189)
- ao_alsa: filter fewer devices
- ao_alsa: fix an error check (#4188)
- ao_jack: update latency on buffer_size/graph change
- ao_wasapi: do not pass nonsense to drivers with double precision formats
- ass_mp: reallocate cached subtitle image data on format changes (#4325)
- build: decouple dvdnav check from dvdread (#4290)
- build: encode_lavc: fix build failure after libavcodec major bump
- build: fix build with HAVE_GL==0
- build: replace android-gl check with a standard GLES3 check
- build: update bundled waf to 1.9.8
- build: vd_lavc: fix potential build failure with vaapi
- demux_lavf: disable half-working mp4 edit list support in libavcodec
- demux_lavf: skip avformat_find_stream_info() for some formats (hls, mp4, mkv by default)
- etc/encoding_profiles.conf: update and remove deprecated stuff
- etc/mpv.conf: remove deprecated options
- external_files: actually try to autoload from fallback paths
- external_files: enable autoloading with URLs (#3264)
- image_writer: make it work with libavcodec's jpg encoder
- macOS: add --ontop-level option for modifying ontop window level (#2376, #3974)
- macOS: add key mappings for previous and next Media Keys (#4204)
- macOS: add option to force dedicated GPU (#3242)
- macOS: fix autofit options on HiDPI resolutions without HiDPI scaling (#4194)
- macOS: fix black edges on live resize
- macOS: fix cursor hiding in the Dock area and top of the screen
- macOS: fix event propagation of menu bar item key shortcuts
- macOS: fix first responder when borderless window is used
- macOS: fix key input in certain circumstances
- macOS: fix retrieval of non-fullscreen window size, also while animating (#4323)
- macOS: fix scroll wheel input with Shift modifier (#3506)
- macOS: improve bundle environment variable handling (#2061)
- macOS: make window draggable on init
- macOS: only move window into screen bounds when changing screens (#4178)
- macOS: only report mouse movements when window is not being dragged (might have triggered OSC and other scripts)
- macOS: properly restore shell state when quitting from the Dock's context menu
- macOS: refactor mouse events and cursor visibility (#1817, #3856, #4147)
- macOS: set background of the title bar from black to white
- osc: bottom/topbar: add fullscreen button
- osc: bottom/topbar: don't clip title vertically
- osc: bottom/topbar: increase timecodes width a bit (#3952)
- osc: fix PlayResX undefined warning when aspect is 0
- osc: fix window dragging with showwindowed=no (#1819)
- osc: make title configurable and use property expansion on it (#4221)
- osc: refactor osc message scaling (#4081, #4083, #4102)
- player: don't block playback stop when seeking
- player: enable "buffering" pausing for DASH streams too
- player: fix core-idle and eof-reached update notifcations
- player: make screenshot commands honor the async flag (#4250)
- player: reduce blocking on VO when switching pause (#4152)
- sd_ass: disable --sub-fix-timing if sub style override is fully disabled
- stream/stream_dvdnav: don't ignore setting title (#4283)
- stream_dvd: fix subs/audio detection on DVDs containing multi-PGC titles
- vf_vavpp: add advanced deint bug compatibility for Intel vaapi drivers
- vf_vavpp: fix first-field mode
- vo_opengl: fix crash with temporal dithering in dumb mode
- vo_opengl: hwdec_d3d11egl: make it work with some ANGLE DLL versions
- vo_x11: reduce flickering on playlist navigation
- wayland: correctly map mouse buttons
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log v0.24.0..v0.25.0`
in the git repository or by visiting either
https://github.com/mpv-player/mpv/compare/v0.24.0...v0.25.0 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.24.0..v0.25.0
Release 0.24.0
==============
Features
--------
Added
~~~~~
- Windows: allow snapping to screen edges (#2248)
- macOS: add border cycling (#2430)
- player: add experimental C plugin interface
- player: add experimental stream recording feature (--record-file)
- player: add prefetching of the next playlist entry (--prefetch-playlist; does NOT work with URLs resolved by youtube-dl)
- stream_lavf: add support for data URIs (#4058)
- vaapi: add support for 10-bit video formats (requires patched Mesa and capable hardware)
- x11: pseudo HiDPI scaling
Options and Commands
--------------------
Added
~~~~~
- sub: add --sub-justify and --sub-ass-justify options
- sub: add option to force using video resolution for image subtitles (--image-subs-video-resolution)
Changed
~~~~~~~
- command: rename framedrop properties
- drop-frame-count → decoder-frame-drop-count
- vo-drop-frame-count → frame-drop-count
- input.conf: change "L" to change loop-file by default
Deprecated
~~~~~~~~~~
- --hwdec-preload (replaced with --opengl-hwdec-interop)
Removed
~~~~~~~
- options: drop deprecated --sub-codepage syntax
- options: drop deprecated --vd/--ad codecs selection features
- player: remove --stream-capture option/property
Fixes and Minor Enhancements
----------------------------
- Windows: update the fullscreen state on restoring
- ad_spdif: fix obscure cases of AC3 passthrough (e.g. 44100 Hz AC3)
- ao_oss: use --audio-device if --oss-device isn't set (#4122)
- build: fix --disable-gl if cuda is enabled
- build: rpi: rely on pkgconfig for compiler flags to ease cross compilation
- charset_conv: fallback to interpreting subs as latin1 if iconv fails
- charset_conv: fix "auto" fallback with uchardet not compiled (#3954)
- client API: fix freeze when destroying mpv_handle before mpv_initialize
- client API: fix mpv_set_property() return value before init (#3988)
- command: fix potential crash for script-binding with multi-commands
- command: nicer OSD formatting for loop-file
- command: shorten long playlists on OSD
- config: do not resolve default profile during "include" processing (#4024)
- cuda: fix 10 bit decoding
- cue: accept lower-case cue commands (#4057)
- demux_mkv: any reference makes a frame not a keyframe (fixes seeking in WebM files with alpha channel)
- lavfi: slightly better disconnected output handling (#4118)
- lua: close directory after reading its entries (#4045)
- macOS: consistent normalization when searching for external files (#4016)
- macOS: don't change Space on quit in fullscreen (#3957)
- macOS: don't constrain window frame for fullscreen (#4044)
- macOS: don't init displaylink on reconfig (#4031)
- macOS: fix build on OS X 10.9 (#3946)
- macOS: fix color profile retrieval
- macOS: fix displaylink refresh rate retrieval
- macOS: fix dropping of files and URLs (#4036)
- macOS: fix handling of geometry option (#3867)
- macOS: fix unwanted behavior with window level other than the default (#1757, #1884)
- macOS: fix window size in certain circumstances
- macOS: properly recover from toggleFullscreen fail (#4035)
- osc: allow playlist buttons when looping (#4092)
- osc: bottom/topbar: clip title instead of stretching
- osc: bottombar/topbar: make chapter markers slightly bigger
- osc: box: clip with ellipsis after too much stretching
- osc: fix crashes related to field eventresponder being nil (#3210)
- player: add .scc subtitle extension
- stream_bluray: use proper 0-based index
- sub: remove .txt as text subtitle extension
- tv: fix segfaults on TV input (#4096)
- vaapi: set libva > 0.39.4 message callbacks to prevent it from printing messages to the terminal
- vd_lavc: improved fallback behavior for --hwdec=cuda (#3914)
- vdpau: reject decoding of non-4:2:0 (would decode to garbage)
- vf_lavfi: don't crash with VOs without hardware decoding support (#4064)
- vo_opengl, vo_opengl_cb: better hwdec interop backend selection
- vo_opengl: angle: rewrite with custom swap chain (fixes problems with e.g. 24 fps video on 24 Hz monitors, avoids problems with DirectComposition, enables "screenshot window" command on Windows 8 and newer)
- vo_opengl: partially fix rotation for 4:2:2 content
- vo_opengl: x11egl: fix alpha mode
- wayland: fix high CPU usage with mpv paused and visible
- ytdl_hook, edl: implement pseudo-DASH support
- ytdl_hook: add non-dash fallbacks to default formats
- ytdl_hook: fix opening hitbox.tv rtmp stream
- ytdl_hook: respect --no-audio, don't force-select track
- ytdl_hook: support livestream segmented DASH VODs
- ytdl_hook: support segmented dash
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log v0.23.0..v0.24.0`
in the git repository or by visiting either
https://github.com/mpv-player/mpv/compare/v0.23.0...v0.24.0 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.23.0..v0.24.0
Release 0.23.0
==============
View File
Whitespace-only changes.
+5 -26
View File
@@ -5,44 +5,23 @@
# of every string, so code using the string may need to remove that to get
# the exact contents of the original file.
#
# This file is part of mpv.
#
# mpv 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.
#
# mpv 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 mpv. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import unicode_literals
import sys
# Indexing a byte string yields int on Python 3.x, and a str on Python 2.x
def pord(c):
return ord(c) if type(c) == str else c
def file2string(infilename, infile, outfile):
outfile.write("// Generated from %s\n\n" % infilename)
def main(infile):
conv = ['\\' + ("%03o" % c) for c in range(256)]
safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
"0123456789!#%&'()*+,-./:;<=>?[]^_{|}~ "
for c in safe_chars:
conv[ord(c)] = c
for c, esc in ("\nn", "\tt", r"\\", '""'):
conv[ord(c)] = '\\' + esc
for line in infile:
outfile.write('"' + ''.join(conv[pord(c)] for c in line) + '"\n')
sys.stdout.write('"' + ''.join(conv[pord(c)] for c in line) + '"\n')
if __name__ == "__main__":
with open(sys.argv[1], 'rb') as infile:
file2string(sys.argv[1], infile, sys.stdout)
with open(sys.argv[1], 'rb') as infile:
sys.stdout.write("// Generated from %s\n\n" % sys.argv[1])
main(infile)
-9
View File
@@ -1,9 +0,0 @@
#!/bin/sh
# This script is expected to be called as TOOLS/gen-osd-font.sh (it will access
# TOOLS/mpv-osd-symbols.sfdir), and it will write sub/osd_font.otf.
# Needs fontforge with python scripting
fontforge -lang=py -c 'f=open(argv[1]); f.generate(argv[2])' \
TOOLS/mpv-osd-symbols.sfdir sub/osd_font.otf
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
# This script is expected to be called as TOOLS/gen-x11-icon.sh (it will access
# etc/mpv-icon...), and it will write video/out/x11_icon.bin.
conv() {
echo
echo `identify -format "icon: %w %h" "$1"`
convert "$1" -depth 8 rgba:-
}
(echo "# File generated by gen-x11-icon.sh" ;
conv etc/mpv-icon-8bit-16x16.png ;
conv etc/mpv-icon-8bit-32x32.png ;
conv etc/mpv-icon-8bit-64x64.png) | gzip -c > video/out/x11_icon.bin
-155
View File
@@ -1,155 +0,0 @@
-- This script adds control to the dynamic range compression ffmpeg
-- filter including key bindings for adjusting parameters.
--
-- See https://ffmpeg.org/ffmpeg-filters.html#acompressor for explanation
-- of the parameteres.
local mp = require 'mp'
local options = require 'mp.options'
local o = {
default_enable = false,
show_osd = true,
osd_timeout = 4000,
filter_label = mp.get_script_name(),
key_toggle = 'n',
key_increase_threshold = 'F1',
key_decrease_threshold = 'Shift+F1',
key_increase_ratio = 'F2',
key_decrease_ratio = 'Shift+F2',
key_increase_knee = 'F3',
key_decrease_knee = 'Shift+F3',
key_increase_makeup = 'F4',
key_decrease_makeup = 'Shift+F4',
key_increase_attack = 'F5',
key_decrease_attack = 'Shift+F5',
key_increase_release = 'F6',
key_decrease_release = 'Shift+F6',
default_threshold = -25.0,
default_ratio = 3.0,
default_knee = 2.0,
default_makeup = 8.0,
default_attack = 20.0,
default_release = 250.0,
step_threshold = -2.5,
step_ratio = 1.0,
step_knee = 1.0,
step_makeup = 1.0,
step_attack = 10.0,
step_release = 10.0,
}
options.read_options(o)
local params = {
{ name = 'attack', min=0.01, max=2000, hide_default=true, dB='' },
{ name = 'release', min=0.01, max=9000, hide_default=true, dB='' },
{ name = 'threshold', min= -30, max= 0, hide_default=false, dB='dB' },
{ name = 'ratio', min= 1, max= 20, hide_default=false, dB='' },
{ name = 'knee', min= 1, max= 10, hide_default=true, dB='dB' },
{ name = 'makeup', min= 0, max= 24, hide_default=false, dB='dB' },
}
local function parse_value(value)
-- Using nil here because tonumber differs between lua 5.1 and 5.2 when parsing fractions in combination with explicit base argument set to 10.
-- And we can't omit it because gsub returns 2 values which would get unpacked and cause more problems. Gotta love scripting languages.
return tonumber(value:gsub('dB$', ''), nil)
end
local function format_value(value, dB)
return string.format('%g%s', value, dB)
end
local function show_osd(filter)
if not o.show_osd then
return
end
if not filter.enabled then
mp.commandv('show-text', 'Dynamic range compressor: disabled', o.osd_timeout)
return
end
local pretty = {}
for _,param in ipairs(params) do
local value = parse_value(filter.params[param.name])
if not (param.hide_default and value == o['default_' .. param.name]) then
pretty[#pretty+1] = string.format('%s: %g%s', param.name:gsub("^%l", string.upper), value, param.dB)
end
end
if #pretty == 0 then
pretty = ''
else
pretty = '\n(' .. table.concat(pretty, ', ') .. ')'
end
mp.commandv('show-text', 'Dynamic range compressor: enabled' .. pretty, o.osd_timeout)
end
local function get_filter()
local af = mp.get_property_native('af', {})
for i = 1, #af do
if af[i].label == o.filter_label then
return af, i
end
end
af[#af+1] = {
name = 'acompressor',
label = o.filter_label,
enabled = false,
params = {},
}
for _,param in pairs(params) do
af[#af].params[param.name] = format_value(o['default_' .. param.name], param.dB)
end
return af, #af
end
local function toggle_acompressor()
local af, i = get_filter()
af[i].enabled = not af[i].enabled
mp.set_property_native('af', af)
show_osd(af[i])
end
local function update_param(name, increment)
for _,param in pairs(params) do
if param.name == string.lower(name) then
local af, i = get_filter()
local value = parse_value(af[i].params[param.name])
value = math.max(param.min, math.min(value + increment, param.max))
af[i].params[param.name] = format_value(value, param.dB)
af[i].enabled = true
mp.set_property_native('af', af)
show_osd(af[i])
return
end
end
mp.msg.error('Unknown parameter "' .. name .. '"')
end
mp.add_key_binding(o.key_toggle, "toggle-acompressor", toggle_acompressor)
mp.register_script_message('update-param', update_param)
for _,param in pairs(params) do
for direction,step in pairs({increase=1, decrease=-1}) do
mp.add_key_binding(o['key_' .. direction .. '_' .. param.name],
'acompressor-' .. direction .. '-' .. param.name,
function() update_param(param.name, step*o['step_' .. param.name]); end,
{ repeatable = true })
end
end
if o.default_enable then
local af, i = get_filter()
af[i].enabled = true
mp.set_property_native('af', af)
end
+3 -4
View File
@@ -66,8 +66,8 @@ function autocrop_start()
-- insert the cropdetect filter
ret=mp.command(
string.format(
'vf add @%s:cropdetect=limit=%f:round=2:reset=0',
cropdetect_label, 24/255
'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"',
cropdetect_label
)
)
-- wait to gather data
@@ -79,7 +79,6 @@ function do_crop()
local cropdetect_metadata = mp.get_property_native(
string.format("vf-metadata/%s", cropdetect_label)
)
-- use it to crop if its valid
if cropdetect_metadata then
if cropdetect_metadata["lavfi.cropdetect.w"]
@@ -87,7 +86,7 @@ function do_crop()
and cropdetect_metadata["lavfi.cropdetect.x"]
and cropdetect_metadata["lavfi.cropdetect.y"]
then
mp.command(string.format("vf add @%s:lavfi-crop=w=%s:h=%s:x=%s:y=%s",
mp.command(string.format("vf add @%s:crop=%s:%s:%s:%s",
crop_label,
cropdetect_metadata["lavfi.cropdetect.w"],
cropdetect_metadata["lavfi.cropdetect.h"],
+27 -38
View File
@@ -3,13 +3,13 @@
-- currently playing video.
--
-- It registers the key-binding ctrl+d, which when pressed, inserts the filters
-- ``vf=idet,lavfi-pullup,idet``. After 4 seconds, it removes these
-- ``vf=lavfi=idet,pullup,vf=lavfi=idet``. After 4 seconds, it removes these
-- filters and decides whether the content is progressive, interlaced, or
-- telecined and the interlacing field dominance.
--
-- Based on this information, it may set mpv's ``deinterlace`` property (which
-- usually inserts the yadif filter), or insert the ``pullup`` filter if the
-- content is telecined. It also sets field dominance with lavfi setfield.
-- content is telecined. It also sets mpv's ``field-dominance`` property.
--
-- OPTIONS:
-- The default detection time may be overridden by adding
@@ -22,14 +22,16 @@
-- To see counts of the various types of frames for each detection phase,
-- the verbosity can be increased with
--
-- --msg-level=autodeint=v
-- --msg-level autodeint=v
--
-- This script requires a recent version of ffmpeg for which the idet
-- filter adds the required metadata.
require "mp.msg"
script_name = mp.get_script_name()
detect_label = string.format("%s-detect", script_name)
pullup_label = string.format("%s", script_name)
dominance_label = string.format("%s-dominance", script_name)
ivtc_detect_label = string.format("%s-ivtc-detect", script_name)
-- number of seconds to gather cropdetect data
@@ -53,10 +55,6 @@ function del_filter_if_present(label)
return false
end
local function add_vf(label, filter)
return mp.command(('vf add @%s:%s'):format(label, filter))
end
function start_detect()
-- exit if detection is already in progress
if timer then
@@ -66,13 +64,11 @@ function start_detect()
mp.set_property("deinterlace","no")
del_filter_if_present(pullup_label)
del_filter_if_present(dominance_label)
-- insert the detection filters
if not (add_vf(detect_label, 'idet') and
add_vf(dominance_label, 'setfield=mode=auto') and
add_vf(pullup_label, 'lavfi-pullup') and
add_vf(ivtc_detect_label, 'idet')) then
-- insert the detection filter
local cmd = string.format('vf add @%s:lavfi=graph="idet",@%s:pullup,@%s:lavfi=graph="idet"',
detect_label, pullup_label, ivtc_detect_label)
if not mp.command(cmd) then
mp.msg.error("failed to insert detection filters")
return
end
@@ -92,12 +88,12 @@ progressive, interlaced_tff, interlaced_bff, interlaced = 0, 1, 2, 3, 4
function judge(label)
-- get the metadata
local result = mp.get_property_native(string.format("vf-metadata/%s", label))
local num_tff = tonumber(result["lavfi.idet.multiple.tff"])
local num_bff = tonumber(result["lavfi.idet.multiple.bff"])
local num_progressive = tonumber(result["lavfi.idet.multiple.progressive"])
local num_undetermined = tonumber(result["lavfi.idet.multiple.undetermined"])
local num_interlaced = num_tff + num_bff
local num_determined = num_interlaced + num_progressive
num_tff = tonumber(result["lavfi.idet.multiple.tff"])
num_bff = tonumber(result["lavfi.idet.multiple.bff"])
num_progressive = tonumber(result["lavfi.idet.multiple.progressive"])
num_undetermined = tonumber(result["lavfi.idet.multiple.undetermined"])
num_interlaced = num_tff + num_bff
num_determined = num_interlaced + num_progressive
mp.msg.verbose(label.." progressive = "..num_progressive)
mp.msg.verbose(label.." interlaced-tff = "..num_tff)
@@ -120,33 +116,26 @@ end
function select_filter()
-- handle the first detection filter results
local verdict = judge(detect_label)
local ivtc_verdict = judge(ivtc_detect_label)
local dominance = "auto"
verdict = judge(detect_label)
if verdict == progressive then
mp.msg.info("progressive: doing nothing")
stop_detect()
del_filter_if_present(dominance_label)
del_filter_if_present(pullup_label)
return
else
if verdict == interlaced_tff then
dominance = "tff"
add_vf(dominance_label, 'setfield=mode='..dominance)
elseif verdict == interlaced_bff then
dominance = "bff"
add_vf(dominance_label, 'setfield=mode='..dominance)
else
del_filter_if_present(dominance_label)
end
elseif verdict == interlaced_tff then
mp.set_property("field-dominance", "top")
elseif verdict == interlaced_bff then
mp.set_property("field-dominance", "bottom")
elseif verdict == interlaced then
mp.set_property("field-dominance", "auto")
end
-- handle the ivtc detection filter results
if ivtc_verdict == progressive then
mp.msg.info(string.format("telecined with %s field dominance: using pullup", dominance))
verdict = judge(ivtc_detect_label)
if verdict == progressive then
mp.msg.info(string.format("telecinied with %s field dominance: using pullup", mp.get_property("field-dominance")))
stop_detect()
else
mp.msg.info(string.format("interlaced with %s field dominance: setting deinterlace property", dominance))
mp.msg.info(string.format("interlaced with %s field dominance: setting deinterlace property", mp.get_property("field-dominance")))
del_filter_if_present(pullup_label)
mp.set_property("deinterlace","yes")
stop_detect()
+8 -35
View File
@@ -53,37 +53,6 @@ table.filter = function(t, iter)
end
end
-- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
-- Released under the MIT License
-- http://www.davekoelle.com/files/alphanum.lua
-- split a string into a table of number and string values
function splitbynum(s)
local result = {}
for x, y in (s or ""):gmatch("(%d*)(%D*)") do
if x ~= "" then table.insert(result, tonumber(x)) end
if y ~= "" then table.insert(result, y) end
end
return result
end
function clean_key(k)
k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
return splitbynum(k)
end
-- compare two strings
function alnumcomp(x, y)
local xt, yt = clean_key(x), clean_key(y)
for i = 1, math.min(#xt, #yt) do
local xe, ye = xt[i], yt[i]
if type(xe) == "string" then ye = tostring(ye)
elseif type(ye) == "string" then xe = tostring(xe) end
if xe ~= ye then return xe < ye end
end
return #xt < #yt
end
function find_and_add_entries()
local path = mp.get_property("path", "")
local dir, filename = mputils.split_path(path)
@@ -103,16 +72,20 @@ function find_and_add_entries()
return
end
table.filter(files, function (v, k)
if string.match(v, "^%.") then
return false
end
local ext = get_extension(v)
if ext == nil then
return false
end
return EXTENSIONS[string.lower(ext)]
end)
table.sort(files, alnumcomp)
table.sort(files, function (a, b)
local len = string.len(a) - string.len(b)
if len ~= 0 then -- case for ordering filename ending with such as X.Y.Z
local ext = string.len(get_extension(a)) + 1
return string.sub(a, 1, -ext) < string.sub(b, 1, -ext)
end
return string.lower(a) < string.lower(b)
end)
if dir == "." then
dir = ""
+99
View File
@@ -0,0 +1,99 @@
-- This script enables live control of the dynamic range compression
-- (drc) audio filter while the video is playing back. This can be
-- useful to avoid having to stop and restart mpv to adjust filter
-- parameters. See the entry for "drc" under the "AUDIO FILTERS"
-- section of the man page for a complete description of the filter.
--
-- This script registers the key-binding "\" to toggle the filter between
--
-- * off
-- * method=1 (single-sample smoothing)
-- * method=2 (multi-sample smoothing)
--
-- It registers the keybindings ctrl+9/ctrl+0 to decrease/increase the
-- target ampltiude. These keys will insert the filter at the default
-- target amplitude of 0.25 if it was not previously present.
--
-- OSD feedback of the current filter state is displayed on pressing
-- each bound key.
script_name = mp.get_script_name()
function print_state(params)
if params then
mp.osd_message(script_name..":\n"
.."method = "..params["method"].."\n"
.."target = "..params["target"])
else
mp.osd_message(script_name..":\noff")
end
end
function get_index_of_drc(afs)
for i,af in pairs(afs) do
if af["label"] == script_name then
return i
end
end
end
function append_drc(afs)
afs[#afs+1] = {
name = "drc",
label = script_name,
params = {
method = "1",
target = "0.25"
}
}
print_state(afs[#afs]["params"])
end
function modify_or_create_af(fun)
afs = mp.get_property_native("af")
i = get_index_of_drc(afs)
if not i then
append_drc(afs)
else
fun(afs, i)
end
mp.set_property_native("af", afs)
end
function drc_toggle_method_handler()
modify_or_create_af(
function (afs, i)
new_method=(afs[i]["params"]["method"]+1)%3
if new_method == 0 then
table.remove(afs, i)
print_state(nil)
else
afs[i]["params"]["method"] = tostring((afs[i]["params"]["method"])%2+1)
print_state(afs[i]["params"])
end
end
)
end
function drc_scale_target(factor)
modify_or_create_af(
function (afs)
afs[i]["params"]["target"] = tostring(afs[i]["params"]["target"]*factor)
print_state(afs[i]["params"])
end
)
end
function drc_louder_handler()
drc_scale_target(2.0)
end
function drc_quieter_handler()
drc_scale_target(0.5)
end
-- toggle between off, method 1 and method 2
mp.add_key_binding("\\", "drc_toggle_method", drc_toggle_method_handler)
-- increase or decrease target volume
mp.add_key_binding("ctrl+9", "drc_quieter", drc_quieter_handler)
mp.add_key_binding("ctrl+0", "drc_louder", drc_louder_handler)
+6 -27
View File
@@ -18,10 +18,10 @@ function update_status_line()
atsl("(Buffering) ")
end
if mp.get_property("aid") ~= "no" then
if mp.get_property("vid") ~= "no" then
atsl("A")
end
if mp.get_property("vid") ~= "no" then
if mp.get_property("aid") ~= "no" then
atsl("V")
end
@@ -43,7 +43,7 @@ function update_status_line()
r = mp.get_property_number("avsync", nil)
if r ~= nil then
atsl(string.format(" A-V: %f", r))
atsl(string.format(" A-V: %7.3f", r))
end
r = mp.get_property("total-avsync-change", 0)
@@ -51,24 +51,12 @@ function update_status_line()
atsl(string.format(" ct:%7.3f", r))
end
r = mp.get_property_number("decoder-drop-frame-count", -1)
r = mp.get_property_number("drop-frame-count", -1)
if r > 0 then
atsl(" Late: ")
atsl(r)
end
r = mp.get_property_osd("video-bitrate")
if r ~= nil and r ~= "" then
atsl(" Vb: ")
atsl(r)
end
r = mp.get_property_osd("audio-bitrate")
if r ~= nil and r ~= "" then
atsl(" Ab: ")
atsl(r)
end
r = mp.get_property_number("cache", 0)
if r > 0 then
atsl(string.format(" Cache: %d%% ", r))
@@ -78,15 +66,6 @@ function update_status_line()
mp.set_property("options/term-status-msg", newStatus)
end
timer = mp.add_periodic_timer(1, update_status_line)
-- Register the event
mp.register_event("tick", update_status_line)
function on_pause_change(name, value)
if value == false then
timer:resume()
else
timer:stop()
end
mp.add_timeout(0.1, update_status_line)
end
mp.observe_property("pause", "bool", on_pause_change)
mp.register_event("seek", update_status_line)
+18 -29
View File
@@ -1,24 +1,25 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""
Generate C definitions for parsing Matroska files.
Can also be used to directly parse Matroska files and display their contents.
"""
#
# This file is part of mpv.
# This file is part of MPlayer.
#
# mpv 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.
# MPlayer is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# MPlayer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along
# with MPlayer; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# for compatibility with Python 2.x
@@ -68,12 +69,6 @@ elements_matroska = (
'BlockDuration, 9b, uint',
'ReferenceBlock*, fb, sint',
'DiscardPadding, 75A2, sint',
'BlockAdditions, 75A1, sub', (
'BlockMore*, A6, sub', (
'BlockAddID, EE, uint',
'BlockAdditional, A5, binary',
),
),
),
'SimpleBlock*, a3, binary',
),
@@ -137,13 +132,6 @@ elements_matroska = (
'LuminanceMin, 55DA, float',
),
),
'Projection, 7670, sub', (
'ProjectionType, 7671, uint',
'ProjectionPrivate, 7672, binary',
'ProjectionPoseYaw, 7673, float',
'ProjectionPosePitch, 7674, float',
'ProjectionPoseRoll, 7675, float',
),
),
'Audio, e1, sub', (
'SamplingFrequency, b5, float',
@@ -283,7 +271,6 @@ def parse_elems(l, namespace):
for el in l:
if isinstance(el, str):
name, hexid, eltype = [x.strip() for x in el.split(',')]
hexid = hexid.lower()
multiple = name.endswith('*')
name = name.strip('*')
new = MatroskaElement(name, hexid, eltype, namespace)
@@ -298,8 +285,8 @@ parse_elems(elements_ebml, 'EBML')
parse_elems(elements_matroska, 'MATROSKA')
def printf(out, *args):
out.write(u' '.join([str(x) for x in args]))
out.write(u'\n')
out.write(' '.join([str(x) for x in args]))
out.write('\n')
def generate_C_header(out):
printf(out, '// Generated by TOOLS/matroska.py, do not edit manually')
@@ -413,6 +400,10 @@ def read_float(s, length):
def parse_one(s, depth, parent, maxlen):
elid = hexlify(read_id(s)).decode('ascii')
elem = elementd.get(elid)
if parent is not None and elid not in parent.subids and elid not in ('ec', 'bf'):
print('Unexpected:', elid)
if 1:
raise NotImplementedError
size, length = read_vint(s)
this_length = len(elid) / 2 + size + length
if elem is not None:
@@ -451,7 +442,7 @@ def parse_one(s, depth, parent, maxlen):
else:
raise NotImplementedError
else:
print(" " * depth, '[' + elid + '] Unknown element! size:', length)
print(depth, 'Unknown element:', elid, 'size:', length)
read(s, length)
return this_length
@@ -464,8 +455,6 @@ if __name__ == "__main__":
elif sys.argv[1] == '--generate-definitions':
generate_C_definitions(sys.stdout)
else:
if sys.version_info.major < 3:
raise Exception("Dumping requires Python 3.")
s = open(sys.argv[1], "rb")
while 1:
start = s.tell()
@@ -1,6 +0,0 @@
StartChar: .notdef
Encoding: 65536 -1 0
Width: 400
Flags: W
LayerCount: 2
EndChar
-77
View File
@@ -1,77 +0,0 @@
SplineFontDB: 3.0
FontName: mpv-osd-symbols-Regular
FullName: mpv-osd-symbols Regular
FamilyName: mpv-osd-symbols
Weight: Normal
Copyright: This is generated file.
Version: 001.000
ItalicAngle: 0
UnderlinePosition: -133
UnderlineWidth: 50
Ascent: 800
Descent: 200
InvalidEm: 0
sfntRevision: 0x00010000
LayerCount: 2
Layer: 0 0 "Back" 1
Layer: 1 0 "Fore" 0
XUID: [1021 879 -1597228462 15927]
StyleMap: 0x0040
FSType: 8
OS2Version: 3
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 0
CreationTime: 1408646554
ModificationTime: 1492879730
PfmFamily: 81
TTFWeight: 400
TTFWidth: 5
LineGap: 0
VLineGap: 0
Panose: 0 0 5 0 0 0 0 0 0 0
OS2TypoAscent: 800
OS2TypoAOffset: 0
OS2TypoDescent: -200
OS2TypoDOffset: 0
OS2TypoLinegap: 90
OS2WinAscent: 1000
OS2WinAOffset: 0
OS2WinDescent: 200
OS2WinDOffset: 0
HheadAscent: 1000
HheadAOffset: 0
HheadDescent: -200
HheadDOffset: 0
OS2SubXSize: 650
OS2SubYSize: 600
OS2SubXOff: 0
OS2SubYOff: 75
OS2SupXSize: 650
OS2SupYSize: 600
OS2SupXOff: 0
OS2SupYOff: 350
OS2StrikeYSize: 50
OS2StrikeYPos: 220
OS2Vendor: 'PfEd'
OS2CodePages: 00000001.00000000
OS2UnicodeRanges: 00000000.00000000.00000000.00000000
DEI: 91125
LangName: 1033 "" "" "Regular" "1.000;PfEd;mpv-osd-symbols-Regular" "mpv-osd-symbols" "Version 1.000;PS 001.000;hotconv 1.0.70;makeotf.lib2.5.58329"
Encoding: UnicodeBmp
UnicodeInterp: none
NameList: AGL For New Fonts
DisplaySize: -72
AntiAlias: 1
FitToEm: 0
WinInfo: 57600 8 2
BeginPrivate: 8
BlueValues 31 [-10 0 640 650 720 730 800 810]
BlueScale 5 0.037
BlueShift 1 0
BlueFuzz 1 0
StdHW 4 [65]
StdVW 4 [65]
StemSnapH 8 [65 800]
StemSnapV 8 [65 150]
EndPrivate
EndSplineFont
-16
View File
@@ -1,16 +0,0 @@
StartChar: uniE001
Encoding: 57345 57345 1
Width: 880
GlyphClass: 2
Flags: MW
HStem: 780 20G<200 200>
VStem: 200 375<400 400 400 800>
LayerCount: 2
Fore
SplineSet
575 400 m 1
200 0 l 1
200 800 l 1
575 400 l 1
EndSplineSet
EndChar
-22
View File
@@ -1,22 +0,0 @@
StartChar: uniE002
Encoding: 57346 57346 2
Width: 880
GlyphClass: 2
Flags: MW
HStem: 0 800<200 350 200 350 200 500 500 650>
VStem: 200 150<0 800 0 800> 500 150<0 800 0 800>
LayerCount: 2
Fore
SplineSet
350 800 m 1
350 0 l 1
200 0 l 1
200 800 l 1
350 800 l 1
650 800 m 1
650 0 l 1
500 0 l 1
500 800 l 1
650 800 l 1
EndSplineSet
EndChar
-17
View File
@@ -1,17 +0,0 @@
StartChar: uniE003
Encoding: 57347 57347 3
Width: 880
GlyphClass: 2
Flags: MW
HStem: 0 720<110 775 110 775>
VStem: 110 665<0 720 0 720>
LayerCount: 2
Fore
SplineSet
775 720 m 1
775 0 l 1
110 0 l 1
110 720 l 1
775 720 l 1
EndSplineSet
EndChar
-20
View File
@@ -1,20 +0,0 @@
StartChar: uniE004
Encoding: 57348 57348 4
Width: 880
GlyphClass: 2
Flags: MW
HStem: 780 20G<423 423 813 813>
VStem: 48 765<400 400>
LayerCount: 2
Fore
SplineSet
423 800 m 1
423 0 l 1
48 400 l 1
423 800 l 1
813 800 m 1
813 0 l 1
438 400 l 1
813 800 l 1
EndSplineSet
EndChar
-20
View File
@@ -1,20 +0,0 @@
StartChar: uniE005
Encoding: 57349 57349 5
Width: 880
GlyphClass: 2
Flags: MW
HStem: 780 20G<95 95 485 485>
VStem: 95 765<400 400 400 800 400 800>
LayerCount: 2
Fore
SplineSet
470 400 m 1
95 0 l 1
95 800 l 1
470 400 l 1
860 400 m 1
485 0 l 1
485 800 l 1
860 400 l 1
EndSplineSet
EndChar
-47
View File
@@ -1,47 +0,0 @@
StartChar: uniE006
Encoding: 57350 57350 6
Width: 880
GlyphClass: 2
Flags: MW
HStem: -10 11<396 461 396 543> 196 171<397 461 396 462> 401 31 801 9<397 462 397 397>
VStem: 20 9<369 434 369 513> 224 173<369 408 367 434 367 434> 363 34 397 65<367 404 367 408 367 404 606 801> 462 173<368 404 404 404> 830 10<368 433 433 433>
LayerCount: 2
Fore
SplineSet
430 810 m 0x9940
656 810 840 626 840 400 c 0
840 174 656 -10 430 -10 c 0
204 -10 20 174 20 400 c 0
20 626 204 810 430 810 c 0x9940
397 606 m 1x5280
462 606 l 1
462 801 l 1
397 801 l 1
397 606 l 1x5280
462 367 m 1
462 404 l 1
710 627 l 1
683 657 l 1
439 437 l 1
363 592 l 1
318 570 l 1x4280
397 408 l 1
397 367 l 1x44
462 367 l 1
224 434 m 1
29 434 l 1
29 369 l 1
224 369 l 1
224 434 l 1
830 368 m 1
830 433 l 1
635 433 l 1
635 368 l 1
830 368 l 1
461 196 m 1
396 196 l 1
396 1 l 1
461 1 l 1
461 196 l 1
EndSplineSet
EndChar
-21
View File
@@ -1,21 +0,0 @@
StartChar: uniE007
Encoding: 57351 57351 7
Width: 880
GlyphClass: 2
Flags: MW
HStem: -10 80<339 430 339 543> 730 80<339 430>
VStem: 20 80<309 491 309 513>
LayerCount: 2
Fore
SplineSet
430 -10 m 0
204 -10 20 174 20 400 c 0
20 626 204 810 430 810 c 0
656 810 840 626 840 400 c 0
840 174 656 -10 430 -10 c 0
430 70 m 1
430 730 l 1
248 730 100 582 100 400 c 0
100 218 248 70 430 70 c 1
EndSplineSet
EndChar
-37
View File
@@ -1,37 +0,0 @@
StartChar: uniE008
Encoding: 57352 57352 8
Width: 880
GlyphClass: 2
Flags: MW
HStem: -10 80<339 521 339 543> 240 160<269 313 546 590> 480 160<408 452> 730 80<339 521>
VStem: 20 80<309 491 309 513> 211 160<298 342> 350 160<538 582> 488 160<298 342> 760 80<309 491>
LayerCount: 2
Fore
SplineSet
430 -10 m 0xfa80
204 -10 20 174 20 400 c 0
20 626 204 810 430 810 c 0
656 810 840 626 840 400 c 0
840 174 656 -10 430 -10 c 0xfa80
430 70 m 0
612 70 760 218 760 400 c 0
760 582 612 730 430 730 c 0
248 730 100 582 100 400 c 0
100 218 248 70 430 70 c 0
430 480 m 0
386 480 350 516 350 560 c 0
350 604 386 640 430 640 c 0
474 640 510 604 510 560 c 0
510 516 474 480 430 480 c 0
291 240 m 0xfd80
247 240 211 276 211 320 c 0
211 364 247 400 291 400 c 0
335 400 371 364 371 320 c 0
371 276 335 240 291 240 c 0xfd80
568 240 m 0
524 240 488 276 488 320 c 0
488 364 524 400 568 400 c 0
612 400 648 364 648 320 c 0
648 276 612 240 568 240 c 0
EndSplineSet
EndChar
-17
View File
@@ -1,17 +0,0 @@
StartChar: uniE009
Encoding: 57353 57353 9
Width: 880
Flags: HMW
LayerCount: 2
Fore
SplineSet
716 10 m 1
378 244 l 1
165 244 l 1
165 559 l 1
379 559 l 1
716 793 l 1
716 10 l 1
EndSplineSet
Validated: 1
EndChar
-50
View File
@@ -1,50 +0,0 @@
StartChar: uniE00A
Encoding: 57354 57354 10
Width: 880
GlyphClass: 2
Flags: MW
HStem: 252 48<406 406 456 456> 375 50<57 282 57 282 578 805> 500 48<406 406> 627 20G<149 149 713 713>
VStem: 282 48<375 375 425 425> 406 50<26 252 26 252 548 774> 530 48<375 375>
LayerCount: 2
Fore
SplineSet
805 375 m 1
578 375 l 1
574 352 565 331 553 313 c 1
713 153 l 1
678 118 l 1
518 278 l 1
500 265 479 256 456 252 c 1
456 26 l 1
406 26 l 1
406 252 l 1
383 256 362 265 343 277 c 1
184 118 l 1
149 153 l 1
308 312 l 1
295 330 286 352 282 375 c 1
57 375 l 1
57 425 l 1
282 425 l 1
286 448 295 470 308 488 c 1
149 647 l 1
184 682 l 1
343 523 l 1
362 535 383 544 406 548 c 1
406 774 l 1
456 774 l 1
456 548 l 1
479 544 500 535 518 522 c 1
678 682 l 1
713 647 l 1
553 487 l 1
565 469 574 448 578 425 c 1
805 425 l 1
805 375 l 1
430 300 m 0
485 300 530 345 530 400 c 0
530 455 485 500 430 500 c 0
375 500 330 455 330 400 c 0
330 345 375 300 430 300 c 0
EndSplineSet
EndChar
-27
View File
@@ -1,27 +0,0 @@
StartChar: uniE00B
Encoding: 57355 57355 11
Width: 880
GlyphClass: 2
Flags: MW
HStem: -10 244<341 519 341 543> 566 54<413.5 446.5 413.5 519> 740 70<413.5 446.5>
VStem: 20 88<354 446 354 513> 752 88<354 446>
LayerCount: 2
Fore
SplineSet
430 -10 m 0
204 -10 20 174 20 400 c 0
20 626 204 810 430 810 c 0
656 810 840 626 840 400 c 0
840 174 656 -10 430 -10 c 0
430 620 m 0
463 620 490 647 490 680 c 0
490 713 463 740 430 740 c 0
397 740 370 713 370 680 c 0
370 647 397 620 430 620 c 0
430 234 m 0
608 234 752 308 752 400 c 0
752 492 608 566 430 566 c 0
252 566 108 492 108 400 c 0
108 308 252 234 430 234 c 0
EndSplineSet
EndChar
-21
View File
@@ -1,21 +0,0 @@
StartChar: uniE010
Encoding: 57360 57360 12
Width: 334
GlyphClass: 2
Flags: MW
HStem: 0 90<221 258 221 258> 550 90<221 258 221 221>
VStem: 76 145<90 550 90 640 90 640>
LayerCount: 2
Fore
SplineSet
258 640 m 1
258 550 l 1
221 550 l 1
221 90 l 1
258 90 l 1
258 0 l 1
76 0 l 1
76 640 l 1
258 640 l 1
EndSplineSet
EndChar
-17
View File
@@ -1,17 +0,0 @@
StartChar: uniE011
Encoding: 57361 57361 13
Width: 334
GlyphClass: 2
Flags: MW
HStem: 0 640<84 250 84 250>
VStem: 84 166<0 640 0 640>
LayerCount: 2
Fore
SplineSet
250 640 m 1
250 0 l 1
84 0 l 1
84 640 l 1
250 640 l 1
EndSplineSet
EndChar
-21
View File
@@ -1,21 +0,0 @@
StartChar: uniE012
Encoding: 57362 57362 14
Width: 334
GlyphClass: 2
Flags: MW
HStem: 0 90<76 113 76 258 76 113> 550 90<76 113 76 258>
VStem: 113 145<90 550 550 550>
LayerCount: 2
Fore
SplineSet
113 90 m 1
113 550 l 1
76 550 l 1
76 640 l 1
258 640 l 1
258 0 l 1
76 0 l 1
76 90 l 1
113 90 l 1
EndSplineSet
EndChar
-17
View File
@@ -1,17 +0,0 @@
StartChar: uniE013
Encoding: 57363 57363 15
Width: 334
GlyphClass: 2
Flags: MW
HStem: 255 130<102 232 102 232>
VStem: 102 130<255 385 255 385>
LayerCount: 2
Fore
SplineSet
232 385 m 1
232 255 l 1
102 255 l 1
102 385 l 1
232 385 l 1
EndSplineSet
EndChar
-16
View File
@@ -1,16 +0,0 @@
StartChar: uniE101
Encoding: 57601 57601 16
Width: 880
GlyphClass: 2
Flags: MW
HStem: 780 20G<222 222>
VStem: 222 600<400 400 400 800 400 800>
LayerCount: 2
Fore
SplineSet
822 400 m 1
222 0 l 1
222 800 l 1
822 400 l 1
EndSplineSet
EndChar
-25
View File
@@ -1,25 +0,0 @@
StartChar: uniE104
Encoding: 57604 57604 17
Width: 880
GlyphClass: 2
Flags: MW
HStem: 0 800<3 126 3 126 3 502 3 878> 780 20G<3 126 126 126 502 502 878 878>
VStem: 3 123<0 800 0 800>
LayerCount: 2
Fore
SplineSet
126 800 m 1x60
126 0 l 1
3 0 l 1xa0
3 800 l 1
126 800 l 1x60
502 800 m 1
502 0 l 1
127 400 l 1
502 800 l 1
878 800 m 1
878 0 l 1
503 400 l 1
878 800 l 1
EndSplineSet
EndChar
-25
View File
@@ -1,25 +0,0 @@
StartChar: uniE105
Encoding: 57605 57605 18
Width: 880
GlyphClass: 2
Flags: MW
HStem: 0 800<3 3 3 379 3 755 755 878> 780 20G<3 3 379 379 755 878 878 878>
VStem: 755 123<0 800>
LayerCount: 2
Fore
SplineSet
3 0 m 1x60
3 800 l 1
378 400 l 1
3 0 l 1x60
379 0 m 1xa0
379 800 l 1
754 400 l 1
379 0 l 1xa0
878 0 m 1
755 0 l 1
755 800 l 1
878 800 l 1
878 0 l 1
EndSplineSet
EndChar
-22
View File
@@ -1,22 +0,0 @@
StartChar: uniE106
Encoding: 57606 57606 19
Width: 880
GlyphClass: 2
Flags: MW
HStem: 0 649<68.5 556.5>
VStem: 0 880
LayerCount: 2
Fore
SplineSet
880 380 m 0
880 230 685 101 449 101 c 0
390 101 336 107 283 118 c 1
278 49 189 0 85 0 c 0
52 0 24 14 0 40 c 1
82 48 137 93 137 158 c 0
137 163 137 168 135 172 c 0
58 217 19 273 19 380 c 0
19 528 258 649 449 649 c 0
664 649 880 508 880 380 c 0
EndSplineSet
EndChar
-56
View File
@@ -1,56 +0,0 @@
StartChar: uniE107
Encoding: 57607 57607 20
Width: 880
GlyphClass: 2
Flags: MW
HStem: 0 60<0 60 60 820> 106 50<146 343 146 343 146 390 390 641 680 735> 207 50<99 317 99 317 99 363 363 488 529 781> 580 60<60 820 60 820>
VStem: 0 60<60 580> 99 218<207 257 207 257> 146 197<106 156 106 156> 363 125<207 257 207 257> 529 112<106 257 106 257> 680 55<106 156 106 156> 820 60<0 60 60 580>
LayerCount: 2
Fore
SplineSet
0 60 m 2xfde0
0 580 l 2
0 610 30 640 60 640 c 2
820 640 l 2
850 640 880 610 880 580 c 2
880 60 l 2
880 30 850 0 820 0 c 2
60 0 l 2
30 0 0 30 0 60 c 2xfde0
60 60 m 1
820 60 l 1
820 580 l 1
60 580 l 1
60 60 l 1
317 257 m 1
317 207 l 1
99 207 l 1
99 257 l 1
317 257 l 1
488 257 m 1
488 207 l 1
363 207 l 1
363 257 l 1
488 257 l 1
781 257 m 1
781 207 l 1
529 207 l 1
529 257 l 1
781 257 l 1
343 156 m 1x4280
343 106 l 1
146 106 l 1
146 156 l 1
343 156 l 1x4280
641 156 m 1
641 106 l 1
390 106 l 1
390 156 l 1x41c0
641 156 l 1
735 156 m 1
735 106 l 1
680 106 l 1
680 156 l 1
735 156 l 1
EndSplineSet
EndChar
-39
View File
@@ -1,39 +0,0 @@
StartChar: uniE108
Encoding: 57608 57608 21
Width: 880
GlyphClass: 2
Flags: MW
HStem: 80 60<0 60 60 820> 321 159<274 606 274 606> 660 60<60 820 60 820>
VStem: 0 60<140 660> 274 332<321 480 321 480> 820 60<80 140 140 660>
LayerCount: 2
Fore
SplineSet
0 140 m 2
0 660 l 2
0 690 30 720 60 720 c 2
820 720 l 2
850 720 880 690 880 660 c 2
880 140 l 2
880 110 850 80 820 80 c 2
60 80 l 2
30 80 0 110 0 140 c 2
60 140 m 1
820 140 l 1
820 660 l 1
60 660 l 1
60 140 l 1
580 600 m 1
760 600 l 1
760 420 l 1
580 600 l 1
606 480 m 1
606 321 l 1
274 321 l 1
274 480 l 1
606 480 l 1
300 200 m 1
120 200 l 1
120 380 l 1
300 200 l 1
EndSplineSet
EndChar
-39
View File
@@ -1,39 +0,0 @@
StartChar: uniE109
Encoding: 57609 57609 22
Width: 880
GlyphClass: 2
Flags: MW
HStem: 80 60<0 60 60 820> 296 209<285 595 285 595> 660 60<60 820 60 820>
VStem: 0 60<140 660> 120 107<400 400 400 510> 285 310<296 505 296 505> 653 107<400 400> 820 60<80 140 140 660>
LayerCount: 2
Fore
SplineSet
0 140 m 2
0 660 l 2
0 690 30 720 60 720 c 2
820 720 l 2
850 720 880 690 880 660 c 2
880 140 l 2
880 110 850 80 820 80 c 2
60 80 l 2
30 80 0 110 0 140 c 2
60 140 m 1
820 140 l 1
820 660 l 1
60 660 l 1
60 140 l 1
227 400 m 1
120 290 l 1
120 510 l 1
227 400 l 1
760 290 m 1
653 400 l 1
760 510 l 1
760 290 l 1
595 505 m 1
595 296 l 1
285 296 l 1
285 505 l 1
595 505 l 1
EndSplineSet
EndChar
-36
View File
@@ -1,36 +0,0 @@
StartChar: uniE10A
Encoding: 57610 57610 23
Width: 1977
GlyphClass: 2
Flags: HMWO
HStem: 242 248<2 155 2 156>
LayerCount: 2
Fore
SplineSet
398 58 m 1
155 242 l 1
2 242 l 1
2 490 l 1
156 490 l 1
398 674 l 1
398 58 l 1
809 524 m 0
814 524 819 523 823 519 c 0
831 511 831 499 823 491 c 2
697 365 l 1
823 239 l 2
830 232 830 221 823 213 c 0
816 206 804 206 797 213 c 2
671 339 l 1
545 213 l 2
538 206 525 206 518 213 c 0
510 221 510 233 518 241 c 2
643 367 l 1
517 493 l 2
510 500 510 511 517 519 c 0
525 526 536 526 544 519 c 2
670 393 l 1
796 519 l 2
799 523 804 524 809 524 c 0
EndSplineSet
EndChar
-26
View File
@@ -1,26 +0,0 @@
StartChar: uniE10B
Encoding: 57611 57611 24
Width: 1977
GlyphClass: 2
Flags: MW
HStem: 242 248<2 155 2 156>
VStem: 603 47<326.5 405>
LayerCount: 2
Fore
SplineSet
650 366 m 0
650 281 615 198 545 119 c 1
507 142 l 1
571 213 603 287 603 366 c 0
603 444 571 518 507 590 c 1
545 613 l 1
615 534 650 452 650 366 c 0
398 58 m 1
155 242 l 1
2 242 l 1
2 490 l 1
156 490 l 1
398 674 l 1
398 58 l 1
EndSplineSet
EndChar
-33
View File
@@ -1,33 +0,0 @@
StartChar: uniE10C
Encoding: 57612 57612 25
Width: 1977
GlyphClass: 2
Flags: MW
HStem: 242 248<2 155 2 156>
VStem: 603 47<326.5 405> 717 47<316.5 416>
LayerCount: 2
Fore
SplineSet
764 366 m 0
764 258 720 156 631 61 c 1
593 84 l 1
675 173 717 267 717 366 c 0
717 466 675 559 593 647 c 1
631 671 l 1
720 578 764 476 764 366 c 0
650 366 m 0
650 281 615 198 545 119 c 1
507 142 l 1
571 213 603 287 603 366 c 0
603 444 571 518 507 590 c 1
545 613 l 1
615 534 650 452 650 366 c 0
398 58 m 1
155 242 l 1
2 242 l 1
2 490 l 1
156 490 l 1
398 674 l 1
398 58 l 1
EndSplineSet
EndChar
-40
View File
@@ -1,40 +0,0 @@
StartChar: uniE10D
Encoding: 57613 57613 26
Width: 1977
GlyphClass: 2
Flags: MW
HStem: 242 248<2 155 2 156> 709 20G<717 717>
VStem: 603 47<326.5 405> 717 47<316.5 416> 830 47<304 426.5>
LayerCount: 2
Fore
SplineSet
877 366 m 0
877 236 824 115 717 3 c 1
679 27 l 1
780 130 830 242 830 366 c 0
830 487 780 600 679 705 c 1
717 729 l 1
824 617 877 496 877 366 c 0
764 366 m 0
764 258 720 156 631 61 c 1
593 84 l 1
675 173 717 267 717 366 c 0
717 466 675 559 593 647 c 1
631 671 l 1
720 578 764 476 764 366 c 0
650 366 m 0
650 281 615 198 545 119 c 1
507 142 l 1
571 213 603 287 603 366 c 0
603 444 571 518 507 590 c 1
545 613 l 1
615 534 650 452 650 366 c 0
398 58 m 1
155 242 l 1
2 242 l 1
2 490 l 1
156 490 l 1
398 674 l 1
398 58 l 1
EndSplineSet
EndChar
-53
View File
@@ -1,53 +0,0 @@
StartChar: uniE10E
Encoding: 57614 57614 27
Width: 1977
GlyphClass: 2
Flags: MW
HStem: 49 95<806 818.5> 242 248<2 155 2 156>
VStem: 559 47<326.5 405> 673 47<316.5 416> 767 91<90 103.5 648 652>
LayerCount: 2
Fore
SplineSet
720 366 m 0
720 258 676 156 587 61 c 1
549 84 l 1
631 173 673 267 673 366 c 0
673 466 631 559 549 647 c 1
587 671 l 1
676 578 720 476 720 366 c 0
606 366 m 0
606 281 571 198 501 119 c 1
463 142 l 1
527 213 559 287 559 366 c 0
559 444 527 518 463 590 c 1
501 613 l 1
571 534 606 452 606 366 c 0
398 58 m 1
155 242 l 1
2 242 l 1
2 490 l 1
156 490 l 1
398 674 l 1
398 58 l 1
858 648 m 1
824 238 l 2
823 224 819 217 812 217 c 0
805 217 801 224 800 238 c 2
767 648 l 1
767 652 l 2
767 665 771 675 780 682 c 0
789 690 800 694 812 694 c 0
825 694 835 690 844 682 c 0
853 675 858 665 858 652 c 2
858 648 l 1
858 97 m 0
858 83 853 72 845 63 c 0
836 53 825 49 812 49 c 0
800 49 789 53 780 63 c 0
771 72 767 83 767 97 c 0
767 110 771 121 780 130 c 0
789 140 800 144 812 144 c 0
825 144 836 140 845 130 c 0
853 121 858 110 858 97 c 0
EndSplineSet
EndChar
-16
View File
@@ -1,16 +0,0 @@
StartChar: uniE110
Encoding: 57616 57616 28
Width: 880
GlyphClass: 2
Flags: MW
HStem: 780 20G<656 656>
VStem: 56 600<400 400>
LayerCount: 2
Fore
SplineSet
656 0 m 1
56 400 l 1
656 800 l 1
656 0 l 1
EndSplineSet
EndChar
-37
View File
@@ -1,37 +0,0 @@
StartChar: uniE111
Encoding: 57617 57617 29
Width: 880
GlyphClass: 2
Flags: W
LayerCount: 2
Fore
SplineSet
0 140 m 2
0 660 l 2
0 690 30 720 60 720 c 2
820 720 l 2
850 720 880 690 880 660 c 2
880 140 l 2
880 110 850 80 820 80 c 2
60 80 l 2
30 80 0 110 0 140 c 2
60 140 m 1
820 140 l 1
820 660 l 1
60 660 l 1
60 140 l 1
227 400 m 1
120 290 l 1
120 510 l 1
227 400 l 1
760 290 m 1
653 400 l 1
760 510 l 1
760 290 l 1
595 505 m 1
595 296 l 1
285 296 l 1
285 505 l 1
595 505 l 1
EndSplineSet
EndChar
+1 -1
View File
@@ -80,7 +80,7 @@ EOF
video-codec
video-format
video-aspect
container-fps
fps
width
height
dwidth
+1 -1
View File
@@ -173,7 +173,7 @@
</dict>
</array>
<key>CFBundleExecutable</key>
<string>mpv-wrapper.sh</string>
<string>mpv</string>
<key>CFBundleIconFile</key>
<string>icon</string>
<key>CFBundleIdentifier</key>
@@ -1,13 +0,0 @@
#!/bin/sh
export MPVBUNDLE="true"
# set the right args for the user specified standard shell
# to load the expected profiles and configs
args="-c"
case "$SHELL" in
*bash) args="-l $args";;
*zsh) args="-l -i $args";;
esac
cd "$(dirname "$0")"
$SHELL $args "./mpv --player-operation-mode=pseudo-gui"
@@ -0,0 +1 @@
player-operation-mode=pseudo-gui
+5 -1
View File
@@ -87,6 +87,10 @@ end
class Libav < TravisDepsBuilder
def build_map
{
"libav-stable" => {
:action => :stable,
:url => 'http://libav.org/releases/libav-12.tar.gz'
},
"libav-git" => {
:action => :git,
:url => "git://git.libav.org/libav.git"
@@ -129,7 +133,7 @@ end
class Dependencies < TravisDepsBuilder
def deps
packages = {
'linux' => 'pkg-config fontconfig libfribidi-dev yasm libxinerama-dev libxrandr-dev',
'linux' => 'pkg-config fontconfig libfribidi-dev yasm',
'osx' => 'pkg-config fontconfig freetype fribidi yasm'
}
package_manager_update
+1 -1
View File
@@ -11,7 +11,7 @@ if [ "x$TRAVIS_BRANCH" != "xmaster" ]; then
fi
TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE:-HEAD^..}
if git diff --quiet --name-only --exit-code "$TRAVIS_COMMIT_RANGE" DOCS/ VERSION; then
if git diff --quiet --name-only --exit-code "$TRAVIS_COMMIT_RANGE" DOCS/; then
exit;
fi
+50
View File
@@ -0,0 +1,50 @@
#
# Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
#
# This file is part of mpv's vf_dlopen examples.
#
# mpv's vf_dlopen examples are free software; you can redistribute them and/or
# modify them 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.
#
# mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
#
FILTERS = telecine tile rectangle framestep ildetect
COMMON = filterutils.o
OBJECTS = $(patsubst %,%.o,$(FILTERS)) $(COMMON)
HEADERS = $(wildcard *.h)
OUT = $(patsubst %,%.so,$(FILTERS))
CFLAGS ?= -Wall -Wextra -O3 -march=native -mtune=native -ffast-math
CPPFLAGS += -I../../video/filter
CFLAGS += -fPIC
LDFLAGS += -shared -fPIC
ifneq ($(LTO),)
CFLAGS += -flto
LDFLAGS += $(CFLAGS) -flto
endif
all: $(OUT)
clean:
$(RM) $(OBJECTS) $(OUT)
%.so: %.o $(COMMON)
$(CC) $(LDFLAGS) $(LIBS) -o $@ $(COMMON) $<
# FIXME replace this by real dependency tracking
%.o: %.c $(HEADERS)
+40
View File
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <assert.h>
#include <string.h>
#include "filterutils.h"
void copy_plane(
unsigned char *dest, unsigned dest_stride,
const unsigned char *src, unsigned src_stride,
unsigned length,
unsigned rows
)
{
unsigned i;
assert(dest_stride >= length);
assert(src_stride >= length);
for (i = 0; i < rows; ++i)
memcpy(&dest[dest_stride * i], &src[src_stride * i], length);
}
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
void copy_plane(
unsigned char *dest, unsigned dest_stride,
const unsigned char *src, unsigned src_stride,
unsigned length,
unsigned rows
);
+103
View File
@@ -0,0 +1,103 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vf_dlopen.h"
#include "filterutils.h"
#define MIN(a,b) ((a)<(b)?(a):(b))
/*
* frame stepping filter
*
* usage: --vf=dlopen=/path/to/framestep.so:5
*
* outputs every 5th frame
*
* usage: --vf=dlopen=/path/to/framestep.so:5:3
*
* outputs every 5th frame, starting with frame index 3 (default: 0)
*/
typedef struct {
int step, pos;
} framestep_data_t;
static int framestep_put_image(struct vf_dlopen_context *ctx)
{
framestep_data_t *framestep = ctx->priv;
// stepping
if (framestep->pos < 0)
return 0;
--framestep->pos;
if (framestep->pos >= 0)
return 0;
framestep->pos += framestep->step;
// copying
assert(ctx->inpic.planes == ctx->outpic[0].planes);
int np = ctx->inpic.planes;
int p;
for (p = 0; p < np; ++p) {
assert(ctx->inpic.planewidth[p] == ctx->outpic->planewidth[p]);
assert(ctx->inpic.planeheight[p] == ctx->outpic->planeheight[p]);
copy_plane(
ctx->outpic->plane[p],
ctx->outpic->planestride[p],
ctx->inpic.plane[p],
ctx->inpic.planestride[p],
MIN(ctx->inpic.planestride[p], ctx->outpic->planestride[p]),
ctx->inpic.planeheight[p]
);
}
ctx->outpic->pts = ctx->inpic.pts;
return 1;
}
void framestep_uninit(struct vf_dlopen_context *ctx)
{
free(ctx->priv);
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
if (argc != 1 && argc != 2)
return -1;
framestep_data_t *framestep = calloc(1,sizeof(framestep_data_t));
framestep->step = atoi(argv[0]);
framestep->pos = (argc >= 2) ? atoi(argv[1]) : 0;
ctx->priv = framestep;
ctx->put_image = framestep_put_image;
ctx->uninit = framestep_uninit;
return 1;
}
+295
View File
@@ -0,0 +1,295 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "vf_dlopen.h"
#include "filterutils.h"
/*
* interlacing detector
*
* usage: -vf dlopen=./ildetect.so:<method>:<threshold>
*
* outputs an interlacing detection report at the end
*
* methods:
* 0 = transcode 32detect (default)
* 1 = decomb IsCombed
* 2 = IsCombedTIVTC
* 3 = simple average
*
* threshold:
* normalized at 1
*/
typedef struct {
int method;
double combing_threshold;
double motion_threshold;
double motion_amount;
double yes_threshold;
double no_threshold;
double total_yes_threshold;
double total_no_threshold;
double tc_threshold;
double decision_threshold;
double tc_decision_threshold;
double lastcombed;
int numtotalframes;
int numdecidedframes;
int totalcombedframes;
int numjumpingadjacentframes;
int numdecidedadjacentframes;
unsigned char *buffer_data;
size_t buffer_size;
} ildetect_data_t;
static int il_config(struct vf_dlopen_context *ctx)
{
ctx->out_height -= 4;
ctx->out_d_height = ctx->out_height;
return 1;
}
static int il_decision(struct vf_dlopen_context *ctx,
int p0, int p1, int p2, int p3, int p4)
{
ildetect_data_t *il = ctx->priv;
// model for threshold: p0, p2, p4 = 0; p1, p3 = t
switch (il->method) {
case 0: { // diff-diff (transcode 32detect)
int d12 = p1 - p2; // t
int d13 = p1 - p3; // 0
if (abs(d12) > 15 * il->combing_threshold &&
abs(d13) < 10 * il->combing_threshold)
return 1;
// true for t > 15
break;
}
case 1: { // multiply (decomb IsCombed)
int d12 = p1 - p2; // t
int d32 = p3 - p2; // t
if (d12 * d32 > pow(il->combing_threshold, 2) * (25*25))
return 1;
// true for t > 21
break;
}
case 2: { // blur-blur (IsCombedTIVTC)
int b024 = p0 + 6 * p2 + p4; // 0
int b13 = 4 * p1 + 4 * p3; // 8t
if (abs(b024 - b13) > il->combing_threshold * 8 * 20)
return 1;
// true for t > 20
break;
}
case 3: { // average-average
int d123 = p1 + p3 - 2 * p2; // 2t
int d024 = p0 + p4 - 2 * p2; // 0
if ((abs(d123) - abs(d024)) > il->combing_threshold * 30)
return 1;
// true for t > 15
break;
}
}
return 0;
}
static int il_put_image(struct vf_dlopen_context *ctx)
{
ildetect_data_t *il = ctx->priv;
unsigned int x, y;
int first_frame = 0;
size_t sz = ctx->inpic.planestride[0] * ctx->inpic.planeheight[0];
if (sz != il->buffer_size) {
il->buffer_data = realloc(il->buffer_data, sz);
il->buffer_size = sz;
first_frame = 1;
}
assert(ctx->inpic.planes == 1);
assert(ctx->outpic[0].planes == 1);
assert(ctx->inpic.planewidth[0] == ctx->outpic[0].planewidth[0]);
assert(ctx->inpic.planeheight[0] == ctx->outpic[0].planeheight[0] + 4);
if (first_frame) {
printf("First frame\n");
il->lastcombed = -1;
} else {
// detect interlacing
// for each row of 5 pixels, compare:
// p2 vs (p1 + p3) / 2
// p2 vs (p0 + p4) / 2
unsigned int totalcombedframes = 0; // add 255 per combed pixel
unsigned int totalpixels = 0;
for (y = 0; y < ctx->inpic.planeheight[0] - 4; ++y) {
unsigned char *in_line =
&ctx->inpic.plane[0][ctx->inpic.planestride[0] * y];
unsigned char *buf_line =
&il->buffer_data[ctx->inpic.planestride[0] * y];
unsigned char *out_line =
&ctx->outpic->plane[0][ctx->outpic->planestride[0] * y];
for (x = 0; x < ctx->inpic.planewidth[0]; ++x) {
int b2 = buf_line[x + ctx->inpic.planestride[0] * 2];
int p0 = in_line[x];
int p1 = in_line[x + ctx->inpic.planestride[0]];
int p2 = in_line[x + ctx->inpic.planestride[0] * 2];
int p3 = in_line[x + ctx->inpic.planestride[0] * 3];
int p4 = in_line[x + ctx->inpic.planestride[0] * 4];
int is_moving = abs(b2 - p2) > il->motion_threshold;
if (!is_moving) {
out_line[x] = 128;
continue;
}
++totalpixels;
int combed = il_decision(ctx, p0, p1, p2, p3, p4);
totalcombedframes += combed;
out_line[x] = 255 * combed;
}
}
double avgpixels = totalpixels / (double)
((ctx->inpic.planeheight[0] - 4) * ctx->inpic.planewidth[0]);
if (avgpixels > il->motion_amount) {
double avgcombed = totalcombedframes / (double) totalpixels;
if (il->lastcombed >= 0) {
if (il->lastcombed < il->no_threshold ||
il->lastcombed > il->yes_threshold)
if (avgcombed < il->no_threshold ||
avgcombed > il->yes_threshold)
++il->numdecidedadjacentframes;
if (il->lastcombed > il->yes_threshold &&
avgcombed < il->no_threshold)
++il->numjumpingadjacentframes;
if (il->lastcombed < il->no_threshold &&
avgcombed > il->yes_threshold)
++il->numjumpingadjacentframes;
}
il->lastcombed = avgcombed;
if (avgcombed > il->yes_threshold) {
++il->numdecidedframes;
++il->totalcombedframes;
} else if (avgcombed < il->no_threshold) {
++il->numdecidedframes;
}
} else
il->lastcombed = -1;
}
++il->numtotalframes;
copy_plane(
il->buffer_data, ctx->inpic.planestride[0],
ctx->inpic.plane[0], ctx->inpic.planestride[0],
ctx->inpic.planewidth[0],
ctx->inpic.planeheight[0]);
ctx->outpic[0].pts = ctx->inpic.pts;
return 1;
}
void il_uninit(struct vf_dlopen_context *ctx)
{
ildetect_data_t *il = ctx->priv;
double avgdecided = il->numtotalframes
? il->numdecidedframes / (double) il->numtotalframes : -1;
double avgadjacent = il->numdecidedframes
? il->numdecidedadjacentframes / (double) il->numdecidedframes : -1;
double avgscore = il->numdecidedframes
? il->totalcombedframes / (double) il->numdecidedframes : -1;
double avgjumps = il->numdecidedadjacentframes
? il->numjumpingadjacentframes / (double) il->numdecidedadjacentframes : -1;
printf("ildetect: Avg decided: %f\n", avgdecided);
printf("ildetect: Avg adjacent decided: %f\n", avgadjacent);
printf("ildetect: Avg interlaced decided: %f\n", avgscore);
printf("ildetect: Avg interlaced/progressive adjacent decided: %f\n", avgjumps);
if (avgdecided < il->decision_threshold)
avgadjacent = avgscore = avgjumps = -1;
if (avgadjacent < il->tc_decision_threshold)
avgadjacent = avgjumps = -1;
if (avgscore < 0)
printf("ildetect: Content is probably: undecided\n");
else if (avgscore < il->total_no_threshold)
printf("ildetect: Content is probably: PROGRESSIVE\n");
else if (avgscore > il->total_yes_threshold && avgjumps < 0)
printf("ildetect: Content is probably: INTERLACED (possibly telecined)\n");
else if (avgjumps > il->tc_threshold)
printf("ildetect: Content is probably: TELECINED\n");
else if (avgscore > il->total_yes_threshold)
printf("ildetect: Content is probably: INTERLACED\n");
else
printf("ildetect: Content is probably: unknown\n");
free(ctx->priv);
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
(void) argc;
(void) argv;
ildetect_data_t *il = calloc(1,sizeof(ildetect_data_t));
#define A(i,d) ((argc>(i) && *argv[i]) ? atof(argv[i]) : (d))
il->method = A(0, 0);
il->combing_threshold = A(1, 1);
il->motion_threshold = A(2, 6);
il->motion_amount = A(3, 0.1);
il->yes_threshold = A(4, 0.1);
il->no_threshold = A(5, 0.05);
il->total_yes_threshold = A(6, 0.1);
il->total_no_threshold = A(7, 0.05);
il->tc_threshold = A(8, 0.1);
il->decision_threshold = A(9, 0.2);
il->tc_decision_threshold = A(10, 0.2);
static struct vf_dlopen_formatpair map[] = {
{ "gray", "gray" },
{ NULL, NULL }
};
ctx->format_mapping = map;
ctx->config = il_config;
ctx->put_image = il_put_image;
ctx->uninit = il_uninit;
ctx->priv = il;
return 1;
}
+89
View File
@@ -0,0 +1,89 @@
#!/bin/sh
case "$0" in
*/*)
MYDIR=${0%/*}
;;
*)
MYDIR=.
;;
esac
: ${MPV:=mpv}
: ${ILDETECT_MPV:=$MPV}
: ${ILDETECT_MPVFLAGS:=--start=35% --length=35}
: ${ILDETECT_DRY_RUN:=}
: ${ILDETECT_QUIET:=}
: ${ILDETECT_RUN_INTERLACED_ONLY:=}
: ${ILDETECT_FORCE_RUN:=}
: ${MAKE:=make}
# exit status:
# 0 progressive
# 1 telecine
# 2 interlaced
# 8 unknown
# 15 compile fail
# 16 detect fail
# 17+ mpv's status | 16
$MAKE -C "$MYDIR" ildetect.so || exit 15
testfun()
{
$ILDETECT_MPV "$@" \
--vf=dlopen="$MYDIR/ildetect.so" \
--o= --vo=null --no-audio --untimed \
$ILDETECT_MPVFLAGS \
| { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \
| grep "^ildetect:"
}
out=`testfun "$@"`
case "$out" in
*"probably: PROGRESSIVE"*)
[ -n "$ILDETECT_DRY_RUN" ] || \
[ -n "$ILDETECT_RUN_INTERLACED_ONLY" ] || \
$ILDETECT_MPV "$@"
r=$?
[ $r -eq 0 ] || exit $(($r | 16))
exit 0
;;
*"probably: TELECINED"*)
out2=`ILDETECT_MPVFLAGS="$ILDETECT_MPVFLAGS --vf-pre=pullup,scale" testfun "$@"`
case "$out2" in
*"probably: TELECINED"*|*"probably: INTERLACED"*)
[ -n "$ILDETECT_DRY_RUN" ] || \
$ILDETECT_MPV "$@" -vf-pre yadif
r=$?
[ $r -eq 0 ] || exit $(($r | 16))
exit 2
;;
*)
[ -n "$ILDETECT_DRY_RUN" ] || \
$ILDETECT_MPV "$@" -vf-pre pullup
r=$?
[ $r -eq 0 ] || exit $(($r | 16))
exit 1
;;
esac
;;
*"probably: INTERLACED"*)
[ -n "$ILDETECT_DRY_RUN" ] || \
$ILDETECT_MPV "$@" -vf-pre yadif
r=$?
[ $r -eq 0 ] || exit $(($r | 16))
exit 2
;;
*"probably: "*)
[ -n "$ILDETECT_FORCE_RUN" ] || exit 8
[ -n "$ILDETECT_DRY_RUN" ] || \
$ILDETECT_MPV "$@" -vf-pre yadif
r=$?
[ $r -eq 0 ] || exit $(($r | 16))
exit 0
;;
*)
exit 16
;;
esac
+367
View File
@@ -0,0 +1,367 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "vf_dlopen.h"
#include "filterutils.h"
/*
* rectangle
*
* usage: --vf=dlopen=/path/to/rectangle.so
*
* provides an editable rectangle
* NOTE: unix only, and requires xterm to be installed. Don't ask.
*/
typedef struct
{
int x, y, w, h;
int step;
int inpid;
int infd;
int ansimode;
int rectmode;
} privdata;
enum {
RECTMODE_LINES = 0,
RECTMODE_BOX,
RECTMODE_COUNT
};
static int put_image(struct vf_dlopen_context *ctx)
{
privdata *priv = ctx->priv;
unsigned int p;
assert(ctx->inpic.planes == ctx->outpic->planes);
for (p = 0; p < ctx->outpic->planes; ++p) {
assert(ctx->inpic.planewidth[p] == ctx->outpic->planewidth[p]);
assert(ctx->inpic.planeheight[p] == ctx->outpic->planeheight[p]);
}
char data;
while(read(priv->infd, &data, sizeof(data)) > 0) {
// printf("\nMODE: %d, CHAR: %d (%c)\n", priv->ansimode, data, data);
switch(priv->ansimode) {
case 0: // initial
switch(data) {
case 27: priv->ansimode = 1; break;
default: priv->ansimode = 0; break;
}
break;
case 1: // seen ESC
switch(data) {
case '[': priv->ansimode = 2; break;
default: priv->ansimode = 0; break;
}
break;
case 2: // seen ESC [
switch(data) {
case 'D': priv->ansimode = 0; data = 'h'; break; // arrow
case 'B': priv->ansimode = 0; data = 'j'; break; // arrow
case 'A': priv->ansimode = 0; data = 'k'; break; // arrow
case 'C': priv->ansimode = 0; data = 'l'; break; // arrow
case 'd': priv->ansimode = 0; data = 'H'; break; // rxvt shift-arrow
case 'b': priv->ansimode = 0; data = 'J'; break; // rxvt shift-arrow
case 'a': priv->ansimode = 0; data = 'K'; break; // rxvt shift-arrow
case 'c': priv->ansimode = 0; data = 'L'; break; // rxvt shift-arrow
case '1': priv->ansimode = 3; break;
default: priv->ansimode = -1; break;
}
break;
case 3: // seen ESC [ 1
switch(data) {
case ';': priv->ansimode = 4; break;
default: priv->ansimode = -1; break;
}
break;
case 4: // seen ESC [ 1 ;
switch(data) {
case '2': priv->ansimode = 5; break;
default: priv->ansimode = -1; break;
}
break;
case 5: // seen ESC [ 1 ; 2
switch(data) {
case 'D': priv->ansimode = 0; data = 'H'; break; // xterm shift-arrow
case 'B': priv->ansimode = 0; data = 'J'; break; // xterm shift-arrow
case 'A': priv->ansimode = 0; data = 'K'; break; // xterm shift-arrow
case 'C': priv->ansimode = 0; data = 'L'; break; // xterm shift-arrow
default: priv->ansimode = -1; break;
}
break;
case -1: // wait for end of ESC [ sequence
if((data > '9' || data < '0') && (data != ';')) {
priv->ansimode = 0;
data = 0; // do not process
}
break;
}
if(priv->ansimode == 0) {
switch(data) {
case 'h': case 'D': priv->x -= priv->step; priv->w += priv->step; break;
case 'j': case 'B': priv->y += priv->step; priv->h -= priv->step; break;
case 'k': case 'A': priv->y -= priv->step; priv->h += priv->step; break;
case 'l': case 'C': priv->x += priv->step; priv->w -= priv->step; break;
case 'H': case 'd': priv->w -= priv->step; break;
case 'J': case 'b': priv->h += priv->step; break;
case 'K': case 'a': priv->h -= priv->step; break;
case 'L': case 'c': priv->w += priv->step; break;
case ' ': priv->step ^= 9; break;
case 9: ++priv->rectmode; priv->rectmode %= RECTMODE_COUNT; break;
}
}
}
// apply limits
if(priv->x < 0) {
priv->w += priv->x;
priv->x = 0;
}
if(priv->y < 0) {
priv->h += priv->y;
priv->y = 0;
}
if(priv->w < 0) {
priv->w = 0;
}
if(priv->h < 0) {
priv->h = 0;
}
if(priv->x >= (int) ctx->inpic.planewidth[0]) {
priv->x = ctx->inpic.planewidth[0] - 1;
}
if(priv->y >= (int) ctx->inpic.planeheight[0]) {
priv->y = ctx->inpic.planeheight[0] - 1;
}
if(priv->x + priv->w > (int) ctx->inpic.planewidth[0]) {
priv->w = ctx->inpic.planewidth[0] - priv->x;
}
if(priv->y + priv->h > (int) ctx->inpic.planeheight[0]) {
priv->h = ctx->inpic.planeheight[0] - priv->y;
}
// apply step
priv->x = ((priv->x + priv->step - 1) / priv->step) * priv->step;
priv->y = ((priv->y + priv->step - 1) / priv->step) * priv->step;
priv->w = (priv->w / priv->step) * priv->step;
priv->h = (priv->h / priv->step) * priv->step;
// print
printf("\nRECTANGLE: -vf crop=%d:%d:%d:%d\n", priv->w, priv->h, priv->x, priv->y);
// copy picture
for (p = 0; p < ctx->outpic->planes; ++p) {
copy_plane(
ctx->outpic->plane[p], ctx->outpic->planestride[p],
ctx->inpic.plane[p], ctx->inpic.planestride[p],
ctx->inpic.planewidth[p], ctx->inpic.planeheight[p]
);
}
ctx->outpic->pts = ctx->inpic.pts;
// draw rectangle
#define PUT_PIXEL(x,y) \
do { \
int x_ = (x); \
int y_ = (y); \
if(x_ >= 0 && y_ >= 0 && x_ < (int) ctx->outpic->planewidth[0] && y_ < (int) ctx->outpic->planeheight[0]) { \
ctx->outpic->plane[0][y_ * ctx->outpic->planestride[0] + x_] ^= 0x80; \
} \
} while(0)
switch(priv->rectmode) {
case RECTMODE_LINES:
{
unsigned int i;
unsigned int n;
if(priv->w > priv->h)
n = priv->h / 3;
else
n = priv->w / 3;
if(n > 64)
n = 64;
for (i = 0; i < n; ++i) {
// topleft
PUT_PIXEL(priv->x + i, priv->y);
if(i)
PUT_PIXEL(priv->x, priv->y + i);
// topright
PUT_PIXEL(priv->x + priv->w - 1 - i, priv->y);
if(i)
PUT_PIXEL(priv->x + priv->w - 1, priv->y + i);
// bottomright
PUT_PIXEL(priv->x + priv->w - 1 - i, priv->y + priv->h - 1);
if(i)
PUT_PIXEL(priv->x + priv->w - 1, priv->y + priv->h - 1 - i);
// bottomleft
PUT_PIXEL(priv->x + i, priv->y + priv->h - 1);
if(i)
PUT_PIXEL(priv->x, priv->y + priv->h - 1 - i);
}
}
break;
case RECTMODE_BOX:
{
int x, y;
for(y = 0; y < priv->y; ++y) {
for(x = 0; x < (int) ctx->outpic->planewidth[0]; ++x) {
PUT_PIXEL(x, y);
}
}
for(y = priv->y; y < priv->y + priv->h; ++y) {
for(x = 0; x < priv->x; ++x) {
PUT_PIXEL(x, y);
}
for(x = priv->x + priv->w; x < (int) ctx->outpic->planewidth[0]; ++x) {
PUT_PIXEL(x, y);
}
}
for(y = priv->y + priv->h; y < (int) ctx->outpic->planeheight[0]; ++y) {
for(x = 0; x < (int) ctx->outpic->planewidth[0]; ++x) {
PUT_PIXEL(x, y);
}
}
}
break;
}
return 1;
}
int config(struct vf_dlopen_context *ctx)
{
privdata *priv = ctx->priv;
if(priv->w == 0 || priv->h == 0) {
priv->x = 0;
priv->y = 0;
priv->w = ctx->in_width;
priv->h = ctx->in_height;
}
printf("\nRECTANGLE: reconfigured\n");
if(priv->inpid == 0) {
int fd[2];
if(pipe(fd)) {
perror("pipe");
return -1;
}
priv->inpid = fork();
if(priv->inpid < 0) {
perror("fork");
return -1;
}
if(priv->inpid == 0) {
close(fd[0]);
if(fd[1] != 3) {
dup2(fd[1], 3);
close(fd[1]);
}
execlp("xterm", "xterm",
"-geometry", "40x10",
"-e",
"echo \"rectangle.so control window\";"
"echo \"\";"
"echo \"Arrow or hjkl: top left corner\";"
"echo \"Shift-Arrow or HJKL: bottom right corner\";"
"echo \"SPACE: toggle 8-px alignment\";"
"echo \"TAB: toggle rectangle display\";"
"echo \"\";"
"stty raw -echo;"
"cat >&3",
NULL
);
_exit(1);
}
close(fd[1]);
priv->infd = fd[0];
int flags;
if(fcntl(priv->infd, F_GETFL, &flags)) {
perror("fcntl F_GETFL");
close(priv->infd);
kill(priv->inpid, SIGTERM);
waitpid(priv->inpid, NULL, 0);
priv->inpid = 0;
}
flags |= O_NONBLOCK;
if(fcntl(priv->infd, F_SETFL, flags)) {
perror("fcntl F_SETFL");
close(priv->infd);
kill(priv->inpid, SIGTERM);
waitpid(priv->inpid, NULL, 0);
priv->inpid = 0;
}
}
return 1;
}
void uninit(struct vf_dlopen_context *ctx)
{
privdata *priv = ctx->priv;
if(priv->inpid) {
close(priv->infd);
kill(priv->inpid, SIGTERM);
waitpid(priv->inpid, NULL, 0);
priv->inpid = 0;
}
printf("\nRECTANGLE: finished\n");
free(priv);
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
(void) argc;
(void) argv;
static struct vf_dlopen_formatpair map[] = {
{ "yuv420p", "yuv420p" },
{ NULL, NULL }
};
privdata *priv = calloc(1,sizeof(privdata));
priv->step = 8;
if(argc >= 1)
priv->w = atoi(argv[0]);
if(argc >= 2)
priv->h = atoi(argv[1]);
if(argc >= 3)
priv->x = atoi(argv[2]);
if(argc >= 4)
priv->y = atoi(argv[3]);
ctx->priv = priv;
ctx->format_mapping = map;
ctx->config = config;
ctx->put_image = put_image;
ctx->uninit = uninit;
return 1;
}
+269
View File
@@ -0,0 +1,269 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vf_dlopen.h"
#include "filterutils.h"
#define MIN(a,b) ((a)<(b)?(a):(b))
/*
* telecine filter
*
* usage: --vf=dlopen=/path/to/telecine.so:t:23
*
* Parameter: first parameter is "t" for top field first, "b" for bottom field first
* then digits (0-9) for how many fields a frame is to be displayed
*
* Typical patterns (see http://en.wikipedia.org/wiki/Telecine):
*
* NTSC output (30i):
* 27.5p: 32222
* 24p: 23 (classic)
* 24p: 2332 (preferred)
* 20p: 33
* 18p: 334
* 16p: 3444
*
* PAL output (25i):
* 27.5p: 12222
* 24p: 222222222223 ("Euro pulldown")
* 16.67p: 33
* 16p: 33333334
*/
typedef struct {
int firstfield;
const char *pattern;
unsigned int pattern_pos;
unsigned char *buffer_plane[4];
size_t buffer_size[4];
int pts_num;
int pts_denom;
int occupied;
double lastpts_in;
double lastpts_out;
int first_frame_of_group;
} tc_data_t;
static int tc_config(struct vf_dlopen_context *ctx)
{
// we may return more than one pic!
tc_data_t *tc = ctx->priv;
const char *p;
int max = 0;
tc->pts_num = 0;
tc->pts_denom = 0;
for (p = tc->pattern; *p; ++p) {
if (*p - '0' > max)
max = *p - '0';
tc->pts_num += 2;
tc->pts_denom += *p - '0';
}
ctx->out_cnt = (max + 1) / 2;
printf(
"Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n",
tc->pattern, ctx->out_cnt, tc->pts_num, tc->pts_denom);
return 1;
}
static int tc_put_image(struct vf_dlopen_context *ctx)
{
tc_data_t *tc = ctx->priv;
unsigned p;
unsigned np = ctx->outpic[0].planes;
assert(ctx->inpic.planes == ctx->outpic[0].planes);
int need_reinit = 0;
// fix buffers
for (p = 0; p < np; ++p) {
size_t sz = ctx->inpic.planestride[p] * ctx->inpic.planeheight[p];
if (sz != tc->buffer_size[p]) {
if (p == 0 && tc->buffer_plane[p])
printf("WARNING: reinitializing telecine buffers.\n");
tc->buffer_plane[p] = realloc(tc->buffer_plane[p], sz);
tc->buffer_size[p] = sz;
need_reinit = 1;
}
}
// too big pts change? reinit
if (ctx->inpic.pts < tc->lastpts_in || ctx->inpic.pts > tc->lastpts_in + 0.5)
need_reinit = 1;
if (need_reinit) {
// initialize telecine
tc->pattern_pos = 0;
tc->occupied = 0;
tc->lastpts_in = ctx->inpic.pts;
tc->lastpts_out = ctx->inpic.pts;
}
int len = tc->pattern[tc->pattern_pos] - '0';
unsigned nout;
double delta = ctx->inpic.pts - tc->lastpts_in;
tc->lastpts_in = ctx->inpic.pts;
for (nout = 0; nout < ctx->out_cnt; ++nout) {
for (p = 0; p < np; ++p) {
assert(ctx->inpic.planewidth[p] == ctx->outpic[nout].planewidth[p]);
assert(ctx->inpic.planeheight[p] == ctx->outpic[nout].planeheight[p]);
}
}
nout = 0;
if (tc->pattern_pos == 0 && !tc->occupied) {
// at the start of the pattern, reset pts
// printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, ctx->inpic.pts, ctx->inpic.pts - tc->lastpts_out);
tc->lastpts_out = ctx->inpic.pts;
tc->first_frame_of_group = 1;
}
++tc->pattern_pos;
if (!tc->pattern[tc->pattern_pos])
tc->pattern_pos = 0;
if (len == 0) {
// do not output any field from this frame
return 0;
}
if (tc->occupied) {
for (p = 0; p < np; ++p) {
// fill in the EARLIER field from the buffered pic
copy_plane(
&ctx->outpic[nout].plane[p][ctx->outpic[nout].planestride[p] * tc->firstfield],
ctx->outpic[nout].planestride[p] * 2,
&tc->buffer_plane[p][ctx->inpic.planestride[p] * tc->firstfield],
ctx->inpic.planestride[p] * 2,
MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
(ctx->inpic.planeheight[p] - tc->firstfield + 1) / 2
);
// fill in the LATER field from the new pic
copy_plane(
&ctx->outpic[nout].plane[p][ctx->outpic[nout].planestride[p] * !tc->firstfield],
ctx->outpic[nout].planestride[p] * 2,
&ctx->inpic.plane[p][ctx->inpic.planestride[p] * !tc->firstfield],
ctx->inpic.planestride[p] * 2,
MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
(ctx->inpic.planeheight[p] - !tc->firstfield + 1) / 2
);
}
if (tc->first_frame_of_group)
tc->first_frame_of_group = 0;
else
tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;
--len;
tc->occupied = 0;
}
while (len >= 2) {
// output THIS image as-is
for (p = 0; p < np; ++p)
copy_plane(
ctx->outpic[nout].plane[p], ctx->outpic[nout].planestride[p],
ctx->inpic.plane[p], ctx->inpic.planestride[p],
MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
ctx->inpic.planeheight[p]
);
if (tc->first_frame_of_group)
tc->first_frame_of_group = 0;
else
tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;
len -= 2;
}
if (len >= 1) {
// copy THIS image to the buffer, we need it later
for (p = 0; p < np; ++p)
copy_plane(
&tc->buffer_plane[p][0], ctx->inpic.planestride[p],
&ctx->inpic.plane[p][0], ctx->inpic.planestride[p],
ctx->inpic.planestride[p],
ctx->inpic.planeheight[p]
);
tc->occupied = 1;
}
return nout;
}
void tc_uninit(struct vf_dlopen_context *ctx)
{
tc_data_t *tc = ctx->priv;
free(tc->buffer_plane[3]);
free(tc->buffer_plane[2]);
free(tc->buffer_plane[1]);
free(tc->buffer_plane[0]);
free(tc);
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
const char *a0 = (argc < 1) ? "t" : argv[0];
const char *a1 = (argc < 2) ? "23" : argv[1];
if (!a0[0] || a0[1] || !a1[0] || argc > 2)
return -1;
tc_data_t *tc = calloc(1,sizeof(tc_data_t));
if (a0[0] == 't')
tc->firstfield = 0;
else if (a0[0] == 'b')
tc->firstfield = 1;
else {
printf("telecine: invalid first field\n");
free(tc);
return -1;
}
tc->pattern = a1;
const char *p;
for (p = tc->pattern; *p; ++p)
if (*p < '0' || *p > '9') {
printf("telecine: invalid pattern\n");
free(tc);
return -1;
}
ctx->priv = tc;
ctx->format_mapping = NULL; // anything goes
ctx->config = tc_config;
ctx->put_image = tc_put_image;
ctx->uninit = tc_uninit;
return 1;
}
+177
View File
@@ -0,0 +1,177 @@
/*
* Copyright (c) 2012 Rudolf Polzer <divVerent@xonotic.org>
*
* This file is part of mpv's vf_dlopen examples.
*
* mpv's vf_dlopen examples are free software; you can redistribute them and/or
* modify them 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.
*
* mpv's vf_dlopen examples are distributed in the hope that they 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 mpv's vf_dlopen examples; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vf_dlopen.h"
#include "filterutils.h"
/*
* tile filter
*
* usage: --vf=dlopen=/path/to/tile.so:4:3
*
* only supports rgb24 and yuv420p for now
* in theory can support any format where rows are a multiple of bytes, and the
* multiple is known
*/
#define ALLFORMATS \
/* format bytes xmul ymul */ \
FORMAT("rgb24" , 3, 1, 1) \
FORMAT("yuv420p", 1, 2, 2)
typedef struct {
int rows, cols;
unsigned char *buffer_plane[4];
size_t buffer_size[4];
int pos;
int pixelbytes;
} tile_data_t;
static int tile_config(struct vf_dlopen_context *ctx)
{
// we may return more than one pic!
tile_data_t *tile = ctx->priv;
ctx->out_width = tile->cols * ctx->in_width;
ctx->out_height = tile->rows * ctx->in_height;
ctx->out_d_width = tile->cols * ctx->in_d_width;
ctx->out_d_height = tile->rows * ctx->in_d_height;
#define FORMAT(fmt,sz,xmul,ymul) \
if (!strcmp(ctx->in_fmt, fmt)) { \
if (ctx->in_width % xmul || ctx->in_height % ymul) { \
printf("Format " fmt " requires width to be a multiple of %d and height to be a multiple of %d\n", \
xmul, ymul); \
return -1; \
} \
tile->pixelbytes = sz; \
} else
ALLFORMATS
#undef FORMAT
{
printf("Format %s is not in the list, how come?\n", ctx->in_fmt);
return -1;
}
return 1;
}
static int tile_put_image(struct vf_dlopen_context *ctx)
{
tile_data_t *tile = ctx->priv;
unsigned p;
unsigned np = ctx->outpic[0].planes;
assert(ctx->inpic.planes == ctx->outpic[0].planes);
// fix buffers
for (p = 0; p < np; ++p) {
size_t sz = ctx->outpic->planestride[p] * ctx->outpic->planeheight[p];
if (sz != tile->buffer_size[p]) {
if (p == 0 && tile->buffer_plane[p])
printf("WARNING: reinitializing output buffers.\n");
tile->buffer_plane[p] = realloc(tile->buffer_plane[p], sz);
tile->buffer_size[p] = sz;
tile->pos = 0;
}
}
for (p = 0; p < np; ++p) {
assert(ctx->inpic.planewidth[p] * tile->cols == ctx->outpic->planewidth[p]);
assert(ctx->inpic.planeheight[p] * tile->rows == ctx->outpic->planeheight[p]);
}
// copy this frame
for (p = 0; p < np; ++p)
copy_plane(
&tile->buffer_plane[p][ctx->outpic->planestride[p] * ctx->inpic.planeheight[p] * (tile->pos / tile->cols) + tile->pixelbytes * ctx->inpic.planewidth[p] * (tile->pos % tile->cols)],
ctx->outpic->planestride[p],
ctx->inpic.plane[p],
ctx->inpic.planestride[p],
tile->pixelbytes * ctx->inpic.planewidth[p],
ctx->inpic.planeheight[p]
);
++tile->pos;
if (tile->pos == tile->rows * tile->cols) {
// copy THIS image to the buffer, we need it later
for (p = 0; p < np; ++p)
copy_plane(
ctx->outpic->plane[p], ctx->outpic->planestride[p],
&tile->buffer_plane[p][0], ctx->outpic->planestride[p],
tile->pixelbytes * ctx->outpic->planewidth[p],
ctx->outpic->planeheight[p]
);
ctx->outpic->pts = ctx->inpic.pts;
tile->pos = 0;
return 1;
}
return 0;
}
void tile_uninit(struct vf_dlopen_context *ctx)
{
tile_data_t *tile = ctx->priv;
free(tile->buffer_plane[3]);
free(tile->buffer_plane[2]);
free(tile->buffer_plane[1]);
free(tile->buffer_plane[0]);
free(tile);
}
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
VF_DLOPEN_CHECK_VERSION(ctx);
if (argc != 2)
return -1;
tile_data_t *tile = calloc(1,sizeof(tile_data_t));
tile->cols = atoi(argv[0]);
tile->rows = atoi(argv[1]);
if (!tile->rows || !tile->cols) {
printf("tile: invalid rows/cols\n");
free(tile);
return -1;
}
ctx->priv = tile;
static struct vf_dlopen_formatpair map[] = {
#define FORMAT(fmt,sz,xmul,ymul) {fmt, NULL},
ALLFORMATS
#undef FORMAT
{NULL, NULL}
};
ctx->format_mapping = map;
ctx->config = tile_config;
ctx->put_image = tile_put_image;
ctx->uninit = tile_uninit;
return 1;
}
-20
View File
@@ -2,23 +2,6 @@
# Generate ZSH completion
#
# This file is part of mpv.
#
# mpv 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.
#
# mpv 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 mpv. If not, see <http://www.gnu.org/licenses/>.
#
use strict;
use warnings;
use warnings FATAL => 'uninitialized';
@@ -113,9 +96,6 @@ my $tmpl = <<"EOS";
local curcontext="\$curcontext" state state_descr line
typeset -A opt_args
local -a match mbegin mend
local MATCH MBEGIN MEND
# By default, don't complete URLs unless no files match
local -a tag_order
zstyle -a ":completion:*:*:\$service:*" tag-order tag_order || \
+1 -1
View File
@@ -1 +1 @@
0.27.1
0.23.0
-2
View File
@@ -4,8 +4,6 @@ branches:
- appveyor
environment:
global:
PATH: C:\msys64\usr\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
matrix:
- MSYSTEM: MINGW64
- MSYSTEM: MINGW32
-445
View File
@@ -1,445 +0,0 @@
/*
* This file is part of mpv.
*
* mpv 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.
*
* mpv 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 mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libavutil/frame.h>
#include <libavutil/mem.h>
#include "common/common.h"
#include "chmap.h"
#include "fmt-conversion.h"
#include "format.h"
#include "aframe.h"
struct mp_aframe {
AVFrame *av_frame;
// We support channel layouts different from AVFrame channel masks
struct mp_chmap chmap;
// We support spdif formats, which are allocated as AV_SAMPLE_FMT_S16.
int format;
double pts;
};
static void free_frame(void *ptr)
{
struct mp_aframe *frame = ptr;
av_frame_free(&frame->av_frame);
}
struct mp_aframe *mp_aframe_create(void)
{
struct mp_aframe *frame = talloc_zero(NULL, struct mp_aframe);
frame->pts = MP_NOPTS_VALUE;
frame->av_frame = av_frame_alloc();
if (!frame->av_frame)
abort();
talloc_set_destructor(frame, free_frame);
return frame;
}
struct mp_aframe *mp_aframe_new_ref(struct mp_aframe *frame)
{
if (!frame)
return NULL;
struct mp_aframe *dst = mp_aframe_create();
dst->chmap = frame->chmap;
dst->format = frame->format;
dst->pts = frame->pts;
if (mp_aframe_is_allocated(frame)) {
if (av_frame_ref(dst->av_frame, frame->av_frame) < 0)
abort();
} else {
// av_frame_ref() would fail.
mp_aframe_config_copy(dst, frame);
}
return dst;
}
// Revert to state after mp_aframe_create().
void mp_aframe_reset(struct mp_aframe *frame)
{
av_frame_unref(frame->av_frame);
frame->chmap.num = 0;
frame->format = 0;
frame->pts = MP_NOPTS_VALUE;
}
// Remove all actual audio data and leave only the metadata.
void mp_aframe_unref_data(struct mp_aframe *frame)
{
// In a fucked up way, this is less complex than just unreffing the data.
struct mp_aframe *tmp = mp_aframe_create();
MPSWAP(struct mp_aframe, *tmp, *frame);
mp_aframe_reset(frame);
mp_aframe_config_copy(frame, tmp);
talloc_free(tmp);
}
// Return a new reference to the data in av_frame. av_frame itself is not
// touched. Returns NULL if not representable, or if input is NULL.
// Does not copy the timestamps.
struct mp_aframe *mp_aframe_from_avframe(struct AVFrame *av_frame)
{
if (!av_frame || av_frame->width > 0 || av_frame->height > 0)
return NULL;
int format = af_from_avformat(av_frame->format);
if (!format && av_frame->format != AV_SAMPLE_FMT_NONE)
return NULL;
struct mp_aframe *frame = mp_aframe_create();
// This also takes care of forcing refcounting.
if (av_frame_ref(frame->av_frame, av_frame) < 0)
abort();
frame->format = format;
mp_chmap_from_lavc(&frame->chmap, frame->av_frame->channel_layout);
#if LIBAVUTIL_VERSION_MICRO >= 100
// FFmpeg being a stupid POS again
if (frame->chmap.num != frame->av_frame->channels)
mp_chmap_from_channels(&frame->chmap, av_frame->channels);
#endif
return frame;
}
// Return a new reference to the data in frame. Returns NULL is not
// representable (), or if input is NULL.
// Does not copy the timestamps.
struct AVFrame *mp_aframe_to_avframe(struct mp_aframe *frame)
{
if (!frame)
return NULL;
if (af_to_avformat(frame->format) != frame->av_frame->format)
return NULL;
if (!mp_chmap_is_lavc(&frame->chmap))
return NULL;
return av_frame_clone(frame->av_frame);
}
struct AVFrame *mp_aframe_to_avframe_and_unref(struct mp_aframe *frame)
{
AVFrame *av = mp_aframe_to_avframe(frame);
talloc_free(frame);
return av;
}
// You must not use this.
struct AVFrame *mp_aframe_get_raw_avframe(struct mp_aframe *frame)
{
return frame->av_frame;
}
// Return whether it has associated audio data. (If not, metadata only.)
bool mp_aframe_is_allocated(struct mp_aframe *frame)
{
return frame->av_frame->buf[0] || frame->av_frame->extended_data[0];
}
// Clear dst, and then copy the configuration to it.
void mp_aframe_config_copy(struct mp_aframe *dst, struct mp_aframe *src)
{
mp_aframe_reset(dst);
dst->chmap = src->chmap;
dst->format = src->format;
dst->pts = src->pts;
if (av_frame_copy_props(dst->av_frame, src->av_frame) < 0)
abort();
dst->av_frame->format = src->av_frame->format;
dst->av_frame->channel_layout = src->av_frame->channel_layout;
#if LIBAVUTIL_VERSION_MICRO >= 100
// FFmpeg being a stupid POS again
dst->av_frame->channels = src->av_frame->channels;
#endif
}
// Return whether a and b use the same physical audio format. Extra metadata
// such as PTS, per-frame signalling, and AVFrame side data is not compared.
bool mp_aframe_config_equals(struct mp_aframe *a, struct mp_aframe *b)
{
struct mp_chmap ca = {0}, cb = {0};
mp_aframe_get_chmap(a, &ca);
mp_aframe_get_chmap(b, &cb);
return mp_chmap_equals(&ca, &cb) &&
mp_aframe_get_rate(a) == mp_aframe_get_rate(b) &&
mp_aframe_get_format(a) == mp_aframe_get_format(b);
}
// Return whether all required format fields have been set.
bool mp_aframe_config_is_valid(struct mp_aframe *frame)
{
return frame->format && frame->chmap.num && frame->av_frame->sample_rate;
}
// Return the pointer to the first sample for each plane. The pointers stay
// valid until the next call that mutates frame somehow. You must not write to
// the audio data. Returns NULL if no frame allocated.
uint8_t **mp_aframe_get_data_ro(struct mp_aframe *frame)
{
return mp_aframe_is_allocated(frame) ? frame->av_frame->extended_data : NULL;
}
// Like mp_aframe_get_data_ro(), but you can write to the audio data.
// Additionally, it will return NULL if copy-on-write fails.
uint8_t **mp_aframe_get_data_rw(struct mp_aframe *frame)
{
if (!mp_aframe_is_allocated(frame))
return NULL;
if (av_frame_make_writable(frame->av_frame) < 0)
return NULL;
return frame->av_frame->extended_data;
}
int mp_aframe_get_format(struct mp_aframe *frame)
{
return frame->format;
}
bool mp_aframe_get_chmap(struct mp_aframe *frame, struct mp_chmap *out)
{
if (!mp_chmap_is_valid(&frame->chmap))
return false;
*out = frame->chmap;
return true;
}
int mp_aframe_get_channels(struct mp_aframe *frame)
{
return frame->chmap.num;
}
int mp_aframe_get_rate(struct mp_aframe *frame)
{
return frame->av_frame->sample_rate;
}
int mp_aframe_get_size(struct mp_aframe *frame)
{
return frame->av_frame->nb_samples;
}
double mp_aframe_get_pts(struct mp_aframe *frame)
{
return frame->pts;
}
bool mp_aframe_set_format(struct mp_aframe *frame, int format)
{
if (mp_aframe_is_allocated(frame))
return false;
enum AVSampleFormat av_format = af_to_avformat(format);
if (av_format == AV_SAMPLE_FMT_NONE && format) {
if (!af_fmt_is_spdif(format))
return false;
av_format = AV_SAMPLE_FMT_S16;
}
frame->format = format;
frame->av_frame->format = av_format;
return true;
}
bool mp_aframe_set_chmap(struct mp_aframe *frame, struct mp_chmap *in)
{
if (!mp_chmap_is_valid(in) && !mp_chmap_is_empty(in))
return false;
if (mp_aframe_is_allocated(frame) && in->num != frame->chmap.num)
return false;
uint64_t lavc_layout = mp_chmap_to_lavc_unchecked(in);
if (!lavc_layout && in->num)
return false;
frame->chmap = *in;
frame->av_frame->channel_layout = lavc_layout;
#if LIBAVUTIL_VERSION_MICRO >= 100
// FFmpeg being a stupid POS again
frame->av_frame->channels = frame->chmap.num;
#endif
return true;
}
bool mp_aframe_set_rate(struct mp_aframe *frame, int rate)
{
if (rate < 1 && rate > 10000000)
return false;
frame->av_frame->sample_rate = rate;
return true;
}
bool mp_aframe_set_size(struct mp_aframe *frame, int samples)
{
if (!mp_aframe_is_allocated(frame) || mp_aframe_get_size(frame) < samples)
return false;
frame->av_frame->nb_samples = MPMAX(samples, 0);
return true;
}
void mp_aframe_set_pts(struct mp_aframe *frame, double pts)
{
frame->pts = pts;
}
// Return number of data pointers.
int mp_aframe_get_planes(struct mp_aframe *frame)
{
return af_fmt_is_planar(mp_aframe_get_format(frame))
? mp_aframe_get_channels(frame) : 1;
}
// Return number of bytes between 2 consecutive samples on the same plane.
size_t mp_aframe_get_sstride(struct mp_aframe *frame)
{
int format = mp_aframe_get_format(frame);
return af_fmt_to_bytes(format) *
(af_fmt_is_planar(format) ? 1 : mp_aframe_get_channels(frame));
}
// Set data to the audio after the given number of samples (i.e. slice it).
void mp_aframe_skip_samples(struct mp_aframe *f, int samples)
{
assert(samples >= 0 && samples <= mp_aframe_get_size(f));
int num_planes = mp_aframe_get_planes(f);
size_t sstride = mp_aframe_get_sstride(f);
for (int n = 0; n < num_planes; n++)
f->av_frame->extended_data[n] += samples * sstride;
f->av_frame->nb_samples -= samples;
if (f->pts != MP_NOPTS_VALUE)
f->pts += samples / (double)mp_aframe_get_rate(f);
}
// Return the timestamp of the sample just after the end of this frame.
double mp_aframe_end_pts(struct mp_aframe *f)
{
int rate = mp_aframe_get_rate(f);
if (f->pts == MP_NOPTS_VALUE || rate < 1)
return MP_NOPTS_VALUE;
return f->pts + f->av_frame->nb_samples / (double)rate;
}
// Return the duration in seconds of the frame (0 if invalid).
double mp_aframe_duration(struct mp_aframe *f)
{
int rate = mp_aframe_get_rate(f);
if (rate < 1)
return 0;
return f->av_frame->nb_samples / (double)rate;
}
// Clip the given frame to the given timestamp range. Adjusts the frame size
// and timestamp.
void mp_aframe_clip_timestamps(struct mp_aframe *f, double start, double end)
{
double f_end = mp_aframe_end_pts(f);
int rate = mp_aframe_get_rate(f);
if (f_end == MP_NOPTS_VALUE)
return;
if (end != MP_NOPTS_VALUE) {
if (f_end >= end) {
if (f->pts >= end) {
f->av_frame->nb_samples = 0;
} else {
int new = (end - f->pts) * rate;
f->av_frame->nb_samples = MPCLAMP(new, 0, f->av_frame->nb_samples);
}
}
}
if (start != MP_NOPTS_VALUE) {
if (f->pts < start) {
if (f_end <= start) {
f->av_frame->nb_samples = 0;
f->pts = f_end;
} else {
int skip = (start - f->pts) * rate;
skip = MPCLAMP(skip, 0, f->av_frame->nb_samples);
mp_aframe_skip_samples(f, skip);
}
}
}
}
struct mp_aframe_pool {
AVBufferPool *avpool;
int element_size;
};
struct mp_aframe_pool *mp_aframe_pool_create(void *ta_parent)
{
return talloc_zero(ta_parent, struct mp_aframe_pool);
}
static void mp_aframe_pool_destructor(void *p)
{
struct mp_aframe_pool *pool = p;
av_buffer_pool_uninit(&pool->avpool);
}
// Like mp_aframe_allocate(), but use the pool to allocate data.
int mp_aframe_pool_allocate(struct mp_aframe_pool *pool, struct mp_aframe *frame,
int samples)
{
int planes = mp_aframe_get_planes(frame);
size_t sstride = mp_aframe_get_sstride(frame);
int plane_size = MP_ALIGN_UP(sstride * MPMAX(samples, 1), 32);
int size = plane_size * planes;
if (size <= 0 || mp_aframe_is_allocated(frame))
return -1;
if (!pool->avpool || size > pool->element_size) {
size_t alloc = ta_calc_prealloc_elems(size);
if (alloc >= INT_MAX)
return -1;
av_buffer_pool_uninit(&pool->avpool);
pool->element_size = alloc;
pool->avpool = av_buffer_pool_init(pool->element_size, NULL);
if (!pool->avpool)
return -1;
talloc_set_destructor(pool, mp_aframe_pool_destructor);
}
// Yes, you have to do all this shit manually.
// At least it's less stupid than av_frame_get_buffer(), which just wipes
// the entire frame struct on error for no reason.
AVFrame *av_frame = frame->av_frame;
if (av_frame->extended_data != av_frame->data)
av_freep(&av_frame->extended_data); // sigh
av_frame->extended_data =
av_mallocz_array(planes, sizeof(av_frame->extended_data[0]));
if (!av_frame->extended_data)
abort();
av_frame->buf[0] = av_buffer_pool_get(pool->avpool);
if (!av_frame->buf[0])
return -1;
av_frame->linesize[0] = samples * sstride;
for (int n = 0; n < planes; n++)
av_frame->extended_data[n] = av_frame->buf[0]->data + n * plane_size;
av_frame->nb_samples = samples;
return 0;
}
-53
View File
@@ -1,53 +0,0 @@
#pragma once
#include <stdint.h>
struct mp_aframe;
struct AVFrame;
struct mp_chmap;
struct mp_aframe *mp_aframe_from_avframe(struct AVFrame *av_frame);
struct mp_aframe *mp_aframe_create(void);
struct mp_aframe *mp_aframe_new_ref(struct mp_aframe *frame);
void mp_aframe_reset(struct mp_aframe *frame);
void mp_aframe_unref_data(struct mp_aframe *frame);
struct AVFrame *mp_aframe_to_avframe(struct mp_aframe *frame);
struct AVFrame *mp_aframe_to_avframe_and_unref(struct mp_aframe *frame);
struct AVFrame *mp_aframe_get_raw_avframe(struct mp_aframe *frame);
bool mp_aframe_is_allocated(struct mp_aframe *frame);
void mp_aframe_config_copy(struct mp_aframe *dst, struct mp_aframe *src);
bool mp_aframe_config_equals(struct mp_aframe *a, struct mp_aframe *b);
bool mp_aframe_config_is_valid(struct mp_aframe *frame);
uint8_t **mp_aframe_get_data_ro(struct mp_aframe *frame);
uint8_t **mp_aframe_get_data_rw(struct mp_aframe *frame);
int mp_aframe_get_format(struct mp_aframe *frame);
bool mp_aframe_get_chmap(struct mp_aframe *frame, struct mp_chmap *out);
int mp_aframe_get_channels(struct mp_aframe *frame);
int mp_aframe_get_rate(struct mp_aframe *frame);
int mp_aframe_get_size(struct mp_aframe *frame);
double mp_aframe_get_pts(struct mp_aframe *frame);
bool mp_aframe_set_format(struct mp_aframe *frame, int format);
bool mp_aframe_set_chmap(struct mp_aframe *frame, struct mp_chmap *in);
bool mp_aframe_set_rate(struct mp_aframe *frame, int rate);
bool mp_aframe_set_size(struct mp_aframe *frame, int samples);
void mp_aframe_set_pts(struct mp_aframe *frame, double pts);
int mp_aframe_get_planes(struct mp_aframe *frame);
size_t mp_aframe_get_sstride(struct mp_aframe *frame);
void mp_aframe_skip_samples(struct mp_aframe *f, int samples);
double mp_aframe_end_pts(struct mp_aframe *f);
double mp_aframe_duration(struct mp_aframe *f);
void mp_aframe_clip_timestamps(struct mp_aframe *f, double start, double end);
struct mp_aframe_pool;
struct mp_aframe_pool *mp_aframe_pool_create(void *ta_parent);
int mp_aframe_pool_allocate(struct mp_aframe_pool *pool, struct mp_aframe *frame,
int samples);
-25
View File
@@ -29,7 +29,6 @@
#include "common/common.h"
#include "fmt-conversion.h"
#include "audio.h"
#include "aframe.h"
static void update_redundant_info(struct mp_audio *mpa)
{
@@ -404,30 +403,6 @@ fail:
return NULL;
}
struct mp_audio *mp_audio_from_aframe(struct mp_aframe *aframe)
{
struct AVFrame *av = mp_aframe_get_raw_avframe(aframe);
struct mp_audio *res = mp_audio_from_avframe(av);
if (!res)
return NULL;
struct mp_chmap chmap = {0};
mp_aframe_get_chmap(aframe, &chmap);
mp_audio_set_channels(res, &chmap);
mp_audio_set_format(res, mp_aframe_get_format(aframe));
res->pts = mp_aframe_get_pts(aframe);
return res;
}
void mp_audio_config_from_aframe(struct mp_audio *dst, struct mp_aframe *src)
{
*dst = (struct mp_audio){0};
struct mp_chmap chmap = {0};
mp_aframe_get_chmap(src, &chmap);
mp_audio_set_channels(dst, &chmap);
mp_audio_set_format(dst, mp_aframe_get_format(src));
dst->rate = mp_aframe_get_rate(src);
}
int mp_audio_to_avframe(struct mp_audio *frame, struct AVFrame *avframe)
{
av_frame_unref(avframe);
-4
View File
@@ -83,10 +83,6 @@ struct mp_audio *mp_audio_from_avframe(struct AVFrame *avframe);
struct AVFrame *mp_audio_to_avframe_and_unref(struct mp_audio *frame);
int mp_audio_to_avframe(struct mp_audio *frame, struct AVFrame *avframe);
struct mp_aframe;
struct mp_audio *mp_audio_from_aframe(struct mp_aframe *aframe);
void mp_audio_config_from_aframe(struct mp_audio *dst, struct mp_aframe *src);
struct mp_audio_pool;
struct mp_audio_pool *mp_audio_pool_create(void *ta_parent);
struct mp_audio *mp_audio_pool_get(struct mp_audio_pool *pool,
+1
View File
@@ -95,6 +95,7 @@ static const char *const std_layout_names[][2] = {
{"7.1(wide-side)", "fl-fr-fc-lfe-flc-frc-sl-sr"},
{"7.1(rear)", "fl-fr-fc-lfe-bl-br-sdl-sdr"}, // not in lavc
{"octagonal", "fl-fr-fc-bl-br-bc-sl-sr"},
{"downmix", "dl-dr"},
{"auto", ""}, // not in lavc
{0}
};
+11 -14
View File
@@ -1,18 +1,18 @@
/*
* This file is part of mpv.
*
* mpv 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.
* mpv 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.
*
* mpv 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.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPLAYER_AD_H
@@ -23,23 +23,20 @@
#include "demux/demux.h"
#include "audio/format.h"
#include "audio/aframe.h"
#include "audio/audio.h"
#include "dec_audio.h"
struct mp_decoder_list;
/* interface of audio decoder drivers */
/* interface of video decoder drivers */
struct ad_functions {
const char *name;
void (*add_decoders)(struct mp_decoder_list *list);
int (*init)(struct dec_audio *da, const char *decoder);
void (*uninit)(struct dec_audio *da);
int (*control)(struct dec_audio *da, int cmd, void *arg);
// Return whether or not the packet has been consumed.
bool (*send_packet)(struct dec_audio *da, struct demux_packet *pkt);
// Return whether decoding is still going on (false if EOF was reached).
// Never returns false & *out set, but can return true with !*out.
bool (*receive_frame)(struct dec_audio *da, struct mp_aframe **out);
int (*decode_packet)(struct dec_audio *da, struct demux_packet *pkt,
struct mp_audio **out);
};
enum ad_ctrl {
+79 -61
View File
@@ -1,18 +1,18 @@
/*
* This file is part of mpv.
*
* mpv 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.
* mpv 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.
*
* mpv 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.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@@ -40,10 +40,12 @@
struct priv {
AVCodecContext *avctx;
AVFrame *avframe;
struct mp_audio frame;
bool force_channel_map;
uint32_t skip_samples, trim_samples;
bool preroll_done;
double next_pts;
bool needs_reset;
AVRational codec_timebase;
};
@@ -114,18 +116,26 @@ static int init(struct dec_audio *da, const char *decoder)
av_opt_set_double(lavc_context, "drc_scale", opts->ac3drc,
AV_OPT_SEARCH_CHILDREN);
#if LIBAVCODEC_VERSION_MICRO >= 100
#if HAVE_AVFRAME_SKIP_SAMPLES
// Let decoder add AV_FRAME_DATA_SKIP_SAMPLES.
av_opt_set(lavc_context, "flags2", "+skip_manual", AV_OPT_SEARCH_CHILDREN);
#endif
mp_set_avopts(da->log, lavc_context, opts->avopts);
if (mp_set_avctx_codec_headers(lavc_context, c) < 0) {
MP_ERR(da, "Could not set decoder parameters.\n");
uninit(da);
return 0;
}
lavc_context->codec_tag = c->codec_tag;
lavc_context->sample_rate = c->samplerate;
lavc_context->bit_rate = c->bitrate;
lavc_context->block_align = c->block_align;
lavc_context->bits_per_coded_sample = c->bits_per_coded_sample;
lavc_context->channels = c->channels.num;
if (!mp_chmap_is_unknown(&c->channels))
lavc_context->channel_layout = mp_chmap_to_lavc(&c->channels);
// demux_mkv
mp_lavc_set_extradata(lavc_context, c->extradata, c->extradata_size);
mp_set_lav_codec_headers(lavc_context, c);
mp_set_avcodec_threads(da->log, lavc_context, opts->threads);
@@ -146,8 +156,14 @@ static void uninit(struct dec_audio *da)
struct priv *ctx = da->priv;
if (!ctx)
return;
AVCodecContext *lavc_context = ctx->avctx;
avcodec_free_context(&ctx->avctx);
if (lavc_context) {
if (avcodec_close(lavc_context) < 0)
MP_ERR(da, "Could not close codec.\n");
av_freep(&lavc_context->extradata);
av_freep(&lavc_context);
}
av_frame_free(&ctx->avframe);
}
@@ -161,12 +177,14 @@ static int control(struct dec_audio *da, int cmd, void *arg)
ctx->trim_samples = 0;
ctx->preroll_done = false;
ctx->next_pts = MP_NOPTS_VALUE;
ctx->needs_reset = false;
return CONTROL_TRUE;
}
return CONTROL_UNKNOWN;
}
static bool send_packet(struct dec_audio *da, struct demux_packet *mpkt)
static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
struct mp_audio **out)
{
struct priv *priv = da->priv;
AVCodecContext *avctx = priv->avctx;
@@ -177,59 +195,59 @@ static bool send_packet(struct dec_audio *da, struct demux_packet *mpkt)
if (mpkt && priv->next_pts == MP_NOPTS_VALUE)
priv->next_pts = mpkt->pts;
int in_len = mpkt ? mpkt->len : 0;
AVPacket pkt;
mp_set_av_packet(&pkt, mpkt, &priv->codec_timebase);
int ret = avcodec_send_packet(avctx, mpkt ? &pkt : NULL);
int got_frame = 0;
av_frame_unref(priv->avframe);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
return false;
if (ret < 0)
MP_ERR(da, "Error decoding audio.\n");
return true;
}
static bool receive_frame(struct dec_audio *da, struct mp_aframe **out)
{
struct priv *priv = da->priv;
AVCodecContext *avctx = priv->avctx;
int ret = avcodec_receive_frame(avctx, priv->avframe);
if (ret == AVERROR_EOF) {
// If flushing was initialized earlier and has ended now, make it start
// over in case we get new packets at some point in the future.
if (priv->needs_reset)
control(da, ADCTRL_RESET, NULL);
return false;
} else if (ret < 0 && ret != AVERROR(EAGAIN)) {
MP_ERR(da, "Error decoding audio.\n");
int ret = avcodec_send_packet(avctx, &pkt);
if (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
if (ret >= 0 && mpkt)
mpkt->len = 0;
ret = avcodec_receive_frame(avctx, priv->avframe);
if (ret >= 0)
got_frame = 1;
if (ret == AVERROR_EOF)
priv->needs_reset = true;
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
ret = 0;
}
#if LIBAVCODEC_VERSION_MICRO >= 100
if (priv->avframe->flags & AV_FRAME_FLAG_DISCARD)
av_frame_unref(priv->avframe);
#endif
if (!priv->avframe->buf[0])
return true;
if (ret < 0) {
MP_ERR(da, "Error decoding audio.\n");
return -1;
}
if (!got_frame)
return 0;
double out_pts = mp_pts_from_av(priv->avframe->pts, &priv->codec_timebase);
struct mp_aframe *mpframe = mp_aframe_from_avframe(priv->avframe);
struct mp_audio *mpframe = mp_audio_from_avframe(priv->avframe);
if (!mpframe)
return true;
return -1;
if (priv->force_channel_map)
mp_aframe_set_chmap(mpframe, &da->codec->channels);
struct mp_chmap lavc_chmap = mpframe->channels;
if (lavc_chmap.num != avctx->channels)
mp_chmap_from_channels(&lavc_chmap, avctx->channels);
if (priv->force_channel_map) {
if (lavc_chmap.num == da->codec->channels.num)
lavc_chmap = da->codec->channels;
}
mp_audio_set_channels(mpframe, &lavc_chmap);
if (out_pts == MP_NOPTS_VALUE)
out_pts = priv->next_pts;
mp_aframe_set_pts(mpframe, out_pts);
mpframe->pts = out_pts;
priv->next_pts = mp_aframe_end_pts(mpframe);
if (mpframe->pts == MP_NOPTS_VALUE)
mpframe->pts = priv->next_pts;
if (mpframe->pts != MP_NOPTS_VALUE)
priv->next_pts = mpframe->pts + mpframe->samples / (double)mpframe->rate;
#if LIBAVCODEC_VERSION_MICRO >= 100
#if HAVE_AVFRAME_SKIP_SAMPLES
AVFrameSideData *sd =
av_frame_get_side_data(priv->avframe, AV_FRAME_DATA_SKIP_SAMPLES);
if (sd && sd->size >= 10) {
@@ -246,14 +264,14 @@ static bool receive_frame(struct dec_audio *da, struct mp_aframe **out)
priv->preroll_done = true;
}
uint32_t skip = MPMIN(priv->skip_samples, mp_aframe_get_size(mpframe));
uint32_t skip = MPMIN(priv->skip_samples, mpframe->samples);
if (skip) {
mp_aframe_skip_samples(mpframe, skip);
mp_audio_skip_samples(mpframe, skip);
priv->skip_samples -= skip;
}
uint32_t trim = MPMIN(priv->trim_samples, mp_aframe_get_size(mpframe));
uint32_t trim = MPMIN(priv->trim_samples, mpframe->samples);
if (trim) {
mp_aframe_set_size(mpframe, mp_aframe_get_size(mpframe) - trim);
mpframe->samples -= trim;
priv->trim_samples -= trim;
}
@@ -261,7 +279,8 @@ static bool receive_frame(struct dec_audio *da, struct mp_aframe **out)
av_frame_unref(priv->avframe);
return true;
MP_DBG(da, "Decoded %d -> %d samples\n", in_len, mpframe->samples);
return 0;
}
static void add_decoders(struct mp_decoder_list *list)
@@ -275,6 +294,5 @@ const struct ad_functions ad_lavc = {
.init = init,
.uninit = uninit,
.control = control,
.send_packet = send_packet,
.receive_frame = receive_frame,
.decode_packet = decode_packet,
};
+45 -114
View File
@@ -3,18 +3,18 @@
*
* This file is part of mpv.
*
* mpv 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.
* mpv 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.
*
* mpv 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.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
@@ -40,11 +40,8 @@ struct spdifContext {
uint8_t out_buffer[OUTBUF_SIZE];
bool need_close;
bool use_dts_hd;
struct mp_aframe *fmt;
int sstride;
struct mp_aframe_pool *pool;
bool got_eof;
struct demux_packet *queued_packet;
struct mp_audio fmt;
struct mp_audio_pool *pool;
};
static int write_packet(void *p, uint8_t *buf, int buf_size)
@@ -74,7 +71,6 @@ static void uninit(struct dec_audio *da)
av_freep(&lavf_ctx->pb->buffer);
av_freep(&lavf_ctx->pb);
avformat_free_context(lavf_ctx);
talloc_free(spdif_ctx->queued_packet);
spdif_ctx->lavf_ctx = NULL;
}
}
@@ -85,7 +81,7 @@ static int init(struct dec_audio *da, const char *decoder)
da->priv = spdif_ctx;
spdif_ctx->log = da->log;
spdif_ctx->use_dts_hd = da->opts->dtshd;
spdif_ctx->pool = mp_aframe_pool_create(spdif_ctx);
spdif_ctx->pool = mp_audio_pool_create(spdif_ctx);
if (strcmp(decoder, "spdif_dts_hd") == 0)
spdif_ctx->use_dts_hd = true;
@@ -94,38 +90,13 @@ static int init(struct dec_audio *da, const char *decoder)
return spdif_ctx->codec_id != AV_CODEC_ID_NONE;
}
static void determine_codec_params(struct dec_audio *da, AVPacket *pkt,
int *out_profile, int *out_rate)
static int determine_codec_profile(struct dec_audio *da, AVPacket *pkt)
{
struct spdifContext *spdif_ctx = da->priv;
int profile = FF_PROFILE_UNKNOWN;
AVCodecContext *ctx = NULL;
AVFrame *frame = NULL;
AVCodecParserContext *parser = av_parser_init(spdif_ctx->codec_id);
if (parser) {
// Don't make it wait for the next frame.
parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
ctx = avcodec_alloc_context3(NULL);
if (!ctx) {
av_parser_close(parser);
goto done;
}
uint8_t *d = NULL;
int s = 0;
av_parser_parse2(parser, ctx, &d, &s, pkt->data, pkt->size, 0, 0, 0);
*out_profile = profile = ctx->profile;
*out_rate = ctx->sample_rate;
avcodec_free_context(&ctx);
av_parser_close(parser);
}
if (profile != FF_PROFILE_UNKNOWN || spdif_ctx->codec_id != AV_CODEC_ID_DTS)
return;
AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);
if (!codec)
goto done;
@@ -138,23 +109,29 @@ static void determine_codec_params(struct dec_audio *da, AVPacket *pkt,
if (!ctx)
goto done;
if (avcodec_open2(ctx, codec, NULL) < 0)
if (avcodec_open2(ctx, codec, NULL) < 0) {
av_free(ctx); // don't attempt to avcodec_close() an unopened ctx
ctx = NULL;
goto done;
}
if (avcodec_send_packet(ctx, pkt) < 0)
goto done;
if (avcodec_receive_frame(ctx, frame) < 0)
goto done;
*out_profile = profile = ctx->profile;
*out_rate = ctx->sample_rate;
profile = ctx->profile;
done:
av_frame_free(&frame);
if (ctx)
avcodec_close(ctx);
avcodec_free_context(&ctx);
if (profile == FF_PROFILE_UNKNOWN)
MP_WARN(da, "Failed to parse codec profile.\n");
return profile;
}
static int init_filter(struct dec_audio *da, AVPacket *pkt)
@@ -162,9 +139,8 @@ static int init_filter(struct dec_audio *da, AVPacket *pkt)
struct spdifContext *spdif_ctx = da->priv;
int profile = FF_PROFILE_UNKNOWN;
int c_rate = 0;
determine_codec_params(da, pkt, &profile, &c_rate);
MP_VERBOSE(da, "In: profile=%d samplerate=%d\n", profile, c_rate);
if (spdif_ctx->codec_id == AV_CODEC_ID_DTS)
profile = determine_codec_profile(da, pkt);
AVFormatContext *lavf_ctx = avformat_alloc_context();
if (!lavf_ctx)
@@ -199,9 +175,6 @@ static int init_filter(struct dec_audio *da, AVPacket *pkt)
AVDictionary *format_opts = NULL;
spdif_ctx->fmt = mp_aframe_create();
talloc_steal(spdif_ctx, spdif_ctx->fmt);
int num_channels = 0;
int sample_format = 0;
int samplerate = 0;
@@ -213,7 +186,7 @@ static int init_filter(struct dec_audio *da, AVPacket *pkt)
break;
case AV_CODEC_ID_AC3:
sample_format = AF_FORMAT_S_AC3;
samplerate = c_rate > 0 ? c_rate : 48000;
samplerate = 48000;
num_channels = 2;
break;
case AV_CODEC_ID_DTS: {
@@ -250,14 +223,9 @@ static int init_filter(struct dec_audio *da, AVPacket *pkt)
default:
abort();
}
struct mp_chmap chmap;
mp_chmap_from_channels(&chmap, num_channels);
mp_aframe_set_chmap(spdif_ctx->fmt, &chmap);
mp_aframe_set_format(spdif_ctx->fmt, sample_format);
mp_aframe_set_rate(spdif_ctx->fmt, samplerate);
spdif_ctx->sstride = mp_aframe_get_sstride(spdif_ctx->fmt);
mp_audio_set_num_channels(&spdif_ctx->fmt, num_channels);
mp_audio_set_format(&spdif_ctx->fmt, sample_format);
spdif_ctx->fmt.rate = samplerate;
if (avformat_write_header(lavf_ctx, &format_opts) < 0) {
MP_FATAL(da, "libavformat spdif initialization failed.\n");
@@ -275,80 +243,44 @@ fail:
return -1;
}
static bool send_packet(struct dec_audio *da, struct demux_packet *mpkt)
static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
struct mp_audio **out)
{
struct spdifContext *spdif_ctx = da->priv;
if (spdif_ctx->queued_packet || spdif_ctx->got_eof)
return false;
spdif_ctx->out_buffer_len = 0;
spdif_ctx->queued_packet = mpkt ? demux_copy_packet(mpkt) : NULL;
spdif_ctx->got_eof = !mpkt;
return true;
}
if (!mpkt)
return 0;
static bool receive_frame(struct dec_audio *da, struct mp_aframe **out)
{
struct spdifContext *spdif_ctx = da->priv;
if (spdif_ctx->got_eof) {
spdif_ctx->got_eof = false;
return false;
}
if (!spdif_ctx->queued_packet)
return true;
double pts = spdif_ctx->queued_packet->pts;
double pts = mpkt->pts;
AVPacket pkt;
mp_set_av_packet(&pkt, spdif_ctx->queued_packet, NULL);
mp_set_av_packet(&pkt, mpkt, NULL);
mpkt->len = 0; // will be fully consumed
pkt.pts = pkt.dts = 0;
if (!spdif_ctx->lavf_ctx) {
if (init_filter(da, &pkt) < 0)
goto done;
return -1;
}
spdif_ctx->out_buffer_len = 0;
int ret = av_write_frame(spdif_ctx->lavf_ctx, &pkt);
avio_flush(spdif_ctx->lavf_ctx->pb);
if (ret < 0) {
MP_ERR(da, "spdif mux error: '%s'\n", mp_strerror(AVUNERROR(ret)));
goto done;
}
if (ret < 0)
return -1;
*out = mp_aframe_new_ref(spdif_ctx->fmt);
int samples = spdif_ctx->out_buffer_len / spdif_ctx->sstride;
if (mp_aframe_pool_allocate(spdif_ctx->pool, *out, samples) < 0) {
TA_FREEP(out);
goto done;
}
int samples = spdif_ctx->out_buffer_len / spdif_ctx->fmt.sstride;
*out = mp_audio_pool_get(spdif_ctx->pool, &spdif_ctx->fmt, samples);
if (!*out)
return -1;
uint8_t **data = mp_aframe_get_data_rw(*out);
if (!data) {
TA_FREEP(out);
goto done;
}
memcpy((*out)->planes[0], spdif_ctx->out_buffer, spdif_ctx->out_buffer_len);
(*out)->pts = pts;
memcpy(data[0], spdif_ctx->out_buffer, spdif_ctx->out_buffer_len);
mp_aframe_set_pts(*out, pts);
done:
talloc_free(spdif_ctx->queued_packet);
spdif_ctx->queued_packet = NULL;
return true;
return 0;
}
static int control(struct dec_audio *da, int cmd, void *arg)
{
struct spdifContext *spdif_ctx = da->priv;
switch (cmd) {
case ADCTRL_RESET:
talloc_free(spdif_ctx->queued_packet);
spdif_ctx->queued_packet = NULL;
spdif_ctx->got_eof = false;
return CONTROL_TRUE;
}
return CONTROL_UNKNOWN;
}
@@ -412,6 +344,5 @@ const struct ad_functions ad_spdif = {
.init = init,
.uninit = uninit,
.control = control,
.send_packet = send_packet,
.receive_frame = receive_frame,
.decode_packet = decode_packet,
};
+39 -30
View File
@@ -1,18 +1,18 @@
/*
* This file is part of mpv.
*
* mpv 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.
* mpv 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.
*
* mpv 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.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@@ -27,7 +27,6 @@
#include "common/codecs.h"
#include "common/msg.h"
#include "common/recorder.h"
#include "misc/bstr.h"
#include "stream/stream.h"
@@ -38,6 +37,8 @@
#include "dec_audio.h"
#include "ad.h"
#include "audio/format.h"
#include "audio/audio.h"
#include "audio/audio_buffer.h"
#include "audio/filter/af.h"
@@ -177,29 +178,30 @@ static void fix_audio_pts(struct dec_audio *da)
if (!da->current_frame)
return;
double frame_pts = mp_aframe_get_pts(da->current_frame);
if (frame_pts != MP_NOPTS_VALUE) {
if (da->current_frame->pts != MP_NOPTS_VALUE) {
double newpts = da->current_frame->pts;
if (da->pts != MP_NOPTS_VALUE)
MP_STATS(da, "value %f audio-pts-err", da->pts - frame_pts);
MP_STATS(da, "value %f audio-pts-err", da->pts - newpts);
// Keep the interpolated timestamp if it doesn't deviate more
// than 1 ms from the real one. (MKV rounded timestamps.)
if (da->pts == MP_NOPTS_VALUE || fabs(da->pts - frame_pts) > 0.001)
da->pts = frame_pts;
if (da->pts == MP_NOPTS_VALUE || fabs(da->pts - newpts) > 0.001)
da->pts = newpts;
}
if (da->pts == MP_NOPTS_VALUE && da->header->missing_timestamps)
da->pts = 0;
mp_aframe_set_pts(da->current_frame, da->pts);
da->current_frame->pts = da->pts;
if (da->pts != MP_NOPTS_VALUE)
da->pts += mp_aframe_duration(da->current_frame);
da->pts += da->current_frame->samples / (double)da->current_frame->rate;
}
void audio_work(struct dec_audio *da)
{
if (da->current_frame || !da->ad_driver)
if (da->current_frame)
return;
if (!da->packet && !da->new_segment &&
@@ -215,30 +217,36 @@ void audio_work(struct dec_audio *da)
da->packet = NULL;
}
if (da->ad_driver->send_packet(da, da->packet)) {
if (da->recorder_sink)
mp_recorder_feed_packet(da->recorder_sink, da->packet);
bool had_input_packet = !!da->packet;
bool had_packet = da->packet || da->new_segment;
int ret = da->ad_driver->decode_packet(da, da->packet, &da->current_frame);
if (ret < 0 || (da->packet && da->packet->len == 0)) {
talloc_free(da->packet);
da->packet = NULL;
}
bool progress = da->ad_driver->receive_frame(da, &da->current_frame);
if (da->current_frame && !mp_audio_config_valid(da->current_frame)) {
talloc_free(da->current_frame);
da->current_frame = NULL;
}
da->current_state = da->current_frame ? DATA_OK : DATA_AGAIN;
if (!progress)
da->current_state = DATA_OK;
if (!da->current_frame) {
da->current_state = DATA_EOF;
if (had_packet)
da->current_state = DATA_AGAIN;
}
fix_audio_pts(da);
bool segment_end = da->current_state == DATA_EOF;
bool segment_end = !da->current_frame && !had_input_packet;
if (da->current_frame) {
mp_aframe_clip_timestamps(da->current_frame, da->start, da->end);
double frame_pts = mp_aframe_get_pts(da->current_frame);
if (frame_pts != MP_NOPTS_VALUE && da->start != MP_NOPTS_VALUE)
segment_end = frame_pts >= da->end;
if (mp_aframe_get_size(da->current_frame) == 0) {
mp_audio_clip_timestamps(da->current_frame, da->start, da->end);
if (da->current_frame->pts != MP_NOPTS_VALUE && da->start != MP_NOPTS_VALUE)
segment_end = da->current_frame->pts >= da->end;
if (da->current_frame->samples == 0) {
talloc_free(da->current_frame);
da->current_frame = NULL;
}
@@ -253,7 +261,8 @@ void audio_work(struct dec_audio *da)
audio_reset_decoding(da);
} else {
da->codec = new_segment->codec;
da->ad_driver->uninit(da);
if (da->ad_driver)
da->ad_driver->uninit(da);
da->ad_driver = NULL;
audio_init_best_codec(da);
}
@@ -273,7 +282,7 @@ void audio_work(struct dec_audio *da)
// DATA_WAIT: waiting for demuxer; will receive a wakeup signal
// DATA_EOF: end of file, no more frames to be expected
// DATA_AGAIN: dropped frame or something similar
int audio_get_frame(struct dec_audio *da, struct mp_aframe **out_frame)
int audio_get_frame(struct dec_audio *da, struct mp_audio **out_frame)
{
*out_frame = NULL;
if (da->current_frame) {
+11 -12
View File
@@ -1,28 +1,29 @@
/*
* This file is part of mpv.
*
* mpv 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.
* mpv 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.
*
* mpv 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.
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPLAYER_DEC_AUDIO_H
#define MPLAYER_DEC_AUDIO_H
#include "audio/chmap.h"
#include "audio/aframe.h"
#include "audio/audio.h"
#include "demux/demux.h"
#include "demux/stheader.h"
struct mp_audio_buffer;
struct mp_decoder_list;
struct dec_audio {
@@ -36,8 +37,6 @@ struct dec_audio {
bool try_spdif;
struct mp_recorder_sink *recorder_sink;
// For free use by the ad_driver
void *priv;
@@ -47,7 +46,7 @@ struct dec_audio {
double start, end;
struct demux_packet *packet;
struct demux_packet *new_segment;
struct mp_aframe *current_frame;
struct mp_audio *current_frame;
int current_state;
};
@@ -56,7 +55,7 @@ int audio_init_best_codec(struct dec_audio *d_audio);
void audio_uninit(struct dec_audio *d_audio);
void audio_work(struct dec_audio *d_audio);
int audio_get_frame(struct dec_audio *d_audio, struct mp_aframe **out_frame);
int audio_get_frame(struct dec_audio *d_audio, struct mp_audio **out_frame);
void audio_reset_decoding(struct dec_audio *d_audio);
+5 -35
View File
@@ -36,12 +36,12 @@ extern const struct af_info af_info_format;
extern const struct af_info af_info_volume;
extern const struct af_info af_info_equalizer;
extern const struct af_info af_info_pan;
extern const struct af_info af_info_drc;
extern const struct af_info af_info_lavcac3enc;
extern const struct af_info af_info_lavrresample;
extern const struct af_info af_info_scaletempo;
extern const struct af_info af_info_bs2b;
extern const struct af_info af_info_lavfi;
extern const struct af_info af_info_lavfi_bridge;
extern const struct af_info af_info_rubberband;
static const struct af_info *const filter_list[] = {
@@ -50,6 +50,7 @@ static const struct af_info *const filter_list[] = {
&af_info_volume,
&af_info_equalizer,
&af_info_pan,
&af_info_drc,
&af_info_lavcac3enc,
&af_info_lavrresample,
#if HAVE_RUBBERBAND
@@ -57,7 +58,6 @@ static const struct af_info *const filter_list[] = {
#endif
&af_info_scaletempo,
&af_info_lavfi,
&af_info_lavfi_bridge,
NULL
};
@@ -80,8 +80,6 @@ static bool get_desc(struct m_obj_desc *dst, int index)
const struct m_obj_list af_obj_list = {
.get_desc = get_desc,
.description = "audio filters",
.allow_disable_entries = true,
.allow_unknown_entries = true,
.aliases = {
{"force", "format"},
{0}
@@ -152,25 +150,15 @@ contain the commandline parameters for the filter */
static struct af_instance *af_create(struct af_stream *s, char *name,
char **args)
{
const char *lavfi_name = NULL;
char **lavfi_args = NULL;
struct m_obj_desc desc;
if (!m_obj_list_find(&desc, &af_obj_list, bstr0(name))) {
if (!m_obj_list_find(&desc, &af_obj_list, bstr0("lavfi-bridge"))) {
MP_ERR(s, "Couldn't find audio filter '%s'.\n", name);
return NULL;
}
lavfi_name = name;
lavfi_args = args;
args = NULL;
if (strncmp(lavfi_name, "lavfi-", 6) == 0)
lavfi_name += 6;
MP_ERR(s, "Couldn't find audio filter '%s'.\n", name);
return NULL;
}
MP_VERBOSE(s, "Adding filter %s \n", name);
struct af_instance *af = talloc_zero(NULL, struct af_instance);
*af = (struct af_instance) {
.full_name = talloc_strdup(af, name),
.info = desc.p,
.data = talloc_zero(af, struct mp_audio),
.log = mp_log_new(af, s->log, name),
@@ -183,20 +171,6 @@ static struct af_instance *af_create(struct af_stream *s, char *name,
name, s->opts->af_defs, args);
if (!config)
goto error;
if (lavfi_name) {
// Pass the filter arguments as proper sub-options to the bridge filter.
struct m_config_option *name_opt = m_config_get_co(config, bstr0("name"));
assert(name_opt);
assert(name_opt->opt->type == &m_option_type_string);
if (m_config_set_option_raw(config, name_opt, &lavfi_name, 0) < 0)
goto error;
struct m_config_option *opts = m_config_get_co(config, bstr0("opts"));
assert(opts);
assert(opts->opt->type == &m_option_type_keyvalue_list);
if (m_config_set_option_raw(config, opts, &lavfi_args, 0) < 0)
goto error;
af->full_name = talloc_asprintf(af, "%s (lavfi)", af->full_name);
}
af->priv = config->optstruct;
// Initialize the new filter
@@ -275,7 +249,7 @@ static void af_print_filter_chain(struct af_stream *s, struct af_instance *at,
struct af_instance *af = s->first;
while (af) {
char b[128] = {0};
mp_snprintf_cat(b, sizeof(b), " [%s] ", af->full_name);
mp_snprintf_cat(b, sizeof(b), " [%s] ", af->info->name);
if (af->label)
mp_snprintf_cat(b, sizeof(b), "\"%s\" ", af->label);
if (af->data)
@@ -522,7 +496,6 @@ struct af_stream *af_new(struct mpv_global *global)
static const struct af_info in = { .name = "in" };
s->first = talloc(s, struct af_instance);
*s->first = (struct af_instance) {
.full_name = "in",
.info = &in,
.log = s->log,
.control = input_control,
@@ -534,7 +507,6 @@ struct af_stream *af_new(struct mpv_global *global)
static const struct af_info out = { .name = "out" };
s->last = talloc(s, struct af_instance);
*s->last = (struct af_instance) {
.full_name = "out",
.info = &out,
.log = s->log,
.control = output_control,
@@ -575,8 +547,6 @@ int af_init(struct af_stream *s)
// Add all filters in the list (if there are any)
struct m_obj_settings *list = s->opts->af_settings;
for (int i = 0; list && list[i].name; i++) {
if (!list[i].enabled)
continue;
struct af_instance *af =
af_prepend(s, s->last, list[i].name, list[i].attribs);
if (!af) {
+1 -1
View File
@@ -52,7 +52,6 @@ struct af_info {
// Linked list of audio filters
struct af_instance {
const struct af_info *info;
char *full_name;
struct mp_log *log;
struct MPOpts *opts;
struct replaygain_data *replaygain_data;
@@ -114,6 +113,7 @@ enum af_control {
AF_CONTROL_REINIT = 1,
AF_CONTROL_RESET,
AF_CONTROL_SET_VOLUME,
AF_CONTROL_GET_VOLUME,
AF_CONTROL_SET_PAN_LEVEL,
AF_CONTROL_SET_PAN_NOUT,
AF_CONTROL_SET_PAN_BALANCE,
-2
View File
@@ -214,8 +214,6 @@ static int af_open(struct af_instance* af){
af->filter_frame = filter_frame;
af_channels_t *s = af->priv;
MP_WARN(af, "This filter is deprecated (no replacement).\n");
// If router scan commandline for routing pairs
if(s->routes && s->routes[0]){
char* cp = s->routes;
Loaded 100 of 522 files, more files were not shown because too many files have changed in this diff. Show more