Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
463b877ec0 | ||
|
|
72c81aa111 | ||
|
|
9f7c014930 | ||
|
|
97eddff865 | ||
|
|
cf880b9070 | ||
|
|
3478575419 | ||
|
|
88a53309cd | ||
|
|
da76eb9f14 | ||
|
|
df6901b653 | ||
|
|
53e4ba26b5 | ||
|
|
f10a3cac0f | ||
|
|
7370ad2120 | ||
|
|
ed2d819ea5 | ||
|
|
4f728cfb99 |
No files matched your search
+4
-19
@@ -2,7 +2,6 @@
|
||||
*.a
|
||||
*.d
|
||||
*.exe
|
||||
*.pyc
|
||||
.depend
|
||||
|
||||
/config.h
|
||||
@@ -11,27 +10,13 @@
|
||||
/mpv
|
||||
/mpv.app
|
||||
/version.h
|
||||
/input/input_conf.h
|
||||
/mpvcore/input/input_conf.h
|
||||
/tags
|
||||
/TAGS
|
||||
/video/out/x11_icon.inc
|
||||
/video/out/gl_video_shaders.h
|
||||
/video/out/vdpau_template.c
|
||||
/demux/ebml_defs.c
|
||||
/demux/ebml_types.h
|
||||
/sub/osd_font.h
|
||||
/player/lua/*.inc
|
||||
/DOCS/man/mpv.1
|
||||
/DOCS/man/mpv.aux
|
||||
/DOCS/man/mpv.log
|
||||
/DOCS/man/mpv.out
|
||||
/DOCS/man/mpv.pdf
|
||||
/DOCS/man/mpv.toc
|
||||
/DOCS/man/*/mpv.1
|
||||
|
||||
/waf
|
||||
/waf-*
|
||||
/waf3-*
|
||||
/build
|
||||
/.waf*
|
||||
/.lock-waf_*
|
||||
|
||||
/old_build
|
||||
/Makefile
|
||||
+15
-47
@@ -1,62 +1,30 @@
|
||||
language: c
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
env:
|
||||
matrix:
|
||||
- LIBAV=libav-stable
|
||||
- LIBAV=libav-git
|
||||
- LIBAV=ffmpeg-stable
|
||||
- LIBAV=ffmpeg-git
|
||||
global:
|
||||
# Coverity token
|
||||
- secure: "H21mSRlMhk4BKS0xHZvCFGJxteCP0hRVUxTuNfM2Z9HBsyutuLEYMtViLO86VtM+Tqla3xXPzUdS4ozLwI72Ax/5ZUDXACROj73yW6QhFB5D6rLut12+FjqC7M33Qv2hl0xwgNBmR5dsm1ToP37+Wn+ecJQNvN8fkTXF+HVzOEw="
|
||||
- LIBAV=libav-stable
|
||||
- LIBAV=libav-git
|
||||
- LIBAV=ffmpeg-stable
|
||||
- LIBAV=ffmpeg-git
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- ci
|
||||
- coverity_scan
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
env: LIBAV=libav-stable
|
||||
- os: osx
|
||||
env: LIBAV=libav-git
|
||||
- os: osx
|
||||
env: LIBAV=ffmpeg-git
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: LIBAV=ffmpeg-stable
|
||||
- os: linux
|
||||
compiler: clang
|
||||
|
||||
before_install: ./travis-deps libass-stable $LIBAV
|
||||
script:
|
||||
- ./bootstrap.py
|
||||
- ./waf configure
|
||||
- ./waf build
|
||||
script: ./configure && make
|
||||
|
||||
notifications-policy: ¬ifications-policy
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
email:
|
||||
recipients:
|
||||
- mpv-team@googlegroups.com
|
||||
<<: *notifications-policy
|
||||
irc:
|
||||
channels:
|
||||
- "irc.freenode.org#mpv-devel"
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
||||
addons:
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "mpv-player/mpv"
|
||||
description: "Build submitted via Travis CI"
|
||||
notification_email: mpv-team@googlegroups.com
|
||||
build_command_prepend: "./bootstrap.py && ./waf configure"
|
||||
build_command: "./waf build"
|
||||
branch_pattern: coverity_scan
|
||||
- "irc.freenode.org#mpv-player-dev"
|
||||
<<: *notifications-policy
|
||||
@@ -1,27 +1,35 @@
|
||||
mpv is a fork of mplayer2, which is a fork of MPlayer.
|
||||
Original MPlayer Copyright file follows below.
|
||||
|
||||
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. Files without Copyright notice are licensed as LGPLv2.1+.
|
||||
MPlayer was originally written by Árpád Gereöffy and has been extended and
|
||||
worked on by many more since then, see the AUTHORS file for an (incomplete)
|
||||
list. MPlayer as a whole is copyrighted by the MPlayer team. Individual
|
||||
copyright notices can be found in file headers.
|
||||
|
||||
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
|
||||
the code to LGPLv2.1+ at a later point without asking the contributor. (This
|
||||
is a safeguard for making potential relicensing of the project to LGPLv2.1+
|
||||
easier.) Using a more liberal license compatible to LGPLv2.1+ is also ok.
|
||||
Most files in MPlayer are licensed under the GNU General Public License,
|
||||
version 2 with an explicit "or later" clause or a compatible license
|
||||
(LGPL 2.1+, MIT/BSD). An exception are the files talloc.c and talloc.h,
|
||||
which are LGPL 3+.
|
||||
Thus MPlayer as a whole can be redistributed under terms compatible with
|
||||
the GNU General Public License, version 3; see the LICENSE file for details.
|
||||
|
||||
For information about authors and contributors, consult the git log, which
|
||||
contains the complete SVN and CVS history as well.
|
||||
MPlayer includes code from several external sources. General information and
|
||||
license details are listed below:
|
||||
|
||||
Note that mplayer2 as a whole is licensed under GPLv3+. This is because it uses
|
||||
a copy of talloc (part of Samba), which is LGPLv3+, and the next compatible
|
||||
license for this mix is GPLv3+.
|
||||
Name: a couple of files copied from FFmpeg
|
||||
Version: updated to different versions
|
||||
URL: http://www.ffmpeg.org
|
||||
Directory: compat/x86_cpu.h
|
||||
Copyright: Many, see individual files for copyright notices.
|
||||
License: GNU Lesser General Public License
|
||||
|
||||
MPlayer as a whole is licensed under GPLv2 (incompatible to GPLv3!), because
|
||||
some files are licensed to GPLv2 (and _not_ any later version of the license).
|
||||
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".
|
||||
Name: dvbstream
|
||||
Version: 0.4.3-pre3 (CVS checkout)
|
||||
URL: http://sourceforge.net/projects/dvbtools/
|
||||
Directory: stream/dvbin.h stream/stream_dvb.c
|
||||
Copyright: 2001-2002 Dave Chapman <dave@dchapman.com>
|
||||
License: GNU General Public License
|
||||
|
||||
|
||||
This is not a complete list. grep the sources for "Copyright".
|
||||
@@ -0,0 +1,160 @@
|
||||
1. Input layer, supported devices, methods:
|
||||
- plain file, with seeking
|
||||
- STDIN, without seeking backward
|
||||
- network streaming (currently plain wget-like HTTP and MMS (.asx))
|
||||
- VCD (Video CD) track, by direct CDROM device access (not requires mounting disc)
|
||||
- DVD titles using .IFO structure, by direct DVD device access (not requires mounting disc)
|
||||
- DVD titles using menu navigation (experimental/alpha, not yet finished!!!)
|
||||
- CDDA - raw audio from audio CD-ROM discs (using cdparanoia libs)
|
||||
- RTP streaming (mpeg-ps over multicast only)
|
||||
- LIVE555 streaming - support SDP/RTSP (using the LIVE555 libs)
|
||||
- SMB - file access over samba (experimental)
|
||||
|
||||
2. Demuxer/parser layer, supported file/media formats:
|
||||
|
||||
- MPEG streams (ES,PES,PS. no TS support yet)
|
||||
note: mpeg demuxer silently ignore non-mpeg content, and find mpeg packets
|
||||
in arbitrary streams. it means you can play directly VCD images (for example
|
||||
CDRwin's .BIN files) without extracting mpeg files first (with tools like vcdgear)
|
||||
It accepts all PES variants, including files created by VDR.
|
||||
Note: VOB (video object) is simple mpeg stream, but it usually has 01BD
|
||||
packets which may contain subtitles and non-mpeg audio. Usually found on DVD discs.
|
||||
|
||||
Headers: mpeg streams has no global header. each frame sequence (also called GOP,
|
||||
group of pictures) contains an sequence header, it describes that block.
|
||||
In normal mpeg 1/2 content there are groups of 12-15 frames (24/30 fps).
|
||||
It means you can freely seek in mpeg streams, and even can cut it to
|
||||
small parts with standard file tools (dd, cut) without destroying it.
|
||||
|
||||
Codecs: video is always mpeg video (mpeg1, mpeg2 or mpeg4).
|
||||
audio is usually mpeg audio (any layer allowed, but it's layer 2 in most files)
|
||||
but 01BD packets may contain AC3, DTS or LPCM too.
|
||||
|
||||
FPS: mpeg2 content allows variable framerate, in form of delayed frames.
|
||||
It's mostly used for playback 24fps content at 29.97/30 fps (NTSC) rate.
|
||||
(so called Telecine or 3:2 pulldown effect)
|
||||
It means you see 30 frames per second, but there are only 24 different
|
||||
pictures and some of them are shown longer to fill 30 frame time.
|
||||
If you encode such files with mencoder, using -ofps 24 or -ofps 23.976
|
||||
is recommended.
|
||||
|
||||
- AVI streams.
|
||||
Two kind of RIFF AVI files exists:
|
||||
1. interleaved: audio and video content is interleaved. it's faster and
|
||||
requires only 1 reading thread, so it's recommended (and mostly used).
|
||||
2. non-interleaved: audio and video aren't interleaved, i mean first come
|
||||
whole video followed by whole audio. it requires 2 reading process or
|
||||
1 reading with lots of seeking. very bad for network or cdrom.
|
||||
3. badly interleaved streams: mplayer detects interleaving at startup and
|
||||
enables -ni option if it finds non-interleaved content. but sometimes
|
||||
the stream seems to be interleaved, but with bad sync so it should be
|
||||
played as non-interleaved otherwise you get a-v desync or buffer overflow.
|
||||
|
||||
MPlayer supports 2 kind of timing for AVI files:
|
||||
- bps-based: it is based on bitrate/samplerate of video/audio stream.
|
||||
this method is used by most players, including avifile and wmp.
|
||||
files with broken headers, and files created with VBR audio but not
|
||||
vbr-compliant encoder will result a-v desync with this method.
|
||||
(mostly at seeking).
|
||||
- interleaving-based: note: it can't be used togethwer with -ni
|
||||
it doesn't use bitrate stuff of header, it uses the relative position
|
||||
of interleaved audio and video chunks. makes some badly encoded file
|
||||
with vbr audio playable.
|
||||
|
||||
Headers: AVI files has a mandatory header at the begin of the file,
|
||||
describing video parameters (resolution, fps) and codecs. Optionally
|
||||
they have an INDEX block at the end of the file. It's optional, but
|
||||
most files has such block, because it's REQUIRED for seeking.
|
||||
Btw usually it can be rebuilt from file content, mplayer does it with
|
||||
the -idx switch. MPlayer can recreate broken index blocks using -forceidx.
|
||||
As AVI files needs index for random access, broken files with no index
|
||||
are usually unplayable.
|
||||
Of course, cutting/joining AVI files needs special programs.
|
||||
|
||||
Codecs: any audio and video codecs allowed, but I note that VBR audio is
|
||||
not well supported by most players. The file format makes it possible to
|
||||
use VBR audio, but most players expect CBR audio and fails with VBR,
|
||||
as VBR is unusual, and Microsoft's AVI specs only describe CBR audio.
|
||||
I also note, that most AVI encoders/multiplexers create bad files if
|
||||
using VBR audio. only 2 exception (known by me): NaNDub and MEncoder.
|
||||
|
||||
FPS: only constant framerate allowed, but it's possible to skip frames.
|
||||
|
||||
- ASF streams:
|
||||
ASF (active streaming format) comes from Microsoft. they developed two
|
||||
variant of ASF, v1.0 and v2.0. v1.0 is used by their media tools (wmp and
|
||||
wme) and v2.0 is published and patented :). of course, they differ,
|
||||
no compatibility at all. (it's just a legality game)
|
||||
MPlayer supports only v1.0, as nobody ever seen v2.0 files :)
|
||||
Note, that .ASF files are nowdays come with extension .WMA or .WMV.
|
||||
UPDATE: MS recently released the ASF v1.0 specs too, but it has some
|
||||
restrictions making it illegal to read by us :)
|
||||
|
||||
Headers: Stream headers (codecs parameters) can be everywhere (in theory),
|
||||
but all files i've seen had it at the beginning of the file.
|
||||
Asf uses fixed packet size, so it is seekable without any INDEX block,
|
||||
and broken files are playable well.
|
||||
|
||||
Codecs: video is mostly microsoft's mpeg4 variants: MP42, MP43 (aka DivX),
|
||||
WMV1 and WMV2. but any codecs allowed.
|
||||
audio is usually wma or voxware, sometimes mp3, but any codecs allowed.
|
||||
|
||||
FPS: no fixed fps, every video frame has an exact timestamp instead.
|
||||
I've got stream with up to 3 sec frame display times.
|
||||
|
||||
- QuickTime / MOV files:
|
||||
They come from Mac users, usually with .mov or .qt extension, but as
|
||||
MPEG Group chose quicktime as recommended file format for MPEG4,
|
||||
sometimes you meet quicktime files with .mpg or .mp4 extension.
|
||||
|
||||
At first look, it's a mixture of ASF and AVI.
|
||||
It requires INDEX block for random access and seeking, and even for
|
||||
playback, like AVI, but uses timestamps instead of constant framerate
|
||||
and has more flexible stream options (including network stuff) like ASF.
|
||||
|
||||
Headers: header can be placed at the beginning or at the end of file.
|
||||
About half of my files have it at the beginning, others have it at the end.
|
||||
Broken files are only playable if they have header at the beginning!
|
||||
|
||||
Codecs: any codecs allowed, both CBR and VBR.
|
||||
Note: most new mov files use Sorenson video and QDesign Music audio,
|
||||
they are patented, closed, secret, (TM)-ed etc formats, only Apple's
|
||||
quicktime player is able to playback these files (on win/mac only).
|
||||
|
||||
- VIVO files:
|
||||
They are funny streams. They have a human-readable ascii header at
|
||||
the beginning, followed by interleaved audio and video chunks.
|
||||
It has no index block, has no fixed packetsize or sync bytes, and most
|
||||
files even has no keyframes, so forget seeking!
|
||||
Video is standard h.263 (in vivo/2.0 files it's modified, non-standard
|
||||
h.263), audio is either standard g.723 or Vivo Siren codec.
|
||||
|
||||
Note, that microsoft licensed vivo stuff, and included in their netshow
|
||||
v2.0 program, so there are VfW/ACM codecs for vivo video and audio.
|
||||
|
||||
- RealMedia files:
|
||||
A mixture of AVI and ASF features. It has mandatory headers at the
|
||||
beginning and an optional INDEX (missing in most files).
|
||||
The file is constructed of variable size chunks, with small header
|
||||
telling the stream ID, timestamp, flags (keyframe...) and size.
|
||||
But it has some features found in ASF files:
|
||||
The video is actually double-muxed, the video chunks are really
|
||||
appended fragments of the video frame. RV30+ supports B frames, so
|
||||
you have to parse some bits of the first fragment to get the real PTS.
|
||||
The audio frames are fixed size (CBR) but using the same scrambling
|
||||
(out-of-order interleaving) as in the ASF files.
|
||||
|
||||
Codecs: Audio is either COOK(er), SIPR(o), ATRAC3 or DNET.
|
||||
The DNET is actually a byte-swapped low-bitrate Dolby AC3 variant :)
|
||||
Video is RV10 (h263 variant), RV20 (rp G2), RV30 (rp v8) or RV40 (rp v9).
|
||||
|
||||
FPS: variable, just like in ASF.
|
||||
|
||||
Note, that similarity of real and asf has some background - they worked
|
||||
together on the (never finished/used) ASF v2 spec for some time.
|
||||
|
||||
- GIF files:
|
||||
The GIF format is a common format for web graphics that supports
|
||||
animation. These are read through libungif or compatible library.
|
||||
Variable frame delays are supported, but seeking is not supported.
|
||||
Seeking will be supported once an index of gif frames can be built.
|
||||
@@ -0,0 +1,228 @@
|
||||
So, I'll describe how this stuff works.
|
||||
|
||||
The main modules:
|
||||
|
||||
1. stream.c: this is the input layer, this reads the input media (file, stdin,
|
||||
vcd, dvd, network etc). what it has to know: appropriate buffering by
|
||||
sector, seek, skip functions, reading by bytes, or blocks with any size.
|
||||
The stream_t (stream.h) structure describes the input stream, file/device.
|
||||
|
||||
There is a stream cache layer (cache2.c), it's a wrapper for the stream
|
||||
API. It does fork(), then emulates stream driver in the parent process,
|
||||
and stream user in the child process, while proxying between them using
|
||||
preallocated big memory chunk for FIFO buffer.
|
||||
|
||||
2. demuxer.c: this does the demultiplexing (separating) of the input to
|
||||
audio, video or dvdsub channels, and their reading by buffered packages.
|
||||
The demuxer.c is basically a framework, which is the same for all the
|
||||
input formats, and there are parsers for each of them (mpeg-es,
|
||||
mpeg-ps, avi, avi-ni, asf), these are in the demux_*.c files.
|
||||
The structure is the demuxer_t. There is only one demuxer.
|
||||
|
||||
2.a. demux_packet_t, that is DP.
|
||||
Contains one chunk (avi) or packet (asf,mpg). They are stored in memory as
|
||||
in linked list, cause of their different size.
|
||||
|
||||
2.b. demuxer stream, that is DS.
|
||||
Struct: demux_stream_t
|
||||
Every channel (a/v/s) has one. This contains the packets for the stream
|
||||
(see 2.a). For now, there can be 3 for each demuxer :
|
||||
- audio (d_audio)
|
||||
- video (d_video)
|
||||
- DVD subtitle (d_dvdsub)
|
||||
|
||||
2.c. stream header. There are 2 types (for now): sh_audio_t and sh_video_t
|
||||
This contains every parameter essential for decoding, such as input/output
|
||||
buffers, chosen codec, fps, etc. There are each for every stream in
|
||||
the file. At least one for video, if sound is present then another,
|
||||
but if there are more, then there'll be one structure for each.
|
||||
These are filled according to the header (avi/asf), or demux_mpg.c
|
||||
does it (mpg) if it founds a new stream. If a new stream is found,
|
||||
the ====> Found audio/video stream: <id> messages is displayed.
|
||||
|
||||
The chosen stream header and its demuxer are connected together
|
||||
(ds->sh and sh->ds) to simplify the usage. So it's enough to pass the
|
||||
ds or the sh, depending on the function.
|
||||
|
||||
For example: we have an asf file, 6 streams inside it, 1 audio, 5
|
||||
video. During the reading of the header, 6 sh structs are created, 1
|
||||
audio and 5 video. When it starts reading the packet, it chooses the
|
||||
stream for the first found audio & video packet, and sets the sh
|
||||
pointers of d_audio and d_video according to them. So later it reads
|
||||
only these streams. Of course the user can force choosing a specific
|
||||
stream with
|
||||
-vid and -aid switches.
|
||||
A good example for this is the DVD, where the english stream is not
|
||||
always the first, so every VOB has different language :)
|
||||
That's when we have to use for example the -aid 128 switch.
|
||||
|
||||
Now, how this reading works?
|
||||
- demuxer.c/demux_read_data() is called, it gets how many bytes,
|
||||
and where (memory address), would we like to read, and from which
|
||||
DS. The codecs call this.
|
||||
- this checks if the given DS's buffer contains something, if so, it
|
||||
reads from there as much as needed. If there isn't enough, it calls
|
||||
ds_fill_buffer(), which:
|
||||
- checks if the given DS has buffered packages (DP's), if so, it moves
|
||||
the oldest to the buffer, and reads on. If the list is empty, it
|
||||
calls demux_fill_buffer() :
|
||||
- this calls the parser for the input format, which reads the file
|
||||
onward, and moves the found packages to their buffers.
|
||||
Well it we'd like an audio package, but only a bunch of video
|
||||
packages are available, then sooner or later the:
|
||||
DEMUXER: Too many (%d in %d bytes) audio packets in the buffer
|
||||
error shows up.
|
||||
|
||||
2.d. video.c: this file/function handle the reading and assembling of the
|
||||
video frames. each call to video_read_frame() should read and return a
|
||||
single video frame, and it's duration in seconds (float).
|
||||
The implementation is splitted to 2 big parts - reading from mpeg-like
|
||||
streams and reading from one-frame-per-chunk files (avi, asf, mov).
|
||||
Then it calculates duration, either from fixed FPS value, or from the
|
||||
PTS difference between and after reading the frame.
|
||||
|
||||
2.e. other utility functions: there are some useful code there, like
|
||||
AVI muxer, or mp3 header parser, but leave them for now.
|
||||
|
||||
So everything is ok 'till now. It can be found in libmpdemux/ library.
|
||||
It should compile outside of mplayer tree, you just have to implement few
|
||||
simple functions, like mp_msg() to print messages, etc.
|
||||
See libmpdemux/test.c for example.
|
||||
|
||||
See also formats.txt, for description of common media file formats and their
|
||||
implementation details in libmpdemux.
|
||||
|
||||
Now, go on:
|
||||
|
||||
3. mplayer.c - ooh, he's the boss :)
|
||||
Its main purpose is connecting the other modules, and maintaining A/V
|
||||
sync.
|
||||
|
||||
The given stream's actual position is in the 'timer' field of the
|
||||
corresponding stream header (sh_audio / sh_video).
|
||||
|
||||
The structure of the playing loop :
|
||||
while(not EOF) {
|
||||
fill audio buffer (read & decode audio) + increase a_frame
|
||||
read & decode a single video frame + increase v_frame
|
||||
sleep (wait until a_frame>=v_frame)
|
||||
display the frame
|
||||
apply A-V PTS correction to a_frame
|
||||
handle events (keys,lirc etc) -> pause,seek,...
|
||||
}
|
||||
|
||||
When playing (a/v), it increases the variables by the duration of the
|
||||
played a/v.
|
||||
- with audio this is played bytes / sh_audio->o_bps
|
||||
Note: i_bps = number of compressed bytes for one second of audio
|
||||
o_bps = number of uncompressed bytes for one second of audio
|
||||
(this is = bps*samplerate*channels)
|
||||
- with video this is usually == 1.0/fps, but I have to note that
|
||||
fps doesn't really matters at video, for example asf doesn't have that,
|
||||
instead there is "duration" and it can change per frame.
|
||||
MPEG2 has "repeat_count" which delays the frame by 1-2.5 ...
|
||||
Maybe only AVI and MPEG1 has fixed fps.
|
||||
|
||||
So everything works right until the audio and video are in perfect
|
||||
synchronity, since the audio goes, it gives the timing, and if the
|
||||
time of a frame passed, the next frame is displayed.
|
||||
But what if these two aren't synchronized in the input file?
|
||||
PTS correction kicks in. The input demuxers read the PTS (presentation
|
||||
timestamp) of the packages, and with it we can see if the streams
|
||||
are synchronized. Then MPlayer can correct the a_frame, within
|
||||
a given maximal bounder (see -mc option). The summary of the
|
||||
corrections can be found in c_total .
|
||||
|
||||
Of course this is not everything, several things suck.
|
||||
For example the soundcards delay, which has to be corrected by
|
||||
MPlayer! The audio delay is the sum of all these:
|
||||
- bytes read since the last timestamp:
|
||||
t1 = d_audio->pts_bytes/sh_audio->i_bps
|
||||
- if Win32/ACM then the bytes stored in audio input buffer
|
||||
t2 = a_in_buffer_len/sh_audio->i_bps
|
||||
- uncompressed bytes in audio out buffer
|
||||
t3 = a_buffer_len/sh_audio->o_bps
|
||||
- not yet played bytes stored in the soundcard's (or DMA's) buffer
|
||||
t4 = get_audio_delay()/sh_audio->o_bps
|
||||
|
||||
From this we can calculate what PTS we need for the just played
|
||||
audio, then after we compare this with the video's PTS, we have
|
||||
the difference!
|
||||
|
||||
Life didn't get simpler with AVI. There's the "official" timing
|
||||
method, the BPS-based, so the header contains how many compressed
|
||||
audio bytes or chunks belong to one second of frames.
|
||||
In the AVI stream header there are 2 important fields, the
|
||||
dwSampleSize, and dwRate/dwScale pairs:
|
||||
- If the dwSampleSize is 0, then it's VBR stream, so its bitrate
|
||||
isn't constant. It means that 1 chunk stores 1 sample, and
|
||||
dwRate/dwScale gives the chunks/sec value.
|
||||
- If the dwSampleSize is >0, then it's constant bitrate, and the
|
||||
time can be measured this way: time = (bytepos/dwSampleSize) /
|
||||
(dwRate/dwScale) (so the sample's number is divided with the
|
||||
samplerate). Now the audio can be handled as a stream, which can
|
||||
be cut to chunks, but can be one chunk also.
|
||||
|
||||
The other method can be used only for interleaved files: from
|
||||
the order of the chunks, a timestamp (PTS) value can be calculated.
|
||||
The PTS of the video chunks are simple: chunk number * fps
|
||||
The audio is the same as the previous video chunk was.
|
||||
We have to pay attention to the so called "audio preload", that is,
|
||||
there is a delay between the audio and video streams. This is
|
||||
usually 0.5-1.0 sec, but can be totally different.
|
||||
The exact value was measured until now, but now the demux_avi.c
|
||||
handles it: at the audio chunk after the first video, it calculates
|
||||
the A/V difference, and take this as a measure for audio preload.
|
||||
|
||||
3.a. audio playback:
|
||||
Some words on audio playback:
|
||||
Not the playing is hard, but:
|
||||
1. knowing when to write into the buffer, without blocking
|
||||
2. knowing how much was played of what we wrote into
|
||||
The first is needed for audio decoding, and to keep the buffer
|
||||
full (so the audio will never skip). And the second is needed for
|
||||
correct timing, because some soundcards delay even 3-7 seconds,
|
||||
which can't be forgotten about.
|
||||
To solve this, the OSS gives several possibilities:
|
||||
- ioctl(SNDCTL_DSP_GETODELAY): tells how many unplayed bytes are in
|
||||
the soundcard's buffer -> perfect for timing, but not all drivers
|
||||
support it :(
|
||||
- ioctl(SNDCTL_DSP_GETOSPACE): tells how much can we write into the
|
||||
soundcard's buffer, without blocking. If the driver doesn't
|
||||
support GETODELAY, we can use this to know how much the delay is.
|
||||
- select(): should tell if we can write into the buffer without
|
||||
blocking. Unfortunately it doesn't say how much we could :((
|
||||
Also, doesn't/badly works with some drivers.
|
||||
Only used if none of the above works.
|
||||
|
||||
4. Codecs. Consists of libmpcodecs/* and separate files or libs,
|
||||
for example libmpeg2, loader, mp3lib.
|
||||
|
||||
mplayer.c doesn't call them directly, but through the dec_audio.c and
|
||||
dec_video.c files, so the mplayer.c doesn't have to know anything about
|
||||
the codecs.
|
||||
|
||||
libmpcodecs contains wrapper for every codecs, some of them include the
|
||||
codec function implementation, some calls functions from other files
|
||||
included with mplayer, some calls optional external libraries.
|
||||
file naming convention in libmpcodecs:
|
||||
ad_*.c - audio decoder (called through dec_audio.c)
|
||||
vd_*.c - video decoder (called through dec_video.c)
|
||||
ve_*.c - video encoder (used by mencoder)
|
||||
vf_*.c - video filter (see option -vf)
|
||||
|
||||
On this topic, see also:
|
||||
libmpcodecs.txt - The structure of the codec-filter path, with explanation
|
||||
dr-methods.txt - Direct rendering, MPI buffer management for video codecs
|
||||
codecs.conf.txt - How to write/edit codec configuration file (codecs.conf)
|
||||
codec-devel.txt - Mike's hints about codec development - a bit OUTDATED
|
||||
hwac3.txt - about SP/DIF audio passthrough
|
||||
|
||||
5. libvo: this displays the frame.
|
||||
|
||||
for details on this, read libvo.txt
|
||||
|
||||
6. libao2: this control audio playing
|
||||
6.a audio plugins
|
||||
|
||||
for details on this, read libao2.txt
|
||||
@@ -0,0 +1,145 @@
|
||||
mails by A'rpi and Marcus Blomenkamp <Marcus.Blomenkamp@epost.de>
|
||||
describing how this ac3-passtrough hack work under linux and mplayer...
|
||||
-----------------------------------------------------------------------
|
||||
Hi,
|
||||
|
||||
> I received the following patch from Steven Brookes <stevenjb@mda.co.uk>.
|
||||
> He is working on fixing the digital audio output of the dxr3 driver and
|
||||
> told me he fixed some bugs in mplayer along the way. I don't know shit
|
||||
> about hwac3 output so all I did was to make sure the patch applied
|
||||
> against latest cvs.
|
||||
> This is from his e-mail to me:
|
||||
>
|
||||
> "Secondly there is a patch to dec_audio.c and
|
||||
> ac3-iec958 to fix the -ac hwac3 codec stuff and to use liba52 to sync it.
|
||||
|
||||
> Seems to work for everything I've thrown at and maintains sync for all audio
|
||||
> types through the DXR3."
|
||||
|
||||
patch applied (with some comments added and an unwanted change (in software
|
||||
a52 decoder) removed)
|
||||
|
||||
now i understand how this whole hwac3 mess work.
|
||||
it's very very tricky. it virtually decodes ac3 to LPCM packets, but really
|
||||
it keeps the original compressed data padded by zeros. this way it's
|
||||
constant bitrate, and sync is calculated just like for stereo PCM.
|
||||
(so it bypass LPCM-capable media converters...)
|
||||
|
||||
so, every ac3 frame is translated to 6144 byte long tricky LPCM packet.
|
||||
6144 = 4*(6*256) = 4 * samples_per_ac3_frame = LPCM size of uncompressed ac3
|
||||
frame.
|
||||
|
||||
i wanna know if it works for sblive and other ac3-capable cards too?
|
||||
(i can't test it, lack of ac3 decoder)
|
||||
|
||||
A'rpi / Astral & ESP-team
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Hi folks.
|
||||
I spend some time fiddling with ac3 passthrough in mplayer. The
|
||||
traditional way of setting the output format to AFMT_AC3 was no ideal
|
||||
solution since not all digital io cards/drivers supported this format or
|
||||
honoured it to set the spdif non-audio bit. To make it short, it only
|
||||
worked with oss sblive driver IIRC.
|
||||
|
||||
Inspired by alsa's ac3dec program I found an alternative way by
|
||||
inspecting to which format the alsa device had been set. Suprise: it was
|
||||
simple 16bit_le 2_channel pcm. So setting the non-audio bit doesn't
|
||||
necessarily mean the point. The only important thing seems to be
|
||||
bit-identical output at the correct samplerate. Modern AV-Receivers seem
|
||||
to be quite tolerant/compatible.
|
||||
|
||||
So I changed the output format of hwac3 from
|
||||
|
||||
AFMT_AC3 channels=1
|
||||
to
|
||||
AFMT_S16_LE channels=2
|
||||
|
||||
and corrected the absolute time calculation. That was all to get it
|
||||
running for me.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Hi there.
|
||||
|
||||
Perhaps I can clear up some mystification about AC3 passthrough in
|
||||
general and mplayer in special:
|
||||
|
||||
To get the external decoder solution working, it must be fed with data
|
||||
which is bitidentical to the chunks in the source ac3 file (compressed
|
||||
data is very picky about bit errors). Additionally - or better to say
|
||||
'historically' - the non-audio bit should be set in the spdif status
|
||||
fields to prevent old spdif hardware from reproducing ugly scratchy
|
||||
noise. Note: for current decoders (probably those with DTS capability)
|
||||
this safety bit isn't needed anymore. At least I can state that for my
|
||||
Sherwood RVD-6095RDS. I think it is due to DTS because DTS sound can
|
||||
reside on a ordinary AudioCD and an ordinary AudioCD-Player will always
|
||||
have it's audio-bit set.
|
||||
|
||||
The sample format of the data must be 2channel 16bit (little endian
|
||||
IIRC). Samplerates are 48kHz - although my receiver also accepts
|
||||
44100Hz. I do not know if this is due to an over-compatability of my
|
||||
receiver or if 44100 is also possible in the ac3 specs. For safety's
|
||||
sake lets keep this at 48000Hz. AC3 data chunks are inserted into the
|
||||
stream every 0x1600 bytes (don't bite me on that, look into
|
||||
'ac3-iec958.c': 'ac3_iec958_build_burst').
|
||||
|
||||
To come back to the problem: data must be played bit-identically through
|
||||
the soundcard at the correct samplerate and should optionally have it's
|
||||
non-audio bit set. There are two ways to accomplish this:
|
||||
|
||||
1) Some OSS guy invented the format AFMT_AC3. Soundcard drivers
|
||||
implementing this format should therefore adjust it's mixers and
|
||||
switches to produce the desired output. Unfortunately some soundcard
|
||||
drivers do not support this format correctly and most do not even
|
||||
support it at all (including ALSA).
|
||||
|
||||
2) The alternative approach currently in mplayer CVS is to simply set
|
||||
the output format to 48kHz16bitLE and rely on the user to have the
|
||||
soundcard mixers adjusted properly.
|
||||
|
||||
I do have two soundcards with digital IO facilities (CMI8738 and
|
||||
Trident4DWaveNX based) plus the mentioned decoder. I'm currently running
|
||||
Linux-2.4.17. Following configurations are happily running here:
|
||||
|
||||
1. Trident with ALSA drivers (OSS does not support Hoontech's dig. IO)
|
||||
2. CMI with ALSA drivers
|
||||
3. CMI with OSS drivers
|
||||
|
||||
For Linux I'd suggest using ALSA because of it's cleaner architecture
|
||||
and more consitent user interface. Not to mention that it'll be the
|
||||
standard sound support in Linux soon.
|
||||
|
||||
For those who want to stick to OSS drivers: The CMI8738 drivers works
|
||||
out-of-the-box, if the PCM/Wave mixer is set to 100%.
|
||||
|
||||
For ALSA I'd suggest using its OSS emulation. More on that later.
|
||||
ALSA-0.9 invented the idea of cards, devices and dubdevices. You can
|
||||
reach the digital interface of all supported cards consitently by using
|
||||
the device 'hw:x,2' (x counting from 0 is the number of your soundcard).
|
||||
So most people would end up at 'hw:0,2'. This device can only be opened
|
||||
in sample formats and rates which are directly supported in hardware
|
||||
hence no samplerate conversion is done keeping the stream as-is. However
|
||||
most consumer soundcards do not support 44kHz so it would definitively
|
||||
be a bad idea to use this as your standard device if you wanted to
|
||||
listen to some mp3s (most of them are 44kHz due to CD source). Here the
|
||||
OSS comes to play again. You can configure which OSS device (/dev/dsp
|
||||
and /dev/adsp) uses which ALSA device. So I'd suggest pointing the
|
||||
standard '/dev/dsp' to standard 'hw:0,0' which suports mixing and
|
||||
samplerate conversion. No further reconfiguration would be needed for
|
||||
your sound apps. For movies I'd point '/dev/adsp' to 'hw:0,2' and
|
||||
configure mplayer to use adsp instead of dsp. The samplerate constrain
|
||||
is no big deal here since movies usually are in 48Khz anyway. The
|
||||
configuration in '/etc/modules.conf' is no big deal also:
|
||||
|
||||
alias snd-card-0 snd-card-cmipci # insert your card here
|
||||
alias snd-card-1 snd-pcm-oss # load OSS emulation
|
||||
options snd-pcm-oss snd_dsp_map=0 snd_adsp_map=2 # do the mapping
|
||||
|
||||
This works flawlessly in combination with alsa's native
|
||||
SysVrc-init-script 'alsasound'. Be sure to disable any distribution
|
||||
dependent script (e.g. Mandrake-8.1 has an 'alsa' script which depends
|
||||
on ALSA-0.5).
|
||||
|
||||
Sorry for you *BSD'lers out there. I have no grasp on sound support there.
|
||||
|
||||
HTH Marcus
|
||||
@@ -0,0 +1,56 @@
|
||||
6. libao2: this control audio playing
|
||||
|
||||
As in libvo (see 5.) also here are some drivers, based on the same API:
|
||||
|
||||
static int control(int cmd, int arg);
|
||||
This is for reading/setting driver-specific and other special parameters.
|
||||
Not really used for now.
|
||||
|
||||
static int init(int rate,int channels,int format,int flags);
|
||||
The init of driver, opens device, sets sample rate, channels, sample format
|
||||
parameters.
|
||||
Sample format: usually AFMT_S16_LE or AFMT_U8, for more definitions see
|
||||
dec_audio.c and linux/soundcards.h files!
|
||||
|
||||
static void uninit(void);
|
||||
Guess what.
|
||||
Ok I help: closes the device, not (yet) called when exit.
|
||||
|
||||
static void reset(void);
|
||||
Resets device. To be exact, it's for deleting buffers' contents,
|
||||
so after reset() the previously received stuff won't be output.
|
||||
(called if pause or seek)
|
||||
|
||||
static int get_space(void);
|
||||
Returns how many bytes can be written into the audio buffer without
|
||||
blocking (making caller process wait). MPlayer occasionally checks the
|
||||
remaining space and tries to fill the buffer with play() if there's free
|
||||
space. The buffer size used should be sane; a buffer that is too small
|
||||
could run empty before MPlayer tries filling it again (normally once per
|
||||
video frame), a buffer that is too big would force MPlayer decode the file
|
||||
far ahead trying to find enough audio data to fill it.
|
||||
|
||||
static int play(void* data,int len,int flags);
|
||||
Plays a bit of audio, which is received throught the "data" memory area, with
|
||||
a size of "len". It has to copy the data, because they can be overwritten
|
||||
after the call is made. Doesn't have to use all the bytes; it has to
|
||||
return the number of bytes used used (copied to buffer). If
|
||||
flags|AOPLAY_FINAL_CHUNK is true then this is the last audio in the file.
|
||||
The purpose of this flag is to tell aos that round down the audio played
|
||||
from "len" to a multiple of some chunksize that this "len" should not be
|
||||
rounded down to 0 or the data will never be played (as MPlayer will never
|
||||
call play() with a larger len).
|
||||
|
||||
static float get_delay(void);
|
||||
Returns how long time it will take to play the data currently in the
|
||||
output buffer. Be exact, if possible, since the whole timing depends
|
||||
on this! In the worst case, return the maximum delay.
|
||||
|
||||
!!! Because the video is synchronized to the audio (card), it's very important
|
||||
!!! that the get_delay function is correctly implemented!
|
||||
|
||||
static void audio_pause(void);
|
||||
Pause playing but do not delete buffered data if possible.
|
||||
|
||||
static void audio_resume(void);
|
||||
Continue playing after audio_pause().
|
||||
@@ -0,0 +1,173 @@
|
||||
libvo --- the library to handle video output by A'rpi, 2002.04
|
||||
============================================
|
||||
|
||||
Note: before start on this, read colorspaces.txt !
|
||||
|
||||
The constants for different pixelformats are defined in img_format.h,
|
||||
their usage is mandatory.
|
||||
|
||||
WARNING: Please keep in mind that some of this information may be out-dated,
|
||||
so if you are working on a new vo, consider submitting preliminary patches
|
||||
very early on. Currently vo_gl is one of the more up-to-date VOs to use
|
||||
as reference if you are unsure about something and do not want to ask on the
|
||||
list.
|
||||
vo_vdpau and vo_direct3d may be a good choice, too, they use different
|
||||
approaches closer to the sometimes convoluted way DirectX works.
|
||||
|
||||
Each vo driver _has_ to implement these:
|
||||
|
||||
preinit():
|
||||
init the video system (to support querying for supported formats)
|
||||
|
||||
uninit():
|
||||
Uninit the whole system, this is on the same "level" as preinit.
|
||||
|
||||
control():
|
||||
Current controls (VOCTRL_QUERY_FORMAT must be implemented,
|
||||
VOCTRL_DRAW_IMAGE, VOCTRL_FULLSCREEN, VOCTRL_UPDATE_SCREENINFO
|
||||
should be implemented):
|
||||
VOCTRL_QUERY_FORMAT - queries if a given pixelformat is supported.
|
||||
It also returns various flags decsirbing the capabilities
|
||||
of the driver with teh given mode. for the flags, see
|
||||
file vfcaps.h !
|
||||
the most important flags, every driver must properly report
|
||||
these:
|
||||
0x1 - supported (with or without conversion)
|
||||
0x2 - supported without conversion (define 0x1 too!)
|
||||
0x100 - driver/hardware handles timing (blocking)
|
||||
also SET sw/hw scaling and osd support flags, and flip,
|
||||
and accept_stride if you implement VOCTRL_DRAW_IMAGE (see bellow)
|
||||
NOTE: VOCTRL_QUERY_FORMAT may be called _before_ first config()
|
||||
but is always called between preinit() and uninit()
|
||||
VOCTRL_GET_IMAGE
|
||||
libmpcodecs Direct Rendering interface
|
||||
You need to update mpi (mp_image.h) structure, for example,
|
||||
look at vo_x11, vo_sdl, vo_xv or mga_common.
|
||||
VOCTRL_DRAW_IMAGE
|
||||
replacement for the current draw_slice/draw_frame way of
|
||||
passing video frames. by implementing SET_IMAGE, you'll get
|
||||
image in mp_image struct instead of by calling draw_*.
|
||||
unless you return VO_TRUE for VOCTRL_DRAW_IMAGE call, the
|
||||
old-style draw_* functils will be called!
|
||||
Note: draw_slice is still mandatory, for per-slice rendering!
|
||||
VOCTRL_RESET - reset the video device
|
||||
This is sent on seeking and similar and is useful if you are
|
||||
using a device which prebuffers frames that need to flush them
|
||||
before refilling audio/video buffers.
|
||||
VOCTRL_PAUSE
|
||||
VOCTRL_RESUME
|
||||
VOCTRL_GUISUPPORT
|
||||
return true only if driver supports co-operation with
|
||||
MPlayer's GUI (not yet used by GUI)
|
||||
VOCTRL_SET_EQUALIZER
|
||||
set the video equalizer to the given values
|
||||
two arguments are provided: item and value
|
||||
item is a string, the possible values are (currently):
|
||||
brightness, contrast, saturation, hue
|
||||
VOCTRL_GET_EQUALIZER
|
||||
get the current video equalizer values
|
||||
two arguments are provided: item and value
|
||||
item is a string, the possible values are (currently):
|
||||
brightness, contrast, saturation, hue
|
||||
VOCTRL_ONTOP
|
||||
Makes the player window stay-on-top. Only supported (currently)
|
||||
by drivers which use X11, except SDL, as well as directx and
|
||||
gl2 under Windows.
|
||||
VOCTRL_BORDER
|
||||
Makes the player window borderless.
|
||||
VOCTRL_FULLSCREEN
|
||||
Switch from and to fullscreen mode
|
||||
VOCTRL_GET_PANSCAN
|
||||
VOCTRL_SET_PANSCAN
|
||||
Needed to implement pan-scan support ('w' and 'e' keys during
|
||||
playback in fullscreen mode)
|
||||
VOCTRL_START_SLICE
|
||||
Called before the first draw_slice of each frame, useful if
|
||||
you need to do some set-up work.
|
||||
VOCTRL_DRAW_EOSD
|
||||
Required for EOSD (ASS subtitle) support. Provides all
|
||||
information necessary to draw the EOSD for the current video
|
||||
frame.
|
||||
VOCTRL_GET_EOSD_RES
|
||||
Required for EOSD (ASS subtitle) support. Informs the ASS
|
||||
renderer about the properties of the drawing area (size,
|
||||
borders).
|
||||
VOCTRL_SET_DEINTERLACE
|
||||
VOCTRL_GET_DEINTERLACE
|
||||
Get or set deinterlacing status for VOs that support some kind
|
||||
of deinterlacing.
|
||||
VOCTRL_UPDATE_SCREENINFO
|
||||
Should set the xinerama_x, xinerama_y, vo_screenwidth and
|
||||
vo_screenheight appropriately for the currently used
|
||||
monitor and -xineramascreen option.
|
||||
Usually should simply call the w32_update_xinerama_info or
|
||||
update_xinerama_info function.
|
||||
By supporting this, the VO also requests the newer API
|
||||
that sets vo_dx, vo_dy etc. appropriately before config()
|
||||
is called.
|
||||
|
||||
config():
|
||||
Set up the video system. You get the dimensions and flags.
|
||||
width, height: size of the source image
|
||||
d_width, d_height: wanted scaled/display size (it's a hint)
|
||||
Flags:
|
||||
0x01 - force fullscreen (-fs)
|
||||
0x02 - allow mode switching (-vm)
|
||||
0x04 - allow software scaling (-zoom)
|
||||
0x08 - flipping (-flip)
|
||||
They're defined as VOFLAG_* (see libvo/video_out.h)
|
||||
|
||||
IMPORTANT NOTE: config() may be called 0 (zero), 1 or more (2,3...)
|
||||
times between preinit() and uninit() calls. You MUST handle it, and
|
||||
you shouldn't crash at second config() call or at uninit() without
|
||||
any config() call! To make your life easier, vo_config_count is
|
||||
set to the number of previous config() call, counted from preinit().
|
||||
It's set by the caller (vf_vo.c), you don't have to increase it!
|
||||
So, you can check for vo_config_count>0 in uninit() when freeing
|
||||
resources allocated in config() to avoid crash!
|
||||
|
||||
You should implement VOCTRL_UPDATE_SCREENINFO so that vo_dx, vo_dy,
|
||||
vo_dwidth and vo_dheight are already pre-set to values that take
|
||||
aspect and -geometry into account. It is also necessary to properly
|
||||
support multi-monitor setups (if based on x11_common, w32_common).
|
||||
|
||||
draw_slice(): this displays YV12 pictures (3 planes, one full sized that
|
||||
contains brightness (Y), and 2 quarter-sized which the colour-info
|
||||
(U,V). MPEG codecs (libmpeg2, opendivx) use this. This doesn't have
|
||||
to display the whole frame, only update small parts of it.
|
||||
If this is not supported, it must be signaled in QUERY_FORMAT with
|
||||
VOCAP_NOSLICES.
|
||||
|
||||
draw_frame(): this is the older interface, this displays only complete
|
||||
frames, and can do only packed format (YUY2, RGB/BGR).
|
||||
Win32 codecs use this (DivX, Indeo, etc).
|
||||
If you implement VOCTRL_DRAW_IMAGE, you do not need to implement draw_frame.
|
||||
|
||||
draw_osd(): this displays subtitles and OSD.
|
||||
It's a bit tricky to use it, since it's a callback-style stuff.
|
||||
It should call vo_draw_text() with screen dimension and your
|
||||
draw_alpha implementation for the pixelformat (function pointer).
|
||||
The vo_draw_text() checks the characters to draw, and calls
|
||||
draw_alpha() for each. As a help, osd.c contains draw_alpha for
|
||||
each pixelformats, use this if possible!
|
||||
Note that if you do not draw directly onto the video you should
|
||||
use vo_draw_text_ext() which allows you to specify the border
|
||||
values etc. needed to draw DVD menu highlights at the correct place.
|
||||
If you do not want to implement this, you can still use -vf
|
||||
expand=osd=1 to draw the OSD, or even implement code to insert
|
||||
this filter automatically.
|
||||
Make sure you set VFCAP_OSD depending on whether you implemented it
|
||||
or not.
|
||||
|
||||
NOTE: This one will be obsolete soon! But it's still useful when
|
||||
you want to do tricks, like rendering osd _after_ hardware scaling
|
||||
(tdfxfb) or render subtitles under of the image (vo_mpegpes, sdl)
|
||||
|
||||
NOTE2: above NOTE is probably wrong, there are currently no plans to
|
||||
obsolete draw_osd, though there is the more advanced EOSD support for
|
||||
ASS subtitles.
|
||||
|
||||
flip_page(): this is called after each frame, this displays the buffer for
|
||||
real. This is 'swapbuffers' when doublebuffering.
|
||||
Try to do as little work here as possible, since that affect jitter/
|
||||
A-V sync.
|
||||
@@ -0,0 +1,100 @@
|
||||
TITLE=Weird Al Yankovic - The Saga Begins (clip)
|
||||
# just to be informative (maybe future
|
||||
# use?)
|
||||
FILE=14233792,7972c637f619e01854ecb453b7339e3f # size,md5
|
||||
AUTHOR=Gabucino
|
||||
TYPE=VIDEO # maybe AUDIO in future (for displaying
|
||||
# mp3 lyrics while playing or whatever)
|
||||
FORMAT=TIME # this file contains measures based on
|
||||
# TIME, not frames.
|
||||
|
||||
# if FORMAT is a number, then it's frame based, i.e.:
|
||||
# FORMAT=25
|
||||
|
||||
NOTE=MPlayerSub test file v0.1
|
||||
|
||||
# first number : wait this much after previous subtitle disappeared
|
||||
# second number : display the current subtitle for this many seconds
|
||||
|
||||
15 3
|
||||
A long, long time ago...
|
||||
|
||||
0 3
|
||||
in a galaxy far away...
|
||||
|
||||
0 3
|
||||
Naboo was under an attack.
|
||||
|
||||
1 2.5
|
||||
And I thought me and
|
||||
Qui-Gon Jinn could
|
||||
|
||||
0 2.5
|
||||
talk the Federation into
|
||||
|
||||
0 4
|
||||
...maybe cutting them a
|
||||
little slack.
|
||||
|
||||
2 3
|
||||
But their response, it
|
||||
didn't thrill us,
|
||||
|
||||
0 3
|
||||
They locked the doors,
|
||||
and tried to kill us.
|
||||
|
||||
0 2.5
|
||||
We escaped from that gas,
|
||||
|
||||
0 3.5
|
||||
then met Jar-jar and
|
||||
Boss-Nass.
|
||||
|
||||
1 6
|
||||
We took a bongo from the
|
||||
scene and we went to
|
||||
Theed to see the Queen.
|
||||
|
||||
0 5
|
||||
We all wound' up on
|
||||
Tatooine.
|
||||
|
||||
0 6
|
||||
That's where, we've found
|
||||
this boy.
|
||||
|
||||
0 4
|
||||
Oh my, my this here
|
||||
Anakin guy,
|
||||
|
||||
0 5
|
||||
maybe Vader someday
|
||||
later now he's just
|
||||
a small fry.
|
||||
|
||||
0 4
|
||||
And he left his home and
|
||||
kissed his mommy goodbye,
|
||||
|
||||
0 5
|
||||
singing "Soon I'm gonna be
|
||||
a Jedi!"
|
||||
|
||||
6 6
|
||||
Did you know this junkyard
|
||||
slave isn't even old enough
|
||||
to shave,
|
||||
|
||||
0 3
|
||||
but he can use the Force,
|
||||
they say.
|
||||
|
||||
1 6
|
||||
Ahh, do you see him hitting
|
||||
on the queen though he's
|
||||
just nine and she's fourteen
|
||||
|
||||
0 6
|
||||
yeah, he's probably gonna
|
||||
marry her, someday!
|
||||
@@ -0,0 +1,19 @@
|
||||
software scaler filter docs
|
||||
|
||||
-ssf cgb=<float> chrominance gaussian blur
|
||||
useful for videos with some chroma (color) noise (TV captures, VHS, ...)
|
||||
|
||||
-ssf lgb=<float> -> luminance gaussian blur
|
||||
hmm, mostly special effect, could be used as lame noise reducer though
|
||||
|
||||
-ssf chs=<int> -> shift chrominance horizontally
|
||||
-ssf cvs=<int> -> shift chrominance vertically
|
||||
useful if the luma & chroma are not aligned exactly
|
||||
|
||||
-ssf cs=<float> -> chrominance sharpen
|
||||
-ssf ls=<float> -> luminance sharpen
|
||||
simple sharpening filter
|
||||
|
||||
note: these will only work if the swscaler is used at all (use -vf scale)
|
||||
|
||||
example: mplayer foobar.avi -vf scale -ssf lgb=3.0
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
artifact types:
|
||||
---------------------------------------------------------------------
|
||||
ringing
|
||||
wave or noise like patterns around sharp edges
|
||||
bad: sinc, lanczos (with high filter length)
|
||||
acceptable: lanczos (with low filter length), cubic, spline
|
||||
ok: area, (fast)blinear, gauss, point
|
||||
|
||||
blur
|
||||
loss of detail / high frequency
|
||||
bad: gauss with high variance
|
||||
acceptable: (fast)bilinear, area
|
||||
ok: others
|
||||
|
||||
aliasing (only downscale)
|
||||
straight lines look like staircases
|
||||
areas of high detail look worse
|
||||
regular patterns turn into a funny looking mess (moire patterns)
|
||||
bad: fast bilinear, point, gauss with low variance
|
||||
acceptable: area
|
||||
ok: others
|
||||
|
||||
blocky (upscale only)
|
||||
looks like the image is made of rectangular blocks like a mosaic
|
||||
bad: point
|
||||
ok: others
|
||||
|
||||
recommendations: (based upon my personal opinion many ppl might disagree ...)
|
||||
---------------------------------------------------------------------
|
||||
|
||||
the recommended scalers for upscaling:
|
||||
fast_bilinear, point if speed is important
|
||||
cubic, spline, lanczos if quality is important
|
||||
|
||||
the recommended scalers for downscaling:
|
||||
fast_bilinear, point if speed is important
|
||||
gauss, bilinear if quality is important
|
||||
cubic, spline, lanczos if a sharper picture is important
|
||||
|
||||
note: when encoding at a limited amount of bits (not constant quantizer)
|
||||
then a slightly blurred input might look better after decoding than a slightly
|
||||
sharpened one, especially for lower bitrates
|
||||
|
||||
sws numbers / names / artifact types
|
||||
-------------------------------------------------------------------------
|
||||
r ringing
|
||||
b blurry
|
||||
a aliasing (downscale only)
|
||||
m mosaic (blocky) (upscale only)
|
||||
|
||||
-sws 0 fast bilinear bA
|
||||
-sws 1 bilinear b
|
||||
-sws 2 bicubic high sharpness r
|
||||
low sharpness b
|
||||
-sws 3 experimental ????
|
||||
-sws 4 nearest neighbour AM
|
||||
-sws 5 area ba
|
||||
-sws 6 luma bicubic / chroma bilinear r
|
||||
-sws 7 gauss low sharpness B
|
||||
high sharpness AM
|
||||
-sws 8 sinc R
|
||||
-sws 9 lanczos long filter R
|
||||
short filter b
|
||||
-sws 10 bicubic spline r
|
||||
|
||||
Notes:
|
||||
area upscale is identical to bilinear
|
||||
@@ -1,111 +0,0 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
This file lists all changes that can cause compatibility issues when using
|
||||
mpv through the client API (libmpv and ``client.h``). Since the client API
|
||||
interfaces to input handling (commands, properties) as well as command line
|
||||
options, you should also look at ``interface-changes.rst``.
|
||||
|
||||
Normally, changes to the C API that are incompatible to previous iterations
|
||||
receive a major version bump (i.e. the first version number is increased),
|
||||
while C API additions bump the minor version (i.e. the second number is
|
||||
increased). Changes to properties/commands/options may also lead to a minor
|
||||
version bump, in particular if they are incompatible.
|
||||
|
||||
The version number is the same as used for MPV_CLIENT_API_VERSION (see
|
||||
``client.h`` how to convert between major/minor version numbers and the flat
|
||||
32 bit integer).
|
||||
|
||||
Also, read the section ``Compatibility`` in ``client.h``.
|
||||
|
||||
Options, commands, properties
|
||||
=============================
|
||||
|
||||
Changes to these are not listed here, but in ``interface-changes.rst``. (Before
|
||||
client API version 1.17, they were listed here partially.)
|
||||
|
||||
This listing includes changes to the bare C API and behavior only, not what
|
||||
you can access with them.
|
||||
|
||||
API changes
|
||||
===========
|
||||
|
||||
::
|
||||
|
||||
--- mpv 0.11.0 ---
|
||||
1.19 - add "GL_MP_D3D_interfaces" pseudo extension to make it possible to
|
||||
use DXVA2 in OpenGL fullscreen mode in some situations
|
||||
- mpv_request_log_messages() now accepts "terminal-default" as parameter
|
||||
1.18 - add MPV_END_FILE_REASON_REDIRECT, and change behavior of
|
||||
MPV_EVENT_END_FILE accordingly
|
||||
- a bunch of interface-changes.rst changes
|
||||
1.17 - mpv_initialize() now blocks SIGPIPE (details see client.h)
|
||||
--- mpv 0.9.0 ---
|
||||
1.16 - add mpv_opengl_cb_report_flip()
|
||||
- introduce mpv_opengl_cb_draw() and deprecate mpv_opengl_cb_render()
|
||||
- add MPV_FORMAT_BYTE_ARRAY
|
||||
1.15 - mpv_initialize() will now load config files. This requires setting
|
||||
the "config" and "config-dir" options. In particular, it will load
|
||||
mpv.conf.
|
||||
- minor backwards-compatible change to the "seek" and "screenshot"
|
||||
commands (new flag syntax, old additional args deprecated)
|
||||
--- mpv 0.8.0 ---
|
||||
1.14 - add mpv_wait_async_requests()
|
||||
- the --msg-level option changes its native type from a flat string to
|
||||
a key-value list (setting/reading the option as string still works)
|
||||
1.13 - add MPV_EVENT_QUEUE_OVERFLOW
|
||||
1.12 - add class Handle to qthelper.hpp
|
||||
- improve opengl_cb.h API uninitialization behavior, and fix the qml
|
||||
example
|
||||
- add mpv_create_client() function
|
||||
1.11 - add OpenGL rendering interop API - allows an application to combine
|
||||
its own and mpv's OpenGL rendering
|
||||
Warning: this API is not stable yet - anything in opengl_cb.h might
|
||||
be changed in completely incompatible ways in minor API bumps
|
||||
--- mpv 0.7.0 ---
|
||||
1.10 - deprecate/disable everything directly related to script_dispatch
|
||||
(most likely affects nobody)
|
||||
1.9 - add enum mpv_end_file_reason for mpv_event_end_file.reason
|
||||
- add MPV_END_FILE_REASON_ERROR and the mpv_event_end_file.error field
|
||||
for slightly better error reporting on playback failure
|
||||
- add --stop-playback-on-init-failure option, and make it the default
|
||||
behavior for libmpv only
|
||||
- add qthelper.hpp set_option_variant()
|
||||
- mark the following events as deprecated:
|
||||
MPV_EVENT_TRACKS_CHANGED
|
||||
MPV_EVENT_TRACK_SWITCHED
|
||||
MPV_EVENT_PAUSE
|
||||
MPV_EVENT_UNPAUSE
|
||||
MPV_EVENT_METADATA_UPDATE
|
||||
MPV_EVENT_CHAPTER_CHANGE
|
||||
They are handled better with mpv_observe_property() as mentioned in
|
||||
the documentation comments. They are not removed and still work.
|
||||
1.8 - add qthelper.hpp
|
||||
1.7 - add mpv_command_node(), mpv_command_node_async()
|
||||
1.6 - modify "core-idle" property behavior
|
||||
- MPV_EVENT_LOG_MESSAGE now always sends complete lines
|
||||
- introduce numeric log levels (mpv_log_level)
|
||||
--- mpv 0.6.0 ---
|
||||
1.5 - change in X11 and "--wid" behavior again. The previous change didn't
|
||||
work as expected, and now the behavior can be explicitly controlled
|
||||
with the "input-x11-keyboard" option. This is only a temporary
|
||||
measure until XEmbed is implemented and confirmed working.
|
||||
Note: in 1.6, "input-x11-keyboard" was renamed to "input-vo-keyboard",
|
||||
although the old option name still works.
|
||||
1.4 - subtle change in X11 and "--wid" behavior
|
||||
(this change was added to 0.5.2, and broke some things, see #1090)
|
||||
--- mpv 0.5.0 ---
|
||||
1.3 - add MPV_MAKE_VERSION()
|
||||
1.2 - remove "stream-time-pos" property (no replacement)
|
||||
1.1 - remap dvdnav:// to dvd://
|
||||
- add "--cache-file", "--cache-file-size"
|
||||
- add "--colormatrix-primaries" (and property)
|
||||
- add "primaries" sub-field to image format properties
|
||||
- add "playback-time" property
|
||||
- extend the "--start" option; a leading "+", which was previously
|
||||
insignificant is now significant
|
||||
- add "cache-free" and "cache-used" properties
|
||||
- OSX: the "coreaudio" AO spdif code is split into a separate AO
|
||||
--- mpv 0.4.0 ---
|
||||
1.0 - the API is declared stable
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
All examples in this directory and its sub-directories are licensed
|
||||
under one of the following licenses:
|
||||
|
||||
WTFPL, ISC, Ms-PL, AGPLv3, BSD (any)
|
||||
|
||||
Pick any license of your liking, and disregard the others.
|
||||
|
||||
(The full text of each license is available on this website:
|
||||
http://opensource.org/licenses/alphabetical )
|
||||
|
||||
Additionally, you may consider the example code to be public domain.
|
||||
You are free to use any of the example code without further
|
||||
requirements or need for attribution.
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
Client API examples
|
||||
===================
|
||||
|
||||
All these examples use the mpv client API through libmpv.
|
||||
|
||||
cocoa
|
||||
-----
|
||||
|
||||
Shows how to embed the mpv video window in Objective-C/Cocoa.
|
||||
|
||||
qt
|
||||
--
|
||||
|
||||
Shows how to embed the mpv video window in Qt (using normal desktop widgets).
|
||||
|
||||
qml
|
||||
---
|
||||
|
||||
Shows how to use mpv's OpenGL video renderer in QtQuick2 with QML.
|
||||
|
||||
qml_direct
|
||||
----------
|
||||
|
||||
Alternative example, which typically avoids a FBO indirection. Might be
|
||||
slightly faster, but is less flexible and harder to use.
|
||||
|
||||
sdl
|
||||
---
|
||||
|
||||
Show how to embed the mpv OpenGL renderer in SDL.
|
||||
|
||||
simple
|
||||
------
|
||||
|
||||
Very primitive terminal-only example. Shows some most basic API usage.
|
||||
@@ -1,304 +0,0 @@
|
||||
// Plays a video from the command line in an opengl view in its own window.
|
||||
|
||||
// Build with: clang -o cocoa-openglcb cocoa-openglcb.m `pkg-config --libs --cflags mpv` -framework Cocoa -framework OpenGL
|
||||
|
||||
#import <mpv/client.h>
|
||||
#import <mpv/opengl_cb.h>
|
||||
|
||||
#import <stdio.h>
|
||||
#import <stdlib.h>
|
||||
#import <OpenGL/gl.h>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
static inline void check_error(int status)
|
||||
{
|
||||
if (status < 0) {
|
||||
printf("mpv API error: %s\n", mpv_error_string(status));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void *get_proc_address(void *ctx, const char *name)
|
||||
{
|
||||
CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingASCII);
|
||||
void *addr = CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")), symbolName);
|
||||
CFRelease(symbolName);
|
||||
return addr;
|
||||
}
|
||||
|
||||
static void glupdate(void *ctx);
|
||||
|
||||
@interface MpvClientOGLView : NSOpenGLView
|
||||
@property mpv_opengl_cb_context *mpvGL;
|
||||
- (instancetype)initWithFrame:(NSRect)frame;
|
||||
- (void)drawRect;
|
||||
- (void)fillBlack;
|
||||
@end
|
||||
|
||||
@implementation MpvClientOGLView
|
||||
- (instancetype)initWithFrame:(NSRect)frame
|
||||
{
|
||||
// make sure the pixel format is double buffered so we can use
|
||||
// [[self openGLContext] flushBuffer].
|
||||
NSOpenGLPixelFormatAttribute attributes[] = {
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
0
|
||||
};
|
||||
self = [super initWithFrame:frame
|
||||
pixelFormat:[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]];
|
||||
|
||||
if (self) {
|
||||
[self setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
||||
// swap on vsyncs
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
self.mpvGL = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)fillBlack
|
||||
{
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
- (void)drawRect
|
||||
{
|
||||
if (self.mpvGL)
|
||||
mpv_opengl_cb_draw(self.mpvGL, 0, self.bounds.size.width, -self.bounds.size.height);
|
||||
else
|
||||
[self fillBlack];
|
||||
[[self openGLContext] flushBuffer];
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
[self drawRect];
|
||||
}
|
||||
@end
|
||||
|
||||
@interface CocoaWindow : NSWindow
|
||||
@property(retain, readonly) MpvClientOGLView *glView;
|
||||
@property(retain, readonly) NSButton *pauseButton;
|
||||
@end
|
||||
|
||||
@implementation CocoaWindow
|
||||
- (BOOL)canBecomeMainWindow { return YES; }
|
||||
- (BOOL)canBecomeKeyWindow { return YES; }
|
||||
- (void)initOGLView {
|
||||
NSRect bounds = [[self contentView] bounds];
|
||||
// window coordinate origin is bottom left
|
||||
NSRect glFrame = NSMakeRect(bounds.origin.x, bounds.origin.y + 30, bounds.size.width, bounds.size.height - 30);
|
||||
_glView = [[MpvClientOGLView alloc] initWithFrame:glFrame];
|
||||
[self.contentView addSubview:_glView];
|
||||
|
||||
NSRect buttonFrame = NSMakeRect(bounds.origin.x, bounds.origin.y, 60, 30);
|
||||
_pauseButton = [[NSButton alloc] initWithFrame:buttonFrame];
|
||||
_pauseButton.buttonType = NSToggleButton;
|
||||
// button target has to be the delegate (it holds the mpv context
|
||||
// pointer), so that's set later.
|
||||
_pauseButton.action = @selector(togglePause:);
|
||||
_pauseButton.title = @"Pause";
|
||||
_pauseButton.alternateTitle = @"Play";
|
||||
[self.contentView addSubview:_pauseButton];
|
||||
}
|
||||
@end
|
||||
|
||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||
{
|
||||
mpv_handle *mpv;
|
||||
dispatch_queue_t queue;
|
||||
CocoaWindow *window;
|
||||
}
|
||||
@end
|
||||
|
||||
static void wakeup(void *);
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (void)createWindow {
|
||||
|
||||
int mask = NSTitledWindowMask|NSClosableWindowMask|
|
||||
NSMiniaturizableWindowMask|NSResizableWindowMask;
|
||||
|
||||
window = [[CocoaWindow alloc]
|
||||
initWithContentRect:NSMakeRect(0, 0, 1280, 720)
|
||||
styleMask:mask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
|
||||
// force a minimum size to stop opengl from exploding.
|
||||
[window setMinSize:NSMakeSize(200, 200)];
|
||||
[window initOGLView];
|
||||
[window setTitle:@"cocoa-openglcb example"];
|
||||
[window makeMainWindow];
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
|
||||
NSMenu *m = [[NSMenu alloc] initWithTitle:@"AMainMenu"];
|
||||
NSMenuItem *item = [m addItemWithTitle:@"Apple" action:nil keyEquivalent:@""];
|
||||
NSMenu *sm = [[NSMenu alloc] initWithTitle:@"Apple"];
|
||||
[m setSubmenu:sm forItem:item];
|
||||
[sm addItemWithTitle: @"quit" action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
[NSApp setMenu:m];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
- (void) applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
atexit_b(^{
|
||||
// Because activation policy has just been set to behave like a real
|
||||
// application, that policy must be reset on exit to prevent, among
|
||||
// other things, the menubar created here from remaining on screen.
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
||||
});
|
||||
|
||||
// Read filename
|
||||
NSArray *args = [NSProcessInfo processInfo].arguments;
|
||||
if (args.count < 2) {
|
||||
NSLog(@"Expected filename on command line");
|
||||
exit(1);
|
||||
}
|
||||
NSString *filename = args[1];
|
||||
|
||||
[self createWindow];
|
||||
window.pauseButton.target = self;
|
||||
|
||||
mpv = mpv_create();
|
||||
if (!mpv) {
|
||||
printf("failed creating context\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
check_error(mpv_set_option_string(mpv, "input-media-keys", "yes"));
|
||||
// request important errors
|
||||
check_error(mpv_request_log_messages(mpv, "warn"));
|
||||
|
||||
check_error(mpv_initialize(mpv));
|
||||
check_error(mpv_set_option_string(mpv, "vo", "opengl-cb"));
|
||||
mpv_opengl_cb_context *mpvGL = mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
|
||||
if (!mpvGL) {
|
||||
puts("libmpv does not have the opengl-cb sub-API.");
|
||||
exit(1);
|
||||
}
|
||||
// pass the mpvGL context to our view
|
||||
window.glView.mpvGL = mpvGL;
|
||||
int r = mpv_opengl_cb_init_gl(mpvGL, NULL, get_proc_address, NULL);
|
||||
if (r < 0) {
|
||||
puts("gl init has failed.");
|
||||
exit(1);
|
||||
}
|
||||
mpv_opengl_cb_set_update_callback(mpvGL, glupdate, (__bridge void *)window.glView);
|
||||
|
||||
// Deal with MPV in the background.
|
||||
queue = dispatch_queue_create("mpv", DISPATCH_QUEUE_SERIAL);
|
||||
dispatch_async(queue, ^{
|
||||
// Register to be woken up whenever mpv generates new events.
|
||||
mpv_set_wakeup_callback(mpv, wakeup, (__bridge void *)self);
|
||||
// Load the indicated file
|
||||
const char *cmd[] = {"loadfile", filename.UTF8String, NULL};
|
||||
check_error(mpv_command(mpv, cmd));
|
||||
});
|
||||
}
|
||||
|
||||
static void glupdate(void *ctx)
|
||||
{
|
||||
MpvClientOGLView *glView = (__bridge MpvClientOGLView *)ctx;
|
||||
// I'm still not sure what the best way to handle this is, but this
|
||||
// works.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[glView drawRect];
|
||||
});
|
||||
}
|
||||
|
||||
- (void) handleEvent:(mpv_event *)event
|
||||
{
|
||||
switch (event->event_id) {
|
||||
case MPV_EVENT_SHUTDOWN: {
|
||||
mpv_detach_destroy(mpv);
|
||||
mpv_opengl_cb_uninit_gl(window.glView.mpvGL);
|
||||
mpv = NULL;
|
||||
printf("event: shutdown\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case MPV_EVENT_LOG_MESSAGE: {
|
||||
struct mpv_event_log_message *msg = (struct mpv_event_log_message *)event->data;
|
||||
printf("[%s] %s: %s", msg->prefix, msg->level, msg->text);
|
||||
}
|
||||
|
||||
default:
|
||||
printf("event: %s\n", mpv_event_name(event->event_id));
|
||||
}
|
||||
}
|
||||
|
||||
- (void)togglePause:(NSButton *)button
|
||||
{
|
||||
if (mpv) {
|
||||
switch (button.state) {
|
||||
case NSOffState:
|
||||
{
|
||||
int pause = 0;
|
||||
mpv_set_property(mpv, "pause", MPV_FORMAT_FLAG, &pause);
|
||||
}
|
||||
break;
|
||||
case NSOnState:
|
||||
{
|
||||
int pause = 1;
|
||||
mpv_set_property(mpv, "pause", MPV_FORMAT_FLAG, &pause);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NSLog(@"This should never happen.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) readEvents
|
||||
{
|
||||
dispatch_async(queue, ^{
|
||||
while (mpv) {
|
||||
mpv_event *event = mpv_wait_event(mpv, 0);
|
||||
if (event->event_id == MPV_EVENT_NONE)
|
||||
break;
|
||||
[self handleEvent:event];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void wakeup(void *context)
|
||||
{
|
||||
AppDelegate *a = (__bridge AppDelegate *) context;
|
||||
[a readEvents];
|
||||
}
|
||||
|
||||
// quit when the window is closed.
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||
{
|
||||
NSLog(@"Terminating.");
|
||||
const char *args[] = {"quit", NULL};
|
||||
mpv_command(mpv, args);
|
||||
[window.glView clearGLContext];
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// Delete this if you already have a main.m.
|
||||
int main(int argc, const char * argv[]) {
|
||||
@autoreleasepool {
|
||||
NSApplication *app = [NSApplication sharedApplication];
|
||||
AppDelegate *delegate = [AppDelegate new];
|
||||
app.delegate = delegate;
|
||||
[app run];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
// Plays a video from the command line in a view provided by the client
|
||||
// application.
|
||||
|
||||
// Build with: clang -o cocoabasic cocoabasic.m `pkg-config --libs --cflags mpv` -framework cocoa
|
||||
|
||||
#include <mpv/client.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static inline void check_error(int status)
|
||||
{
|
||||
if (status < 0) {
|
||||
printf("mpv API error: %s\n", mpv_error_string(status));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface CocoaWindow : NSWindow
|
||||
@end
|
||||
|
||||
@implementation CocoaWindow
|
||||
- (BOOL)canBecomeMainWindow { return YES; }
|
||||
- (BOOL)canBecomeKeyWindow { return YES; }
|
||||
@end
|
||||
|
||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||
{
|
||||
mpv_handle *mpv;
|
||||
dispatch_queue_t queue;
|
||||
NSWindow *w;
|
||||
NSView *wrapper;
|
||||
}
|
||||
@end
|
||||
|
||||
static void wakeup(void *);
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (void)createWindow {
|
||||
|
||||
int mask = NSTitledWindowMask|NSClosableWindowMask|
|
||||
NSMiniaturizableWindowMask|NSResizableWindowMask;
|
||||
|
||||
self->w = [[CocoaWindow alloc]
|
||||
initWithContentRect:NSMakeRect(0,0, 1280, 720)
|
||||
styleMask:mask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
|
||||
[self->w setTitle:@"cocoabasic example"];
|
||||
[self->w makeMainWindow];
|
||||
[self->w makeKeyAndOrderFront:nil];
|
||||
|
||||
NSRect frame = [[self->w contentView] bounds];
|
||||
self->wrapper = [[NSView alloc] initWithFrame:frame];
|
||||
[self->wrapper setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
||||
[[self->w contentView] addSubview:self->wrapper];
|
||||
[self->wrapper release];
|
||||
|
||||
NSMenu *m = [[NSMenu alloc] initWithTitle:@"AMainMenu"];
|
||||
NSMenuItem *item = [m addItemWithTitle:@"Apple" action:nil keyEquivalent:@""];
|
||||
NSMenu *sm = [[NSMenu alloc] initWithTitle:@"Apple"];
|
||||
[m setSubmenu:sm forItem:item];
|
||||
[sm addItemWithTitle: @"mpv_command('stop')" action:@selector(mpv_stop) keyEquivalent:@""];
|
||||
[sm addItemWithTitle: @"mpv_command('quit')" action:@selector(mpv_quit) keyEquivalent:@""];
|
||||
[sm addItemWithTitle: @"quit" action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
[NSApp setMenu:m];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
- (void) applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
atexit_b(^{
|
||||
// Because activation policy has just been set to behave like a real
|
||||
// application, that policy must be reset on exit to prevent, among
|
||||
// other things, the menubar created here from remaining on screen.
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
||||
});
|
||||
|
||||
// Read filename
|
||||
NSArray *args = [NSProcessInfo processInfo].arguments;
|
||||
if (args.count < 2) {
|
||||
NSLog(@"Expected filename on command line");
|
||||
exit(1);
|
||||
}
|
||||
NSString *filename = args[1];
|
||||
|
||||
[self createWindow];
|
||||
|
||||
// Deal with MPV in the background.
|
||||
queue = dispatch_queue_create("mpv", DISPATCH_QUEUE_SERIAL);
|
||||
dispatch_async(queue, ^{
|
||||
|
||||
mpv = mpv_create();
|
||||
if (!mpv) {
|
||||
printf("failed creating context\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int64_t wid = (intptr_t) self->wrapper;
|
||||
check_error(mpv_set_option(mpv, "wid", MPV_FORMAT_INT64, &wid));
|
||||
|
||||
// Maybe set some options here, like default key bindings.
|
||||
// NOTE: Interaction with the window seems to be broken for now.
|
||||
check_error(mpv_set_option_string(mpv, "input-default-bindings", "yes"));
|
||||
|
||||
// for testing!
|
||||
check_error(mpv_set_option_string(mpv, "input-media-keys", "yes"));
|
||||
check_error(mpv_set_option_string(mpv, "input-cursor", "no"));
|
||||
check_error(mpv_set_option_string(mpv, "input-vo-keyboard", "yes"));
|
||||
|
||||
// request important errors
|
||||
check_error(mpv_request_log_messages(mpv, "warn"));
|
||||
|
||||
check_error(mpv_initialize(mpv));
|
||||
|
||||
// Register to be woken up whenever mpv generates new events.
|
||||
mpv_set_wakeup_callback(mpv, wakeup, (__bridge void *) self);
|
||||
|
||||
// Load the indicated file
|
||||
const char *cmd[] = {"loadfile", filename.UTF8String, NULL};
|
||||
check_error(mpv_command(mpv, cmd));
|
||||
});
|
||||
}
|
||||
|
||||
- (void) handleEvent:(mpv_event *)event
|
||||
{
|
||||
switch (event->event_id) {
|
||||
case MPV_EVENT_SHUTDOWN: {
|
||||
mpv_detach_destroy(mpv);
|
||||
mpv = NULL;
|
||||
printf("event: shutdown\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case MPV_EVENT_LOG_MESSAGE: {
|
||||
struct mpv_event_log_message *msg = (struct mpv_event_log_message *)event->data;
|
||||
printf("[%s] %s: %s", msg->prefix, msg->level, msg->text);
|
||||
}
|
||||
|
||||
case MPV_EVENT_VIDEO_RECONFIG: {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSArray *subviews = [self->wrapper subviews];
|
||||
if ([subviews count] > 0) {
|
||||
// mpv's events view
|
||||
NSView *eview = [self->wrapper subviews][0];
|
||||
[self->w makeFirstResponder:eview];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
default:
|
||||
printf("event: %s\n", mpv_event_name(event->event_id));
|
||||
}
|
||||
}
|
||||
|
||||
- (void) readEvents
|
||||
{
|
||||
dispatch_async(queue, ^{
|
||||
while (mpv) {
|
||||
mpv_event *event = mpv_wait_event(mpv, 0);
|
||||
if (event->event_id == MPV_EVENT_NONE)
|
||||
break;
|
||||
[self handleEvent:event];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void wakeup(void *context) {
|
||||
AppDelegate *a = (__bridge AppDelegate *) context;
|
||||
[a readEvents];
|
||||
}
|
||||
|
||||
// Ostensibly, mpv's window would be hooked up to this.
|
||||
- (BOOL) windowShouldClose:(id)sender
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) mpv_stop
|
||||
{
|
||||
if (mpv) {
|
||||
const char *args[] = {"stop", NULL};
|
||||
mpv_command(mpv, args);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) mpv_quit
|
||||
{
|
||||
if (mpv) {
|
||||
const char *args[] = {"quit", NULL};
|
||||
mpv_command(mpv, args);
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
// Delete this if you already have a main.m.
|
||||
int main(int argc, const char * argv[]) {
|
||||
@autoreleasepool {
|
||||
NSApplication *app = [NSApplication sharedApplication];
|
||||
AppDelegate *delegate = [AppDelegate new];
|
||||
app.delegate = delegate;
|
||||
[app run];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
#include "main.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <clocale>
|
||||
|
||||
#include <QObject>
|
||||
#include <QtGlobal>
|
||||
#include <QOpenGLContext>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#include <QtGui/QOpenGLFramebufferObject>
|
||||
|
||||
#include <QtQuick/QQuickWindow>
|
||||
#include <QtQuick/QQuickView>
|
||||
|
||||
class MpvRenderer : public QQuickFramebufferObject::Renderer
|
||||
{
|
||||
static void *get_proc_address(void *ctx, const char *name) {
|
||||
(void)ctx;
|
||||
QOpenGLContext *glctx = QOpenGLContext::currentContext();
|
||||
if (!glctx)
|
||||
return NULL;
|
||||
return (void *)glctx->getProcAddress(QByteArray(name));
|
||||
}
|
||||
|
||||
mpv::qt::Handle mpv;
|
||||
QQuickWindow *window;
|
||||
mpv_opengl_cb_context *mpv_gl;
|
||||
public:
|
||||
MpvRenderer(const MpvObject *obj)
|
||||
: mpv(obj->mpv), window(obj->window()), mpv_gl(obj->mpv_gl)
|
||||
{
|
||||
int r = mpv_opengl_cb_init_gl(mpv_gl, NULL, get_proc_address, NULL);
|
||||
if (r < 0)
|
||||
throw std::runtime_error("could not initialize OpenGL");
|
||||
}
|
||||
|
||||
virtual ~MpvRenderer()
|
||||
{
|
||||
// Until this call is done, we need to make sure the player remains
|
||||
// alive. This is done implicitly with the mpv::qt::Handle instance
|
||||
// in this class.
|
||||
mpv_opengl_cb_uninit_gl(mpv_gl);
|
||||
}
|
||||
|
||||
void render()
|
||||
{
|
||||
QOpenGLFramebufferObject *fbo = framebufferObject();
|
||||
window->resetOpenGLState();
|
||||
mpv_opengl_cb_draw(mpv_gl, fbo->handle(), fbo->width(), fbo->height());
|
||||
window->resetOpenGLState();
|
||||
}
|
||||
};
|
||||
|
||||
MpvObject::MpvObject(QQuickItem * parent)
|
||||
: QQuickFramebufferObject(parent), mpv_gl(0)
|
||||
{
|
||||
mpv = mpv::qt::Handle::FromRawHandle(mpv_create());
|
||||
if (!mpv)
|
||||
throw std::runtime_error("could not create mpv context");
|
||||
|
||||
mpv_set_option_string(mpv, "terminal", "yes");
|
||||
mpv_set_option_string(mpv, "msg-level", "all=v");
|
||||
|
||||
if (mpv_initialize(mpv) < 0)
|
||||
throw std::runtime_error("could not initialize mpv context");
|
||||
|
||||
// Make use of the MPV_SUB_API_OPENGL_CB API.
|
||||
mpv::qt::set_option_variant(mpv, "vo", "opengl-cb");
|
||||
|
||||
// Request hw decoding, just for testing.
|
||||
mpv::qt::set_option_variant(mpv, "hwdec", "auto");
|
||||
|
||||
// Setup the callback that will make QtQuick update and redraw if there
|
||||
// is a new video frame. Use a queued connection: this makes sure the
|
||||
// doUpdate() function is run on the GUI thread.
|
||||
mpv_gl = (mpv_opengl_cb_context *)mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
|
||||
if (!mpv_gl)
|
||||
throw std::runtime_error("OpenGL not compiled in");
|
||||
mpv_opengl_cb_set_update_callback(mpv_gl, MpvObject::on_update, (void *)this);
|
||||
connect(this, &MpvObject::onUpdate, this, &MpvObject::doUpdate,
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
MpvObject::~MpvObject()
|
||||
{
|
||||
if (mpv_gl)
|
||||
mpv_opengl_cb_set_update_callback(mpv_gl, NULL, NULL);
|
||||
}
|
||||
|
||||
void MpvObject::on_update(void *ctx)
|
||||
{
|
||||
MpvObject *self = (MpvObject *)ctx;
|
||||
emit self->onUpdate();
|
||||
}
|
||||
|
||||
// connected to onUpdate(); signal makes sure it runs on the GUI thread
|
||||
void MpvObject::doUpdate()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void MpvObject::command(const QVariant& params)
|
||||
{
|
||||
mpv::qt::command_variant(mpv, params);
|
||||
}
|
||||
|
||||
void MpvObject::setProperty(const QString& name, const QVariant& value)
|
||||
{
|
||||
mpv::qt::set_property_variant(mpv, name, value);
|
||||
}
|
||||
|
||||
QQuickFramebufferObject::Renderer *MpvObject::createRenderer() const
|
||||
{
|
||||
window()->setPersistentOpenGLContext(true);
|
||||
window()->setPersistentSceneGraph(true);
|
||||
return new MpvRenderer(this);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
// Qt sets the locale in the QGuiApplication constructor, but libmpv
|
||||
// requires the LC_NUMERIC category to be set to "C", so change it back.
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
|
||||
qmlRegisterType<MpvObject>("mpvtest", 1, 0, "MpvObject");
|
||||
|
||||
QQuickView view;
|
||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
view.setSource(QUrl("qrc:///mpvtest/main.qml"));
|
||||
view.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef MPVRENDERER_H_
|
||||
#define MPVRENDERER_H_
|
||||
|
||||
#include <QtQuick/QQuickFramebufferObject>
|
||||
|
||||
#include <mpv/client.h>
|
||||
#include <mpv/opengl_cb.h>
|
||||
#include <mpv/qthelper.hpp>
|
||||
|
||||
class MpvRenderer;
|
||||
|
||||
class MpvObject : public QQuickFramebufferObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
mpv::qt::Handle mpv;
|
||||
mpv_opengl_cb_context *mpv_gl;
|
||||
|
||||
friend class MpvRenderer;
|
||||
|
||||
public:
|
||||
MpvObject(QQuickItem * parent = 0);
|
||||
virtual ~MpvObject();
|
||||
virtual Renderer *createRenderer() const;
|
||||
public slots:
|
||||
void command(const QVariant& params);
|
||||
void setProperty(const QString& name, const QVariant& value);
|
||||
signals:
|
||||
void onUpdate();
|
||||
private slots:
|
||||
void doUpdate();
|
||||
private:
|
||||
static void on_update(void *ctx);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,71 +0,0 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0
|
||||
|
||||
import mpvtest 1.0
|
||||
|
||||
Item {
|
||||
width: 1280
|
||||
height: 720
|
||||
|
||||
MpvObject {
|
||||
id: renderer
|
||||
anchors.fill: parent
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: renderer.command(["loadfile", "../../../test.mkv"])
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: labelFrame
|
||||
anchors.margins: -50
|
||||
radius: 5
|
||||
color: "white"
|
||||
border.color: "black"
|
||||
opacity: 0.8
|
||||
anchors.fill: box
|
||||
}
|
||||
|
||||
Row {
|
||||
id: box
|
||||
anchors.bottom: renderer.bottom
|
||||
anchors.left: renderer.left
|
||||
anchors.right: renderer.right
|
||||
anchors.margins: 100
|
||||
|
||||
Text {
|
||||
anchors.margins: 10
|
||||
wrapMode: Text.WordWrap
|
||||
text: "QtQuick and mpv are both rendering stuff.\n
|
||||
Click to load ../../../test.mkv"
|
||||
}
|
||||
|
||||
// Don't take these controls too seriously. They're for testing.
|
||||
Column {
|
||||
CheckBox {
|
||||
id: checkbox
|
||||
anchors.margins: 10
|
||||
// Heavily filtered means good, right?
|
||||
text: "Make video look like on a Smart TV"
|
||||
onClicked: {
|
||||
if (checkbox.checked) {
|
||||
renderer.command(["vo_cmdline", "scale=sharpen3:scale-param1=5.0"])
|
||||
} else {
|
||||
renderer.command(["vo_cmdline", ""])
|
||||
}
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
id: slider
|
||||
anchors.margins: 10
|
||||
anchors.left: checkbox.left
|
||||
anchors.right: checkbox.right
|
||||
minimumValue: -100
|
||||
maximumValue: 100
|
||||
value: 0
|
||||
onValueChanged: renderer.setProperty("gamma", slider.value | 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
QT += qml quick
|
||||
|
||||
HEADERS += main.h
|
||||
SOURCES += main.cpp
|
||||
|
||||
QT_CONFIG -= no-pkg-config
|
||||
CONFIG += link_pkgconfig debug
|
||||
PKGCONFIG += mpv
|
||||
|
||||
RESOURCES += mpvtest.qrc
|
||||
|
||||
OTHER_FILES += main.qml
|
||||
@@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/mpvtest">
|
||||
<file>main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,159 +0,0 @@
|
||||
#include "main.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <clocale>
|
||||
|
||||
#include <QObject>
|
||||
#include <QtGlobal>
|
||||
#include <QOpenGLContext>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QtQuick/QQuickWindow>
|
||||
#include <QtQuick/QQuickView>
|
||||
|
||||
static void *get_proc_address(void *ctx, const char *name) {
|
||||
(void)ctx;
|
||||
QOpenGLContext *glctx = QOpenGLContext::currentContext();
|
||||
if (!glctx)
|
||||
return NULL;
|
||||
return (void *)glctx->getProcAddress(QByteArray(name));
|
||||
}
|
||||
|
||||
MpvRenderer::MpvRenderer(mpv::qt::Handle a_mpv, mpv_opengl_cb_context *a_mpv_gl)
|
||||
: mpv(a_mpv), mpv_gl(a_mpv_gl), window(0), size()
|
||||
{
|
||||
int r = mpv_opengl_cb_init_gl(mpv_gl, NULL, get_proc_address, NULL);
|
||||
if (r < 0)
|
||||
throw std::runtime_error("could not initialize OpenGL");
|
||||
}
|
||||
|
||||
MpvRenderer::~MpvRenderer()
|
||||
{
|
||||
// Until this call is done, we need to make sure the player remains
|
||||
// alive. This is done implicitly with the mpv::qt::Handle instance
|
||||
// in this class.
|
||||
mpv_opengl_cb_uninit_gl(mpv_gl);
|
||||
}
|
||||
|
||||
void MpvRenderer::paint()
|
||||
{
|
||||
window->resetOpenGLState();
|
||||
|
||||
// This uses 0 as framebuffer, which indicates that mpv will render directly
|
||||
// to the frontbuffer. Note that mpv will always switch framebuffers
|
||||
// explicitly. Some QWindow setups (such as using QQuickWidget) actually
|
||||
// want you to render into a FBO in the beforeRendering() signal, and this
|
||||
// code won't work there.
|
||||
// The negation is used for rendering with OpenGL's flipped coordinates.
|
||||
mpv_opengl_cb_draw(mpv_gl, 0, size.width(), -size.height());
|
||||
|
||||
window->resetOpenGLState();
|
||||
}
|
||||
|
||||
MpvObject::MpvObject(QQuickItem * parent)
|
||||
: QQuickItem(parent), mpv_gl(0), renderer(0)
|
||||
{
|
||||
mpv = mpv::qt::Handle::FromRawHandle(mpv_create());
|
||||
if (!mpv)
|
||||
throw std::runtime_error("could not create mpv context");
|
||||
|
||||
mpv_set_option_string(mpv, "terminal", "yes");
|
||||
mpv_set_option_string(mpv, "msg-level", "all=v");
|
||||
|
||||
if (mpv_initialize(mpv) < 0)
|
||||
throw std::runtime_error("could not initialize mpv context");
|
||||
|
||||
// Make use of the MPV_SUB_API_OPENGL_CB API.
|
||||
mpv::qt::set_option_variant(mpv, "vo", "opengl-cb");
|
||||
|
||||
// Setup the callback that will make QtQuick update and redraw if there
|
||||
// is a new video frame. Use a queued connection: this makes sure the
|
||||
// doUpdate() function is run on the GUI thread.
|
||||
mpv_gl = (mpv_opengl_cb_context *)mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
|
||||
if (!mpv_gl)
|
||||
throw std::runtime_error("OpenGL not compiled in");
|
||||
mpv_opengl_cb_set_update_callback(mpv_gl, MpvObject::on_update, (void *)this);
|
||||
connect(this, &MpvObject::onUpdate, this, &MpvObject::doUpdate,
|
||||
Qt::QueuedConnection);
|
||||
|
||||
connect(this, &QQuickItem::windowChanged,
|
||||
this, &MpvObject::handleWindowChanged);
|
||||
}
|
||||
|
||||
MpvObject::~MpvObject()
|
||||
{
|
||||
if (mpv_gl)
|
||||
mpv_opengl_cb_set_update_callback(mpv_gl, NULL, NULL);
|
||||
}
|
||||
|
||||
void MpvObject::handleWindowChanged(QQuickWindow *win)
|
||||
{
|
||||
if (!win)
|
||||
return;
|
||||
connect(win, &QQuickWindow::beforeSynchronizing,
|
||||
this, &MpvObject::sync, Qt::DirectConnection);
|
||||
connect(win, &QQuickWindow::sceneGraphInvalidated,
|
||||
this, &MpvObject::cleanup, Qt::DirectConnection);
|
||||
connect(win, &QQuickWindow::frameSwapped,
|
||||
this, &MpvObject::swapped, Qt::DirectConnection);
|
||||
win->setClearBeforeRendering(false);
|
||||
}
|
||||
|
||||
void MpvObject::sync()
|
||||
{
|
||||
if (!renderer) {
|
||||
renderer = new MpvRenderer(mpv, mpv_gl);
|
||||
connect(window(), &QQuickWindow::beforeRendering,
|
||||
renderer, &MpvRenderer::paint, Qt::DirectConnection);
|
||||
}
|
||||
renderer->window = window();
|
||||
renderer->size = window()->size() * window()->devicePixelRatio();
|
||||
}
|
||||
|
||||
void MpvObject::swapped()
|
||||
{
|
||||
mpv_opengl_cb_report_flip(mpv_gl, 0);
|
||||
}
|
||||
|
||||
void MpvObject::cleanup()
|
||||
{
|
||||
if (renderer) {
|
||||
delete renderer;
|
||||
renderer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MpvObject::on_update(void *ctx)
|
||||
{
|
||||
MpvObject *self = (MpvObject *)ctx;
|
||||
emit self->onUpdate();
|
||||
}
|
||||
|
||||
// connected to onUpdate(); signal makes sure it runs on the GUI thread
|
||||
void MpvObject::doUpdate()
|
||||
{
|
||||
window()->update();
|
||||
}
|
||||
|
||||
void MpvObject::command(const QVariant& params)
|
||||
{
|
||||
mpv::qt::command_variant(mpv, params);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
// Qt sets the locale in the QGuiApplication constructor, but libmpv
|
||||
// requires the LC_NUMERIC category to be set to "C", so change it back.
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
|
||||
qmlRegisterType<MpvObject>("mpvtest", 1, 0, "MpvObject");
|
||||
|
||||
QQuickView view;
|
||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
view.setSource(QUrl("qrc:///mpvtest/main.qml"));
|
||||
view.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#ifndef MPVRENDERER_H_
|
||||
#define MPVRENDERER_H_
|
||||
|
||||
#include <QtQuick/QQuickItem>
|
||||
|
||||
#include <mpv/client.h>
|
||||
#include <mpv/opengl_cb.h>
|
||||
#include <mpv/qthelper.hpp>
|
||||
|
||||
class MpvRenderer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
mpv::qt::Handle mpv;
|
||||
mpv_opengl_cb_context *mpv_gl;
|
||||
QQuickWindow *window;
|
||||
QSize size;
|
||||
|
||||
friend class MpvObject;
|
||||
public:
|
||||
MpvRenderer(mpv::qt::Handle a_mpv, mpv_opengl_cb_context *a_mpv_gl);
|
||||
virtual ~MpvRenderer();
|
||||
public slots:
|
||||
void paint();
|
||||
};
|
||||
|
||||
class MpvObject : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
mpv::qt::Handle mpv;
|
||||
mpv_opengl_cb_context *mpv_gl;
|
||||
MpvRenderer *renderer;
|
||||
|
||||
public:
|
||||
MpvObject(QQuickItem * parent = 0);
|
||||
virtual ~MpvObject();
|
||||
public slots:
|
||||
void command(const QVariant& params);
|
||||
void sync();
|
||||
void swapped();
|
||||
void cleanup();
|
||||
signals:
|
||||
void onUpdate();
|
||||
private slots:
|
||||
void doUpdate();
|
||||
void handleWindowChanged(QQuickWindow *win);
|
||||
private:
|
||||
static void on_update(void *ctx);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0
|
||||
|
||||
import mpvtest 1.0
|
||||
|
||||
Item {
|
||||
width: 1280
|
||||
height: 720
|
||||
|
||||
MpvObject {
|
||||
id: renderer
|
||||
|
||||
// This object isn't real and not visible; it just renders into the
|
||||
// background of the containing Window.
|
||||
width: 0
|
||||
height: 0
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: renderer.command(["loadfile", "../../../test.mkv"])
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: labelFrame
|
||||
anchors.margins: -50
|
||||
radius: 5
|
||||
color: "white"
|
||||
border.color: "black"
|
||||
opacity: 0.8
|
||||
anchors.fill: box
|
||||
}
|
||||
|
||||
Row {
|
||||
id: box
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 100
|
||||
|
||||
Text {
|
||||
anchors.margins: 10
|
||||
wrapMode: Text.WordWrap
|
||||
text: "QtQuick and mpv are both rendering stuff.\n
|
||||
In this example, mpv is always in the background.\n
|
||||
Click to load ../../../test.mkv"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
QT += qml quick
|
||||
|
||||
HEADERS += main.h
|
||||
SOURCES += main.cpp
|
||||
|
||||
QT_CONFIG -= no-pkg-config
|
||||
CONFIG += link_pkgconfig debug
|
||||
PKGCONFIG += mpv
|
||||
|
||||
RESOURCES += mpvtest.qrc
|
||||
|
||||
OTHER_FILES += main.qml
|
||||
@@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/mpvtest">
|
||||
<file>main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,225 +0,0 @@
|
||||
// This example can be built with: qmake && make
|
||||
|
||||
#include <clocale>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QFileDialog>
|
||||
#include <QStatusBar>
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
#include <QGridLayout>
|
||||
#include <QApplication>
|
||||
#include <QTextEdit>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QJsonDocument>
|
||||
#endif
|
||||
|
||||
#include <mpv/qthelper.hpp>
|
||||
|
||||
#include "qtexample.h"
|
||||
|
||||
static void wakeup(void *ctx)
|
||||
{
|
||||
// This callback is invoked from any mpv thread (but possibly also
|
||||
// recursively from a thread that is calling the mpv API). Just notify
|
||||
// the Qt GUI thread to wake up (so that it can process events with
|
||||
// mpv_wait_event()), and return as quickly as possible.
|
||||
MainWindow *mainwindow = (MainWindow *)ctx;
|
||||
emit mainwindow->mpv_events();
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent)
|
||||
{
|
||||
setWindowTitle("Qt embedding demo");
|
||||
setMinimumSize(640, 480);
|
||||
|
||||
QMenu *menu = menuBar()->addMenu(tr("&File"));
|
||||
QAction *on_open = new QAction(tr("&Open"), this);
|
||||
on_open->setShortcuts(QKeySequence::Open);
|
||||
on_open->setStatusTip(tr("Open a file"));
|
||||
connect(on_open, &QAction::triggered, this, &MainWindow::on_file_open);
|
||||
menu->addAction(on_open);
|
||||
|
||||
QAction *on_new = new QAction(tr("&New window"), this);
|
||||
connect(on_new, &QAction::triggered, this, &MainWindow::on_new_window);
|
||||
menu->addAction(on_new);
|
||||
|
||||
statusBar();
|
||||
|
||||
QMainWindow *log_window = new QMainWindow(this);
|
||||
log = new QTextEdit(log_window);
|
||||
log->setReadOnly(true);
|
||||
log_window->setCentralWidget(log);
|
||||
log_window->setWindowTitle("mpv log window");
|
||||
log_window->setMinimumSize(500, 50);
|
||||
log_window->show();
|
||||
|
||||
mpv = mpv_create();
|
||||
if (!mpv)
|
||||
throw std::runtime_error("can't create mpv instance");
|
||||
|
||||
// Create a video child window. Force Qt to create a native window, and
|
||||
// pass the window ID to the mpv wid option. Works on: X11, win32, Cocoa
|
||||
mpv_container = new QWidget(this);
|
||||
setCentralWidget(mpv_container);
|
||||
mpv_container->setAttribute(Qt::WA_DontCreateNativeAncestors);
|
||||
mpv_container->setAttribute(Qt::WA_NativeWindow);
|
||||
// If you have a HWND, use: int64_t wid = (intptr_t)hwnd;
|
||||
int64_t wid = mpv_container->winId();
|
||||
mpv_set_option(mpv, "wid", MPV_FORMAT_INT64, &wid);
|
||||
|
||||
// Enable default bindings, because we're lazy. Normally, a player using
|
||||
// mpv as backend would implement its own key bindings.
|
||||
mpv_set_option_string(mpv, "input-default-bindings", "yes");
|
||||
|
||||
// Enable keyboard input on the X11 window. For the messy details, see
|
||||
// --input-vo-keyboard on the manpage.
|
||||
mpv_set_option_string(mpv, "input-vo-keyboard", "yes");
|
||||
|
||||
// Let us receive property change events with MPV_EVENT_PROPERTY_CHANGE if
|
||||
// this property changes.
|
||||
mpv_observe_property(mpv, 0, "time-pos", MPV_FORMAT_DOUBLE);
|
||||
|
||||
mpv_observe_property(mpv, 0, "track-list", MPV_FORMAT_NODE);
|
||||
mpv_observe_property(mpv, 0, "chapter-list", MPV_FORMAT_NODE);
|
||||
|
||||
// Request log messages with level "info" or higher.
|
||||
// They are received as MPV_EVENT_LOG_MESSAGE.
|
||||
mpv_request_log_messages(mpv, "info");
|
||||
|
||||
// From this point on, the wakeup function will be called. The callback
|
||||
// can come from any thread, so we use the QueuedConnection mechanism to
|
||||
// relay the wakeup in a thread-safe way.
|
||||
connect(this, &MainWindow::mpv_events, this, &MainWindow::on_mpv_events,
|
||||
Qt::QueuedConnection);
|
||||
mpv_set_wakeup_callback(mpv, wakeup, this);
|
||||
|
||||
if (mpv_initialize(mpv) < 0)
|
||||
throw std::runtime_error("mpv failed to initialize");
|
||||
}
|
||||
|
||||
void MainWindow::handle_mpv_event(mpv_event *event)
|
||||
{
|
||||
switch (event->event_id) {
|
||||
case MPV_EVENT_PROPERTY_CHANGE: {
|
||||
mpv_event_property *prop = (mpv_event_property *)event->data;
|
||||
if (strcmp(prop->name, "time-pos") == 0) {
|
||||
if (prop->format == MPV_FORMAT_DOUBLE) {
|
||||
double time = *(double *)prop->data;
|
||||
std::stringstream ss;
|
||||
ss << "At: " << time;
|
||||
statusBar()->showMessage(QString::fromStdString(ss.str()));
|
||||
} else if (prop->format == MPV_FORMAT_NONE) {
|
||||
// The property is unavailable, which probably means playback
|
||||
// was stopped.
|
||||
statusBar()->showMessage("");
|
||||
}
|
||||
} else if (strcmp(prop->name, "chapter-list") == 0 ||
|
||||
strcmp(prop->name, "track-list") == 0)
|
||||
{
|
||||
// Dump the properties as JSON for demo purposes.
|
||||
#if QT_VERSION >= 0x050000
|
||||
if (prop->format == MPV_FORMAT_NODE) {
|
||||
QVariant v = mpv::qt::node_to_variant((mpv_node *)prop->data);
|
||||
// Abuse JSON support for easily printing the mpv_node contents.
|
||||
QJsonDocument d = QJsonDocument::fromVariant(v);
|
||||
append_log("Change property " + QString(prop->name) + ":\n");
|
||||
append_log(d.toJson().data());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MPV_EVENT_VIDEO_RECONFIG: {
|
||||
// Retrieve the new video size.
|
||||
int64_t w, h;
|
||||
if (mpv_get_property(mpv, "dwidth", MPV_FORMAT_INT64, &w) >= 0 &&
|
||||
mpv_get_property(mpv, "dheight", MPV_FORMAT_INT64, &h) >= 0 &&
|
||||
w > 0 && h > 0)
|
||||
{
|
||||
// Note that the MPV_EVENT_VIDEO_RECONFIG event doesn't necessarily
|
||||
// imply a resize, and you should check yourself if the video
|
||||
// dimensions really changed.
|
||||
// mpv itself will scale/letter box the video to the container size
|
||||
// if the video doesn't fit.
|
||||
std::stringstream ss;
|
||||
ss << "Reconfig: " << w << " " << h;
|
||||
statusBar()->showMessage(QString::fromStdString(ss.str()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MPV_EVENT_LOG_MESSAGE: {
|
||||
struct mpv_event_log_message *msg = (struct mpv_event_log_message *)event->data;
|
||||
std::stringstream ss;
|
||||
ss << "[" << msg->prefix << "] " << msg->level << ": " << msg->text;
|
||||
append_log(QString::fromStdString(ss.str()));
|
||||
break;
|
||||
}
|
||||
case MPV_EVENT_SHUTDOWN: {
|
||||
mpv_terminate_destroy(mpv);
|
||||
mpv = NULL;
|
||||
break;
|
||||
}
|
||||
default: ;
|
||||
// Ignore uninteresting or unknown events.
|
||||
}
|
||||
}
|
||||
|
||||
// This slot is invoked by wakeup() (through the mpv_events signal).
|
||||
void MainWindow::on_mpv_events()
|
||||
{
|
||||
// Process all events, until the event queue is empty.
|
||||
while (mpv) {
|
||||
mpv_event *event = mpv_wait_event(mpv, 0);
|
||||
if (event->event_id == MPV_EVENT_NONE)
|
||||
break;
|
||||
handle_mpv_event(event);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_file_open()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this, "Open file");
|
||||
if (mpv) {
|
||||
const QByteArray c_filename = filename.toUtf8();
|
||||
const char *args[] = {"loadfile", c_filename.data(), NULL};
|
||||
mpv_command_async(mpv, 0, args);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_new_window()
|
||||
{
|
||||
(new MainWindow())->show();
|
||||
}
|
||||
|
||||
void MainWindow::append_log(const QString &text)
|
||||
{
|
||||
QTextCursor cursor = log->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.insertText(text);
|
||||
log->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if (mpv)
|
||||
mpv_terminate_destroy(mpv);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
// Qt sets the locale in the QApplication constructor, but libmpv requires
|
||||
// the LC_NUMERIC category to be set to "C", so change it back.
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef QTEXAMPLE_H
|
||||
#define QTEXAMPLE_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <mpv/client.h>
|
||||
|
||||
class QTextEdit;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void on_file_open();
|
||||
void on_new_window();
|
||||
void on_mpv_events();
|
||||
|
||||
signals:
|
||||
void mpv_events();
|
||||
|
||||
private:
|
||||
QWidget *mpv_container;
|
||||
mpv_handle *mpv;
|
||||
QTextEdit *log;
|
||||
|
||||
void append_log(const QString &text);
|
||||
|
||||
void create_player();
|
||||
void handle_mpv_event(mpv_event *event);
|
||||
};
|
||||
|
||||
#endif // QTEXAMPLE_H
|
||||
@@ -1,13 +0,0 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = qtexample
|
||||
TEMPLATE = app
|
||||
|
||||
QT_CONFIG -= no-pkg-config
|
||||
CONFIG += link_pkgconfig debug
|
||||
PKGCONFIG += mpv
|
||||
|
||||
SOURCES += qtexample.cpp
|
||||
HEADERS += qtexample.h
|
||||
@@ -1,158 +0,0 @@
|
||||
// Build with: gcc -o main main.c `pkg-config --libs --cflags mpv sdl2`
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <mpv/client.h>
|
||||
#include <mpv/opengl_cb.h>
|
||||
|
||||
static Uint32 wakeup_on_mpv_redraw, wakeup_on_mpv_events;
|
||||
|
||||
static void die(const char *msg)
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void *get_proc_address_mpv(void *fn_ctx, const char *name)
|
||||
{
|
||||
return SDL_GL_GetProcAddress(name);
|
||||
}
|
||||
|
||||
static void on_mpv_events(void *ctx)
|
||||
{
|
||||
SDL_Event event = {.type = wakeup_on_mpv_events};
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
static void on_mpv_redraw(void *ctx)
|
||||
{
|
||||
SDL_Event event = {.type = wakeup_on_mpv_redraw};
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
die("pass a single media file as argument");
|
||||
|
||||
mpv_handle *mpv = mpv_create();
|
||||
if (!mpv)
|
||||
die("context init failed");
|
||||
|
||||
// Some minor options can only be set before mpv_initialize().
|
||||
if (mpv_initialize(mpv) < 0)
|
||||
die("mpv init failed");
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
die("SDL init failed");
|
||||
|
||||
SDL_Window *window =
|
||||
SDL_CreateWindow("hi", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
1000, 500, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
|
||||
SDL_WINDOW_RESIZABLE);
|
||||
if (!window)
|
||||
die("failed to create SDL window");
|
||||
|
||||
// The OpenGL API is somewhat separate from the normal mpv API. This only
|
||||
// returns NULL if no OpenGL support is compiled.
|
||||
mpv_opengl_cb_context *mpv_gl = mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
|
||||
if (!mpv_gl)
|
||||
die("failed to create mpv GL API handle");
|
||||
|
||||
SDL_GLContext glcontext = SDL_GL_CreateContext(window);
|
||||
if (!glcontext)
|
||||
die("failed to create SDL GL context");
|
||||
|
||||
// This makes mpv use the currently set GL context. It will use the callback
|
||||
// to resolve GL builtin functions, as well as extensions.
|
||||
if (mpv_opengl_cb_init_gl(mpv_gl, NULL, get_proc_address_mpv, NULL) < 0)
|
||||
die("failed to initialize mpv GL context");
|
||||
|
||||
// Actually using the opengl_cb state has to be explicitly requested.
|
||||
// Otherwise, mpv will create a separate platform window.
|
||||
if (mpv_set_option_string(mpv, "vo", "opengl-cb") < 0)
|
||||
die("failed to set VO");
|
||||
|
||||
// We use events for thread-safe notification of the SDL main loop.
|
||||
// Generally, the wakeup callbacks (set further below) should do as least
|
||||
// work as possible, and merely wake up another thread to do actual work.
|
||||
// On SDL, waking up the mainloop is the ideal course of action. SDL's
|
||||
// SDL_PushEvent() is thread-safe, so we use that.
|
||||
wakeup_on_mpv_redraw = SDL_RegisterEvents(1);
|
||||
wakeup_on_mpv_events = SDL_RegisterEvents(1);
|
||||
if (wakeup_on_mpv_redraw == (Uint32)-1 || wakeup_on_mpv_events == (Uint32)-1)
|
||||
die("could not register events");
|
||||
|
||||
// When normal mpv events are available.
|
||||
mpv_set_wakeup_callback(mpv, on_mpv_events, NULL);
|
||||
|
||||
// When a new frame should be drawn with mpv_opengl_cb_draw().
|
||||
// (Separate from the normal event handling mechanism for the sake of
|
||||
// users which run OpenGL on a different thread.)
|
||||
mpv_opengl_cb_set_update_callback(mpv_gl, on_mpv_redraw, NULL);
|
||||
|
||||
// Play this file. Note that this starts playback asynchronously.
|
||||
const char *cmd[] = {"loadfile", argv[1], NULL};
|
||||
mpv_command(mpv, cmd);
|
||||
|
||||
while (1) {
|
||||
SDL_Event event;
|
||||
if (SDL_WaitEvent(&event) != 1)
|
||||
die("event loop error");
|
||||
int redraw = 0;
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
goto done;
|
||||
case SDL_WINDOWEVENT:
|
||||
if (event.window.event == SDL_WINDOWEVENT_EXPOSED)
|
||||
redraw = 1;
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
if (event.key.keysym.sym == SDLK_SPACE)
|
||||
mpv_command_string(mpv, "cycle pause");
|
||||
break;
|
||||
default:
|
||||
// Happens when a new video frame should be rendered, or if the
|
||||
// current frame has to be redrawn e.g. due to OSD changes.
|
||||
if (event.type == wakeup_on_mpv_redraw)
|
||||
redraw = 1;
|
||||
// Happens when at least 1 new event is in the mpv event queue.
|
||||
if (event.type == wakeup_on_mpv_events) {
|
||||
// Handle all remaining mpv events.
|
||||
while (1) {
|
||||
mpv_event *mp_event = mpv_wait_event(mpv, 0);
|
||||
if (mp_event->event_id == MPV_EVENT_NONE)
|
||||
break;
|
||||
printf("event: %s\n", mpv_event_name(mp_event->event_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (redraw) {
|
||||
int w, h;
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
// Note:
|
||||
// - The 0 is the FBO to use; 0 is the default framebuffer (i.e.
|
||||
// render to the window directly.
|
||||
// - The negative height tells mpv to flip the coordinate system.
|
||||
// - If you do not want the video to cover the whole screen, or want
|
||||
// to apply any form of fancy transformation, you will have to
|
||||
// render to a FBO.
|
||||
// - See opengl_cb.h on what OpenGL environment mpv expects, and
|
||||
// other API details.
|
||||
mpv_opengl_cb_draw(mpv_gl, 0, w, -h);
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
}
|
||||
done:
|
||||
|
||||
// Destroy the GL renderer and all of the GL objects it allocated. If video
|
||||
// is still running, the video track will be deselected.
|
||||
mpv_opengl_cb_uninit_gl(mpv_gl);
|
||||
|
||||
mpv_terminate_destroy(mpv);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
// Build with: gcc -o simple simple.c `pkg-config --libs --cflags mpv`
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mpv/client.h>
|
||||
|
||||
static inline void check_error(int status)
|
||||
{
|
||||
if (status < 0) {
|
||||
printf("mpv API error: %s\n", mpv_error_string(status));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("pass a single media file as argument\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
mpv_handle *ctx = mpv_create();
|
||||
if (!ctx) {
|
||||
printf("failed creating context\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Enable default key bindings, so the user can actually interact with
|
||||
// the player (and e.g. close the window).
|
||||
check_error(mpv_set_option_string(ctx, "input-default-bindings", "yes"));
|
||||
mpv_set_option_string(ctx, "input-vo-keyboard", "yes");
|
||||
int val = 1;
|
||||
check_error(mpv_set_option(ctx, "osc", MPV_FORMAT_FLAG, &val));
|
||||
|
||||
// Done setting up options.
|
||||
check_error(mpv_initialize(ctx));
|
||||
|
||||
// Play this file.
|
||||
const char *cmd[] = {"loadfile", argv[1], NULL};
|
||||
check_error(mpv_command(ctx, cmd));
|
||||
|
||||
// Let it play, and wait until the user quits.
|
||||
while (1) {
|
||||
mpv_event *event = mpv_wait_event(ctx, 10000);
|
||||
printf("event: %s\n", mpv_event_name(event->event_id));
|
||||
if (event->event_id == MPV_EVENT_SHUTDOWN)
|
||||
break;
|
||||
}
|
||||
|
||||
mpv_terminate_destroy(ctx);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
Compiling for Windows
|
||||
=====================
|
||||
|
||||
Compiling for Windows is supported with MinGW-w64. This can be used to produce
|
||||
both 32-bit and 64-bit executables, and it works for building on Windows and
|
||||
cross-compiling from Linux and Cygwin. MinGW-w64 is available from:
|
||||
http://mingw-w64.sourceforge.net.
|
||||
|
||||
While building a complete MinGW-w64 toolchain yourself is possible, there are a
|
||||
few build environments and scripts to help ease the process, such as MSYS2 and
|
||||
MXE. Note that MinGW environments included in Linux distributions are often
|
||||
broken, outdated and useless, and usually don't use MinGW-w64.
|
||||
|
||||
**Warning**: the original MinGW (http://www.mingw.org) is unsupported.
|
||||
|
||||
Cross-compilation
|
||||
=================
|
||||
|
||||
When cross-compiling, you have to run mpv's configure with these arguments:
|
||||
|
||||
```bash
|
||||
DEST_OS=win32 TARGET=i686-w64-mingw32 ./waf configure
|
||||
```
|
||||
|
||||
[MXE](http://mxe.cc) makes it very easy to bootstrap a complete MingGW-w64
|
||||
environment from a Linux machine. See a working example below.
|
||||
|
||||
Alternatively, you can try [mingw-w64-cmake](https://github.com/lachs0r/mingw-w64-cmake),
|
||||
which bootstraps a MinGW-w64 environment and builds mpv and dependencies.
|
||||
|
||||
Example with MXE
|
||||
----------------
|
||||
|
||||
```bash
|
||||
# Before starting, make sure you install MXE prerequisites. MXE will download
|
||||
# and build all target dependencies, but no host dependencies. For example,
|
||||
# you need a working compiler, or MXE can't build the crosscompiler.
|
||||
#
|
||||
# Refer to
|
||||
#
|
||||
# http://mxe.cc/#requirements
|
||||
#
|
||||
# Scroll down for disto/OS-specific instructions to install them.
|
||||
|
||||
# Download MXE. Note that compiling the required packages requires about 1.4 GB
|
||||
# or more!
|
||||
|
||||
cd /opt
|
||||
git clone https://github.com/mxe/mxe mxe
|
||||
cd mxe
|
||||
|
||||
# Set build options.
|
||||
|
||||
# The JOBS environment variable controls threads to use when building. DO NOT
|
||||
# use the regular `make -j4` option with MXE as it will slow down the build.
|
||||
# Alternatively, you can set this in the make command by appending "JOBS=4"
|
||||
# to the end of command:
|
||||
echo "JOBS := 4" >> settings.mk
|
||||
|
||||
# The MXE_TARGET environment variable builds MinGW-w64 for 32 bit targets.
|
||||
# Alternatively, you can specify this in the make command by appending
|
||||
# "MXE_TARGETS=i686-w64-mingw32" to the end of command:
|
||||
echo "MXE_TARGETS := i686-w64-mingw32.static" >> settings.mk
|
||||
|
||||
# If you want to build 64 bit version, use this:
|
||||
# echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> settings.mk
|
||||
|
||||
# Build required packages. The following provide a minimum required to build
|
||||
# a reasonable mpv binary (though not an absolute minimum).
|
||||
|
||||
make gcc ffmpeg libass jpeg pthreads lua
|
||||
|
||||
# Add MXE binaries to $PATH
|
||||
export PATH=/opt/mxe/usr/bin/:$PATH
|
||||
|
||||
# Build mpv. The target will be used to automatically select the name of the
|
||||
# build tools involved (e.g. it will use i686-w64-mingw32.static-gcc).
|
||||
|
||||
cd ..
|
||||
git clone https://github.com/mpv-player/mpv.git
|
||||
cd mpv
|
||||
python ./bootstrap.py
|
||||
DEST_OS=win32 TARGET=i686-w64-mingw32.static ./waf configure
|
||||
# Or, if 64 bit version,
|
||||
# DEST_OS=win32 TARGET=x86_64-w64-mingw32.static ./waf configure
|
||||
./waf build
|
||||
```
|
||||
|
||||
Native compilation with MSYS2
|
||||
=============================
|
||||
|
||||
For Windows developers looking to get started quickly, MSYS2 can be used to
|
||||
compile mpv natively on a Windows machine. The MSYS2 repositories have binary
|
||||
packages for most of mpv's dependencies, so the process should only involve
|
||||
building mpv itself.
|
||||
|
||||
To build 64-bit mpv on Windows:
|
||||
|
||||
Installing MSYS2
|
||||
----------------
|
||||
|
||||
1. Download an installer from https://msys2.github.io/
|
||||
|
||||
It doesn't matter whether the i686 or the x86_64 version is used. Both can
|
||||
build 32-bit and 64-bit binaries when running on a 64-bit version of Windows.
|
||||
|
||||
2. Add ``C:\msys64\mingw64\bin`` to your ``%PATH%``. mpv will depend on several
|
||||
DLLs in this folder.
|
||||
|
||||
3. Start a MinGW-w64 shell (``mingw64_shell.bat``). For a 32-bit build, use
|
||||
``mingw32_shell.bat``.
|
||||
|
||||
Updating MSYS2
|
||||
--------------
|
||||
|
||||
To prevent errors during post-install, ``msys2-runtime`` and ``pacman`` must be
|
||||
updated first.
|
||||
|
||||
```bash
|
||||
# Check for updates to msys2-runtime and pacman. If there were updates, restart
|
||||
# MSYS2 before continuing.
|
||||
pacman -Sy --needed msys2-runtime pacman
|
||||
|
||||
# Update everything else
|
||||
pacman -Su
|
||||
```
|
||||
|
||||
Installing mpv dependencies
|
||||
---------------------------
|
||||
|
||||
```bash
|
||||
# Install MSYS2 build dependencies and a MinGW-w64 compiler
|
||||
pacman -S git pkg-config python3 mingw-w64-x86_64-gcc
|
||||
|
||||
# Install the most important MinGW-w64 dependencies. libass, libbluray and
|
||||
# lcms2 are also pulled in as dependencies of ffmpeg.
|
||||
pacman -S mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-lua51
|
||||
|
||||
# Install additional (optional) dependencies
|
||||
pacman -S mingw-w64-x86_64-libdvdnav mingw-w64-x86_64-libguess
|
||||
```
|
||||
|
||||
For a 32-bit build, install ``mingw-w64-i686-*`` packages instead.
|
||||
|
||||
Building mpv
|
||||
------------
|
||||
|
||||
Clone the latest mpv from git and install waf:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/mpv-player/mpv.git && cd mpv
|
||||
./bootstrap.py
|
||||
```
|
||||
|
||||
Finally, compile and install mpv. Binaries will be installed to
|
||||
``/mingw64/bin``.
|
||||
|
||||
```bash
|
||||
# For a 32-bit build, use --prefix=/mingw32 instead
|
||||
./waf configure CC=gcc --prefix=/mingw64
|
||||
./waf install
|
||||
```
|
||||
|
||||
Or, compile and install both libmpv and mpv:
|
||||
|
||||
```bash
|
||||
./waf configure CC=gcc --enable-libmpv-shared --prefix=/mingw64
|
||||
./waf install
|
||||
|
||||
# waf installs libmpv to the wrong directory, so fix it up
|
||||
mv -f /mingw64/bin/pkgconfig/mpv.pc /mingw64/lib/pkgconfig/
|
||||
mv -f /mingw64/bin/libmpv.dll.a /mingw64/lib/
|
||||
sed -i 's_/mingw64/bin_/mingw64/lib_' /mingw64/lib/pkgconfig/mpv.pc
|
||||
rmdir /mingw64/bin/pkgconfig
|
||||
```
|
||||
|
||||
Additional dependencies
|
||||
=======================
|
||||
|
||||
pthreads
|
||||
--------
|
||||
|
||||
mpv will use a pthreads wrapper by default. Either pthreads-win32 or
|
||||
winpthreads should work. The latter is packaged with most MinGW-w64
|
||||
environments, including MSYS2, so it shouldn't be a problem. If you don't have
|
||||
a pthreads wrapper or you want to build mpv without one, configure with:
|
||||
|
||||
```bash
|
||||
./waf configure --enable-win32-internal-pthreads
|
||||
```
|
||||
|
||||
libwaio
|
||||
-------
|
||||
|
||||
If you want to use ``--input-file``, you need libwaio. It's available from
|
||||
git://midipix.org/waio
|
||||
|
||||
To compile libwaio in MSYS2, run:
|
||||
|
||||
```bash
|
||||
git clone git://midipix.org/waio && cd waio
|
||||
|
||||
# 32-bit build, run from mingw32_shell.bat
|
||||
./build-mingw-nt32 lib-static CC=gcc AR=ar
|
||||
cp -r include/waio /mingw32/include
|
||||
cp lib32/libwaio.a /mingw32/lib
|
||||
|
||||
# 64-bit build, run from mingw64_shell.bat
|
||||
./build-mingw-nt64 lib-static CC=gcc AR=ar
|
||||
cp -r include/waio /mingw64/include
|
||||
cp lib64/libwaio.a /mingw64/lib
|
||||
```
|
||||
@@ -1,155 +0,0 @@
|
||||
How to contribute
|
||||
=================
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
The main contact for mpv development is IRC, specifically #mpv
|
||||
and #mpv-devel on Freenode.
|
||||
|
||||
Sending patches
|
||||
---------------
|
||||
|
||||
- Make a github pull request, or send a link to a plaintext patch created with
|
||||
``git format-patch``. diffs posted as pastebins (especially if the http link
|
||||
returns HTML) just cause extra work for everyone, because they lack commit
|
||||
message and authorship information.
|
||||
- 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
|
||||
situation with the patch applied, and past tense for the situation before
|
||||
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 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:
|
||||
|
||||
Bad: ``fixed the bug (wtf?)``
|
||||
Good: ``af_volume: fix crash due to null pointer access``
|
||||
|
||||
Having a prefix gives context, and is especially useful when trying to find
|
||||
a specific change by looking at the history, or when running ``git blame``.
|
||||
- The body of the commit message (everything else after the subject line) should
|
||||
be as informative as possible and contain everything that isn't obvious. Don't
|
||||
hesitate to dump as much information as you can - it doesn't cost you
|
||||
anything. Put some effort into it. If someone finds a bug months or years
|
||||
later, and finds that it's caused by your commit (even though your commit was
|
||||
supposed to fix another bug), it would be bad if there wasn't enough
|
||||
information to test the original bug. The old bug might be reintroduced while
|
||||
fixing the new bug.
|
||||
|
||||
The commit message should be wrapped on 72 characters per line, because git
|
||||
tools usually do not break text automatically. On the other hand, you do not
|
||||
need to break text that would be unnatural to break (like data for test cases,
|
||||
or long URLs).
|
||||
|
||||
Important: put an empty line between the subject line and the commit message.
|
||||
If this is missing, it will break display in common git tools.
|
||||
- Try to separate cosmetic and functional changes. It's ok to make a few
|
||||
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.
|
||||
- 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.
|
||||
- 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).
|
||||
|
||||
Code formatting
|
||||
---------------
|
||||
|
||||
mpv uses C99 with K&R formatting, with some exceptions.
|
||||
|
||||
- Use the K&R indent style.
|
||||
- Use 4 spaces of indentation, never use tabs (except in Makefiles).
|
||||
- Add a single space between keywords and binary operators. There are some other
|
||||
cases where spaces should be added. Example:
|
||||
|
||||
```C
|
||||
if ((a * b) > c) {
|
||||
// code
|
||||
some_function(a, b, c);
|
||||
}
|
||||
```
|
||||
- Break lines on 80 columns. There is a hard limit of 85 columns. You may ignore
|
||||
this limit if there's a strong case that not breaking the line will increase
|
||||
readability. Going over 85 columns might provoke endless discussions about
|
||||
whether such a limit is needed or not, so avoid it.
|
||||
- If the body of an if/for/while statement has more than 1 physical lines, then
|
||||
always add braces, even if they're technically redundant.
|
||||
|
||||
Bad:
|
||||
|
||||
```C
|
||||
if (a)
|
||||
// do something if b
|
||||
if (b)
|
||||
do_something();
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```C
|
||||
if (a) {
|
||||
// do something if b
|
||||
if (b)
|
||||
do_something();
|
||||
}
|
||||
```
|
||||
- If the body of an if statement uses braces, the else branch should also
|
||||
use braces (and reverse).
|
||||
|
||||
Example:
|
||||
|
||||
```C
|
||||
if (a) {
|
||||
// do something
|
||||
something();
|
||||
something_else();
|
||||
} else {
|
||||
one_line();
|
||||
}
|
||||
```
|
||||
- If an if condition spans multiple physical lines, then put the opening brace
|
||||
for the if body on the next physical line. (Also, preferably always add a
|
||||
brace, even if technically none is needed.)
|
||||
|
||||
Example:
|
||||
|
||||
```C
|
||||
if (very_long_condition_a &&
|
||||
very_long_condition_b)
|
||||
{
|
||||
code();
|
||||
} else {
|
||||
...
|
||||
}
|
||||
```
|
||||
- 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
|
||||
--------------
|
||||
|
||||
- Use C99. Also freely make use of C99 features if it's appropriate, such as
|
||||
stdbool.h.
|
||||
- Don't use GNU-only features. In some cases they may be warranted, if they
|
||||
are optional (such as attributes enabling printf-like format string checks).
|
||||
But in general, standard C99 should be used.
|
||||
- The same applies to libc functions. We have to be Windows-compatible too. Use
|
||||
functions guaranteed by C99 or POSIX only, unless your use is guarded by a
|
||||
configure check.
|
||||
- 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.
|
||||
@@ -0,0 +1,60 @@
|
||||
Cross compiling mpv to Windows is supported with MinGW-w64. This can be used to
|
||||
produce both 32 bit and 64 bit executables. MinGW-w64 is available from
|
||||
http://mingw-w64.sourceforge.net.
|
||||
|
||||
You have to run mpv's configure with these arguments:
|
||||
./configure --enable-cross-compile --target=i686-w64-mingw32
|
||||
|
||||
Using MXE to setup a MinGW-w64 environment is recommended: http://mxe.cc
|
||||
Currently, using an experimental branch of MXE is required:
|
||||
https://github.com/tonytheodore/mxe.git
|
||||
|
||||
Warning: the original MinGW (http://www.mingw.org) is unsupported.
|
||||
|
||||
Note that MinGW environments included in Linux distributions are often broken,
|
||||
outdated and useless, and usually don't use MinGW-w64.
|
||||
|
||||
Example with MXE
|
||||
================
|
||||
|
||||
# Download MXE. Note that compiling the required packages requires about 1 GB
|
||||
# or more! We are using an experimental repository, which supports MinGW-w64.
|
||||
# The official MXE supports classic MinGW only, which doesn't work with mpv.
|
||||
|
||||
cd /opt
|
||||
git clone https://github.com/tonytheodore/mxe.git mingw
|
||||
cd mingw
|
||||
|
||||
# Edit the MXE target, so that MinGW-w64 for 32 bit targets is built.
|
||||
|
||||
echo "MXE_TARGETS := i686-w64-mingw32" > settings.mk
|
||||
|
||||
# Build required packages. The following provide a minimum required to build
|
||||
# mpv. (Not all of the following packages are strictly required.)
|
||||
|
||||
make gcc
|
||||
make ffmpeg
|
||||
make libass
|
||||
make jpeg
|
||||
make pthreads
|
||||
|
||||
# Older MXE and MinGW-w64 snapshots don't provide up-to-date OpenGL headers.
|
||||
|
||||
wget http://www.opengl.org/registry/api/glext.h
|
||||
mv glext.h usr/i686-w64-mingw32/include/GL/
|
||||
|
||||
# Build mpv. The target will be used to automatically select the name of the
|
||||
# build tools involved (e.g. it will use i686-w64-mingw32-gcc).
|
||||
|
||||
git clone https://github.com/mpv-player/mpv.git
|
||||
cd mpv
|
||||
export PATH=/opt/mingw/usr/bin/:$PATH
|
||||
./configure --enable-cross-compile --target=i686-w64-mingw32
|
||||
make
|
||||
|
||||
# This should work. For some reason, the resulting .exe will depend on the DLL
|
||||
# /opt/mingw/usr/i686-w64-mingw32/bin/libwinpthread-1.dll because pthreads-w32
|
||||
# folks don't like static linking. How to enable static linking is left as
|
||||
# exercise to the reader. Passsing --disable-pthreads to mpv's configure will
|
||||
# get rid of the dependency, but may disable some features (such as the stream
|
||||
# cache).
|
||||
@@ -1,121 +0,0 @@
|
||||
EDL files
|
||||
=========
|
||||
|
||||
EDL files basically concatenate ranges of video/audio from multiple source
|
||||
files into a single continuous virtual file. Each such range is called a
|
||||
segment, and consists of source file, source offset, and segment length.
|
||||
|
||||
For example::
|
||||
|
||||
# mpv EDL v0
|
||||
f1.mkv,10,20
|
||||
f2.mkv
|
||||
f1.mkv,40,10
|
||||
|
||||
This would skip the first 10 seconds of the file f1.mkv, then play the next
|
||||
20 seconds, then switch to the file f2.mkv and play all of it, then switch
|
||||
back to f1.mkv, skip to the 40 second mark, and play 10 seconds, and then
|
||||
stop playback. The difference to specifying the files directly on command
|
||||
line (and using ``--{ --start=10 --length=20 f1.mkv --}`` etc.) is that the
|
||||
virtual EDL file appears as a virtual timeline (like a single file), instead
|
||||
as a playlist.
|
||||
|
||||
The general simplified syntax is::
|
||||
|
||||
# mpv EDL v0
|
||||
<filename>
|
||||
<filename>,<start in seconds>,<length in seconds>
|
||||
|
||||
If the start time is omitted, 0 is used. If the length is omitted, the
|
||||
estimated remaining duration of the source file is used.
|
||||
|
||||
Note::
|
||||
|
||||
mpv can't use ordered chapter files in EDL entries. Usage of relative or
|
||||
absolute paths as well as any protocol prefixes is prevented for security
|
||||
reasons.
|
||||
|
||||
|
||||
Syntax of mpv EDL files
|
||||
=======================
|
||||
|
||||
Generally, the format is relatively strict. No superfluous whitespace (except
|
||||
empty lines and commented lines) are allowed. You must use UNIX line breaks.
|
||||
|
||||
The first line in the file must be ``# mpv EDL v0``. This designates that the
|
||||
file uses format version 0, which is not frozen yet and may change any time.
|
||||
(If you need a stable EDL file format, make a feature request. Likewise, if
|
||||
you have suggestions for improvements, it's not too late yet.)
|
||||
|
||||
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 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,
|
||||
followed by ``=``, followed by the value. Unnamed parameters have only a
|
||||
value, and the name is implicit from the parameter position.
|
||||
|
||||
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 construct starting with ``%`` allows defining any value with arbitrary
|
||||
contents inline, where ``number`` is an integer giving the number of bytes in
|
||||
``valuebytes``. If a parameter value contains disallowed characters, it has to
|
||||
be guarded by a length specifier using this syntax.
|
||||
|
||||
The parameter name defines the meaning of the parameter:
|
||||
|
||||
1) ``file``, the source file to use for this segment.
|
||||
2) ``start``, a time value that specifies the start offset into the source file.
|
||||
3) ``length``, a time value that specifies the length of the segment.
|
||||
|
||||
See the section below for the format of timestamps.
|
||||
|
||||
Unnamed parameters carry implicit names. The parameter position determines
|
||||
which of the parameters listed above is set. For example, the second parameter
|
||||
implicitly uses the name ``start``.
|
||||
|
||||
Example::
|
||||
|
||||
# mpv EDL v0
|
||||
%18%filename,with,.mkv,10,length=20,param3=%13%value,escaped,param4=value2
|
||||
|
||||
this sets ``file`` to ``filename,with,.mkv``, ``start`` to ``10``, ``length``
|
||||
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.
|
||||
|
||||
Timestamp format
|
||||
================
|
||||
|
||||
Currently, time values are floating point values in seconds.
|
||||
|
||||
As an extension, you can set the ``timestamps=chapters`` option. If this option
|
||||
is set, timestamps have to be integers, and refer to chapter numbers, starting
|
||||
with 0.
|
||||
|
||||
Example::
|
||||
|
||||
# mpv EDL v0
|
||||
file.mkv,2,4,timestamps=chapters
|
||||
|
||||
Plays chapter 3 and ends with the start of chapter 7 (4 chapters later).
|
||||
|
||||
Syntax of EDL URIs
|
||||
==================
|
||||
|
||||
mpv accepts inline EDL data in form of ``edl://`` URIs. Other than the
|
||||
header, the syntax is exactly the same. It's far more convenient to use ``;``
|
||||
instead of line breaks, but that is orthogonal.
|
||||
|
||||
Example: ``edl://f1.mkv,length=5,start=10;f2.mkv,30,20;f3.mkv``
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
Format of mplayer2 EDL files
|
||||
============================
|
||||
|
||||
The first line in the file must be ``mplayer EDL file, version 2``.
|
||||
The rest of the lines belong to one of these classes:
|
||||
|
||||
1) lines specifying source files
|
||||
2) empty lines
|
||||
3) lines specifying timeline segments.
|
||||
|
||||
Lines beginning with ``<`` specify source files. These lines first
|
||||
contain an identifier used to refer to the source file later, then the
|
||||
filename separated by whitespace. The identifier must start with a
|
||||
letter. Filenames that start or end with whitespace or contain
|
||||
newlines are not supported.
|
||||
|
||||
On other lines ``#`` characters delimit comments. Lines that contain
|
||||
only whitespace after comments have been removed are ignored.
|
||||
|
||||
Timeline segments must appear in the file in chronological order. Each
|
||||
segment has the following information associated with it:
|
||||
|
||||
- duration
|
||||
- output start time
|
||||
- output end time (= output start time + duration)
|
||||
- source id (specifies the file the content of the segment comes from)
|
||||
- source start time (timestamp in the source file)
|
||||
- source end time (= source start time + duration)
|
||||
|
||||
The output timestamps must form a continuous timeline from 0 to the
|
||||
end of the last segment, such that each new segment starts from the
|
||||
time the previous one ends at. Source files and times may change
|
||||
arbitrarily between segments.
|
||||
|
||||
The general format for lines specifying timeline segments is
|
||||
[output time info] source_id [source time info]
|
||||
source_id must be an identifier defined on a ``<`` line. Both the time
|
||||
info parts consists of zero or more of the following elements:
|
||||
|
||||
1) ``timestamp``
|
||||
2) ``-timestamp``
|
||||
3) ``+duration``
|
||||
4) ``*``
|
||||
5) ``-*``
|
||||
|
||||
, where ``timestamp`` and ``duration`` are decimal numbers (computations
|
||||
are done with nanosecond precision). Whitespace around ``+`` and ``-`` is
|
||||
optional. 1) and 2) specify start and end time of the segment on
|
||||
output or source side. 3) specifies duration; the semantics are the
|
||||
same whether this appears on output or source side. 4) and 5) are
|
||||
ignored on the output side (they're always implicitly assumed). On the
|
||||
source side 4) specifies that the segment starts where the previous
|
||||
segment *using this source* ended; if there was no previous segment
|
||||
time 0 is used. 5) specifies that the segment ends where the next
|
||||
segment using this source starts.
|
||||
|
||||
Redundant information may be omitted. It will be filled in using the
|
||||
following rules:
|
||||
|
||||
- output start for first segment is 0
|
||||
- two of [output start, output end, duration] imply third
|
||||
- two of [source start, source end, duration] imply third
|
||||
- output start = output end of previous segment
|
||||
- output end = output start of next segment
|
||||
- if ``*``, source start = source end of earlier segment
|
||||
- if ``-*``, source end = source start of a later segment
|
||||
|
||||
As a special rule, a last zero-duration segment without a source
|
||||
specification may appear. This will produce no corresponding segment
|
||||
in the resulting timeline, but can be used as syntax to specify the
|
||||
end time of the timeline (with effect equal to adding -time on the
|
||||
previous line).
|
||||
|
||||
Examples::
|
||||
|
||||
mplayer EDL file, version 2
|
||||
< id1 filename
|
||||
|
||||
0 id1 123
|
||||
100 id1 456
|
||||
200 id1 789
|
||||
300
|
||||
|
||||
All segments come from the source file ``filename``. First segment
|
||||
(output time 0-100) comes from time 123-223, second 456-556, third
|
||||
789-889.
|
||||
|
||||
::
|
||||
|
||||
mplayer EDL file, version 2
|
||||
< f filename
|
||||
f 60-120
|
||||
f 600-660
|
||||
f 30- 90
|
||||
|
||||
Play first seconds 60-120 from the file, then 600-660, then 30-90.
|
||||
|
||||
::
|
||||
|
||||
mplayer EDL file, version 2
|
||||
< id1 filename1
|
||||
< id2 filename2
|
||||
|
||||
+10 id1 *
|
||||
+10 id2 *
|
||||
+10 id1 *
|
||||
+10 id2 *
|
||||
+10 id1 *
|
||||
+10 id2 *
|
||||
|
||||
This plays time 0-10 from filename1, then 0-10 from filename1, then
|
||||
10-20 from filename1, then 10-20 from filename2, then 20-30 from
|
||||
filename1, then 20-30 from filename2.
|
||||
|
||||
::
|
||||
|
||||
mplayer EDL file, version 2
|
||||
< t1 filename1
|
||||
< t2 filename2
|
||||
|
||||
t1 * +2 # segment 1
|
||||
+2 t2 100 # segment 2
|
||||
t1 * # segment 3
|
||||
t2 *-* # segment 4
|
||||
t1 3 -* # segment 5
|
||||
+0.111111 t2 102.5 # segment 6
|
||||
7.37 t1 5 +1 # segment 7
|
||||
|
||||
This rather pathological example illustrates the rules for filling in
|
||||
implied data. All the values can be determined by recursively applying
|
||||
the rules given above, and the full end result is this::
|
||||
|
||||
+2 0-2 t1 0-2 # segment 1
|
||||
+2 2-4 t2 100-102 # segment 2
|
||||
+0.758889 4-4.758889 t1 2-2.758889 # segment 3
|
||||
+0.5 4.4758889-5.258889 t2 102-102.5 # segment 4
|
||||
+2 5.258889-7.258889 t1 3-5 # segment 5
|
||||
+0.111111 7.258889-7.37 t2 102.5-102.611111 # segment 6
|
||||
+1 7.37-8.37 t1 5-6 # segment 7
|
||||
+8
-12
@@ -25,7 +25,7 @@ from the input video. Note that not all codecs and not all formats support VFR
|
||||
encoding, and some which do have bugs when a target bitrate is specified - use
|
||||
-ofps or -oautofps to force CFR encoding in these cases.
|
||||
|
||||
Of course, the options can be stored in a profile, like this .config/mpv/mpv.conf
|
||||
Of course, the options can be stored in a profile, like this .mpv/config
|
||||
section::
|
||||
|
||||
[myencprofile]
|
||||
@@ -38,17 +38,12 @@ section::
|
||||
oac = aac
|
||||
oacopts-add = b=96k
|
||||
|
||||
It's also possible to define default encoding options by putting them into
|
||||
the section named ``[encoding]``. (This behavior changed after mpv 0.3.x. In
|
||||
mpv 0.3.x, config options in the default section / no section were applied
|
||||
to encoding. This is not the case anymore.)
|
||||
|
||||
One can then encode using this profile using the command::
|
||||
|
||||
mpv infile -o outfile.mp4 -profile myencprofile
|
||||
|
||||
Some example profiles are provided in a file
|
||||
etc/encoding-profiles.conf; as for this, see below.
|
||||
etc/encoding-example-profiles.conf; as for this, see below.
|
||||
|
||||
|
||||
Encoding examples
|
||||
@@ -94,12 +89,13 @@ Device targets
|
||||
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 libavfilter is enabled at compilation). If you want to modify
|
||||
it, you can replace and it with your own copy by doing::
|
||||
etc/encoding-example-profiles.conf in the source tree. You can include it into
|
||||
your configuration by doing::
|
||||
|
||||
mkdir -p ~/.mpv
|
||||
cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
|
||||
curl https://raw.github.com/mpv-player/mpv/master/etc/encoding-example-profiles.conf \
|
||||
> ~/.mpv/encoding-profiles.conf
|
||||
echo "include = $HOME/.mpv/encoding-profiles.conf" >> ~/.mpv/config
|
||||
|
||||
Refer to the top of that file for more comments - in a nutshell, the following
|
||||
options are added by it::
|
||||
@@ -139,9 +135,9 @@ What works
|
||||
* Deinterlacing/Inverse Telecine with any of mpv's filters for that
|
||||
* Audio file converting: mpv -o outfile.mp3 infile.flac -no-video -oac
|
||||
libmp3lame -oacopts ab=320k
|
||||
* inverse telecine filters (confirmed working: detc, pullup, filmdint)
|
||||
|
||||
What does not work yet
|
||||
======================
|
||||
|
||||
* 3-pass encoding (ensuring constant total size and bitrate constraints while
|
||||
having VBR audio; mencoder calls this "frameno")
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
Introduction
|
||||
============
|
||||
|
||||
mpv provides access to its internal via the following means:
|
||||
|
||||
- options
|
||||
- commands
|
||||
- properties
|
||||
- events
|
||||
|
||||
All of these are important for interfacing both with end users and API users
|
||||
(which include Lua scripts, libmpv, and the JSON IPC). As such, they constitute
|
||||
a large part of the user interface and APIs.
|
||||
|
||||
This document lists changes to them. New changes are added to the top.
|
||||
|
||||
Interface changes
|
||||
=================
|
||||
|
||||
::
|
||||
|
||||
--- mpv 0.11.0 ---
|
||||
- add "af-metadata" property
|
||||
--- mpv 0.10.0 ---
|
||||
- add --video-aspect-method option
|
||||
- add --playlist-pos option
|
||||
- add --video-sync* options
|
||||
"display-sync-active" property
|
||||
"vo-missed-frame-count" property
|
||||
"audio-speed-correction" and "video-speed-correction" properties
|
||||
- remove --demuxer-readahead-packets and --demuxer-readahead-bytes
|
||||
add --demuxer-max-packets and --demuxer-max-bytes
|
||||
(the new options are not replacement and have very different semantics)
|
||||
- change "video-aspect" property: always settable, even if no video is
|
||||
running; always return the override - if no override is set, return
|
||||
the video's aspect ratio
|
||||
- remove disc-nav (DVD, BD) related properties and commands
|
||||
- add "option-info/<name>/set-locally" property
|
||||
- add --cache-backbuffer; change --cache-default default to 75MB
|
||||
the new total cache size is the sum of backbuffer and the cache size
|
||||
specified by --cache-default or --cache
|
||||
- add ``track-list/N/audio-channels`` property
|
||||
- change --screenshot-tag-colorspace default value
|
||||
- add --stretch-image-subs-to-screen
|
||||
- add "playlist/N/title" property
|
||||
- add --video-stereo-mode=no to disable auto-conversions
|
||||
- add --force-seekable, and change default seekability in some cases
|
||||
- add vf yadif/vavpp/vdpaupp interlaced-only suboptions
|
||||
Also, the option is enabled by default (Except vf_yadif, which has
|
||||
it enabled only if it's inserted by the deinterlace property.)
|
||||
- add --hwdec-preload
|
||||
- add ao coreaudio exclusive suboption
|
||||
- add ``track-list/N/forced`` property
|
||||
- add audio-params/channel-count and ``audio-params-out/channel-count props.
|
||||
- add af volume replaygain-fallback suboption
|
||||
- add video-params/stereo-in property
|
||||
- add "keypress", "keydown", and "keyup" commands
|
||||
- deprecate --ad-spdif-dtshd and enabling passthrough via --ad
|
||||
add --audio-spdif as replacement
|
||||
- remove "get_property" command
|
||||
- remove --slave-broken
|
||||
- add vo opengl custom shader suboptions (source-shader, scale-shader,
|
||||
pre-shaders, post-shaders)
|
||||
- completely change how the hwdec properties work:
|
||||
- "hwdec" now reflects the --hwdec option
|
||||
- "hwdec-detected" does partially what the old "hwdec" property did
|
||||
(and also, "detected-hwdec" is removed)
|
||||
- "hwdec-active" is added
|
||||
- add protocol-list property
|
||||
- deprecate audio-samplerate and audio-channels properties
|
||||
(audio-params sub-properties are the replacement)
|
||||
- add audio-params and audio-out-params properties
|
||||
- deprecate "audio-format" property, replaced with "audio-codec-name"
|
||||
- deprecate --media-title, replaced with --force-media-title
|
||||
- deprecate "length" property, replaced with "duration"
|
||||
- change volume property:
|
||||
- the value 100 is now always "unchanged volume" - with softvol, the
|
||||
range is 0 to --softvol-max, without it is 0-100
|
||||
- the minimum value of --softvol-max is raised to 100
|
||||
- remove vo opengl npot suboption
|
||||
- add relative seeking by percentage to "seek" command
|
||||
- add playlist_shuffle command
|
||||
- add --force-window=immediate
|
||||
- add ao coreaudio change-physical-format suboption
|
||||
- remove vo opengl icc-cache suboption, add icc-cache-dir suboption
|
||||
- add --screenshot-directory
|
||||
- add --screenshot-high-bit-depth
|
||||
- add --screenshot-jpeg-source-chroma
|
||||
- default action for "rescan_external_files" command changes
|
||||
--- mpv 0.9.0 ---
|
||||
-461
@@ -1,461 +0,0 @@
|
||||
AUDIO FILTERS
|
||||
=============
|
||||
|
||||
Audio filters allow you to modify the audio stream and its properties. The
|
||||
syntax is:
|
||||
|
||||
``--af=<filter1[=parameter1:parameter2:...],filter2,...>``
|
||||
Setup a chain of audio filters.
|
||||
|
||||
.. note::
|
||||
|
||||
To get a full list of available audio filters, see ``--af=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.
|
||||
|
||||
You can also set defaults for each filter. The defaults are applied before the
|
||||
normal filter parameters.
|
||||
|
||||
``--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:
|
||||
|
||||
``lavrresample[=option1:option2:...]``
|
||||
This filter uses libavresample (or libswresample, depending on the build)
|
||||
to change sample rate, sample format, or channel layout of the audio stream.
|
||||
This filter is automatically enabled if the audio output does not support
|
||||
the audio configuration of the file being played.
|
||||
|
||||
It supports only the following sample formats: u8, s16, s32, float.
|
||||
|
||||
``filter-size=<length>``
|
||||
Length of the filter with respect to the lower sampling rate. (default:
|
||||
16)
|
||||
``phase-shift=<count>``
|
||||
Log2 of the number of polyphase entries. (..., 10->1024, 11->2048,
|
||||
12->4096, ...) (default: 10->1024)
|
||||
``cutoff=<cutoff>``
|
||||
Cutoff frequency (0.0-1.0), default set depending upon filter length.
|
||||
``linear``
|
||||
If set then filters will be linearly interpolated between polyphase
|
||||
entries. (default: no)
|
||||
``no-detach``
|
||||
Do not detach if input and output audio format/rate/channels match.
|
||||
(If you just want to set defaults for this filter that will be used
|
||||
even by automatically inserted lavrresample instances, you should
|
||||
prefer setting them with ``--af-defaults=lavrresample:...``.)
|
||||
``normalize=<yes|no>``
|
||||
Whether to normalize when remixing channel layouts (default: yes). This
|
||||
is e.g. applied when downmixing surround audio to stereo. The advantage
|
||||
is that this guarantees that no clipping can happen. Unfortunately,
|
||||
this can also lead to too low volume levels. Whether you enable or
|
||||
disable this is essentially a matter of taste, but the default uses
|
||||
the safer choice.
|
||||
``o=<string>``
|
||||
Set AVOptions on the SwrContext or AVAudioResampleContext. These should
|
||||
be documented by FFmpeg or Libav.
|
||||
|
||||
``lavcac3enc[=tospdif[:bitrate[:minch]]]``
|
||||
Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports
|
||||
16-bit native-endian input format, maximum 6 channels. The output is
|
||||
big-endian when outputting a raw AC-3 stream, native-endian when
|
||||
outputting to S/PDIF. If the input sample rate is not 48 kHz, 44.1 kHz or
|
||||
32 kHz, it will be resampled to 48 kHz.
|
||||
|
||||
``tospdif=<yes|no>``
|
||||
Output raw AC-3 stream if ``no``, output to S/PDIF for
|
||||
pass-through if ``yes`` (default).
|
||||
|
||||
``bitrate=<rate>``
|
||||
The bitrate use for the AC-3 stream. Set it to 384 to get 384 kbps.
|
||||
|
||||
The default is 640. Some receivers might not be able to handle this.
|
||||
|
||||
Valid values: 32, 40, 48, 56, 64, 80, 96, 112, 128,
|
||||
160, 192, 224, 256, 320, 384, 448, 512, 576, 640.
|
||||
|
||||
The special value ``auto`` selects a default bitrate based on the
|
||||
input channel number:
|
||||
|
||||
:1ch: 96
|
||||
:2ch: 192
|
||||
:3ch: 224
|
||||
:4ch: 384
|
||||
:5ch: 448
|
||||
:6ch: 448
|
||||
|
||||
``minch=<n>``
|
||||
If the input channel number is less than ``<minch>``, the filter will
|
||||
detach itself (default: 3).
|
||||
|
||||
``equalizer=g1:g2:g3:...:g10``
|
||||
10 octave band graphic equalizer, implemented using 10 IIR band-pass
|
||||
filters. This means that it works regardless of what type of audio is
|
||||
being played back. The center frequencies for the 10 bands are:
|
||||
|
||||
=== ==========
|
||||
No. frequency
|
||||
=== ==========
|
||||
0 31.25 Hz
|
||||
1 62.50 Hz
|
||||
2 125.00 Hz
|
||||
3 250.00 Hz
|
||||
4 500.00 Hz
|
||||
5 1.00 kHz
|
||||
6 2.00 kHz
|
||||
7 4.00 kHz
|
||||
8 8.00 kHz
|
||||
9 16.00 kHz
|
||||
=== ==========
|
||||
|
||||
If the sample rate of the sound being played is lower than the center
|
||||
frequency for a frequency band, then that band will be disabled. A known
|
||||
bug with this filter is that the characteristics for the uppermost band
|
||||
are not completely symmetric if the sample rate is close to the center
|
||||
frequency of that band. This problem can be worked around by upsampling
|
||||
the sound using a resampling filter before it reaches this filter.
|
||||
|
||||
``<g1>:<g2>:<g3>:...:<g10>``
|
||||
floating point numbers representing the gain in dB for each frequency
|
||||
band (-12-12)
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi``
|
||||
Would amplify the sound in the upper and lower frequency region
|
||||
while canceling it almost completely around 1 kHz.
|
||||
|
||||
``channels=nch[:routes]``
|
||||
Can be used for adding, removing, routing and copying audio channels. If
|
||||
only ``<nch>`` is given, the default routing is used. It works as follows:
|
||||
If the number of output channels is greater than the number of input
|
||||
channels, empty channels are inserted (except when mixing from mono to
|
||||
stereo; then the mono channel is duplicated). If the number of output
|
||||
channels is less than the number of input channels, the exceeding
|
||||
channels are truncated.
|
||||
|
||||
``<nch>``
|
||||
number of output channels (1-8)
|
||||
``<routes>``
|
||||
List of ``,`` separated routes, in the form ``from1-to1,from2-to2,...``.
|
||||
Each pair defines where to route each channel. There can be at most
|
||||
8 routes. Without this argument, the default routing is used. Since
|
||||
``,`` is also used to separate filters, you must quote this argument
|
||||
with ``[...]`` or similar.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --af=channels=4:[0-1,1-0,0-2,1-3] media.avi``
|
||||
Would change the number of channels to 4 and set up 4 routes that
|
||||
swap channel 0 and channel 1 and leave channel 2 and 3 intact.
|
||||
Observe that if media containing two channels were played back,
|
||||
channels 2 and 3 would contain silence but 0 and 1 would still be
|
||||
swapped.
|
||||
|
||||
``mpv --af=channels=6:[0-0,0-1,0-2,0-3] media.avi``
|
||||
Would change the number of channels to 6 and set up 4 routes that
|
||||
copy channel 0 to channels 0 to 3. Channel 4 and 5 will contain
|
||||
silence.
|
||||
|
||||
.. note::
|
||||
|
||||
You should probably not use this filter. If you want to change the
|
||||
output channel layout, try the ``format`` filter, which can make mpv
|
||||
automatically up- and downmix standard channel layouts.
|
||||
|
||||
``format=format:srate:channels:out-format:out-srate:out-channels``
|
||||
Does not do any format conversion itself. Rather, it may cause the
|
||||
filter system to insert necessary conversion filters before or after this
|
||||
filter if needed. It is primarily useful for controlling the audio format
|
||||
going into other filters. To specify the format for audio output, see
|
||||
``--audio-format``, ``--audio-samplerate``, and ``--audio-channels``. This
|
||||
filter is able to force a particular format, whereas ``--audio-*``
|
||||
may be overridden by the ao based on output compatibility.
|
||||
|
||||
All parameters are optional. The first 3 parameters restrict what the filter
|
||||
accepts as input. They will therefore cause conversion filters to be
|
||||
inserted before this one. The ``out-`` parameters tell the filters or audio
|
||||
outputs following this filter how to interpret the data without actually
|
||||
doing a conversion. Setting these will probably just break things unless you
|
||||
really know you want this for some reason, such as testing or dealing with
|
||||
broken media.
|
||||
|
||||
``<format>``
|
||||
Force conversion to this format. Use ``--af=format=format=help`` to get
|
||||
a list of valid formats.
|
||||
|
||||
``<srate>``
|
||||
Force conversion to a specific sample rate. The rate is an integer,
|
||||
48000 for example.
|
||||
|
||||
``<channels>``
|
||||
Force mixing to a specific channel layout. See ``--audio-channels`` option
|
||||
for possible values.
|
||||
|
||||
``<out-format>``
|
||||
|
||||
``<out-srate>``
|
||||
|
||||
``<out-channels>``
|
||||
|
||||
*NOTE*: this filter used to be named ``force``. The old ``format`` filter
|
||||
used to do conversion itself, unlike this one which lets the filter system
|
||||
handle the conversion.
|
||||
|
||||
``volume[=<volumedb>[:...]]``
|
||||
Implements software volume control. Use this filter with caution since it
|
||||
can reduce the signal to noise ratio of the sound. In most cases it is
|
||||
best to use the *Master* volume control of your sound card or the volume
|
||||
knob on your amplifier.
|
||||
|
||||
*NOTE*: This filter is not reentrant and can therefore only be enabled
|
||||
once for every audio stream.
|
||||
|
||||
``<volumedb>``
|
||||
Sets the desired gain in dB for all channels in the stream from -200 dB
|
||||
to +60 dB, where -200 dB mutes the sound completely and +60 dB equals a
|
||||
gain of 1000 (default: 0).
|
||||
``replaygain-track``
|
||||
Adjust volume gain according to the track-gain replaygain value stored
|
||||
in the file metadata.
|
||||
``replaygain-album``
|
||||
Like replaygain-track, but using the album-gain value instead.
|
||||
``replaygain-preamp``
|
||||
Pre-amplification gain in dB to apply to the selected replaygain gain
|
||||
(default: 0).
|
||||
``replaygain-clip=yes|no``
|
||||
Prevent clipping caused by replaygain by automatically lowering the
|
||||
gain (default). Use ``replaygain-clip=no`` to disable this.
|
||||
``replaygain-fallback``
|
||||
Gain in dB to apply if the file has no replay gain tags. This option
|
||||
is always applied if the replaygain logic is somehow inactive. If this
|
||||
is applied, no other replaygain options are applied.
|
||||
``softclip``
|
||||
Turns soft clipping on. Soft-clipping can make the
|
||||
sound more smooth if very high volume levels are used. Enable this
|
||||
option if the dynamic range of the loudspeakers is very low.
|
||||
|
||||
*WARNING*: This feature creates distortion and should be considered a
|
||||
last resort.
|
||||
``s16``
|
||||
Force S16 sample format if set. Lower quality, but might be faster
|
||||
in some situations.
|
||||
``detach``
|
||||
Remove the filter if the volume is not changed at audio filter config
|
||||
time. Useful with replaygain: if the current file has no replaygain
|
||||
tags, then the filter will be removed if this option is enabled.
|
||||
(If ``--softvol=yes`` is used and the player volume controls are used
|
||||
during playback, a different volume filter will be inserted.)
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=volume=10.1 media.avi``
|
||||
Would amplify the sound by 10.1 dB and hard-clip if the sound level
|
||||
is too high.
|
||||
|
||||
``pan=n:[<matrix>]``
|
||||
Mixes channels arbitrarily. Basically a combination of the volume and the
|
||||
channels filter that can be used to down-mix many channels to only a few,
|
||||
e.g. stereo to mono, or vary the "width" of the center speaker in a
|
||||
surround sound system. This filter is hard to use, and will require some
|
||||
tinkering before the desired result is obtained. The number of options for
|
||||
this filter depends on the number of output channels. An example how to
|
||||
downmix a six-channel file to two channels with this filter can be found
|
||||
in the examples section near the end.
|
||||
|
||||
``<n>``
|
||||
Number of output channels (1-8).
|
||||
``<matrix>``
|
||||
A list of values ``[L00,L01,L02,...,L10,L11,L12,...,Ln0,Ln1,Ln2,...]``,
|
||||
where each element ``Lij`` means how much of input channel i is mixed
|
||||
into output channel j (range 0-1). So in principle you first have n
|
||||
numbers saying what to do with the first input channel, then n numbers
|
||||
that act on the second input channel etc. If you do not specify any
|
||||
numbers for some input channels, 0 is assumed.
|
||||
Note that the values are separated by ``,``, which is already used
|
||||
by the option parser to separate filters. This is why you must quote
|
||||
the value list with ``[...]`` or similar.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --af=pan=1:[0.5,0.5] media.avi``
|
||||
Would downmix from stereo to mono.
|
||||
|
||||
``mpv --af=pan=3:[1,0,0.5,0,1,0.5] media.avi``
|
||||
Would give 3 channel output leaving channels 0 and 1 intact, and mix
|
||||
channels 0 and 1 into output channel 2 (which could be sent to a
|
||||
subwoofer for example).
|
||||
|
||||
.. note::
|
||||
|
||||
If you just want to force remixing to a certain output channel layout,
|
||||
it is easier to use the ``format`` filter. For example,
|
||||
``mpv '--af=format=channels=5.1' '--audio-channels=5.1'`` would always force
|
||||
remixing audio to 5.1 and output it like this.
|
||||
|
||||
``delay[=[ch1,ch2,...]]``
|
||||
Delays the sound to the loudspeakers such that the sound from the
|
||||
different channels arrives at the listening position simultaneously. It is
|
||||
only useful if you have more than 2 loudspeakers.
|
||||
|
||||
``[ch1,ch2,...]``
|
||||
The delay in ms that should be imposed on each channel (floating point
|
||||
number between 0 and 1000).
|
||||
|
||||
To calculate the required delay for the different channels, do as follows:
|
||||
|
||||
1. Measure the distance to the loudspeakers in meters in relation to your
|
||||
listening position, giving you the distances s1 to s5 (for a 5.1
|
||||
system). There is no point in compensating for the subwoofer (you will
|
||||
not hear the difference anyway).
|
||||
|
||||
2. Subtract the distances s1 to s5 from the maximum distance, i.e.
|
||||
``s[i] = max(s) - s[i]; i = 1...5``.
|
||||
|
||||
3. Calculate the required delays in ms as ``d[i] = 1000*s[i]/342; i =
|
||||
1...5``.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=delay=[10.5,10.5,0,0,7,0] media.avi``
|
||||
Would delay front left and right by 10.5 ms, the two rear channels
|
||||
and the subwoofer by 0 ms and the center channel by 7 ms.
|
||||
|
||||
``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).
|
||||
|
||||
This works by playing 'stride' ms of audio at normal speed then consuming
|
||||
'stride*scale' ms of input audio. It pieces the strides together by
|
||||
blending 'overlap'% of stride with audio following the previous stride. It
|
||||
optionally performs a short statistical analysis on the next 'search' ms
|
||||
of audio to determine the best overlap position.
|
||||
|
||||
``scale=<amount>``
|
||||
Nominal amount to scale tempo. Scales this amount in addition to
|
||||
speed. (default: 1.0)
|
||||
``stride=<amount>``
|
||||
Length in milliseconds to output each stride. Too high of a value will
|
||||
cause noticeable skips at high scale amounts and an echo at low scale
|
||||
amounts. Very low values will alter pitch. Increasing improves
|
||||
performance. (default: 60)
|
||||
``overlap=<percent>``
|
||||
Percentage of stride to overlap. Decreasing improves performance.
|
||||
(default: .20)
|
||||
``search=<amount>``
|
||||
Length in milliseconds to search for best overlap position. Decreasing
|
||||
improves performance greatly. On slow systems, you will probably want
|
||||
to set this very low. (default: 14)
|
||||
``speed=<tempo|pitch|both|none>``
|
||||
Set response to speed change.
|
||||
|
||||
tempo
|
||||
Scale tempo in sync with speed (default).
|
||||
pitch
|
||||
Reverses effect of filter. Scales pitch without altering tempo.
|
||||
Add this to your ``input.conf`` to step by musical semi-tones::
|
||||
|
||||
[ multiply speed 0.9438743126816935
|
||||
] multiply speed 1.059463094352953
|
||||
|
||||
.. warning::
|
||||
|
||||
Loses sync with video.
|
||||
both
|
||||
Scale both tempo and pitch.
|
||||
none
|
||||
Ignore speed changes.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --af=scaletempo --speed=1.2 media.ogg``
|
||||
Would play media at 1.2x normal speed, with audio at normal
|
||||
pitch. Changing playback speed would change audio tempo to match.
|
||||
|
||||
``mpv --af=scaletempo=scale=1.2:speed=none --speed=1.2 media.ogg``
|
||||
Would play media at 1.2x normal speed, with audio at normal
|
||||
pitch, but changing playback speed would have no effect on audio
|
||||
tempo.
|
||||
|
||||
``mpv --af=scaletempo=stride=30:overlap=.50:search=10 media.ogg``
|
||||
Would tweak the quality and performance parameters.
|
||||
|
||||
``mpv --af=format=float,scaletempo media.ogg``
|
||||
Would make scaletempo use float code. Maybe faster on some
|
||||
platforms.
|
||||
|
||||
``mpv --af=scaletempo=scale=1.2:speed=pitch audio.ogg``
|
||||
Would play media at 1.2x normal speed, with audio at normal pitch.
|
||||
Changing playback speed would change pitch, leaving audio tempo at
|
||||
1.2x.
|
||||
|
||||
``rubberband``
|
||||
High quality pitch correction with librubberband. This can be used in place
|
||||
of ``scaletempo``, and will be used to adjust audio pitch when playing
|
||||
at speed different from normal.
|
||||
|
||||
This filter has a number of sub-options. You can list them with
|
||||
``mpv --af=rubberband=help``. This will also show the default values
|
||||
for each option. The options are not documented here, because they are
|
||||
merely passed to librubberband. Look at the librubberband documentation
|
||||
to learn what each option does:
|
||||
http://breakfastquay.com/rubberband/code-doc/classRubberBand_1_1RubberBandStretcher.html
|
||||
(The mapping of the mpv rubberband filter sub-option names and values to
|
||||
those of librubberband follows a simple pattern: ``"Option" + Name + Value``.)
|
||||
|
||||
``lavfi=graph``
|
||||
Filter audio using FFmpeg's libavfilter.
|
||||
|
||||
``<graph>``
|
||||
Libavfilter graph. See ``lavfi`` video filter for details - the graph
|
||||
syntax is the same.
|
||||
|
||||
.. warning::
|
||||
|
||||
Don't forget to quote libavfilter graphs as described in the lavfi
|
||||
video filter section.
|
||||
|
||||
``o=<string>``
|
||||
AVOptions.
|
||||
-337
@@ -1,337 +0,0 @@
|
||||
AUDIO OUTPUT DRIVERS
|
||||
====================
|
||||
|
||||
Audio output drivers are interfaces to different audio output facilities. The
|
||||
syntax is:
|
||||
|
||||
``--ao=<driver1[:suboption1[=value]:...],driver2,...[,]>``
|
||||
Specify a priority list of audio output drivers to be used.
|
||||
|
||||
If the list has a trailing ',', mpv will fall back on drivers not contained
|
||||
in the list. Suboptions are optional and can mostly be omitted.
|
||||
|
||||
You can also set defaults for each driver. The defaults are applied before the
|
||||
normal driver parameters.
|
||||
|
||||
``--ao-defaults=<driver1[:parameter1:parameter2:...],driver2,...>``
|
||||
Set defaults for each driver.
|
||||
|
||||
.. note::
|
||||
|
||||
See ``--ao=help`` for a list of compiled-in audio output drivers. The
|
||||
driver ``--ao=alsa`` is preferred. ``--ao=pulse`` is preferred on systems
|
||||
where PulseAudio is used. On Windows, ``--ao=wasapi`` is preferred,
|
||||
though it might cause trouble sometimes, in which case ``--ao=dsound``
|
||||
should be used. On BSD systems, ``--ao=oss`` or `--ao=sndio`` may work
|
||||
(the latter being experimental). On OS X systems, use ``--ao=coreaudio``.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
- ``--ao=alsa,oss,`` Try the ALSA driver, then the OSS driver, then others.
|
||||
- ``--ao=alsa:resample=yes:device=[plughw:0,3]`` Lets ALSA resample and
|
||||
sets the device-name as first card, fourth device.
|
||||
|
||||
Available audio output drivers are:
|
||||
|
||||
``alsa`` (Linux only)
|
||||
ALSA audio output driver
|
||||
|
||||
``device=<device>``
|
||||
Sets the device name. For ac3 output via S/PDIF, use an "iec958" or
|
||||
"spdif" device, unless you really know how to set it correctly.
|
||||
``resample=yes``
|
||||
Enable ALSA resampling plugin. (This is disabled by default, because
|
||||
some drivers report incorrect audio delay in some cases.)
|
||||
``mixer-device=<device>``
|
||||
Set the mixer device used with ``--no-softvol`` (default: ``default``).
|
||||
``mixer-name=<name>``
|
||||
Set the name of the mixer element (default: ``Master``). This is for
|
||||
example ``PCM`` or ``Master``.
|
||||
``mixer-index=<number>``
|
||||
Set the index of the mixer channel (default: 0). Consider the output of
|
||||
"``amixer scontrols``", then the index is the number that follows the
|
||||
name of the element.
|
||||
``non-interleaved``
|
||||
Allow output of non-interleaved formats (if the audio decoder uses
|
||||
this format). Currently disabled by default, because some popular
|
||||
ALSA plugins are utterly broken with non-interleaved formats.
|
||||
``ignore-chmap``
|
||||
Don't read or set the channel map of the ALSA device - only request the
|
||||
required number of channels, and then pass the audio as-is to it. This
|
||||
option most likely should not be used. It can be useful for debugging,
|
||||
or for static setups with a specially engineered ALSA configuration (in
|
||||
this case you should always force the same layout with ``--audio-channels``,
|
||||
or it will work only for files which use the layout implicit to your
|
||||
ALSA device).
|
||||
|
||||
.. note::
|
||||
|
||||
MPlayer and mplayer2 required you to replace any ',' with '.' and
|
||||
any ':' with '=' in the ALSA device name. mpv does not do this anymore.
|
||||
Instead, quote the device name:
|
||||
|
||||
``--ao=alsa:device=[plug:surround50]``
|
||||
|
||||
Note that the ``[`` and ``]`` simply quote the device name. With some
|
||||
shells (like zsh), you have to quote the option string to prevent the
|
||||
shell from interpreting the brackets instead of passing them to mpv.
|
||||
|
||||
Actually, you should use the ``--audio-device`` option, instead of
|
||||
setting the device directly.
|
||||
|
||||
.. warning::
|
||||
|
||||
Handling of multichannel/surround audio changed in mpv 0.8.0 from the
|
||||
behavior in MPlayer/mplayer2 and older versions of mpv.
|
||||
|
||||
The old behavior is that the player always downmixed to stereo by
|
||||
default. The ``--audio-channels`` (or ``--channels`` before that) option
|
||||
had to be set to get multichannel audio. Then playing stereo would
|
||||
use the ``default`` device (which typically allows multiple programs
|
||||
to play audio at the same time via dmix), while playing anything with
|
||||
more channels would open one of the hardware devices, e.g. via the
|
||||
``surround51`` alias (typically with exclusive access). Whether the
|
||||
player would use exclusive access or not would depend on the file
|
||||
being played.
|
||||
|
||||
The new behavior since mpv 0.8.0 always enables multichannel audio,
|
||||
i.e. ``--audio-channels=auto`` is the default. However, since ALSA
|
||||
provides no good way to play multichannel audio in a non-exclusive
|
||||
way (without blocking other applications from using audio), the player
|
||||
is restricted to the capabilities of the ``default`` device by default,
|
||||
which means it supports only stereo and mono (at least with current
|
||||
typical ALSA configurations). But if a hardware device is selected,
|
||||
then multichannel audio will typically work.
|
||||
|
||||
The short story is: if you want multichannel audio with ALSA, use
|
||||
``--audio-device`` to select the device (use ``--audio-device=help``
|
||||
to get a list of all devices and their mpv name).
|
||||
|
||||
You can also try `using the upmix plugin <http://git.io/vfuAy>`_.
|
||||
This setup enables multichannel audio on the ``default`` device
|
||||
with automatic upmixing with shared access, so playing stereo
|
||||
and multichannel audio at the same time will work as expected.
|
||||
|
||||
``oss``
|
||||
OSS audio output driver
|
||||
|
||||
``<dsp-device>``
|
||||
Sets the audio output device (default: ``/dev/dsp``).
|
||||
``<mixer-device>``
|
||||
Sets the audio mixer device (default: ``/dev/mixer``).
|
||||
``<mixer-channel>``
|
||||
Sets the audio mixer channel (default: ``pcm``). Other valid values
|
||||
include **vol, pcm, line**. For a complete list of options look for
|
||||
``SOUND_DEVICE_NAMES`` in ``/usr/include/linux/soundcard.h``.
|
||||
|
||||
``jack``
|
||||
JACK (Jack Audio Connection Kit) audio output driver
|
||||
|
||||
``port=<name>``
|
||||
Connects to the ports with the given name (default: physical ports).
|
||||
``name=<client>``
|
||||
Client name that is passed to JACK (default: ``mpv``). Useful
|
||||
if you want to have certain connections established automatically.
|
||||
``(no-)autostart``
|
||||
Automatically start jackd if necessary (default: disabled). Note that
|
||||
this tends to be unreliable and will flood stdout with server messages.
|
||||
``(no-)connect``
|
||||
Automatically create connections to output ports (default: enabled).
|
||||
When enabled, the maximum number of output channels will be limited to
|
||||
the number of available output ports.
|
||||
``std-channel-layout=alsa|waveext|any``
|
||||
Select the standard channel layout (default: alsa). JACK itself has no
|
||||
notion of channel layouts (i.e. assigning which speaker a given
|
||||
channel is supposed to map to) - it just takes whatever the application
|
||||
outputs, and reroutes it to whatever the user defines. This means the
|
||||
user and the application are in charge of dealing with the channel
|
||||
layout. ``alsa`` uses the old MPlayer layout, which is inspired by
|
||||
ALSA's standard layouts. In this mode, ao_jack will refuse to play 3
|
||||
or 7 channels (because these do not really have a defined meaning in
|
||||
MPlayer). ``waveext`` uses WAVE_FORMAT_EXTENSIBLE order, which, even
|
||||
though it was defined by Microsoft, is the standard on many systems.
|
||||
The value ``any`` makes JACK accept whatever comes from the audio
|
||||
filter chain, regardless of channel layout and without reordering. This
|
||||
mode is probably not very useful, other than for debugging or when used
|
||||
with fixed setups.
|
||||
|
||||
``coreaudio`` (Mac OS X only)
|
||||
Native Mac OS X audio output driver using AudioUnits and the CoreAudio
|
||||
sound server.
|
||||
|
||||
Automatically redirects to ``coreaudio_exclusive`` when playing compressed
|
||||
formats.
|
||||
|
||||
``change-physical-format=<yes|no>``
|
||||
Change the physical format to one similar to the requested audio format
|
||||
(default: no). This has the advantage that multichannel audio output
|
||||
will actually work. The disadvantage is that it will change the
|
||||
system-wide audio settings. This is equivalent to changing the ``Format``
|
||||
setting in the ``Audio Devices`` dialog in the ``Audio MIDI Setup``
|
||||
utility. Note that this does not effect the selected speaker setup.
|
||||
|
||||
``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)
|
||||
Native Mac OS X audio output driver using direct device access and
|
||||
exclusive mode (bypasses the sound server).
|
||||
|
||||
``openal``
|
||||
Experimental OpenAL audio output driver
|
||||
|
||||
.. note:: This driver is not very useful. Playing multi-channel audio with
|
||||
it is slow.
|
||||
|
||||
``pulse``
|
||||
PulseAudio audio output driver
|
||||
|
||||
``[<host>][:<output 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).
|
||||
|
||||
``buffer=<1-2000|native>``
|
||||
Set the audio buffer size in milliseconds. A higher value buffers
|
||||
more data, and has a lower probability of buffer underruns. A smaller
|
||||
value makes the audio stream react faster, e.g. to playback speed
|
||||
changes. Default: 250.
|
||||
|
||||
``latency-hacks=<yes|no>``
|
||||
Enable hacks to workaround PulseAudio timing bugs (default: no). If
|
||||
enabled, mpv will do elaborate latency calculations on its own. If
|
||||
disabled, it will use PulseAudio automatically updated timing
|
||||
information. Disabling this might help with e.g. networked audio or
|
||||
some plugins, while enabling it might help in some unknown situations
|
||||
(it used to be required to get good behavior on old PulseAudio versions).
|
||||
|
||||
If you have stuttering video when using pulse, try to enable this
|
||||
option. (Or alternatively, try to update PulseAudio.)
|
||||
|
||||
``dsound`` (Windows only)
|
||||
DirectX DirectSound audio output driver
|
||||
|
||||
.. note:: This driver is for compatibility with old systems.
|
||||
|
||||
``device=<devicenum>``
|
||||
Sets the device number to use. Playing a file with ``-v`` will show a
|
||||
list of available devices.
|
||||
|
||||
``buffersize=<ms>``
|
||||
DirectSound buffer size in milliseconds (default: 200).
|
||||
|
||||
``sdl``
|
||||
SDL 1.2+ audio output driver. Should work on any platform supported by SDL
|
||||
1.2, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
|
||||
appropriately for your system.
|
||||
|
||||
.. note:: This driver is for compatibility with extremely foreign
|
||||
environments, such as systems where none of the other drivers
|
||||
are available.
|
||||
|
||||
``buflen=<length>``
|
||||
Sets the audio buffer length in seconds. Is used only as a hint by the
|
||||
sound system. Playing a file with ``-v`` will show the requested and
|
||||
obtained exact buffer size. A value of 0 selects the sound system
|
||||
default.
|
||||
|
||||
``bufcnt=<count>``
|
||||
Sets the number of extra audio buffers in mpv. Usually needs not be
|
||||
changed.
|
||||
|
||||
``null``
|
||||
Produces no audio output but maintains video playback speed. Use
|
||||
``--ao=null:untimed`` for benchmarking.
|
||||
|
||||
``untimed``
|
||||
Do not simulate timing of a perfect audio device. This means audio
|
||||
decoding will go as fast as possible, instead of timing it to the
|
||||
system clock.
|
||||
|
||||
``buffer``
|
||||
Simulated buffer length in seconds.
|
||||
|
||||
``outburst``
|
||||
Simulated chunk size in samples.
|
||||
|
||||
``speed``
|
||||
Simulated audio playback speed as a multiplier. Usually, a real audio
|
||||
device will not go exactly as fast as the system clock. It will deviate
|
||||
just a little, and this option helps simulating this.
|
||||
|
||||
``latency``
|
||||
Simulated device latency. This is additional to EOF.
|
||||
|
||||
``broken-eof``
|
||||
Simulate broken audio drivers, which always add the fixed device
|
||||
latency to the reported audio playback position.
|
||||
|
||||
``broken-delay``
|
||||
Simulate broken audio drivers, which don't report latency correctly.
|
||||
|
||||
``channel-layouts``
|
||||
If not empty, this is a ``,`` separated list of channel layouts the
|
||||
AO allows. This can be used to test channel layout selection.
|
||||
|
||||
``pcm``
|
||||
Raw PCM/WAVE file writer audio output
|
||||
|
||||
``(no-)waveheader``
|
||||
Include or do not include the WAVE header (default: included). When
|
||||
not included, raw PCM will be generated.
|
||||
``file=<filename>``
|
||||
Write the sound to ``<filename>`` instead of the default
|
||||
``audiodump.wav``. If ``no-waveheader`` is specified, the default is
|
||||
``audiodump.pcm``.
|
||||
``(no-)append``
|
||||
Append to the file, instead of overwriting it. Always use this with the
|
||||
``no-waveheader`` option - with ``waveheader`` it's broken, because
|
||||
it will write a WAVE header every time the file is opened.
|
||||
|
||||
``rsound``
|
||||
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.
|
||||
|
||||
``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 '/'.
|
||||
``port=<number>``
|
||||
Set the TCP port used for connecting to the server (default: 12345).
|
||||
Not used if connecting to a Unix domain socket.
|
||||
|
||||
``sndio``
|
||||
Audio output to the OpenBSD sndio sound system
|
||||
|
||||
.. note:: Experimental. There are known bugs and issues.
|
||||
|
||||
(Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel
|
||||
layouts.)
|
||||
|
||||
``device=<device>``
|
||||
sndio device to use (default: ``$AUDIODEVICE``, resp. ``snd0``).
|
||||
|
||||
``wasapi``
|
||||
Audio output to the Windows Audio Session API.
|
||||
|
||||
``exclusive``
|
||||
Requests exclusive, direct hardware access. By definition prevents
|
||||
sound playback of any other program until mpv exits.
|
||||
``device=<id>``
|
||||
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.
|
||||
|
||||
This option is mostly deprecated in favour of the more general
|
||||
``--audio-device`` option. That said, ``--audio-device=help`` will give
|
||||
a list of valid device GUIDs (prefixed with ``wasapi/``), as well as
|
||||
their human readable names, which should work here.
|
||||
@@ -1,13 +0,0 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
There is no real changelog, but you can look at the following things:
|
||||
|
||||
* The release changelog, which should contain most user-visible changes,
|
||||
including new features and bug fixes:
|
||||
|
||||
https://github.com/mpv-player/mpv/releases
|
||||
* The git log, which is the "real" changelog
|
||||
* The file ``mplayer-changes.rst`` in the ``DOCS`` sub directory on the git
|
||||
repository, which used to be in place of this section. It documents some
|
||||
changes that happened since mplayer2 forked off MPlayer.
|
||||
@@ -0,0 +1,573 @@
|
||||
AUDIO FILTERS
|
||||
=============
|
||||
|
||||
Audio filters allow you to modify the audio stream and its properties. The
|
||||
syntax is:
|
||||
|
||||
``--af=<filter1[=parameter1:parameter2:...],filter2,...>``
|
||||
Setup a chain of audio filters.
|
||||
|
||||
.. note::
|
||||
|
||||
To get a full list of available audio filters, see ``--af=help``.
|
||||
|
||||
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:
|
||||
|
||||
``lavrresample[=option1:option2:...]``
|
||||
This filter uses libavresample (or libswresample, depending on the build)
|
||||
to change sample rate, sample format, or channel layout of the audio stream.
|
||||
This filter is automatically enabled if the audio output does not support
|
||||
the audio configuration of the file being played.
|
||||
|
||||
It supports only the following sample formats: u8, s16ne, s32ne, floatne.
|
||||
|
||||
``filter-size=<length>``
|
||||
Length of the filter with respect to the lower sampling rate. (default:
|
||||
16)
|
||||
``phase-shift=<count>``
|
||||
Log2 of the number of polyphase entries. (..., 10->1024, 11->2048,
|
||||
12->4096, ...) (default: 10->1024)
|
||||
``cutoff=<cutoff>``
|
||||
Cutoff frequency (0.0-1.0), default set depending upon filter length.
|
||||
``linear``
|
||||
If set then filters will be linearly interpolated between polyphase
|
||||
entries. (default: no)
|
||||
``no-detach``
|
||||
Do not detach if input and output audio format/rate/channels match.
|
||||
You should add this option if you specify additional parameters, as
|
||||
automatically inserted lavrresample instances will use the default
|
||||
settings.
|
||||
``o=<string>``
|
||||
Set AVOptions on the SwrContext or AVAudioResampleContext. These should
|
||||
be documented by FFmpeg or Libav.
|
||||
|
||||
``lavcac3enc[=tospdif[:bitrate[:minchn]]]``
|
||||
Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports
|
||||
16-bit native-endian input format, maximum 6 channels. The output is
|
||||
big-endian when outputting a raw AC-3 stream, native-endian when
|
||||
outputting to S/PDIF. If the input sample rate is not 48 kHz, 44.1 kHz or
|
||||
32 kHz, it will be resampled to 48 kHz.
|
||||
|
||||
``<tospdif>``
|
||||
Output raw AC-3 stream if zero or not set, output to S/PDIF for
|
||||
passthrough when ``<tospdif>`` is set non-zero.
|
||||
``<bitrate>``
|
||||
The bitrate use for the AC-3 stream. Set it to either 384 or 384000
|
||||
to get 384 kbps.
|
||||
|
||||
Valid values: 32, 40, 48, 56, 64, 80, 96, 112, 128,
|
||||
160, 192, 224, 256, 320, 384, 448, 512, 576, 640.
|
||||
|
||||
Default bitrate is based on the input channel number:
|
||||
|
||||
:1ch: 96
|
||||
:2ch: 192
|
||||
:3ch: 224
|
||||
:4ch: 384
|
||||
:5ch: 448
|
||||
:6ch: 448
|
||||
|
||||
``<minchn>``
|
||||
If the input channel number is less than ``<minchn>``, the filter will
|
||||
detach itself (default: 5).
|
||||
|
||||
``sweep[=speed]``
|
||||
Produces a sine sweep.
|
||||
|
||||
``<0.0-1.0>``
|
||||
Sine function delta, use very low values to hear the sweep.
|
||||
|
||||
``sinesuppress[=freq:decay]``
|
||||
Remove a sine at the specified frequency. Useful to get rid of the 50/60Hz
|
||||
noise on low quality audio equipment. It only works on mono input.
|
||||
|
||||
``<freq>``
|
||||
The frequency of the sine which should be removed (in Hz) (default:
|
||||
50)
|
||||
``<decay>``
|
||||
Controls the adaptivity (a larger value will make the filter adapt to
|
||||
amplitude and phase changes quicker, a smaller value will make the
|
||||
adaptation slower) (default: 0.0001). Reasonable values are around
|
||||
0.001.
|
||||
|
||||
``bs2b[=option1:option2:...]``
|
||||
Bauer stereophonic to binaural transformation using libbs2b. Improves the
|
||||
headphone listening experience by making the sound similar to that from
|
||||
loudspeakers, allowing each ear to hear both channels and taking into
|
||||
account the distance difference and the head shadowing effect. It is
|
||||
applicable only to 2-channel audio.
|
||||
|
||||
``fcut=<300-1000>``
|
||||
Set cut frequency in Hz.
|
||||
``feed=<10-150>``
|
||||
Set feed level for low frequencies in 0.1*dB.
|
||||
``profile=<value>``
|
||||
Several profiles are available for convenience:
|
||||
|
||||
:default: will be used if nothing else was specified (fcut=700,
|
||||
feed=45)
|
||||
:cmoy: Chu Moy circuit implementation (fcut=700, feed=60)
|
||||
:jmeier: Jan Meier circuit implementation (fcut=650, feed=95)
|
||||
|
||||
If ``fcut`` or ``feed`` options are specified together with a profile, they
|
||||
will be applied on top of the selected profile.
|
||||
|
||||
``hrtf[=flag]``
|
||||
Head-related transfer function: Converts multichannel audio to 2-channel
|
||||
output for headphones, preserving the spatiality of the sound.
|
||||
|
||||
==== ===================================
|
||||
Flag Meaning
|
||||
==== ===================================
|
||||
m matrix decoding of the rear channel
|
||||
s 2-channel matrix decoding
|
||||
0 no matrix decoding (default)
|
||||
==== ===================================
|
||||
|
||||
``equalizer=[g1:g2:g3:...:g10]``
|
||||
10 octave band graphic equalizer, implemented using 10 IIR band-pass
|
||||
filters. This means that it works regardless of what type of audio is
|
||||
being played back. The center frequencies for the 10 bands are:
|
||||
|
||||
=== ==========
|
||||
No. frequency
|
||||
=== ==========
|
||||
0 31.25 Hz
|
||||
1 62.50 Hz
|
||||
2 125.00 Hz
|
||||
3 250.00 Hz
|
||||
4 500.00 Hz
|
||||
5 1.00 kHz
|
||||
6 2.00 kHz
|
||||
7 4.00 kHz
|
||||
8 8.00 kHz
|
||||
9 16.00 kHz
|
||||
=== ==========
|
||||
|
||||
If the sample rate of the sound being played is lower than the center
|
||||
frequency for a frequency band, then that band will be disabled. A known
|
||||
bug with this filter is that the characteristics for the uppermost band
|
||||
are not completely symmetric if the sample rate is close to the center
|
||||
frequency of that band. This problem can be worked around by upsampling
|
||||
the sound using a resampling filter before it reaches this filter.
|
||||
|
||||
``<g1>:<g2>:<g3>:...:<g10>``
|
||||
floating point numbers representing the gain in dB for each frequency
|
||||
band (-12-12)
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi``
|
||||
Would amplify the sound in the upper and lower frequency region
|
||||
while canceling it almost completely around 1kHz.
|
||||
|
||||
``channels=nch[:nr:from1:to1:from2:to2:from3:to3:...]``
|
||||
Can be used for adding, removing, routing and copying audio channels. If
|
||||
only ``<nch>`` is given, the default routing is used. It works as follows:
|
||||
If the number of output channels is greater than the number of input
|
||||
channels, empty channels are inserted (except when mixing from mono to
|
||||
stereo; then the mono channel is duplicated). If the number of output
|
||||
channels is less than the number of input channels, the exceeding
|
||||
channels are truncated.
|
||||
|
||||
``<nch>``
|
||||
number of output channels (1-8)
|
||||
``<nr>``
|
||||
number of routes (1-8)
|
||||
``<from1:to1:from2:to2:from3:to3:...>``
|
||||
Pairs of numbers between 0 and 7 that define where to route each
|
||||
channel.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --af=channels=4:4:0:1:1:0:2:2:3:3 media.avi``
|
||||
Would change the number of channels to 4 and set up 4 routes that
|
||||
swap channel 0 and channel 1 and leave channel 2 and 3 intact.
|
||||
Observe that if media containing two channels were played back,
|
||||
channels 2 and 3 would contain silence but 0 and 1 would still be
|
||||
swapped.
|
||||
|
||||
``mpv --af=channels=6:4:0:0:0:1:0:2:0:3 media.avi``
|
||||
Would change the number of channels to 6 and set up 4 routes that
|
||||
copy channel 0 to channels 0 to 3. Channel 4 and 5 will contain
|
||||
silence.
|
||||
|
||||
``force=in-format:in-srate:in-channels:out-format:out-srate:out-channels``
|
||||
Force a specific audio format/configuration without actually changing the
|
||||
audio data. Keep in mind that the filter system might auto-insert actual
|
||||
conversion filters before or after this filter if needed.
|
||||
|
||||
All parameters are optional. The ``in-`` variants restrict what the filter
|
||||
accepts as input. The ``out-`` variants change the audio format, without
|
||||
actually doing a conversion. The data will be 'reinterpreted' by the
|
||||
filters or audio outputs following this filter.
|
||||
|
||||
``<in-format>``
|
||||
Force conversion to this format. See ``format`` filter for valid audio
|
||||
format values.
|
||||
|
||||
``<in-srate>``
|
||||
Force conversion to a specific sample rate. The rate is an integer,
|
||||
48000 for example.
|
||||
|
||||
``<in-channels>``
|
||||
Force mixing to a specific channel layout. See ``--channels`` option
|
||||
for possible values.
|
||||
|
||||
``<out-format>``
|
||||
|
||||
``<out-srate>``
|
||||
|
||||
``<out-channels>``
|
||||
|
||||
``format[=format]``
|
||||
Convert between different sample formats. Automatically enabled when
|
||||
needed by the audio output or another filter. See also ``--format``.
|
||||
|
||||
``<format>``
|
||||
Sets the desired format. The general form is 'sbe', where 's' denotes
|
||||
the sign (either 's' for signed or 'u' for unsigned), 'b' denotes the
|
||||
number of bits per sample (16, 24 or 32) and 'e' denotes the
|
||||
endianness ('le' means little-endian, 'be' big-endian and 'ne' the
|
||||
endianness of the computer mpv is running on). Valid values (amongst
|
||||
others) are: 's16le', 'u32be' and 'u24ne'. Exceptions to this rule that
|
||||
are also valid format specifiers: u8, s8, floatle, floatbe, floatne,
|
||||
mpeg2, and ac3.
|
||||
|
||||
``volume[=v[:sc[:fast]]]``
|
||||
Implements software volume control. Use this filter with caution since it
|
||||
can reduce the signal to noise ratio of the sound. In most cases it is
|
||||
best to use the *Master* volume control of your sound card or the volume
|
||||
knob on your amplifier.
|
||||
|
||||
This filter has a second feature: It measures the overall maximum sound
|
||||
level and prints out that level when mpv exits. This feature currently
|
||||
only works with floating-point data.
|
||||
|
||||
*NOTE*: This filter is not reentrant and can therefore only be enabled
|
||||
once for every audio stream.
|
||||
|
||||
``<v>``
|
||||
Sets the desired gain in dB for all channels in the stream from -200dB
|
||||
to +60dB, where -200dB mutes the sound completely and +60dB equals a
|
||||
gain of 1000 (default: 0).
|
||||
``<sc>``
|
||||
Turns soft clipping on (1) or off (0). Soft-clipping can make the
|
||||
sound more smooth if very high volume levels are used. Enable this
|
||||
option if the dynamic range of the loudspeakers is very low.
|
||||
|
||||
*WARNING*: This feature creates distortion and should be considered a
|
||||
last resort.
|
||||
``<fast>``
|
||||
Force S16 sample format if set to 1. Lower quality, but might be faster
|
||||
in some situations.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=volume=10.1:0 media.avi``
|
||||
Would amplify the sound by 10.1dB and hard-clip if the sound level
|
||||
is too high.
|
||||
|
||||
``pan=n[:L00:L01:L02:...L10:L11:L12:...Ln0:Ln1:Ln2:...]``
|
||||
Mixes channels arbitrarily. Basically a combination of the volume and the
|
||||
channels filter that can be used to down-mix many channels to only a few,
|
||||
e.g. stereo to mono, or vary the "width" of the center speaker in a
|
||||
surround sound system. This filter is hard to use, and will require some
|
||||
tinkering before the desired result is obtained. The number of options for
|
||||
this filter depends on the number of output channels. An example how to
|
||||
downmix a six-channel file to two channels with this filter can be found
|
||||
in the examples section near the end.
|
||||
|
||||
``<n>``
|
||||
Number of output channels (1-8).
|
||||
``<Lij>``
|
||||
How much of input channel i is mixed into output channel j (0-1). So
|
||||
in principle you first have n numbers saying what to do with the first
|
||||
input channel, then n numbers that act on the second input channel
|
||||
etc. If you do not specify any numbers for some input channels, 0 is
|
||||
assumed.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --af=pan=1:0.5:0.5 media.avi``
|
||||
Would downmix from stereo to mono.
|
||||
|
||||
``mpv --af=pan=3:1:0:0.5:0:1:0.5 media.avi``
|
||||
Would give 3 channel output leaving channels 0 and 1 intact, and mix
|
||||
channels 0 and 1 into output channel 2 (which could be sent to a
|
||||
subwoofer for example).
|
||||
|
||||
.. note::
|
||||
|
||||
If you just want to force remixing to a certain output channel
|
||||
layout, it is easier to use the ``force`` filter. For example,
|
||||
``mpv '--af=force=channels=5.1' '--channels=5.1'`` would always
|
||||
force remixing audio to 5.1 and output it like this.
|
||||
|
||||
``sub[=fc:ch]``
|
||||
Adds a subwoofer channel to the audio stream. The audio data used for
|
||||
creating the subwoofer channel is an average of the sound in channel 0 and
|
||||
channel 1. The resulting sound is then low-pass filtered by a 4th order
|
||||
Butterworth filter with a default cutoff frequency of 60Hz and added to a
|
||||
separate channel in the audio stream.
|
||||
|
||||
.. warning::
|
||||
|
||||
Disable this filter when you are playing media with an LFE channel
|
||||
(e.g. 5.1 surround sound), otherwise this filter will disrupt the sound
|
||||
to the subwoofer.
|
||||
|
||||
``<fc>``
|
||||
cutoff frequency in Hz for the low-pass filter (20Hz to 300Hz)
|
||||
(default: 60Hz) For the best result try setting the cutoff frequency
|
||||
as low as possible. This will improve the stereo or surround sound
|
||||
experience.
|
||||
``<ch>``
|
||||
Determines the channel number in which to insert the sub-channel
|
||||
audio. Channel number can be between 0 and 7 (default: 5). Observe
|
||||
that the number of channels will automatically be increased to <ch> if
|
||||
necessary.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=sub=100:4 --channels=5 media.avi``
|
||||
Would add a subwoofer channel with a cutoff frequency of 100Hz to
|
||||
output channel 4.
|
||||
|
||||
``center``
|
||||
Creates a center channel from the front channels. May currently be low
|
||||
quality as it does not implement a high-pass filter for proper extraction
|
||||
yet, but averages and halves the channels instead.
|
||||
|
||||
``<ch>``
|
||||
Determines the channel number in which to insert the center channel.
|
||||
Channel number can be between 0 and 7 (default: 5). Observe that the
|
||||
number of channels will automatically be increased to ``<ch>`` if
|
||||
necessary.
|
||||
|
||||
``surround[=delay]``
|
||||
Decoder for matrix encoded surround sound like Dolby Surround. Some files
|
||||
with 2-channel audio actually contain matrix encoded surround sound.
|
||||
|
||||
``<delay>``
|
||||
delay time in ms for the rear speakers (0 to 1000) (default: 20) This
|
||||
delay should be set as follows: If d1 is the distance from the
|
||||
listening position to the front speakers and d2 is the distance from
|
||||
the listening position to the rear speakers, then the delay should be
|
||||
set to 15ms if d1 <= d2 and to 15 + 5*(d1-d2) if d1 > d2.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=surround=15 --channels=4 media.avi``
|
||||
Would add surround sound decoding with 15ms delay for the sound to
|
||||
the rear speakers.
|
||||
|
||||
``delay[=ch1:ch2:...]``
|
||||
Delays the sound to the loudspeakers such that the sound from the
|
||||
different channels arrives at the listening position simultaneously. It is
|
||||
only useful if you have more than 2 loudspeakers.
|
||||
|
||||
``ch1,ch2,...``
|
||||
The delay in ms that should be imposed on each channel (floating point
|
||||
number between 0 and 1000).
|
||||
|
||||
To calculate the required delay for the different channels, do as follows:
|
||||
|
||||
1. Measure the distance to the loudspeakers in meters in relation to your
|
||||
listening position, giving you the distances s1 to s5 (for a 5.1
|
||||
system). There is no point in compensating for the subwoofer (you will
|
||||
not hear the difference anyway).
|
||||
|
||||
2. Subtract the distances s1 to s5 from the maximum distance, i.e.
|
||||
``s[i] = max(s) - s[i]; i = 1...5``.
|
||||
|
||||
3. Calculate the required delays in ms as ``d[i] = 1000*s[i]/342; i =
|
||||
1...5``.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=delay=10.5:10.5:0:0:7:0 media.avi``
|
||||
Would delay front left and right by 10.5ms, the two rear channels
|
||||
and the subwoofer by 0ms and the center channel by 7ms.
|
||||
|
||||
``export[=mmapped_file[:nsamples]]``
|
||||
Exports the incoming signal to other processes using memory mapping
|
||||
(``mmap()``). Memory mapped areas contain a header::
|
||||
|
||||
int nch /* number of channels */
|
||||
int size /* buffer size */
|
||||
unsigned long long counter /* Used to keep sync, updated every time
|
||||
new data is exported. */
|
||||
|
||||
The rest is payload (non-interleaved) 16-bit data.
|
||||
|
||||
``<mmapped_file>``
|
||||
File to map data to (default: ``~/.mpv/mpv-af_export``).
|
||||
``<nsamples>``
|
||||
number of samples per channel (default: 512).
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``mpv --af=export=/tmp/mpv-af_export:1024 media.avi``
|
||||
Would export 1024 samples per channel to ``/tmp/mpv-af_export``.
|
||||
|
||||
``extrastereo[=mul]``
|
||||
(Linearly) increases the difference between left and right channels which
|
||||
adds some sort of "live" effect to playback.
|
||||
|
||||
``<mul>``
|
||||
Sets the difference coefficient (default: 2.5). 0.0 means mono sound
|
||||
(average of both channels), with 1.0 sound will be unchanged, with
|
||||
-1.0 left and right channels will be swapped.
|
||||
|
||||
``drc[=method:target]``
|
||||
Applies dynamic range compression. This maximizes the volume by compressing
|
||||
the audio signal's dynamic range.
|
||||
|
||||
``<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.
|
||||
|
||||
``ladspa=file:label[:controls...]``
|
||||
Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin. This
|
||||
filter is reentrant, so multiple LADSPA plugins can be used at once.
|
||||
|
||||
``<file>``
|
||||
Specifies the LADSPA plugin library file.
|
||||
|
||||
.. note::
|
||||
|
||||
See also the note about the ``LADSPA_PATH`` variable in the
|
||||
`ENVIRONMENT VARIABLES`_ section.
|
||||
``<label>``
|
||||
Specifies the filter within the library. Some libraries contain only
|
||||
one filter, but others contain many of them. Entering 'help' here
|
||||
will list all available filters within the specified library, which
|
||||
eliminates the use of 'listplugins' from the LADSPA SDK.
|
||||
``<controls>``
|
||||
Controls are zero or more floating point values that determine the
|
||||
behavior of the loaded plugin (for example delay, threshold or gain).
|
||||
In verbose mode (add ``-v`` to the mpv command line), all
|
||||
available controls and their valid ranges are printed. This eliminates
|
||||
the use of 'analyseplugin' from the LADSPA SDK.
|
||||
|
||||
``karaoke``
|
||||
Simple voice removal filter exploiting the fact that voice is usually
|
||||
recorded with mono gear and later 'center' mixed onto the final audio
|
||||
stream. Beware that this filter will turn your signal into mono. Works
|
||||
well for 2 channel tracks; do not bother trying it on anything but 2
|
||||
channel stereo.
|
||||
|
||||
``scaletempo[=option1:option2:...]``
|
||||
Scales audio tempo without altering pitch, optionally synced to playback
|
||||
speed (default).
|
||||
|
||||
This works by playing 'stride' ms of audio at normal speed then consuming
|
||||
'stride*scale' ms of input audio. It pieces the strides together by
|
||||
blending 'overlap'% of stride with audio following the previous stride. It
|
||||
optionally performs a short statistical analysis on the next 'search' ms
|
||||
of audio to determine the best overlap position.
|
||||
|
||||
``scale=<amount>``
|
||||
Nominal amount to scale tempo. Scales this amount in addition to
|
||||
speed. (default: 1.0)
|
||||
``stride=<amount>``
|
||||
Length in milliseconds to output each stride. Too high of a value will
|
||||
cause noticeable skips at high scale amounts and an echo at low scale
|
||||
amounts. Very low values will alter pitch. Increasing improves
|
||||
performance. (default: 60)
|
||||
``overlap=<percent>``
|
||||
Percentage of stride to overlap. Decreasing improves performance.
|
||||
(default: .20)
|
||||
``search=<amount>``
|
||||
Length in milliseconds to search for best overlap position. Decreasing
|
||||
improves performance greatly. On slow systems, you will probably want
|
||||
to set this very low. (default: 14)
|
||||
``speed=<tempo|pitch|both|none>``
|
||||
Set response to speed change.
|
||||
|
||||
tempo
|
||||
Scale tempo in sync with speed (default).
|
||||
pitch
|
||||
Reverses effect of filter. Scales pitch without altering tempo.
|
||||
Add ``[ speed_mult 0.9438743126816935`` and ``] speed_mult
|
||||
1.059463094352953`` to your ``input.conf`` to step by musical
|
||||
semi-tones.
|
||||
|
||||
.. warning::
|
||||
|
||||
Loses sync with video.
|
||||
both
|
||||
Scale both tempo and pitch.
|
||||
none
|
||||
Ignore speed changes.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --af=scaletempo --speed=1.2 media.ogg``
|
||||
Would play media at 1.2x normal speed, with audio at normal
|
||||
pitch. Changing playback speed would change audio tempo to match.
|
||||
|
||||
``mpv --af=scaletempo=scale=1.2:speed=none --speed=1.2 media.ogg``
|
||||
Would play media at 1.2x normal speed, with audio at normal
|
||||
pitch, but changing playback speed would have no effect on audio
|
||||
tempo.
|
||||
|
||||
``mpv --af=scaletempo=stride=30:overlap=.50:search=10 media.ogg``
|
||||
Would tweak the quality and performace parameters.
|
||||
|
||||
``mpv --af=format=floatne,scaletempo media.ogg``
|
||||
Would make scaletempo use float code. Maybe faster on some
|
||||
platforms.
|
||||
|
||||
``mpv --af=scaletempo=scale=1.2:speed=pitch audio.ogg``
|
||||
Would play media at 1.2x normal speed, with audio at normal pitch.
|
||||
Changing playback speed would change pitch, leaving audio tempo at
|
||||
1.2x.
|
||||
|
||||
``lavfi=graph``
|
||||
Filter audio using ffmpeg's libavfilter.
|
||||
|
||||
``<graph>``
|
||||
Libavfilter graph. See ``lavfi`` video filter for details - the graph
|
||||
syntax is the same.
|
||||
|
||||
.. warning::
|
||||
|
||||
Don't forget to quote libavfilter graphs as described in the lavfi
|
||||
video filter section.
|
||||
|
||||
``o=<string>``
|
||||
AVOptions.
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
AUDIO OUTPUT DRIVERS
|
||||
====================
|
||||
|
||||
Audio output drivers are interfaces to different audio output facilities. The
|
||||
syntax is:
|
||||
|
||||
``--ao=<driver1[:suboption1[=value]:...],driver2,...[,]>``
|
||||
Specify a priority list of audio output drivers to be used.
|
||||
|
||||
If the list has a trailing ',', mpv will fall back on drivers not contained
|
||||
in the list. Suboptions are optional and can mostly be omitted.
|
||||
|
||||
.. note::
|
||||
|
||||
See ``--ao=help`` for a list of compiled-in audio output drivers.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
- ``--ao=alsa,oss,`` Try the ALSA driver, then the OSS driver, then others.
|
||||
- ``--ao=alsa:noblock:device=[hw:0,3]`` Sets noblock-mode and the
|
||||
device-name as first card, fourth device.
|
||||
|
||||
Available audio output drivers are:
|
||||
|
||||
``alsa`` (Linux only)
|
||||
ALSA 0.9/1.x audio output driver
|
||||
|
||||
``no-block``
|
||||
Sets noblock-mode.
|
||||
``device=<device>``
|
||||
Sets the device name. For ac3 output via S/PDIF, use an "iec958" or
|
||||
"spdif" device, unless you really know how to set it correctly.
|
||||
``mixer-device=<device>``
|
||||
Set the mixer device used with ``--no-softvol`` (default: ``default``).
|
||||
``mixer-name=<name>``
|
||||
Set the name of the mixer element (default: ``Master``). This is for
|
||||
example ``PCM`` or ``Master``.
|
||||
``mixer-index=<number>``
|
||||
Set the index of the mixer channel (default: 0). Consider the output
|
||||
"``amixer scontrols``", then the index is the number that follows the
|
||||
name of the element.
|
||||
|
||||
.. note::
|
||||
|
||||
MPlayer and mplayer2 required you to replace any ',' with '.' and
|
||||
any ':' with '=' in the ALSA device name. mpv does not do this anymore.
|
||||
Instead, quote the device name:
|
||||
|
||||
``--ao=alsa:device=[plug:surround50]``
|
||||
|
||||
Note that the ``[`` and ``]`` simply quote the device name. With some
|
||||
shells (like zsh), you have to quote the option string to prevent the
|
||||
shell from interpreting the brackets instead of passing them to mpv.
|
||||
|
||||
``oss``
|
||||
OSS audio output driver
|
||||
|
||||
``<dsp-device>``
|
||||
Sets the audio output device (default: ``/dev/dsp``).
|
||||
``<mixer-device>``
|
||||
Sets the audio mixer device (default: ``/dev/mixer``).
|
||||
``<mixer-channel>``
|
||||
Sets the audio mixer channel (default: ``pcm``). Other valid values
|
||||
include **vol, pcm, line**. For a complete list of options look for
|
||||
``SOUND_DEVICE_NAMES`` in ``/usr/include/linux/soundcard.h``.
|
||||
|
||||
``jack``
|
||||
JACK (Jack Audio Connection Kit) audio output driver
|
||||
|
||||
``port=<name>``
|
||||
Connects to the ports with the given name (default: physical ports).
|
||||
``name=<client>``
|
||||
Client name that is passed to JACK (default: ``mpv``). Useful
|
||||
if you want to have certain connections established automatically.
|
||||
``(no-)estimate``
|
||||
Estimate the audio delay, supposed to make the video playback smoother
|
||||
(default: enabled).
|
||||
``(no-)autostart``
|
||||
Automatically start jackd if necessary (default: disabled). Note that
|
||||
this tends to be unreliable and will flood stdout with server messages.
|
||||
``(no-)connect``
|
||||
Automatically create connections to output ports (default: enabled).
|
||||
When enabled, the maximum number of output channels will be limited to
|
||||
the number of available output ports.
|
||||
``std-channel-layout=alsa|waveext|any``
|
||||
Select the standard channel layout (default: alsa). JACK itself has no
|
||||
notion of channel layouts (i.e. assigning which speaker a given
|
||||
channel is supposed to map to) - it just takes whatever the application
|
||||
outputs, and reroutes it to whatever the user defines. This means the
|
||||
user and the application are in charge of dealing with the channel
|
||||
layout. ``alsa`` uses the old MPlayer layout, which is inspired by
|
||||
ALSA's standard layouts. In this mode, ao_jack will refuse to play 3
|
||||
or 7 channels (because these do not really have a defined meaning in
|
||||
MPlayer). ``waveext`` uses WAVE_FORMAT_EXTENSIBLE order, which, even
|
||||
though it was defined by Microsoft, is the standard on many systems.
|
||||
The value ``any`` makes JACK accept whatever comes from the audio
|
||||
filter chain, regardless of channel layout and without reordering. This
|
||||
mode is probably not very useful, other than for debugging or when used
|
||||
with fixed setups.
|
||||
|
||||
``coreaudio`` (Mac OS X only)
|
||||
Native Mac OS X audio output driver
|
||||
|
||||
``device_id=<id>``
|
||||
ID of output device to use (0 = default device)
|
||||
``help``
|
||||
List all available output devices with their IDs.
|
||||
|
||||
``openal``
|
||||
Experimental OpenAL audio output driver
|
||||
|
||||
``pulse``
|
||||
PulseAudio audio output driver
|
||||
|
||||
``[<host>][:<output 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).
|
||||
|
||||
``portaudio``
|
||||
PortAudio audio output driver. This works on all platforms, and has
|
||||
extensive MS Windows support.
|
||||
|
||||
``device``
|
||||
Specify the subdevice to use. Giving ``help`` as device name lists all
|
||||
devices found by PortAudio. Devices can be given as numeric values,
|
||||
starting from ``1``.
|
||||
|
||||
``dsound`` (Windows only)
|
||||
DirectX DirectSound audio output driver
|
||||
|
||||
``device=<devicenum>``
|
||||
Sets the device number to use. Playing a file with ``-v`` will show a
|
||||
list of available devices.
|
||||
|
||||
``sdl``
|
||||
SDL 1.2+ audio output driver. Should work on any platform supported by SDL
|
||||
1.2, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
|
||||
appropriately for your system.
|
||||
|
||||
``buflen=<length>``
|
||||
Sets the audio buffer length in seconds. Is used only as a hint by the
|
||||
sound system. Playing a file with ``-v`` will show the requested and
|
||||
obtained exact buffer size. A value of 0 selects the sound system
|
||||
default.
|
||||
|
||||
``bufcnt=<count>``
|
||||
Sets the number of extra audio buffers in mpv. Usually needs not be
|
||||
changed.
|
||||
|
||||
``null``
|
||||
Produces no audio output but maintains video playback speed. Use
|
||||
``--no-audio`` for benchmarking.
|
||||
|
||||
``pcm``
|
||||
Raw PCM/WAVE file writer audio output
|
||||
|
||||
``(no-)waveheader``
|
||||
Include or do not include the WAVE header (default: included). When
|
||||
not included, raw PCM will be generated.
|
||||
``file=<filename>``
|
||||
Write the sound to ``<filename>`` instead of the default
|
||||
``audiodump.wav``. If ``no-waveheader`` is specified, the default is
|
||||
``audiodump.pcm``.
|
||||
|
||||
``rsound``
|
||||
Audio output to an RSound daemon
|
||||
|
||||
``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 '/'.
|
||||
``port=<number>``
|
||||
Set the TCP port used for connecting to the server (default: 12345).
|
||||
Not used if connecting to a Unix domain socket.
|
||||
|
||||
``wasapi``
|
||||
Audio output to the Windows Audio Session API.
|
||||
|
||||
``device=<id>``
|
||||
Uses the requested endpoint instead of the system's default audio
|
||||
endpoint. Both the number and the ID String are valid; the ID String
|
||||
is guaranteed to not change unless the driver is uninstalled.
|
||||
|
||||
Also supports searching active devices by name. If more than one
|
||||
device matches the name, refuses loading it.
|
||||
|
||||
To get a list of the valid devices, give ``help`` as the id. The
|
||||
list is the same as the ``list`` suboption, but stops the player
|
||||
initialization.
|
||||
``exclusive``
|
||||
Requests exclusive, direct hardware access. By definition prevents
|
||||
sound playback of any other program until mpv exits.
|
||||
``list``
|
||||
Lists all audio endpoints (output devices) present in the system.
|
||||
@@ -0,0 +1,273 @@
|
||||
CHANGES FROM OTHER VERSIONS OF 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. Some changes are incompatible, or completely change how the
|
||||
player behaves.
|
||||
|
||||
General Changes for MPlayer to mplayer2
|
||||
---------------------------------------
|
||||
|
||||
* Removal of the internal GUI, MEncoder, OSD menu
|
||||
* Better pause handling (do not unpause on a command)
|
||||
* Better MKV support (such as ordered chapters)
|
||||
* vo_vdpau improvements
|
||||
* Precise seeking support
|
||||
* No embedded copy of ffmpeg and other libraries
|
||||
* Native OpenGL backend for OSX
|
||||
* General OSX improvements
|
||||
* Improvements in audio/video sync handling
|
||||
* Cleaned up terminal output
|
||||
* Gapless audio support (``--gapless-audio``)
|
||||
* Improved responsiveness on user input
|
||||
* Support for modifier keys (alt, shift, ctrl) in input.conf
|
||||
* OSS4 volume control
|
||||
* More correct color reproduction (color matrix generation)
|
||||
* Use libass for subtitle rendering by default (better quality)
|
||||
* Generally preferring ffmpeg/libav over internal demuxers and decoders
|
||||
* Improvements when playing multiple files (``--fixed-vo``)
|
||||
* Screenshot improvements (instant screenshots without 1-frame delay, allow
|
||||
taking screenshots even with hardware decoding)
|
||||
* Improved support for PulseAudio
|
||||
* General code cleanups
|
||||
* Many more changes
|
||||
|
||||
General Changes for mplayer2 to mpv
|
||||
-----------------------------------
|
||||
|
||||
* Removal of lots of unneeded code to encourage developer activity (less
|
||||
obscure scary zombie code that kills any desire for hacking the codebase)
|
||||
* Removal of dust and dead bodies (code-wise), such as kernel drivers for
|
||||
decades old hardware
|
||||
* Removal of support for dead platforms
|
||||
* Generally improved MS Windows support (dealing with unicode filenames,
|
||||
improved ``--vo=direct3d``, improved window handling)
|
||||
* Better OSD rendering (using libass). This has full unicode support, and
|
||||
languages like Arabic should be better supported.
|
||||
* Cleaned up terminal output (nicer status line, less useless noise)
|
||||
* Support for playing URLs of popular streaming sites directly
|
||||
(e.g. ``mpv https://www.youtube.com/watch?v=...``)
|
||||
* Improved OpenGL output (``--vo=opengl-hq``)
|
||||
* Make ``--softvol`` default (**mpv** is not a mixer control panel)
|
||||
* Improved support for .cue files
|
||||
* Screenshot improvements (can save screenshots as JPG or PNG, configurable
|
||||
filenames, support for taking screenshots with or without subtitles - the
|
||||
``screenshot`` video filter is not needed anymore, and should not be put
|
||||
into the mpv config file)
|
||||
* Removal of teletext support
|
||||
* Removal of most builtin demuxers, using libavformat instead
|
||||
* Removal of builtin network support, using libavformat instead (also,
|
||||
support https via libavformat)
|
||||
* Replace image VOs (``--vo=jpeg`` etc.) with ``--vo=image``
|
||||
* Do not lose settings when playing a new file in the same player instance
|
||||
* New location for config files, new name for the binary.
|
||||
* Slave mode compatibility broken (see below)
|
||||
* Encoding functionality (replacement for mencoder, see ``DOCS/encoding.rst``)
|
||||
* Remove ``--vo=gif89a``, ``--vo=md5sum``, ``--vo=yuv4mpeg``, as encoding can
|
||||
handle these use cases. For yuv4mpeg, for example, use:
|
||||
``mpv input.mkv -o output.y4m --no-audio --oautofps --oneverdrop``.
|
||||
* Image subtitles (DVDs etc.) are rendered in color and use more correct
|
||||
positioning (color can be disabled with ``--sub-gray``)
|
||||
* Wayland support
|
||||
* Support for precise scrolling which scales the parameter of commands. If the
|
||||
input doesn't support precise scrolling the scale factor stays 1.
|
||||
* OSX: Cocoa event loop is independent from mplayer's event loop, so user
|
||||
actions like accessing menus and live resizing do not block the playback.
|
||||
* OSX: Apple Remote support.
|
||||
* OSX: Media Keys support.
|
||||
* Windows: Added WASAPI audio output.
|
||||
* New OSD bar with chapter marks and not positioned in the middle of the video
|
||||
(though this can be customized with the ``--osd-bar-align-y`` option).
|
||||
* Allow customizing whether a key binding for seeking shows the video time, the
|
||||
OSD bar, or nothing (see section `Input Command Prefixes`_).
|
||||
* Display list of chapters and audio/subtitle tracks on OSD (see section
|
||||
`Properties`_).
|
||||
* ``--keep-open`` option to stop the player from closing the window and
|
||||
exiting after playback ends.
|
||||
* Re-enable screensaver while the player is paused.
|
||||
* Matroska edition switching at runtime.
|
||||
* Support for libavfilter (for video->video and audio->audio). This allows
|
||||
using most of FFmpeg's filters, which improve greatly on the old MPlayer
|
||||
filters in features, performance, and correctness.
|
||||
* Improved downmixing and output of surround audio. Instead of using hardcoded
|
||||
pan filters to do remixing, use libavresample. Channel maps are used to
|
||||
identify the channel layout, so e.g. ``3.0`` and ``2.1`` audio can be
|
||||
distinguished.
|
||||
* Allow resuming playback at a later point with ``Shift+q``, also see
|
||||
``quit_watch_later`` input command.
|
||||
* Support mapping multiple commands to one key.
|
||||
* Allow changing/adjusting video filters at runtime. (This is also used to make
|
||||
the ``D`` key insert vf_yadif if deinterlacing is not supported otherwise.)
|
||||
* General bug fixes and removal of long-standing issues
|
||||
* General code cleanups (including refactoring or rewrites of many parts)
|
||||
* Many more changes
|
||||
|
||||
Detailed Listing of User-visible Changes
|
||||
----------------------------------------
|
||||
|
||||
This listing is about changed command line switches, slave commands, and similar
|
||||
things. Completely removed features are not listed.
|
||||
|
||||
Command Line Switches
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* There is a new command line syntax, which is generally preferred over the old
|
||||
syntax. ``-optname optvalue`` becomes ``--optname=optvalue``.
|
||||
|
||||
The old syntax will not be removed in the near future. However, the new
|
||||
syntax is mentioned in all documentation and so on, so it is a good thing to
|
||||
know about this change.
|
||||
|
||||
(The new syntax was introduced in mplayer2.)
|
||||
* In general, negating switches like ``-noopt`` now have to be written as
|
||||
``-no-opt``, or better ``--no-opt``.
|
||||
* Per-file options are not the default anymore. You can explicitly specify
|
||||
file-local options. See ``Usage`` section.
|
||||
* Table of renamed/replaced switches:
|
||||
|
||||
=========================== ========================================
|
||||
Old New
|
||||
=========================== ========================================
|
||||
``-no<opt>`` ``--no-<opt>`` (add a dash)
|
||||
``-nosound`` ``--no-audio``
|
||||
``-use-filename-title`` ``--title="${filename}"``
|
||||
``-loop 0`` ``--loop=inf``
|
||||
``-hardframedrop`` ``--framedrop=hard``
|
||||
``-osdlevel`` ``--osd-level``
|
||||
``-delay`` ``--audio-delay``
|
||||
``-subdelay`` ``--sub-delay``
|
||||
``-subpos`` ``--sub-pos``
|
||||
``-forcedsubsonly`` ``--sub-forced-only``
|
||||
``-benchmark`` ``--untimed`` (no stats)
|
||||
``-xineramascreen`` ``--screen`` (different values)
|
||||
``-ss`` ``--start``
|
||||
``-endpos`` ``--length``
|
||||
``--cursor-autohide-delay`` ``--cursor-autohide``
|
||||
``-sub-fuzziness`` ``--autosub-match``
|
||||
``-subfont`` ``--sub-text-font``
|
||||
``-font`` ``--osd-font``
|
||||
``-subfont-*`` ``--sub-text-*``, ``--osd-*``
|
||||
``-subfont-text-scale`` ``--sub-scale``
|
||||
``-spugauss`` ``--sub-gauss``
|
||||
``-vobsub`` ``--sub`` (pass the .idx file)
|
||||
``-ass-bottom-margin`` ``--vf=sub=bottom:top``
|
||||
``-vc ffh264vdpau`` (etc.) ``--hwdec=vdpau``
|
||||
``-ac spdifac3`` ``--ad=spdif:ac3`` (see ``--ad=help``)
|
||||
``-afm hwac3`` ``--ad=spdif:ac3,spdif:dts``
|
||||
``-x W``, ``-y H`` ``--geometry=WxH`` + ``--no-keepaspect``
|
||||
``-xy W`` ``--autofit=W``
|
||||
``-a52drc level`` ``--ad-lavc-ac3drc=level``
|
||||
``-dumpstream`` ``--stream-dump=<filename>``
|
||||
``-capture`` ``--stream-capture=<filename>``
|
||||
``-stop-xscreensaver`` ``--stop-screensaver``
|
||||
``-subfile`` ``--sub``
|
||||
``-lavdopts ...`` ``--vd-lavc-...``
|
||||
``-lavfdopts`` ``--demuxer-lavf-...``
|
||||
``-rawaudio ...`` ``--demuxer-rawaudio-...``
|
||||
``-rawvideo ...`` ``--demuxer-rawvideo-...``
|
||||
``--mixer`` AO suboptions (``alsa``, ``oss``)
|
||||
``--mixer-channel`` AO suboptions (``alsa``, ``oss``)
|
||||
``--ao=alsa:device=hw=0.3`` ``--ao=alsa:device=[hw:0,3]``
|
||||
=========================== ========================================
|
||||
|
||||
.. note::
|
||||
|
||||
``-opt val`` becomes ``--opt=val``.
|
||||
|
||||
input.conf and Slave Commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Table of renamed input commands:
|
||||
|
||||
This lists only commands that are not always gracefully handled by the
|
||||
internal legacy translation layer. If an input.conf contains any legacy
|
||||
commands, they will be displayed with ``-v`` when it is loaded, and show
|
||||
and the replacement commands.
|
||||
|
||||
Properties containing ``_`` to separate words use ``-`` instead.
|
||||
|
||||
+--------------------------------+----------------------------------------+
|
||||
| Old | New |
|
||||
+================================+========================================+
|
||||
| ``pt_step 1 [0|1]`` | ``playlist_next [weak|force]`` |
|
||||
| | (translation layer cannot deal with |
|
||||
| | whitespace) |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``pt_step -1 [0|1]`` | ``playlist_prev [weak|force] (same)`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``switch_ratio [<ratio>]`` | ``set aspect <ratio>`` |
|
||||
| | |
|
||||
| | ``set aspect 0`` (to reset aspect) |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``step_property_osd <prop>`` | ``cycle <prop> <step>`` (wraps), |
|
||||
| ``<step> <dir>`` | ``add <prop> <step>`` (clamps). |
|
||||
| | ``<dir>`` parameter unsupported. Use |
|
||||
| | a negative ``<step>`` instead. |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``step_property <prop>`` | Prefix ``cycle`` or ``add`` with |
|
||||
| ``<step> <dir>`` | ``no-osd``: ``no-osd cycle <prop>`` |
|
||||
| | ``<step>`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``osd_show_property_text`` | ``show_text <text>`` |
|
||||
| ``<text>`` | The property expansion format string |
|
||||
| | syntax slightly changed. |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``osd_show_text`` | Now does the same as |
|
||||
| | ``osd_show_property_text``. Use the |
|
||||
| | ``raw`` prefix to disable property |
|
||||
| | expansion. |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``show_tracks`` | ``show_text ${track-list}`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``show_chapters`` | ``show_text ${chapter-list}`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``af_switch``, ``af_add``, ... | ``af [set|add|...]`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
|
||||
Other
|
||||
~~~~~
|
||||
|
||||
* The playtree has been removed. **mpv**'s internal playlist is a simple and
|
||||
flat list now. This simplifies the code and makes **mpv** usage less
|
||||
confusing.
|
||||
* Slave mode is broken. This mode is entirely insane in the ``old`` versions of
|
||||
MPlayer. A proper slave mode application needed tons of code and hacks to get
|
||||
it right. The main problem is that slave mode is a bad and incomplete
|
||||
interface, and to get around that, applications parsed output messages
|
||||
intended for users. It is hard to know which messages exactly are parsed by
|
||||
slave mode applications. This makes it virtually impossible to improve
|
||||
terminal output intended for users without possibly breaking something.
|
||||
|
||||
This is absolutely insane, and **mpv** will not try to keep slave mode
|
||||
compatible. If you are a developer of a slave mode application, contact us,
|
||||
and a new and better protocol can be developed.
|
||||
|
||||
Policy for Removed Features
|
||||
---------------------------
|
||||
|
||||
Features are a good thing, because they make users happy. As such, it is
|
||||
attempted to preserve useful features as far as possible. But if a feature is
|
||||
likely to be not used by many, and causes problems otherwise, it will be
|
||||
removed. Developers should not be burdened with fixing or cleaning up code that
|
||||
has no actual use.
|
||||
|
||||
It is always possible to add back removed features. File a feature request if a
|
||||
feature you relied on has been removed, and you want it back. Though it might be
|
||||
rejected in the worst case, it is much more likely that it will be either added
|
||||
back, or that a better solution will be implemented.
|
||||
|
||||
Why this Fork?
|
||||
--------------
|
||||
|
||||
* MPlayer wants to maintain old code, even if it is very bad code. It seems
|
||||
mplayer2 was forked because MPlayer developers refused to get rid of all the
|
||||
cruft. The mplayer2 and MPlayer codebases also deviated enough to make a
|
||||
reunification unlikely.
|
||||
* mplayer2 development is slow, and it is hard to get in changes. Details
|
||||
withheld as to not turn this into a rant.
|
||||
* MPlayer rarely merged from mplayer2, and mplayer2 practically stopped
|
||||
merging from MPlayer (not even code cleanups or new features are merged)
|
||||
* **mpv** intends to continuously merge from mplayer-svn and mplayer2, while
|
||||
speeding up development. There is willingness for significant changes, even
|
||||
if this means breaking compatibility.
|
||||
@@ -3,7 +3,7 @@ ENCODING
|
||||
|
||||
You can encode files from one format/codec to another using this facility.
|
||||
|
||||
``--o=<filename>``
|
||||
``-o <filename>``
|
||||
Enables encoding mode and specifies the output file name.
|
||||
|
||||
``--of=<format>``
|
||||
@@ -38,7 +38,7 @@ You can encode files from one format/codec to another using this facility.
|
||||
|
||||
``--oautofps``
|
||||
Sets the output format time base to the guessed frame rate of the input
|
||||
video (simulates MEncoder behavior, useful for AVI; may cause frame drops).
|
||||
video (simulates mencoder behavior, useful for AVI; may cause frame drops).
|
||||
Note that not all codecs and not all formats support VFR encoding, and some
|
||||
which do have bugs when a target bitrate is specified - use ``--ofps`` or
|
||||
``--oautofps`` to force CFR encoding in these cases.
|
||||
@@ -74,7 +74,7 @@ You can encode files from one format/codec to another using this facility.
|
||||
.. admonition:: Example
|
||||
|
||||
"``--oac=libmp3lame --oacopts=b=128000``"
|
||||
selects 128 kbps MP3 encoding.
|
||||
selects 128kbps MP3 encoding.
|
||||
|
||||
Options are managed in lists. There are a few commands to manage the
|
||||
options list.
|
||||
@@ -111,7 +111,7 @@ You can encode files from one format/codec to another using this facility.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``"--ovc=mpeg4 --ovcopts=qscale=5"``
|
||||
``"--ovc=mpeg4 --oacopts=qscale=5"``
|
||||
selects constant quantizer scale 5 for MPEG-4 encoding.
|
||||
|
||||
``"--ovc=libx264 --ovcopts=crf=23"``
|
||||
@@ -149,7 +149,3 @@ You can encode files from one format/codec to another using this facility.
|
||||
container formats, e.g. AVI). In this mode, discontinuities are not fixed
|
||||
and all pts are passed through as-is. Never seek backwards or use multiple
|
||||
input files in this mode!
|
||||
|
||||
``--no-ometadata``
|
||||
Turns off copying of metadata from input files to output files when
|
||||
encoding (which is enabled by default).
|
||||
@@ -0,0 +1,547 @@
|
||||
INPUT.CONF
|
||||
==========
|
||||
|
||||
The input.conf file consists of a list of key bindings, for example::
|
||||
|
||||
s screenshot # take a screenshot with the s key
|
||||
|
||||
Each line maps a key to an input command. Keys are specified with their literal
|
||||
value (upper case if combined with ``Shift``), or a name for special keys. For
|
||||
example, ``a`` maps to the ``a`` key without shift, and ``A`` maps to ``a``
|
||||
with shift.
|
||||
|
||||
A list of special keys can be obtained with
|
||||
|
||||
``mpv --input-keylist``
|
||||
|
||||
In general, keys can be combined with ``Shift``, ``Ctrl`` and ``Alt``::
|
||||
|
||||
ctrl+q quit
|
||||
|
||||
**mpv** can be started in input test mode, which displays key bindings and the
|
||||
commands they're bound to on the OSD, instead of executing the commands::
|
||||
|
||||
mpv --input-test --demuxer=rawvideo --demuxer-rawvideo=w=1280:h=720 /dev/zero
|
||||
|
||||
(Commands which normally close the player will not work in this mode, and you
|
||||
must kill **mpv** externally to make it exit.)
|
||||
|
||||
General Input Command Syntax
|
||||
----------------------------
|
||||
|
||||
``[Shift+][Ctrl+][Alt+][Meta+]<key> [{<section>}] [<prefixes>] <command> (<argument>)* [; <command>]``
|
||||
|
||||
Newlines always start a new binding. ``#`` starts a comment (outside of quoted
|
||||
string arguments). To bind commands to the ``#`` key, ``SHARP`` can be used.
|
||||
|
||||
``<key>`` is either the literal character the key produces (ASCII or Unicode
|
||||
character), or a symbol name.
|
||||
|
||||
``<section>`` (braced with ``{`` and ``}``) is the input section for this
|
||||
command.
|
||||
|
||||
Arguments are separated by whitespace. This applies even to string arguments.
|
||||
For this reason, string arguments should be quoted with ``"``. Inside quotes,
|
||||
C-style escaping can be used.
|
||||
|
||||
Optional arguments can be skipped with ``-``.
|
||||
|
||||
You can bind multiple commands to one key. For example:
|
||||
|
||||
| a show_text "command 1" ; show_text "command 2"
|
||||
|
||||
Note that some magic is disabled for keys: seek commands inside lists are not
|
||||
coalesced (seeking will appear slower), and no check is done for abort commands
|
||||
(so these commands can't be used to abort playback if the network cache is
|
||||
stuck).
|
||||
|
||||
List of Input Commands
|
||||
----------------------
|
||||
|
||||
``ignore``
|
||||
Use this to "block" keys that should be unbound, and do nothing. Useful for
|
||||
disabling default bindings, without disabling all bindings with
|
||||
``--no-input-default-bindings``.
|
||||
|
||||
``seek <seconds> [relative|absolute|absolute-percent|- [default-precise|exact|keyframes]]``
|
||||
Change the playback position. By default, seeks by a relative amount of
|
||||
seconds.
|
||||
|
||||
The second argument sets the seek mode:
|
||||
|
||||
relative (default)
|
||||
Seek relative to current position (a negative value seeks backwards).
|
||||
absolute
|
||||
Seek to a given time.
|
||||
absolute-percent
|
||||
Seek to a given percent position.
|
||||
|
||||
The third argument defines how exact the seek is:
|
||||
|
||||
default-precise (default)
|
||||
Follow the default behavior as set by ``--hr-seek``, which by default
|
||||
does imprecise seeks (like ``keyframes``).
|
||||
exact
|
||||
Always do exact/hr/precise seeks (slow).
|
||||
keyframes
|
||||
Always restart playback at keyframe boundaries (fast).
|
||||
|
||||
``frame_step``
|
||||
Play one frame, then pause.
|
||||
|
||||
``frame_back_step``
|
||||
Go back by one frame, then pause. Note that this can be very slow (it tries
|
||||
to be precise, not fast), and sometimes fails to behave as expected. How
|
||||
well this works depends on whether precise seeking works correctly (e.g.
|
||||
see the ``--hr-seek-demuxer-offset`` option). Video filters or other video
|
||||
postprocessing that modifies timing of frames (e.g. deinterlacing) should
|
||||
usually work, but might make backstepping silently behave incorrectly in
|
||||
corner cases.
|
||||
|
||||
This does not work with audio-only playback.
|
||||
|
||||
``set <property> "<value>"``
|
||||
Set the given property to the given value.
|
||||
|
||||
``add <property> [<value>]``
|
||||
Add the given value to the property. On overflow or underflow, clamp the
|
||||
property to the maximum. If ``<value>`` is omitted, assume ``1``.
|
||||
|
||||
``cycle <property> [up|down]``
|
||||
Cycle the given property. ``up`` and ``down`` set the cycle direction. On
|
||||
overflow, set the property back to the minimum, on underflow set it to the
|
||||
maximum. If ``up`` or ``down`` is omitted, assume ``up``.
|
||||
|
||||
``speed_mult <value>``
|
||||
Multiply the ``speed`` property by the given value.
|
||||
|
||||
``screenshot [subtitles|video|window|- [single|each-frame]]``
|
||||
Take a screenshot.
|
||||
|
||||
First argument:
|
||||
|
||||
<subtitles> (default)
|
||||
Save the video image, in its original resolution, and with subtitles.
|
||||
Some video outputs may still include the OSD in the output under certain
|
||||
circumstances.
|
||||
<video>
|
||||
Like ``subtitles``, but typically without OSD or subtitles. The exact
|
||||
behavior depends on the selected video output.
|
||||
<window>
|
||||
Save the contents of the mpv window. Typically scaled, with OSD and
|
||||
subtitles. The exact behavior depends on the selected video output, and
|
||||
if no support is available, this will act like ``video``.
|
||||
|
||||
Second argument:
|
||||
|
||||
<single> (default)
|
||||
Take a single screenshot.
|
||||
<each-frame>
|
||||
Take a screenshot each frame. Issue this command again to stop taking
|
||||
screenshots.
|
||||
|
||||
``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
|
||||
behavior when the extension is missing or unknown is arbitrary).
|
||||
|
||||
The second argument is like the first argument to ``screenshot``.
|
||||
|
||||
This command tries to never overwrite files. If the file already exists,
|
||||
it fails.
|
||||
|
||||
Like all input command parameters, the filename is subject to property
|
||||
expansion as described in `Property Expansion`_.
|
||||
|
||||
``playlist_next [weak|force]``
|
||||
Go to the next entry on the playlist.
|
||||
|
||||
weak (default)
|
||||
If the last file on the playlist is currently played, do nothing.
|
||||
force
|
||||
Terminate playback if there are no more files on the playlist.
|
||||
|
||||
``playlist_prev [weak|force]``
|
||||
Go to the previous entry on the playlist.
|
||||
|
||||
weak (default)
|
||||
If the first file on the playlist is currently played, do nothing.
|
||||
force
|
||||
Terminate playback if the first file is being played.
|
||||
|
||||
``loadfile "<file>" [replace|append]``
|
||||
Load the given file and play it.
|
||||
|
||||
Second argument:
|
||||
|
||||
<replace> (default)
|
||||
Stop playback of the current file, and play the new file immediately.
|
||||
<append>
|
||||
Append the file to the playlist.
|
||||
|
||||
``loadlist "<playlist>" [replace|append]``
|
||||
Load the given playlist file (like ``--playlist``).
|
||||
|
||||
``playlist_clear``
|
||||
Clear the playlist, except the currently played file.
|
||||
|
||||
``playlist_remove <index>``
|
||||
Remove the playlist entry at the given index. Index values start counting
|
||||
with 0. You cannot remove the entry for the currently played file.
|
||||
|
||||
``playlist_move <index1> <index2>``
|
||||
Move the playlist entry at index1, so that it takes the place of the
|
||||
entry index2. (Paradoxically, the moved playlist entry will not have
|
||||
the index value index2 after moving if index1 was lower than index2,
|
||||
because index2 refers to the target entry, not the index the entry
|
||||
will have after moving.)
|
||||
|
||||
``run "<command>"``
|
||||
Run the given command with ``/bin/sh -c``. The string is expanded like in
|
||||
`Property Expansion`_.
|
||||
|
||||
``quit [<code>]``
|
||||
Exit the player using the given exit code.
|
||||
|
||||
``quit_watch_later``
|
||||
Exit player, and store current playback position. Playing that file later
|
||||
will seek to the previous position on start.
|
||||
|
||||
``sub_add "<file>"``
|
||||
Load the given subtitle file. It is not selected as current subtitle after
|
||||
loading.
|
||||
|
||||
``sub_remove [<id>]``
|
||||
Remove the given subtitle track. If the ``id`` argument is missing, remove
|
||||
the current track. (Works on external subtitle files only.)
|
||||
|
||||
``sub_reload [<id>]``
|
||||
Reload the given subtitle tracks. If the ``id`` argument is missing, remove
|
||||
the current track. (Works on external subtitle files only.)
|
||||
|
||||
This works by unloading and re-adding the subtitle track.
|
||||
|
||||
``sub_step <skip>``
|
||||
Change subtitle timing such, that the subtitle event after the next
|
||||
``<skip>`` subtitle events is displayed. ``<skip>`` can be negative to step
|
||||
backwards.
|
||||
|
||||
``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`_).
|
||||
|
||||
``show_text "<string>" [<duration>|- [<level>]]``
|
||||
Show text on the OSD. The string can contain properties, which are expanded
|
||||
as described in `Property Expansion`_. This can be used to show playback
|
||||
time, filename, and so on.
|
||||
|
||||
<duration>
|
||||
The time in ms to show the message for. By default, it uses the same
|
||||
value as ``--osd-duration``.
|
||||
|
||||
<level>
|
||||
The minimum OSD level to show the text at (see ``--osd-level``).
|
||||
|
||||
``show_progress``
|
||||
Show the progress bar, the elapsed time and the total duration of the file
|
||||
on the OSD.
|
||||
|
||||
Input Commands that are Possibly Subject to Change
|
||||
--------------------------------------------------
|
||||
|
||||
``af set|add|toggle|del|clr "filter1=params,filter2,..."``
|
||||
Change audio filter chain. See ``vf`` command.
|
||||
|
||||
``vf set|add|toggle|del|clr "filter1=params,filter2,..."``
|
||||
Change video filter chain.
|
||||
|
||||
The first argument decides what happens:
|
||||
|
||||
set
|
||||
Overwrite the previous filter chain with the new one.
|
||||
|
||||
add
|
||||
Append the new filter chain to the previous one.
|
||||
|
||||
toggle
|
||||
Check if the given filter (with the exact parameters) is already
|
||||
in the video chain. If yes, remove the filter. If no, add the filter.
|
||||
(If several filters are passed to the command, this is done for
|
||||
each filter.)
|
||||
|
||||
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
|
||||
or integer indexes. ``0`` would denote the first filter. Negative
|
||||
indexes start from the last filter, and ``-1`` denotes the last
|
||||
filter.
|
||||
|
||||
clr
|
||||
Remove all filters. Note that like the other sub-commands, this does
|
||||
not control automatically inserted filters.
|
||||
|
||||
You can assign labels to filter by prefixing them with ``@name:`` (where
|
||||
``name`` is a user-chosen arbitrary identifier). Labels can be used to
|
||||
refer to filters by name in all of the filter chain modification commands.
|
||||
For ``add``, using an already used label will replace the existing filter.
|
||||
|
||||
The ``vf`` command shows the list of requested filters on the OSD after
|
||||
changing the filter chain. This is roughly equivalent to
|
||||
``show_text ${vf}``. Note that auto-inserted filters for format conversion
|
||||
are not shown on the list, only what was requested by the user.
|
||||
|
||||
.. admonition:: Example for input.conf
|
||||
|
||||
- ``a vf set flip`` turn video upside-down on the ``a`` key
|
||||
- ``b vf set ""`` remove all video filters on ``b``
|
||||
- ``c vf toggle lavfi=gradfun`` toggle debanding on ``c``
|
||||
|
||||
``enable_section "<section>" [default|exclusive]``
|
||||
Enable all key bindings in the named input section.
|
||||
|
||||
The enabled input sections form a stack. Bindings in sections on the top of
|
||||
the stack are preferred to lower sections. This command puts the section
|
||||
on top of the stack. If the section was already on the stack, it is
|
||||
implicitly removed beforehand. (A section cannot be on the stack more than
|
||||
once.)
|
||||
|
||||
If ``exclusive`` is specified as second argument, all sections below the
|
||||
newly enabled section are disabled. They will be re-enabled as soon as
|
||||
all exclusive sections above them are removed.
|
||||
|
||||
``disable_section "<section>"``
|
||||
Disable the named input section. Undoes ``enable_section``.
|
||||
|
||||
Undocumented commands: ``tv_start_scan``, ``tv_step_channel``, ``tv_step_norm``,
|
||||
``tv_step_chanlist``, ``tv_set_channel``, ``tv_last_channel``, ``tv_set_freq``,
|
||||
``tv_step_freq``, ``tv_set_norm``, ``dvb_set_channel``, ``radio_step_channel``,
|
||||
``radio_set_channel``, ``radio_set_freq``, ``radio_step_freq`` (all of these
|
||||
should be replaced by properties), ``stop`` (questionable use), ``get_property``
|
||||
(?), ``vo_cmdline`` (experimental).
|
||||
|
||||
Input Command Prefixes
|
||||
----------------------
|
||||
|
||||
``osd-auto`` (default)
|
||||
Use the default behavior for this command.
|
||||
``no-osd``
|
||||
Do not use any OSD for this command.
|
||||
``osd-bar``
|
||||
If possible, show a bar with this command. Seek commands will show the
|
||||
progress bar, property changing commands may show the newly set value.
|
||||
``osd-msg``
|
||||
If possible, show an OSD message with this command. Seek command show
|
||||
the current playback time, property changing commands show the newly set
|
||||
value as text.
|
||||
``osd-msg-bar``
|
||||
Combine osd-bar and osd-msg.
|
||||
``raw``
|
||||
Do not expand properties in string arguments. (Like ``"${property-name}"``.)
|
||||
``expand-properties`` (default)
|
||||
All string arguments are expanded as described in `Property Expansion`_.
|
||||
|
||||
|
||||
All of the osd prefixes are still overridden by the global ``--osd-level``
|
||||
settings.
|
||||
|
||||
Undocumented prefixes: ``pausing``, ``pausing_keep``, ``pausing_toggle``,
|
||||
``pausing_keep_force``. (Should these be made official?)
|
||||
|
||||
Input Sections
|
||||
--------------
|
||||
|
||||
Input sections group a set of bindings, and enable or disable them at once.
|
||||
In ``input.conf``, each key binding is assigned to an input section, rather
|
||||
than actually having explicit text sections.
|
||||
|
||||
Also see ``enable_section`` and ``disable_section`` commands.
|
||||
|
||||
Predefined bindings:
|
||||
|
||||
``default``
|
||||
Bindings without input section are implicitly assigned to this section. It
|
||||
is enabled by default during normal playback.
|
||||
``encode``
|
||||
Section which is active in encoding mode. It is enabled exclusively, so
|
||||
that bindings in the ``default`` sections are ignored.
|
||||
|
||||
Properties
|
||||
----------
|
||||
|
||||
Properties are used to set mpv options during runtime, or to query arbitrary
|
||||
information. They can be manipulated with the ``set``/``add``/``cycle``
|
||||
commands, and retrieved with ``show_text``, or anything else that uses property
|
||||
expansion. (See `Property Expansion`_.)
|
||||
|
||||
The ``W`` column indicates whether the property is generally writable. If an
|
||||
option is referenced, the property should take/return exactly the same values
|
||||
as the option.
|
||||
|
||||
=============================== = ==================================================
|
||||
Name W Comment
|
||||
=============================== = ==================================================
|
||||
``osd-level`` x see ``--osd-level``
|
||||
``osd-scale`` x osd font size multiplicator, see ``--osd-scale``
|
||||
``loop`` x see ``--loop``
|
||||
``speed`` x see ``--speed``
|
||||
``filename`` currently played file (path stripped)
|
||||
``path`` currently played file (full path)
|
||||
``media-title`` filename or libquvi ``QUVIPROP_PAGETITLE``
|
||||
``demuxer``
|
||||
``stream-path`` filename (full path) of stream layer filename
|
||||
``stream-pos`` x byte position in source stream
|
||||
``stream-start`` start byte offset in source stream
|
||||
``stream-end`` end position in bytes in source stream
|
||||
``stream-length`` length in bytes (``${stream-end} - ${stream-start}``)
|
||||
``stream-time-pos`` x time position in source stream (also see ``time-pos``)
|
||||
``length`` length of the current file in seconds
|
||||
``avsync`` last A/V synchronization difference
|
||||
``percent-pos`` x position in current file (0-100)
|
||||
``ratio-pos`` x position in current file (0.0-1.0)
|
||||
``time-pos`` x position in current file in seconds
|
||||
``time-remaining`` estimated remaining length of the file in seconds
|
||||
``chapter`` x current chapter number
|
||||
``edition`` x current MKV edition number
|
||||
``titles`` number of DVD titles
|
||||
``chapters`` number of chapters
|
||||
``editions`` number of MKV editions
|
||||
``angle`` x current DVD angle
|
||||
``metadata`` metadata key/value pairs
|
||||
``metadata/<key>`` value of metadata entry ``<key>``
|
||||
``pause`` x pause status (bool)
|
||||
``cache`` network cache fill state (0-100)
|
||||
``pts-association-mode`` x see ``--pts-association-mode``
|
||||
``hr-seek`` x see ``--hr-seek``
|
||||
``volume`` x current volume (0-100)
|
||||
``mute`` x current mute status (bool)
|
||||
``audio-delay`` x see ``--audio-delay``
|
||||
``audio-format`` audio format (string)
|
||||
``audio-codec`` audio codec selected for decoding
|
||||
``audio-bitrate`` audio bitrate
|
||||
``samplerate`` audio samplerate
|
||||
``channels`` number of audio channels
|
||||
``aid`` x current audio track (similar to ``--aid``)
|
||||
``audio`` x alias for ``aid``
|
||||
``balance`` x audio channel balance
|
||||
``fullscreen`` x see ``--fullscreen``
|
||||
``deinterlace`` x deinterlacing, if available (bool)
|
||||
``colormatrix`` x see ``--colormatrix``
|
||||
``colormatrix-input-range`` x see ``--colormatrix-input-range``
|
||||
``colormatrix-output-range`` x see ``--colormatrix-output-range``
|
||||
``ontop`` x see ``--ontop``
|
||||
``border`` x see ``--border``
|
||||
``framedrop`` x see ``--framedrop``
|
||||
``gamma`` x see ``--gamma``
|
||||
``brightness`` x see ``--brightness``
|
||||
``contrast`` x see ``--contrast``
|
||||
``saturation`` x see ``--saturation``
|
||||
``hue`` x see ``--hue``
|
||||
``panscan`` x see ``--panscan``
|
||||
``video-format`` video format (string)
|
||||
``video-codec`` video codec selected for decoding
|
||||
``video-bitrate`` video bitrate
|
||||
``width`` video width (container or decoded size)
|
||||
``height`` video height
|
||||
``fps`` container FPS (may contain bogus values)
|
||||
``dwidth`` video width (after filters and aspect scaling)
|
||||
``dheight`` video height
|
||||
``aspect`` x video aspect
|
||||
``vid`` x current video track (similar to ``--vid``)
|
||||
``video`` x alias for ``vid``
|
||||
``program`` x switch TS program (write-only)
|
||||
``sid`` x current subtitle track (similar to ``--sid``)
|
||||
``sub`` x alias for ``sid``
|
||||
``sub-delay`` x see ``--sub-delay``
|
||||
``sub-pos`` x see ``--sub-pos``
|
||||
``sub-visibility`` x whether current subtitle is rendered
|
||||
``sub-forced-only`` x see ``--sub-forced-only``
|
||||
``sub-scale`` x subtitle font size multiplicator
|
||||
``ass-use-margins`` x see ``--ass-use-margins``
|
||||
``ass-vsfilter-aspect-compat`` x see ``--ass-vsfilter-aspect-compat``
|
||||
``ass-style-override`` x see ``--ass-style-override``
|
||||
``stream-capture`` x a filename, see ``--capture``
|
||||
``tv-brightness`` x
|
||||
``tv-contrast`` x
|
||||
``tv-saturation`` x
|
||||
``tv-hue`` x
|
||||
``playlist-pos`` current position on playlist
|
||||
``playlist-count`` number of total playlist entries
|
||||
``playlist`` playlist, current entry marked
|
||||
``track-list`` list of audio/video/sub tracks, cur. entr. marked
|
||||
``chapter-list`` list of chapters, current entry marked
|
||||
``quvi-format`` x see ``--quvi-format``
|
||||
``af`` x see ``--af``
|
||||
``vf`` x see ``--vf``
|
||||
``options/name`` read-only access to value of option ``--name``
|
||||
=============================== = ==================================================
|
||||
|
||||
Property Expansion
|
||||
------------------
|
||||
|
||||
All string arguments to input commands as well as certain options (like
|
||||
``--playing-msg``) are subject to property expansion.
|
||||
|
||||
.. admonition:: Example for input.conf
|
||||
|
||||
``i show_text "Filename: ${filename}"``
|
||||
shows the filename of the current file when pressing the ``i`` key
|
||||
|
||||
Within ``input.conf``, property expansion can be inhibited by putting the
|
||||
``raw`` prefix in front of commands.
|
||||
|
||||
The following expansions are supported:
|
||||
|
||||
``${NAME}``
|
||||
Expands to the value of the property ``NAME``. If retrieving the property
|
||||
fails, expand to an error string. (Use ``${NAME:}`` with a trailing
|
||||
``:`` to expand to an empty string instead.)
|
||||
If ``NAME`` is prefixed with ``=``, expand to the raw value of the property
|
||||
(see below).
|
||||
``${NAME:STR}``
|
||||
Expands to the value of the property ``NAME``, or ``STR`` if the
|
||||
property cannot be retrieved. ``STR`` is expanded recursively.
|
||||
``${!NAME:STR}``
|
||||
Expands to ``STR`` (recursively) if the property ``NAME`` cannot be
|
||||
retrieved.
|
||||
``${?NAME:STR}``
|
||||
Expands to ``STR`` (recursively) if the property ``NAME`` is available.
|
||||
``$$``
|
||||
Expands to ``$``.
|
||||
``$}``
|
||||
Expands to ``}``. (To produce this character inside recursive
|
||||
expansion.)
|
||||
``$>``
|
||||
Disable property expansion and special handling of ``$`` for the rest
|
||||
of the string.
|
||||
|
||||
In places where property expansion is allowed, C-style escapes are often
|
||||
accepted as well. Example:
|
||||
|
||||
- ``\n`` becomes a newline character
|
||||
- ``\\`` expands to ``\``
|
||||
|
||||
Raw and Formatted Properties
|
||||
----------------------------
|
||||
|
||||
Normally, properties are formatted as human-readable text, meant to be
|
||||
displayed on OSD or on the terminal. It is possible to retrieve an unformatted
|
||||
(raw) value from a property by prefixing its name with ``=``. These raw values
|
||||
can be parsed by other programs and follow the same conventions as the options
|
||||
associated with the properties.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
- ``${time-pos}`` expands to ``00:14:23`` (if playback position is at 14
|
||||
minutes 23 seconds)
|
||||
- ``${=time-pos}`` expands to ``863.4`` (same time, plus 400 milliseconds -
|
||||
milliseconds are normally not shown in the formatted case)
|
||||
|
||||
Sometimes, the difference in amount of information carried by raw and formatted
|
||||
property values can be rather big. In some cases, raw values have more
|
||||
information, like higher precision than seconds with ``time-pos``. Sometimes
|
||||
it is the other way around, e.g. ``aid`` shows track title and language in the
|
||||
formatted case, but only the track number if it is raw.
|
||||
@@ -0,0 +1,648 @@
|
||||
..
|
||||
Hint: To generate a nicely formatted XeLaTeX document from this file, use
|
||||
rst2xetex --use-latex-docinfo --use-latex-toc --hyperlink-color=MidnightBlue --latex-preamble="\usepackage[usenames,dvipsnames]{xcolor}\usepackage{fullpage}\setmainfont{Droid Sans}\setsansfont{Linux Biolinum O}\setmonofont[HyphenChar=None]{DejaVu Sans Mono}" mpv.rst
|
||||
|
||||
You might want to put the .. contents:: directive below to generate a TOC.
|
||||
|
||||
mpv
|
||||
###
|
||||
|
||||
##############
|
||||
a movie player
|
||||
##############
|
||||
|
||||
:Author: wm4
|
||||
:Date: 2013-07-08
|
||||
:Copyright: GPLv3
|
||||
:Version: git
|
||||
:Manual section: 1
|
||||
:Manual group: multimedia
|
||||
|
||||
SYNOPSIS
|
||||
========
|
||||
|
||||
| **mpv** [options] [file|URL|-]
|
||||
| **mpv** [options] --playlist=PLAYLIST
|
||||
| **mpv** [options] files
|
||||
| **mpv** [options] {group of files and options}
|
||||
| **mpv** [bd]://[title][/device] [options]
|
||||
| **mpv** dvd://[title|[start\_title]-end\_title][/device] [options]
|
||||
| **mpv** \vcd://[/device]
|
||||
| **mpv** \tv://[channel][/input_id] [options]
|
||||
| **mpv** radio://[channel|frequency][/capture] [options]
|
||||
| **mpv** \pvr:// [options]
|
||||
| **mpv** \dvb://[card\_number@]channel [options]
|
||||
| **mpv** \mf://[filemask|\@listfile] [-mf options] [options]
|
||||
| **mpv** cdda://track[-endtrack][:speed][/device] [options]
|
||||
| **mpv** [file|mms[t]|http|httpproxy|rt[s]p|ftp|udp|smb]:// [user:pass\@]URL[:port] [options]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
**mpv** is a movie player based on MPlayer and mplayer2. It supports a wide variety of video
|
||||
file formats, audio and video codecs, and subtitle types. Special input URL
|
||||
types are available to read input from a variety of sources other than disk
|
||||
files. Depending on platform, a variety of different video and audio output
|
||||
methods are supported.
|
||||
|
||||
Usage examples to get you started quickly can be found at the end of this man
|
||||
page.
|
||||
|
||||
|
||||
INTERACTIVE CONTROL
|
||||
===================
|
||||
|
||||
mpv has a fully configurable, command-driven control layer which allows you
|
||||
to control mpv using keyboard, mouse, joystick or remote control (with
|
||||
LIRC). See the ``--input-`` options for ways to customize it.
|
||||
|
||||
Keyboard Control
|
||||
----------------
|
||||
|
||||
LEFT and RIGHT
|
||||
Seek backward/forward 10 seconds. Shift+arrow does a 1 second exact seek
|
||||
(see ``--hr-seek``).
|
||||
|
||||
UP and DOWN
|
||||
Seek forward/backward 1 minute. Shift+arrow does a 5 second exact seek (see
|
||||
``--hr-seek``).
|
||||
|
||||
PGUP and PGDWN
|
||||
Seek forward/backward 10 minutes.
|
||||
|
||||
[ and ]
|
||||
Decrease/increase current playback speed by 10%.
|
||||
|
||||
{ and }
|
||||
Halve/double current playback speed.
|
||||
|
||||
BACKSPACE
|
||||
Reset playback speed to normal.
|
||||
|
||||
< and >
|
||||
Go backward/forward in the playlist.
|
||||
|
||||
ENTER
|
||||
Go forward in the playlist, even over the end.
|
||||
|
||||
p / SPACE
|
||||
Pause (pressing again unpauses).
|
||||
|
||||
\.
|
||||
Step forward. Pressing once will pause movie, every consecutive press will
|
||||
play one frame and then go into pause mode again.
|
||||
|
||||
q / ESC
|
||||
Stop playing and quit.
|
||||
|
||||
Q
|
||||
Like ``q``, but store the current playback position. Playing the same file
|
||||
later will resume at the old playback position if possible.
|
||||
|
||||
U
|
||||
Stop playing (and quit if ``--idle`` is not used).
|
||||
|
||||
\+ and -
|
||||
Adjust audio delay by +/- 0.1 seconds.
|
||||
|
||||
/ and *
|
||||
Decrease/increase volume.
|
||||
|
||||
9 and 0
|
||||
Decrease/increase volume.
|
||||
|
||||
( and )
|
||||
Adjust audio balance in favor of left/right channel.
|
||||
|
||||
m
|
||||
Mute sound.
|
||||
|
||||
\_
|
||||
Cycle through the available video tracks.
|
||||
|
||||
\#
|
||||
Cycle through the available audio tracks.
|
||||
|
||||
TAB (MPEG-TS and libavformat only)
|
||||
Cycle through the available programs.
|
||||
|
||||
f
|
||||
Toggle fullscreen (see also ``--fs``).
|
||||
|
||||
T
|
||||
Toggle stay-on-top (see also ``--ontop``).
|
||||
|
||||
w and e
|
||||
Decrease/increase pan-and-scan range.
|
||||
|
||||
o
|
||||
Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
|
||||
|
||||
d
|
||||
Toggle frame dropping states: none / skip display / skip decoding (see
|
||||
``--framedrop``).
|
||||
|
||||
v
|
||||
Toggle subtitle visibility.
|
||||
|
||||
j and J
|
||||
Cycle through the available subtitles.
|
||||
|
||||
F
|
||||
Toggle displaying "forced subtitles".
|
||||
|
||||
x and z
|
||||
Adjust subtitle delay by +/- 0.1 seconds.
|
||||
|
||||
V
|
||||
Toggle subtitle VSFilter aspect compatibility mode. See
|
||||
``--ass-vsfilter-aspect-compat`` for more info.
|
||||
|
||||
r and t
|
||||
Move subtitles up/down.
|
||||
|
||||
s
|
||||
Take a screenshot.
|
||||
|
||||
S
|
||||
Take a screenshot, without subtitles. (Whether this works depends on VO
|
||||
driver support.)
|
||||
|
||||
I
|
||||
Show filename on the OSD.
|
||||
|
||||
P
|
||||
Show progression bar, elapsed time and total duration on the OSD.
|
||||
|
||||
! and @
|
||||
Seek to the beginning of the previous/next chapter.
|
||||
|
||||
D (``--vo=vdpau``, ``--vf=yadif`` only)
|
||||
Activate/deactivate deinterlacer.
|
||||
|
||||
A
|
||||
Cycle through the available DVD angles.
|
||||
|
||||
c
|
||||
Change YUV colorspace.
|
||||
|
||||
(The following keys are valid only when using a video output that supports the
|
||||
corresponding adjustment, or the software equalizer (``--vf=eq``).)
|
||||
|
||||
1 and 2
|
||||
Adjust contrast.
|
||||
|
||||
3 and 4
|
||||
Adjust brightness.
|
||||
|
||||
5 and 6
|
||||
Adjust gamma.
|
||||
|
||||
7 and 8
|
||||
Adjust saturation.
|
||||
|
||||
(The following keys are valid only when using the corevideo video output
|
||||
driver.)
|
||||
|
||||
command + 0
|
||||
Resize movie window to half its original size.
|
||||
|
||||
command + 1
|
||||
Resize movie window to its original size.
|
||||
|
||||
command + 2
|
||||
Resize movie window to double its original size.
|
||||
|
||||
command + f
|
||||
Toggle fullscreen (see also ``--fs``).
|
||||
|
||||
command + [ and command + ]
|
||||
Set movie window alpha.
|
||||
|
||||
(The following keys are valid if you have a keyboard with multimedia keys.)
|
||||
|
||||
PAUSE
|
||||
Pause.
|
||||
|
||||
STOP
|
||||
Stop playing and quit.
|
||||
|
||||
PREVIOUS and NEXT
|
||||
Seek backward/forward 1 minute.
|
||||
|
||||
(The following keys are only valid if you compiled with TV or DVB input
|
||||
support and will take precedence over the keys defined above.)
|
||||
|
||||
h and k
|
||||
Select previous/next channel.
|
||||
|
||||
n
|
||||
Change norm.
|
||||
|
||||
u
|
||||
Change channel list.
|
||||
|
||||
Mouse Control
|
||||
-------------
|
||||
|
||||
button 3 and button 4
|
||||
Seek backward/forward 1 minute.
|
||||
|
||||
button 5 and button 6
|
||||
Decrease/increase volume.
|
||||
|
||||
Joystick Control
|
||||
----------------
|
||||
|
||||
left and right
|
||||
Seek backward/forward 10 seconds.
|
||||
|
||||
up and down
|
||||
Seek forward/backward 1 minute.
|
||||
|
||||
button 1
|
||||
Pause.
|
||||
|
||||
button 2
|
||||
Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
|
||||
|
||||
button 3 and button 4
|
||||
Decrease/increase volume.
|
||||
|
||||
|
||||
USAGE
|
||||
=====
|
||||
|
||||
Every *flag* option has a *no-flag* counterpart, e.g. the opposite of the
|
||||
``--fs`` option is ``--no-fs``. ``--fs=yes`` is same as ``--fs``, ``--fs=no``
|
||||
is the same as ``--no-fs``.
|
||||
|
||||
If an option is marked as *(XXX only)*, it will only work in combination with
|
||||
the *XXX* option or if *XXX* is compiled in.
|
||||
|
||||
.. note::
|
||||
|
||||
The suboption parser (used for example for ``--ao=pcm`` suboptions)
|
||||
supports a special kind of string-escaping intended for use with external
|
||||
GUIs.
|
||||
|
||||
It has the following format::
|
||||
|
||||
%n%string_of_length_n
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --ao=pcm:file=%10%C:test.wav test.avi``
|
||||
|
||||
Or in a script:
|
||||
|
||||
``mpv --ao=pcm:file=%`expr length "$NAME"`%"$NAME" test.avi``
|
||||
|
||||
Per-File Options
|
||||
----------------
|
||||
|
||||
When playing multiple files, any option given on the command line usually
|
||||
affects all files. Example::
|
||||
|
||||
mpv --a file1.mkv --b file2.mkv --c
|
||||
|
||||
=============== ===========================
|
||||
File Active options
|
||||
=============== ===========================
|
||||
file1.mkv ``--a --b --c``
|
||||
file2.mkv ``--a --b --c``
|
||||
=============== ===========================
|
||||
|
||||
Also, if any option is changed at runtime (via input commands), they are not
|
||||
reset when a new file is played.
|
||||
|
||||
Sometimes, it is useful to change options per-file. This can be achieved by
|
||||
adding the special per-file markers ``--{`` and ``--}``. (Note that you must
|
||||
escape these on some shells.) Example::
|
||||
|
||||
mpv --a file1.mkv --b --\{ --c file2.mkv --d file3.mkv --e --\} file4.mkv --f
|
||||
|
||||
=============== ===========================
|
||||
File Active options
|
||||
=============== ===========================
|
||||
file1.mkv ``--a --b --f``
|
||||
file2.mkv ``--a --b --f --c --d --e``
|
||||
file3.mkv ``--a --b --f --c --d --e``
|
||||
file4.mkv ``--a --b --f``
|
||||
=============== ===========================
|
||||
|
||||
Additionally, any file-local option changed at runtime is reset when the current
|
||||
file stops playing. If option ``--c`` is changed during playback of
|
||||
``file2.mkv``, it is reset when advancing to ``file3.mkv``. This only affects
|
||||
file-local options. The option ``--a`` is never reset here.
|
||||
|
||||
CONFIGURATION FILES
|
||||
===================
|
||||
|
||||
Location and Syntax
|
||||
-------------------
|
||||
|
||||
You can put all of the options in configuration files which will be read every
|
||||
time mpv is run. The system-wide configuration file 'mpv.conf' is in your
|
||||
configuration directory (e.g. ``/etc/mpv`` or ``/usr/local/etc/mpv``), the
|
||||
user-specific one is ``~/.mpv/config``.
|
||||
User-specific options override system-wide options and options given on the
|
||||
command line override either. The syntax of the configuration files is
|
||||
``option=<value>``; everything after a *#* is considered a comment. Options
|
||||
that work without values can be enabled by setting them to *yes* and disabled by
|
||||
setting them to *no*. Even suboptions can be specified in this way.
|
||||
|
||||
.. admonition:: Example configuration file
|
||||
|
||||
::
|
||||
|
||||
# Use opengl video output by default.
|
||||
vo=opengl
|
||||
# Use quotes for text that can contain spaces:
|
||||
status-msg="Time: ${time-pos}"
|
||||
|
||||
Putting Command Line Options into the Configuration File
|
||||
--------------------------------------------------------
|
||||
|
||||
Almost all command line options can be put into the configuration file. Here
|
||||
is a small guide:
|
||||
|
||||
======================= ========================
|
||||
Option Configuration file entry
|
||||
======================= ========================
|
||||
``--flag`` ``flag``
|
||||
``-opt val`` ``opt=val``
|
||||
``--opt=val`` ``opt=val``
|
||||
``-opt "has spaces"`` ``opt="has spaces"``
|
||||
======================= ========================
|
||||
|
||||
File-specific Configuration Files
|
||||
---------------------------------
|
||||
|
||||
You can also write file-specific configuration files. If you wish to have a
|
||||
configuration file for a file called 'movie.avi', create a file named
|
||||
'movie.avi.conf' with the file-specific options in it and put it in
|
||||
``~/.mpv/``. You can also put the configuration file in the same directory
|
||||
as the file to be played, as long as you give the ``--use-filedir-conf``
|
||||
option (either on the command line or in your global config file). If a
|
||||
file-specific configuration file is found in the same directory, no
|
||||
file-specific configuration is loaded from ``~/.mpv``. In addition, the
|
||||
``--use-filedir-conf`` option enables directory-specific configuration files.
|
||||
For this, mpv first tries to load a mpv.conf from the same directory
|
||||
as the file played and then tries to load any file-specific configuration.
|
||||
|
||||
|
||||
Profiles
|
||||
--------
|
||||
|
||||
To ease working with different configurations, profiles can be defined in the
|
||||
configuration files. A profile starts with its name in square brackets,
|
||||
e.g. ``[my-profile]``. All following options will be part of the profile. A
|
||||
description (shown by ``--profile=help``) can be defined with the
|
||||
``profile-desc`` option. To end the profile, start another one or use the
|
||||
profile name ``default`` to continue with normal options.
|
||||
|
||||
.. admonition:: Example mpv profile
|
||||
|
||||
::
|
||||
|
||||
[vo.vdpau]
|
||||
# Use hardware decoding (this might break playback of some h264 files)
|
||||
hwdec=vdpau
|
||||
|
||||
[protocol.dvd]
|
||||
profile-desc="profile for dvd:// streams"
|
||||
vf=pp=hb/vb/dr/al/fd
|
||||
alang=en
|
||||
|
||||
[extension.flv]
|
||||
profile-desc="profile for .flv files"
|
||||
flip=yes
|
||||
|
||||
[ao.alsa]
|
||||
device=spdif
|
||||
|
||||
|
||||
TAKING SCREENSHOTS
|
||||
==================
|
||||
|
||||
Screenshots of the currently played file can be taken using the 'screenshot'
|
||||
input mode command, which is by default bound to the ``s`` key. Files named
|
||||
``shotNNNN.jpg`` will be saved in the working directory, using the first
|
||||
available number - no files will be overwritten.
|
||||
|
||||
A screenshot will usually contain the unscaled video contents at the end of the
|
||||
video filter chain and subtitles. By default, ``S`` takes screenshots without
|
||||
subtitles, while ``s`` includes subtitles.
|
||||
|
||||
The ``screenshot`` video filter is not required when using a recommended GUI
|
||||
video output driver. It should normally not be added to the config file, as
|
||||
taking screenshots is handled by the VOs, and adding the screenshot filter will
|
||||
break hardware decoding. (The filter may still be useful for taking screenshots
|
||||
at a certain point within the video chain when using multiple video filters.)
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
.. include:: options.rst
|
||||
|
||||
.. include:: ao.rst
|
||||
|
||||
.. include:: vo.rst
|
||||
|
||||
.. include:: af.rst
|
||||
|
||||
.. include:: vf.rst
|
||||
|
||||
.. include:: encode.rst
|
||||
|
||||
.. include:: input.rst
|
||||
|
||||
.. include:: changes.rst
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
=====================
|
||||
|
||||
There are a number of environment variables that can be used to control the
|
||||
behavior of mpv.
|
||||
|
||||
``HOME``
|
||||
Used to determine mpv config directory: ``$HOME/.mpv``
|
||||
|
||||
``TERM``
|
||||
Used to determine terminal type.
|
||||
|
||||
``MPV_HOME``
|
||||
Directory where mpv looks for user settings. Overrides ``HOME``, and mpv
|
||||
will try to load the config file as ``$MPV_HOME/config``.
|
||||
|
||||
``MPV_LOCALEDIR``
|
||||
Directory where mpv looks for gettext translation files (if enabled).
|
||||
|
||||
``MPV_VERBOSE`` (see also ``-v`` and ``--msglevel``)
|
||||
Set the initial verbosity level across all message modules (default: 0).
|
||||
The resulting verbosity corresponds to that of ``--msglevel=5`` plus the
|
||||
value of ``MPV_VERBOSE``.
|
||||
|
||||
``MPV_LEAK_REPORT``
|
||||
If set to ``1``, enable internal talloc leak reporting. Note that this can
|
||||
cause trouble with multithreading, so only developers should use this.
|
||||
|
||||
``LADSPA_PATH``
|
||||
Specifies the search path for LADSPA plugins. If it is unset, fully
|
||||
qualified path names must be used.
|
||||
|
||||
``DISPLAY``
|
||||
Standard X11 display name to use.
|
||||
|
||||
FFmpeg/Libav:
|
||||
This library accesses various environment variables. However, they are not
|
||||
centrally documented, and documenting them is not our job. Therefore, the
|
||||
list is incomplete.
|
||||
|
||||
Notable environment variables:
|
||||
|
||||
``http_proxy``
|
||||
URL to proxy for ``http://`` and ``https://`` URLs.
|
||||
|
||||
``no_proxy``
|
||||
List of domain patterns for which no proxy should be used.
|
||||
List entries are separated by ``,``. Patterns can include ``*``.
|
||||
|
||||
libdvdcss:
|
||||
``DVDCSS_CACHE``
|
||||
Specify a directory in which to store title key values. This will
|
||||
speed up descrambling of DVDs which are in the cache. The
|
||||
``DVDCSS_CACHE`` directory is created if it does not exist, and a
|
||||
subdirectory is created named after the DVD's title or manufacturing
|
||||
date. If ``DVDCSS_CACHE`` is not set or is empty, libdvdcss will use
|
||||
the default value which is ``${HOME}/.dvdcss/`` under Unix and
|
||||
the roaming application data directory (``%APPDATA%``) under
|
||||
Windows. The special value "off" disables caching.
|
||||
|
||||
``DVDCSS_METHOD``
|
||||
Sets the authentication and decryption method that libdvdcss will use
|
||||
to read scrambled discs. Can be one of ``title``, ``key`` or ``disc``.
|
||||
|
||||
key
|
||||
is the default method. libdvdcss will use a set of calculated
|
||||
player keys to try and get the disc key. This can fail if the drive
|
||||
does not recognize any of the player keys.
|
||||
|
||||
disc
|
||||
is a fallback method when key has failed. Instead of using player
|
||||
keys, libdvdcss will crack the disc key using a brute force
|
||||
algorithm. This process is CPU intensive and requires 64 MB of
|
||||
memory to store temporary data.
|
||||
|
||||
title
|
||||
is the fallback when all other methods have failed. It does not
|
||||
rely on a key exchange with the DVD drive, but rather uses a crypto
|
||||
attack to guess the title key. On rare cases this may fail because
|
||||
there is not enough encrypted data on the disc to perform a
|
||||
statistical attack, but on the other hand it is the only way to
|
||||
decrypt a DVD stored on a hard disc, or a DVD with the wrong region
|
||||
on an RPC2 drive.
|
||||
|
||||
``DVDCSS_RAW_DEVICE``
|
||||
Specify the raw device to use. Exact usage will depend on your
|
||||
operating system, the Linux utility to set up raw devices is raw(8)
|
||||
for instance. Please note that on most operating systems, using a raw
|
||||
device requires highly aligned buffers: Linux requires a 2048 bytes
|
||||
alignment (which is the size of a DVD sector).
|
||||
|
||||
``DVDCSS_VERBOSE``
|
||||
Sets the libdvdcss verbosity level.
|
||||
|
||||
:0: Outputs no messages at all.
|
||||
:1: Outputs error messages to stderr.
|
||||
:2: Outputs error messages and debug messages to stderr.
|
||||
|
||||
``DVDREAD_NOKEYS``
|
||||
Skip retrieving all keys on startup. Currently disabled.
|
||||
|
||||
``HOME``
|
||||
FIXME: Document this.
|
||||
|
||||
|
||||
EXIT CODES
|
||||
==========
|
||||
|
||||
Normally **mpv** returns 0 as exit code after finishing playback successfully.
|
||||
If errors happen, the following exit codes can be returned:
|
||||
|
||||
:1: Error initializing mpv. This is also returned if unknown options are
|
||||
passed to mpv.
|
||||
:2: The file passed to mpv couldn't be played. This is somewhat fuzzy:
|
||||
currently, playback of a file is considered to be successful if
|
||||
initialization was mostly successful, even if playback fails
|
||||
immediately after initialization.
|
||||
:3: There were some files that could be played, and some files which
|
||||
couldn't (using the definition of success from above).
|
||||
|
||||
Note that quitting the player manually will always lead to exit code 0,
|
||||
overriding the exit code that would be returned normally. Also, the ``quit``
|
||||
input command can take an exit code: in this case, that exit code is returned.
|
||||
|
||||
FILES
|
||||
=====
|
||||
|
||||
``/usr/local/etc/mpv/mpv.conf``
|
||||
mpv system-wide settings (depends on ``--prefix`` passed to configure)
|
||||
|
||||
``~/.mpv/config``
|
||||
mpv user settings
|
||||
|
||||
``~/.mpv/input.conf``
|
||||
input bindings (see ``--input-keylist`` for the full list)
|
||||
|
||||
|
||||
EXAMPLES OF MPV USAGE
|
||||
=====================
|
||||
|
||||
Quickstart Blu-ray playing:
|
||||
- ``mpv bd:////path/to/disc``
|
||||
- ``mpv bd:// --bluray-device=/path/to/disc``
|
||||
|
||||
Quickstart DVD playing:
|
||||
``mpv dvd://1``
|
||||
|
||||
Play in Japanese with English subtitles:
|
||||
``mpv dvd://1 --alang=ja --slang=en``
|
||||
|
||||
Play only chapters 5, 6, 7:
|
||||
``mpv dvd://1 --chapter=5-7``
|
||||
|
||||
Play only titles 5, 6, 7:
|
||||
``mpv dvd://5-7``
|
||||
|
||||
Play a multiangle DVD:
|
||||
``mpv dvd://1 --dvdangle=2``
|
||||
|
||||
Play from a different DVD device:
|
||||
``mpv dvd://1 --dvd-device=/dev/dvd2``
|
||||
|
||||
Play DVD video from a directory with VOB files:
|
||||
``mpv dvd://1 --dvd-device=/path/to/directory/``
|
||||
|
||||
Stream from HTTP:
|
||||
``mpv http://example.com/example.avi``
|
||||
|
||||
Stream using RTSP:
|
||||
``mpv rtsp://server.example.com/streamName``
|
||||
|
||||
Play a libavfilter graph:
|
||||
``mpv avdevice://lavfi:mandelbrot``
|
||||
|
||||
AUTHORS
|
||||
=======
|
||||
|
||||
mpv is a MPlayer fork based on mplayer2, which in turn is a fork of MPlayer.
|
||||
|
||||
MPlayer was initially written by Arpad Gereoffy. See the ``AUTHORS`` file for
|
||||
a list of some of the many other contributors.
|
||||
|
||||
MPlayer is (C) 2000-2012 The MPlayer Team
|
||||
|
||||
This man page was written mainly by Gabucino, Jonas Jermann and Diego Biurrun.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,863 @@
|
||||
VIDEO FILTERS
|
||||
=============
|
||||
|
||||
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.
|
||||
|
||||
Many parameters are optional and set to default values if omitted. To
|
||||
explicitly use a default value, set a parameter to '-1'. Parameters ``w:h``
|
||||
means width x height in pixels, ``x:y`` means x;y position counted from the
|
||||
upper left corner of the bigger image.
|
||||
|
||||
.. note::
|
||||
|
||||
To get a full list of available video filters, see ``--vf=help``.
|
||||
|
||||
Video filters are managed in lists. There are a few commands to manage the
|
||||
filter list.
|
||||
|
||||
``--vf-add=<filter1[,filter2,...]>``
|
||||
Appends the filters given as arguments to the filter list.
|
||||
|
||||
``--vf-pre=<filter1[,filter2,...]>``
|
||||
Prepends the filters given as arguments to the filter list.
|
||||
|
||||
``--vf-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).
|
||||
|
||||
``--vf-clr``
|
||||
Completely empties the filter list.
|
||||
|
||||
With filters that support it, you can access parameters by their name.
|
||||
|
||||
``--vf=<filter>=help``
|
||||
Prints the parameter names and parameter value ranges for a particular
|
||||
filter.
|
||||
|
||||
``--vf=<filter=named_parameter1=value1[:named_parameter2=value2:...]>``
|
||||
Sets a named parameter to the given value. Use on and off or yes and no to
|
||||
set flag parameters.
|
||||
|
||||
Available filters are:
|
||||
|
||||
``crop[=w:h:x:y]``
|
||||
Crops the given part of the image and discards the rest. Useful to remove
|
||||
black bands from widescreen movies.
|
||||
|
||||
``<w>,<h>``
|
||||
Cropped width and height, defaults to original width and height.
|
||||
``<x>,<y>``
|
||||
Position of the cropped picture, defaults to center.
|
||||
|
||||
``expand[=w:h:x:y:aspect:round]``
|
||||
Expands (not scales) movie resolution to the given value and places the
|
||||
unscaled original at coordinates x, y.
|
||||
|
||||
``<w>,<h>``
|
||||
Expanded width,height (default: original width,height). Negative
|
||||
values for w and h are treated as offsets to the original size.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``expand=0:-50:0:0``
|
||||
Adds a 50 pixel border to the bottom of the picture.
|
||||
|
||||
``<x>,<y>``
|
||||
position of original image on the expanded image (default: center)
|
||||
|
||||
``<aspect>``
|
||||
Expands to fit an aspect instead of a resolution (default: 0).
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``expand=800:::::4/3``
|
||||
Expands to 800x600, unless the source is higher resolution, in
|
||||
which case it expands to fill a 4/3 aspect.
|
||||
|
||||
``<round>``
|
||||
Rounds up to make both width and height divisible by <r> (default: 1).
|
||||
|
||||
``flip``
|
||||
Flips the image upside down. See also ``--flip``.
|
||||
|
||||
``mirror``
|
||||
Mirrors the image on the Y axis.
|
||||
|
||||
``rotate[=<0-7>]``
|
||||
Rotates the image by 90 degrees and optionally flips it. For values
|
||||
between 4-7 rotation is only done if the movie geometry is portrait and
|
||||
not landscape.
|
||||
|
||||
:0: Rotate by 90 degrees clockwise and flip (default).
|
||||
:1: Rotate by 90 degrees clockwise.
|
||||
:2: Rotate by 90 degrees counterclockwise.
|
||||
:3: Rotate by 90 degrees counterclockwise and flip.
|
||||
|
||||
``scale[=w:h[:interlaced[:chr_drop[:par[:par2[:noup[:arnd]]]]]]]``
|
||||
Scales the image with the software scaler (slow) and performs a YUV<->RGB
|
||||
colorspace conversion (see also ``--sws``).
|
||||
|
||||
``<w>,<h>``
|
||||
scaled width/height (default: original width/height)
|
||||
|
||||
:0: scaled d_width/d_height
|
||||
:-1: original width/height
|
||||
:-2: Calculate w/h using the other dimension and the prescaled
|
||||
aspect ratio.
|
||||
:-3: Calculate w/h using the other dimension and the original
|
||||
aspect ratio.
|
||||
:-(n+8): Like -n above, but rounding the dimension to the closest
|
||||
multiple of 16.
|
||||
|
||||
``<chr_drop>``
|
||||
chroma skipping
|
||||
|
||||
:0: Use all available input lines for chroma.
|
||||
:1: Use only every 2. input line for chroma.
|
||||
:2: Use only every 4. input line for chroma.
|
||||
:3: Use only every 8. input line for chroma.
|
||||
|
||||
``<par>[:<par2>]`` (see also ``--sws``)
|
||||
Set some scaling parameters depending on the type of scaler selected
|
||||
with ``--sws``::
|
||||
|
||||
--sws=2 (bicubic): B (blurring) and C (ringing)
|
||||
0.00:0.60 default
|
||||
0.00:0.75 VirtualDub's "precise bicubic"
|
||||
0.00:0.50 Catmull-Rom spline
|
||||
0.33:0.33 Mitchell-Netravali spline
|
||||
1.00:0.00 cubic B-spline
|
||||
|
||||
--sws=7 (gaussian): sharpness (0 (soft) - 100 (sharp))
|
||||
|
||||
--sws=9 (lanczos): filter length (1-10)
|
||||
|
||||
``<noup>``
|
||||
Disallow upscaling past the original dimensions.
|
||||
|
||||
:0: Allow upscaling (default).
|
||||
:1: Disallow upscaling if one dimension exceeds its original value.
|
||||
:2: Disallow upscaling if both dimensions exceed their original values.
|
||||
|
||||
``<arnd>``
|
||||
Accurate rounding for the vertical scaler, which may be faster or
|
||||
slower than the default rounding.
|
||||
|
||||
:0: Disable accurate rounding (default).
|
||||
:1: Enable accurate rounding.
|
||||
|
||||
``dsize[=aspect|w:h:aspect-method:r]``
|
||||
Changes the intended display size/aspect at an arbitrary point in the
|
||||
filter chain. Aspect can be given as a fraction (4/3) or floating point
|
||||
number (1.33). Alternatively, you may specify the exact display width and
|
||||
height desired. Note that this filter does *not* do any scaling itself; it
|
||||
just affects what later scalers (software or hardware) will do when
|
||||
auto-scaling to correct aspect.
|
||||
|
||||
``<w>,<h>``
|
||||
New display width and height.
|
||||
|
||||
Can also be these special values:
|
||||
|
||||
:0: original display width and height
|
||||
:-1: original video width and height (default)
|
||||
:-2: Calculate w/h using the other dimension and the original display
|
||||
aspect ratio.
|
||||
:-3: Calculate w/h using the other dimension and the original video
|
||||
aspect ratio.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``dsize=800:-2``
|
||||
Specifies a display resolution of 800x600 for a 4/3 aspect
|
||||
video, or 800x450 for a 16/9 aspect video.
|
||||
|
||||
``<aspect-method>``
|
||||
Modifies width and height according to original aspect ratios.
|
||||
|
||||
:-1: Ignore original aspect ratio (default).
|
||||
:0: Keep display aspect ratio by using ``<w>`` and ``<h>`` as maximum
|
||||
resolution.
|
||||
:1: Keep display aspect ratio by using ``<w>`` and ``<h>`` as minimum
|
||||
resolution.
|
||||
:2: Keep video aspect ratio by using ``<w>`` and ``<h>`` as maximum
|
||||
resolution.
|
||||
:3: Keep video aspect ratio by using ``<w>`` and ``<h>`` as minimum
|
||||
resolution.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``dsize=800:600:0``
|
||||
Specifies a display resolution of at most 800x600, or smaller,
|
||||
in order to keep aspect.
|
||||
|
||||
``<r>``
|
||||
Rounds up to make both width and height divisible by ``<r>``
|
||||
(default: 1).
|
||||
|
||||
``format[=fmt[:outfmt]]``
|
||||
Restricts the color space for the next filter without doing any conversion.
|
||||
Use together with the scale filter for a real conversion.
|
||||
|
||||
.. note::
|
||||
|
||||
For a list of available formats, see ``format=fmt=help``.
|
||||
|
||||
``<fmt>``
|
||||
Format name, e.g. rgb15, bgr24, 420p, etc. (default: yuyv).
|
||||
``<outfmt>``
|
||||
Format name that should be substituted for the output. If this is not
|
||||
100% compatible with the ``<fmt>`` value, it will crash.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
====================== =====================
|
||||
Valid Invalid (will crash)
|
||||
====================== =====================
|
||||
``format=rgb24:bgr24`` ``format=rgb24:420p``
|
||||
``format=yuyv:uyvy``
|
||||
====================== =====================
|
||||
|
||||
``noformat[=fmt]``
|
||||
Restricts the colorspace for the next filter without doing any conversion.
|
||||
Unlike the format filter, this will allow any colorspace except the one
|
||||
you specify.
|
||||
|
||||
.. note:: For a list of available formats, see ``noformat=fmt=help``.
|
||||
|
||||
``<fmt>``
|
||||
Format name, e.g. rgb15, bgr24, 420p, etc. (default: 420p).
|
||||
|
||||
``pp[=filter1[:option1[:option2...]]/[-]filter2...]``
|
||||
Enables the specified chain of postprocessing subfilters. Subfilters must
|
||||
be separated by '/' and can be disabled by prepending a '-'. Each
|
||||
subfilter and some options have a short and a long name that can be used
|
||||
interchangeably, i.e. ``dr``/``dering`` are the same. All subfilters share
|
||||
common options to determine their scope:
|
||||
|
||||
``a/autoq``
|
||||
Automatically switch the subfilter off if the CPU is too slow.
|
||||
``c/chrom``
|
||||
Do chrominance filtering, too (default).
|
||||
``y/nochrom``
|
||||
Do luminance filtering only (no chrominance).
|
||||
``n/noluma``
|
||||
Do chrominance filtering only (no luminance).
|
||||
|
||||
.. note::
|
||||
|
||||
``--pphelp`` shows a list of available subfilters.
|
||||
|
||||
Available subfilters are:
|
||||
|
||||
``hb/hdeblock[:difference[:flatness]]``
|
||||
horizontal deblocking filter
|
||||
|
||||
:<difference>: Difference factor where higher values mean more
|
||||
deblocking (default: 32).
|
||||
:<flatness>: Flatness threshold where lower values mean more
|
||||
deblocking (default: 39).
|
||||
|
||||
``vb/vdeblock[:difference[:flatness]]``
|
||||
vertical deblocking filter
|
||||
|
||||
:<difference>: Difference factor where higher values mean more
|
||||
deblocking (default: 32).
|
||||
:<flatness>: Flatness threshold where lower values mean more
|
||||
deblocking (default: 39).
|
||||
|
||||
``ha/hadeblock[:difference[:flatness]]``
|
||||
accurate horizontal deblocking filter
|
||||
|
||||
:<difference>: Difference factor where higher values mean more
|
||||
deblocking (default: 32).
|
||||
:<flatness>: Flatness threshold where lower values mean more
|
||||
deblocking (default: 39).
|
||||
|
||||
``va/vadeblock[:difference[:flatness]]``
|
||||
accurate vertical deblocking filter
|
||||
|
||||
:<difference>: Difference factor where higher values mean more
|
||||
deblocking (default: 32).
|
||||
:<flatness>: Flatness threshold where lower values mean more
|
||||
deblocking (default: 39).
|
||||
|
||||
The horizontal and vertical deblocking filters share the difference and
|
||||
flatness values so you cannot set different horizontal and vertical
|
||||
thresholds.
|
||||
|
||||
``h1/x1hdeblock``
|
||||
experimental horizontal deblocking filter
|
||||
|
||||
``v1/x1vdeblock``
|
||||
experimental vertical deblocking filter
|
||||
|
||||
``dr/dering``
|
||||
deringing filter
|
||||
|
||||
``tn/tmpnoise[:threshold1[:threshold2[:threshold3]]]``
|
||||
temporal noise reducer
|
||||
|
||||
:<threshold1>: larger -> stronger filtering
|
||||
:<threshold2>: larger -> stronger filtering
|
||||
:<threshold3>: larger -> stronger filtering
|
||||
|
||||
``al/autolevels[:f/fullyrange]``
|
||||
automatic brightness / contrast correction
|
||||
|
||||
:f/fullyrange: Stretch luminance to (0-255).
|
||||
|
||||
``lb/linblenddeint``
|
||||
Linear blend deinterlacing filter that deinterlaces the given block by
|
||||
filtering all lines with a (1 2 1) filter.
|
||||
|
||||
``li/linipoldeint``
|
||||
Linear interpolating deinterlacing filter that deinterlaces the given
|
||||
block by linearly interpolating every second line.
|
||||
|
||||
``ci/cubicipoldeint``
|
||||
Cubic interpolating deinterlacing filter deinterlaces the given block
|
||||
by cubically interpolating every second line.
|
||||
|
||||
``md/mediandeint``
|
||||
Median deinterlacing filter that deinterlaces the given block by
|
||||
applying a median filter to every second line.
|
||||
|
||||
``fd/ffmpegdeint``
|
||||
FFmpeg deinterlacing filter that deinterlaces the given block by
|
||||
filtering every second line with a (-1 4 2 4 -1) filter.
|
||||
|
||||
``l5/lowpass5``
|
||||
Vertically applied FIR lowpass deinterlacing filter that deinterlaces
|
||||
the given block by filtering all lines with a (-1 2 6 2 -1) filter.
|
||||
|
||||
``fq/forceQuant[:quantizer]``
|
||||
Overrides the quantizer table from the input with the constant
|
||||
quantizer you specify.
|
||||
|
||||
:<quantizer>: quantizer to use
|
||||
|
||||
``de/default``
|
||||
default pp filter combination (hb:a,vb:a,dr:a)
|
||||
|
||||
``fa/fast``
|
||||
fast pp filter combination (h1:a,v1:a,dr:a)
|
||||
|
||||
``ac``
|
||||
high quality pp filter combination (ha:a:128:7,va:a,dr:a)
|
||||
|
||||
.. note::
|
||||
|
||||
This filter is only available if FFmpeg/libav has been compiled
|
||||
with libpostproc enabled.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``--vf=pp=hb/vb/dr/al``
|
||||
horizontal and vertical deblocking, deringing and automatic
|
||||
brightness/contrast
|
||||
|
||||
``--vf=pp=de/-al``
|
||||
default filters without brightness/contrast correction
|
||||
|
||||
``--vf=pp=default/tmpnoise:1:2:3``
|
||||
Enable default filters & temporal denoiser.
|
||||
|
||||
``--vf=pp=hb:y/vb:a``
|
||||
Horizontal deblocking on luminance only, and switch vertical
|
||||
deblocking on or off automatically depending on available CPU time.
|
||||
|
||||
``lavfi=graph[:sws_flags[:o=opts]]``
|
||||
Filter video using FFmpeg's libavfilter.
|
||||
|
||||
``<graph>``
|
||||
The libavfilter graph string. The filter must have a single video input
|
||||
pad and a single video output pad.
|
||||
|
||||
See `<https://ffmpeg.org/ffmpeg-filters.html>`_ for syntax and available
|
||||
filters.
|
||||
|
||||
.. warning::
|
||||
|
||||
If you want to use the full filter syntax with this option, you have
|
||||
to quote the filter graph in order to prevent mpv's syntax and the
|
||||
filter graph syntax from clashing.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``-vf lavfi=[gradfun=20:30,vflip]``
|
||||
``gradfun`` filter with nonsense parameters, followed by a
|
||||
``vflip`` filter. (This demonstrates how libavfilter takes a
|
||||
graph and not just a single filter.) The filter graph string is
|
||||
quoted with ``[`` and ``]``. This requires no additional quoting
|
||||
or escaping with some shells (like bash), while others (like
|
||||
zsh) require additional ``"`` quotes around the option string.
|
||||
|
||||
``'--vf=lavfi="gradfun=20:30,vflip"'``
|
||||
Same as before, but uses quoting that should be safe with all
|
||||
shells. The outer ``'`` quotes make sure that the shell does not
|
||||
remove the ``"`` quotes needed by mpv.
|
||||
|
||||
``'--vf=lavfi=graph="gradfun=radius=30:strength=20,vflip"'``
|
||||
Same as before, but uses named parameters for everything.
|
||||
|
||||
``<sws_flags>``
|
||||
If libavfilter inserts filters for pixel format conversion, this
|
||||
option gives the flags which should be passed to libswscale. This
|
||||
option is numeric and takes a bit-wise combination of ``SWS_`` flags.
|
||||
|
||||
See ``http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libswscale/swscale.h``.
|
||||
|
||||
``<o>``
|
||||
Set AVFilterGraph options. These should be documented by FFmpeg.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``'--vf=lavfi=yadif:o="threads=2,thread_type=slice"'``
|
||||
forces a specific threading configuration.
|
||||
|
||||
``noise[=luma[u][t|a][h][p]:chroma[u][t|a][h][p]]``
|
||||
Adds noise.
|
||||
|
||||
:<0-100>: luma noise
|
||||
:<0-100>: chroma noise
|
||||
:u: uniform noise (gaussian otherwise)
|
||||
:t: temporal noise (noise pattern changes between frames)
|
||||
:a: averaged temporal noise (smoother, but a lot slower)
|
||||
:h: high quality (slightly better looking, slightly slower)
|
||||
:p: mix random noise with a (semi)regular pattern
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``noise`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
``hqdn3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]``
|
||||
This filter aims to reduce image noise producing smooth images and making
|
||||
still images really still (This should enhance compressibility.).
|
||||
|
||||
``<luma_spatial>``
|
||||
spatial luma strength (default: 4)
|
||||
``<chroma_spatial>``
|
||||
spatial chroma strength (default: 3)
|
||||
``<luma_tmp>``
|
||||
luma temporal strength (default: 6)
|
||||
``<chroma_tmp>``
|
||||
chroma temporal strength (default:
|
||||
``luma_tmp*chroma_spatial/luma_spatial``)
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``hqdn3d`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
``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).
|
||||
|
||||
``ilpack[=mode]``
|
||||
When interlaced video is stored in YUV 4:2:0 formats, chroma interlacing
|
||||
does not line up properly due to vertical downsampling of the chroma
|
||||
channels. This filter packs the planar 4:2:0 data into YUY2 (4:2:2) format
|
||||
with the chroma lines in their proper locations, so that in any given
|
||||
scanline, the luma and chroma data both come from the same field.
|
||||
|
||||
``<mode>``
|
||||
Select the sampling mode.
|
||||
|
||||
:0: nearest-neighbor sampling, fast but incorrect
|
||||
:1: linear interpolation (default)
|
||||
|
||||
``unsharp[=l|cWxH:amount[:l|cWxH:amount]]``
|
||||
unsharp mask / gaussian blur
|
||||
|
||||
``l``
|
||||
Apply effect on luma component.
|
||||
|
||||
``c``
|
||||
Apply effect on chroma components.
|
||||
|
||||
``<width>x<height>``
|
||||
width and height of the matrix, odd sized in both directions (min =
|
||||
3x3, max = 13x11 or 11x13, usually something between 3x3 and 7x7)
|
||||
|
||||
``amount``
|
||||
Relative amount of sharpness/blur to add to the image (a sane range
|
||||
should be -1.5-1.5).
|
||||
|
||||
:<0: blur
|
||||
:>0: sharpen
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``unsharp`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
``swapuv``
|
||||
Swap U & V plane.
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``swapuv`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
``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
|
||||
content. The ``pullup`` filter makes use of future context in making its
|
||||
decisions. It is stateless in the sense that it does not lock onto a pattern
|
||||
to follow, but it instead looks forward to the following fields in order to
|
||||
identify matches and rebuild progressive frames.
|
||||
|
||||
``jl``, ``jr``, ``jt``, and ``jb``
|
||||
These options set the amount of "junk" to ignore at the left, right,
|
||||
top, and bottom of the image, respectively. Left/right are in units of
|
||||
8 pixels, while top/bottom are in units of 2 lines. The default is 8
|
||||
pixels on each side.
|
||||
|
||||
``sb`` (strict breaks)
|
||||
Setting this option to 1 will reduce the chances of ``pullup``
|
||||
generating an occasional mismatched frame, but it may also cause an
|
||||
excessive number of frames to be dropped during high motion sequences.
|
||||
Conversely, setting it to -1 will make ``pullup`` match fields more
|
||||
easily. This may help processing of video where there is slight
|
||||
blurring between the fields, but may also cause there to be interlaced
|
||||
frames in the output.
|
||||
|
||||
``mp`` (metric plane)
|
||||
This option may be set to 1 or 2 to use a chroma plane instead of the
|
||||
luma plane for doing ``pullup``'s computations. This may improve accuracy
|
||||
on very clean source material, but more likely will decrease accuracy,
|
||||
especially if there is chroma noise (rainbow effect) or any grayscale
|
||||
video. The main purpose of setting ``mp`` to a chroma plane is to reduce
|
||||
CPU load and make pullup usable in realtime on slow machines.
|
||||
|
||||
``divtc[=options]``
|
||||
Inverse telecine for deinterlaced video. If 3:2-pulldown telecined video
|
||||
has lost one of the fields or is deinterlaced using a method that keeps
|
||||
one field and interpolates the other, the result is a juddering video that
|
||||
has every fourth frame duplicated. This filter is intended to find and
|
||||
drop those duplicates and restore the original film framerate. Two
|
||||
different modes are available: One-pass mode is the default and is
|
||||
straightforward to use, but has the disadvantage that any changes in the
|
||||
telecine phase (lost frames or bad edits) cause momentary judder until the
|
||||
filter can resync again. Two-pass mode avoids this by analyzing the entire
|
||||
video beforehand so it will have forward knowledge about the phase changes
|
||||
and can resync at the exact spot. These passes do *not* correspond to pass
|
||||
one and two of the encoding process. You must run an extra pass using
|
||||
``divtc`` pass one before the actual encoding throwing the resulting video
|
||||
away. Then use ``divtc`` pass two for the actual encoding. If you use
|
||||
multiple encoder passes, use ``divtc`` pass two for all of them.
|
||||
|
||||
The options are:
|
||||
|
||||
``pass=1|2``
|
||||
Use two pass mode.
|
||||
|
||||
``file=<filename>``
|
||||
Set the two pass log filename (default: ``framediff.log``).
|
||||
|
||||
``threshold=<value>``
|
||||
Set the minimum strength the telecine pattern must have for the filter
|
||||
to believe in it (default: 0.5). This is used to avoid recognizing
|
||||
false pattern from the parts of the video that are very dark or very
|
||||
still.
|
||||
|
||||
``window=<numframes>``
|
||||
Set the number of past frames to look at when searching for pattern
|
||||
(default: 30). Longer window improves the reliability of the pattern
|
||||
search, but shorter window improves the reaction time to the changes
|
||||
in the telecine phase. This only affects the one-pass mode. The
|
||||
two-pass mode currently uses fixed window that extends to both future
|
||||
and past.
|
||||
|
||||
``phase=0|1|2|3|4``
|
||||
Sets the initial telecine phase for one pass mode (default: 0). The
|
||||
two-pass mode can see the future, so it is able to use the correct
|
||||
phase from the beginning, but one-pass mode can only guess. It catches
|
||||
the correct phase when it finds it, but this option can be used to fix
|
||||
the possible juddering at the beginning. The first pass of the two
|
||||
pass mode also uses this, so if you save the output from the first
|
||||
pass, you get constant phase result.
|
||||
|
||||
``deghost=<value>``
|
||||
Set the deghosting threshold (0-255 for one-pass mode, -255-255 for
|
||||
two-pass mode, default 0). If nonzero, deghosting mode is used. This
|
||||
is for video that has been deinterlaced by blending the fields
|
||||
together instead of dropping one of the fields. Deghosting amplifies
|
||||
any compression artifacts in the blended frames, so the parameter
|
||||
value is used as a threshold to exclude those pixels from deghosting
|
||||
that differ from the previous frame less than specified value. If two
|
||||
pass mode is used, then negative value can be used to make the filter
|
||||
analyze the whole video in the beginning of pass-2 to determine
|
||||
whether it needs deghosting or not and then select either zero or the
|
||||
absolute value of the parameter. Specify this option for pass 2, it
|
||||
makes no difference on pass 1.
|
||||
|
||||
``phase[=t|b|p|a|u|T|B|A|U][:v]``
|
||||
Delay interlaced video by one field time so that the field order changes.
|
||||
The intended use is to fix PAL movies that have been captured with the
|
||||
opposite field order to the film-to-video transfer. The options are:
|
||||
|
||||
``t``
|
||||
Capture field order top-first, transfer bottom-first. Filter will
|
||||
delay the bottom field.
|
||||
|
||||
``b``
|
||||
Capture bottom-first, transfer top-first. Filter will delay the top
|
||||
field.
|
||||
|
||||
``p``
|
||||
Capture and transfer with the same field order. This mode only exists
|
||||
for the documentation of the other options to refer to, but if you
|
||||
actually select it, the filter will faithfully do nothing ;-)
|
||||
|
||||
``a``
|
||||
Capture field order determined automatically by field flags, transfer
|
||||
opposite. Filter selects among ``t`` and ``b`` modes on a frame by frame
|
||||
basis using field flags. If no field information is available, then this
|
||||
works just like ``u``.
|
||||
|
||||
``u``
|
||||
Capture unknown or varying, transfer opposite. Filter selects among
|
||||
``t`` and ``b`` on a frame by frame basis by analyzing the images and
|
||||
selecting the alternative that produces best match between the fields.
|
||||
|
||||
``T``
|
||||
Capture top-first, transfer unknown or varying. Filter selects among
|
||||
``t`` and ``p`` using image analysis.
|
||||
|
||||
``B``
|
||||
Capture bottom-first, transfer unknown or varying. Filter selects
|
||||
among ``b`` and ``p`` using image analysis.
|
||||
|
||||
``A``
|
||||
Capture determined by field flags, transfer unknown or varying. Filter
|
||||
selects among ``t``, ``b`` and ``p`` using field flags and image
|
||||
analysis. If no field information is available, then this works just
|
||||
like ``U``. This is the default mode.
|
||||
|
||||
``U``
|
||||
Both capture and transfer unknown or varying. Filter selects among
|
||||
``t``, ``b`` and ``p`` using image analysis only.
|
||||
|
||||
``v``
|
||||
Verbose operation. Prints the selected mode for each frame and the
|
||||
average squared difference between fields for ``t``, ``b``, and ``p``
|
||||
alternatives.
|
||||
|
||||
``yadif=[mode[:enabled=yes|no]]``
|
||||
Yet another deinterlacing filter
|
||||
|
||||
``<mode>``
|
||||
:0: Output 1 frame for each frame.
|
||||
:1: Output 1 frame for each field.
|
||||
:2: Like 0 but skips spatial interlacing check.
|
||||
:3: Like 1 but skips spatial interlacing check.
|
||||
|
||||
``<enabled>``
|
||||
:yes: Filter is active (default).
|
||||
:no: Filter is not active, but can be activated with the ``D`` key
|
||||
(or any other key that toggles the ``deinterlace`` property).
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``yadif`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
This filter, or libavfilter's implementation if available, is automatically
|
||||
inserted when using the ``D`` key (or any other key that toggles the
|
||||
``deinterlace`` property), assuming the video output does not have native
|
||||
deinterlacing support.
|
||||
|
||||
``down3dright[=lines]``
|
||||
Reposition and resize stereoscopic images. Extracts both stereo fields and
|
||||
places them side by side, resizing them to maintain the original movie
|
||||
aspect.
|
||||
|
||||
``<lines>``
|
||||
number of lines to select from the middle of the image (default: 12)
|
||||
|
||||
``delogo[=x:y:w:h:t]``
|
||||
Suppresses a TV station logo by a simple interpolation of the surrounding
|
||||
pixels. Just set a rectangle covering the logo and watch it disappear (and
|
||||
sometimes something even uglier appear - your mileage may vary).
|
||||
|
||||
``<x>,<y>``
|
||||
top left corner of the logo
|
||||
``<w>,<h>``
|
||||
width and height of the cleared rectangle
|
||||
``<t>``
|
||||
Thickness of the fuzzy edge of the rectangle (added to ``w`` and
|
||||
``h``). When set to -1, a green rectangle is drawn on the screen to
|
||||
simplify finding the right ``x``,``y``,``w``,``h`` parameters.
|
||||
``file=<file>``
|
||||
You can specify a text file to load the coordinates from. Each line
|
||||
must have a timestamp (in seconds, and in ascending order) and the
|
||||
``x:y:w:h:t`` coordinates (``t`` can be omitted).
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``delogo`` or ``removelogo`` filters
|
||||
through ``--vf=lavfi`` instead.
|
||||
|
||||
``screenshot``
|
||||
Optional filter for screenshot support. This is only needed if the video
|
||||
output does not provide working direct screenshot support. Note that it is
|
||||
not always safe to insert this filter by default. See `TAKING SCREENSHOTS`_
|
||||
for details.
|
||||
|
||||
``sub=[=bottom-margin:top-margin]``
|
||||
Moves subtitle rendering to an arbitrary point in the filter chain, or force
|
||||
subtitle rendering in the video filter as opposed to using video output OSD
|
||||
support.
|
||||
|
||||
``<bottom-margin>``
|
||||
Adds a black band at the bottom of the frame. The SSA/ASS renderer can
|
||||
place subtitles there (with ``--ass-use-margins``).
|
||||
``<top-margin>``
|
||||
Black band on the top for toptitles (with ``--ass-use-margins``).
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``--vf=sub,eq``
|
||||
Moves sub rendering before the eq filter. This will put both
|
||||
subtitle colors and video under the influence of the video equalizer
|
||||
settings.
|
||||
|
||||
``stereo3d[=in:out]``
|
||||
Stereo3d converts between different stereoscopic image formats.
|
||||
|
||||
``<in>``
|
||||
Stereoscopic image format of input. Possible values:
|
||||
|
||||
``sbsl`` or ``side_by_side_left_first``
|
||||
side by side parallel (left eye left, right eye right)
|
||||
``sbsr`` or ``side_by_side_right_first``
|
||||
side by side crosseye (right eye left, left eye right)
|
||||
``abl`` or ``above_below_left_first``
|
||||
above-below (left eye above, right eye below)
|
||||
``abr`` or ``above_below_right_first``
|
||||
above-below (right eye above, left eye below)
|
||||
``ab2l`` or ``above_below_half_height_left_first``
|
||||
above-below with half height resolution (left eye above, right eye
|
||||
below)
|
||||
``ab2r`` or ``above_below_half_height_right_first``
|
||||
above-below with half height resolution (right eye above, left eye
|
||||
below)
|
||||
|
||||
``<out>``
|
||||
Stereoscopic image format of output. Possible values are all the input
|
||||
formats as well as:
|
||||
|
||||
``arcg`` or ``anaglyph_red_cyan_gray``
|
||||
anaglyph red/cyan gray (red filter on left eye, cyan filter on
|
||||
right eye)
|
||||
``arch`` or ``anaglyph_red_cyan_half_color``
|
||||
anaglyph red/cyan half colored (red filter on left eye, cyan filter
|
||||
on right eye)
|
||||
``arcc`` or ``anaglyph_red_cyan_color``
|
||||
anaglyph red/cyan color (red filter on left eye, cyan filter on
|
||||
right eye)
|
||||
``arcd`` or ``anaglyph_red_cyan_dubois``
|
||||
anaglyph red/cyan color optimized with the least squares
|
||||
projection of dubois (red filter on left eye, cyan filter on right
|
||||
eye)
|
||||
``agmg`` or ``anaglyph_green_magenta_gray``
|
||||
anaglyph green/magenta gray (green filter on left eye, magenta
|
||||
filter on right eye)
|
||||
``agmh`` or ``anaglyph_green_magenta_half_color``
|
||||
anaglyph green/magenta half colored (green filter on left eye,
|
||||
magenta filter on right eye)
|
||||
``agmc`` or ``anaglyph_green_magenta_color``
|
||||
anaglyph green/magenta colored (green filter on left eye, magenta
|
||||
filter on right eye)
|
||||
``aybg`` or ``anaglyph_yellow_blue_gray``
|
||||
anaglyph yellow/blue gray (yellow filter on left eye, blue filter
|
||||
on right eye)
|
||||
``aybh`` or ``anaglyph_yellow_blue_half_color``
|
||||
anaglyph yellow/blue half colored (yellow filter on left eye, blue
|
||||
filter on right eye)
|
||||
``aybc`` or ``anaglyph_yellow_blue_color``
|
||||
anaglyph yellow/blue colored (yellow filter on left eye, blue
|
||||
filter on right eye)
|
||||
``irl`` or ``interleave_rows_left_first``
|
||||
Interleaved rows (left eye has top row, right eye starts on next
|
||||
row)
|
||||
``irr`` or ``interleave_rows_right_first``
|
||||
Interleaved rows (right eye has top row, left eye starts on next
|
||||
row)
|
||||
``ml`` or ``mono_left``
|
||||
mono output (left eye only)
|
||||
``mr`` or ``mono_right``
|
||||
mono output (right eye only)
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``stereo3d`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
``gradfun[=strength[:radius]]``
|
||||
Fix the banding artifacts that are sometimes introduced into nearly flat
|
||||
regions by truncation to 8bit color depth. Interpolates the gradients that
|
||||
should go where the bands are, and dithers them.
|
||||
|
||||
``<strength>``
|
||||
Maximum amount by which the filter will change any one pixel. Also the
|
||||
threshold for detecting nearly flat regions (default: 1.2).
|
||||
|
||||
``<radius>``
|
||||
Neighborhood to fit the gradient to. Larger radius makes for smoother
|
||||
gradients, but also prevents the filter from modifying pixels near
|
||||
detailed regions (default: 16).
|
||||
|
||||
.. note::
|
||||
|
||||
Deprecated. Use libavfilter's ``gradfun`` filter through ``--vf=lavfi``
|
||||
instead.
|
||||
|
||||
``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``.
|
||||
|
||||
``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.
|
||||
@@ -0,0 +1,714 @@
|
||||
VIDEO OUTPUT DRIVERS
|
||||
====================
|
||||
|
||||
Video output drivers are interfaces to different video output facilities. The
|
||||
syntax is:
|
||||
|
||||
``--vo=<driver1[:suboption1[=value]:...],driver2,...[,]>``
|
||||
Specify a priority list of video output drivers to be used.
|
||||
|
||||
If the list has a trailing ',', mpv will fall back on drivers not contained
|
||||
in the list. Suboptions are optional and can mostly be omitted.
|
||||
|
||||
.. note::
|
||||
|
||||
See ``--vo=help`` for a list of compiled-in video output drivers.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``--vo=opengl,xv,``
|
||||
Try the ``opengl`` driver, then the ``xv`` driver, then others.
|
||||
|
||||
Available video output drivers are:
|
||||
|
||||
``xv`` (X11 only)
|
||||
Uses the XVideo extension to enable hardware-accelerated playback. This is
|
||||
the most compatible VO on X, but may be low-quality, and has issues with
|
||||
OSD and subtitle display.
|
||||
For information about what colorkey is used and how it is drawn, run
|
||||
mpv with the ``-v`` option and look out for the lines tagged with ``[xv
|
||||
common]`` at the beginning.
|
||||
|
||||
``adaptor=<number>``
|
||||
Select a specific XVideo adaptor (check xvinfo results).
|
||||
``port=<number>``
|
||||
Select a specific XVideo port.
|
||||
``ck=<cur|use|set>``
|
||||
Select the source from which the colorkey is taken (default: cur).
|
||||
|
||||
cur
|
||||
The default takes the colorkey currently set in Xv.
|
||||
use
|
||||
Use but do not set the colorkey from mpv (use the ``--colorkey``
|
||||
option to change it).
|
||||
set
|
||||
Same as use but also sets the supplied colorkey.
|
||||
|
||||
``ck-method=<man|bg|auto>``
|
||||
Sets the colorkey drawing method (default: man).
|
||||
|
||||
man
|
||||
Draw the colorkey manually (reduces flicker in some cases).
|
||||
bg
|
||||
Set the colorkey as window background.
|
||||
auto
|
||||
Let Xv draw the colorkey.
|
||||
|
||||
``colorkey=<number>``
|
||||
Changes the colorkey to an RGB value of your choice. ``0x000000`` is
|
||||
black and ``0xffffff`` is white.
|
||||
|
||||
``no-colorkey``
|
||||
Disables colorkeying.
|
||||
|
||||
``x11`` (X11 only)
|
||||
Shared memory video output driver without hardware acceleration that works
|
||||
whenever X11 is present.
|
||||
|
||||
.. note:: This is a fallback only, and should not be normally used.
|
||||
|
||||
``vdpau`` (X11 only)
|
||||
Uses the VDPAU interface to display and optionally also decode video.
|
||||
Hardware decoding is used with ``--hwdec=vdpau``.
|
||||
|
||||
``sharpen=<-1-1>``
|
||||
For positive values, apply a sharpening algorithm to the video, for
|
||||
negative values a blurring algorithm (default: 0).
|
||||
``denoise=<0-1>``
|
||||
Apply a noise reduction algorithm to the video (default: 0; no noise
|
||||
reduction).
|
||||
``deint=<-4-4>``
|
||||
Select deinterlacing mode (default: -3). Positive values choose mode
|
||||
and enable deinterlacing. Corresponding negative values select the
|
||||
same deinterlacing mode, but do not enable deinterlacing on startup
|
||||
(useful in configuration files to specify which mode will be enabled by
|
||||
the "D" key). All modes respect ``--field-dominance``.
|
||||
|
||||
0
|
||||
Same as -3.
|
||||
1
|
||||
Show only first field.
|
||||
2
|
||||
Bob deinterlacing.
|
||||
3
|
||||
Motion-adaptive temporal deinterlacing. May lead to A/V desync
|
||||
with slow video hardware and/or high resolution.
|
||||
4
|
||||
Motion-adaptive temporal deinterlacing with edge-guided spatial
|
||||
interpolation. Needs fast video hardware.
|
||||
``chroma-deint``
|
||||
Makes temporal deinterlacers operate both on luma and chroma (default).
|
||||
Use no-chroma-deint to solely use luma and speed up advanced
|
||||
deinterlacing. Useful with slow video memory.
|
||||
``pullup``
|
||||
Try to apply inverse telecine, needs motion adaptive temporal
|
||||
deinterlacing.
|
||||
``hqscaling=<0-9>``
|
||||
0
|
||||
Use default VDPAU scaling (default).
|
||||
1-9
|
||||
Apply high quality VDPAU scaling (needs capable hardware).
|
||||
``fps=<number>``
|
||||
Override autodetected display refresh rate value (the value is needed
|
||||
for framedrop to allow video playback rates higher than display
|
||||
refresh rate, and for vsync-aware frame timing adjustments). Default 0
|
||||
means use autodetected value. A positive value is interpreted as a
|
||||
refresh rate in Hz and overrides the autodetected value. A negative
|
||||
value disables all timing adjustment and framedrop logic.
|
||||
``composite-detect``
|
||||
NVIDIA's current VDPAU implementation behaves somewhat differently
|
||||
under a compositing window manager and does not give accurate frame
|
||||
timing information. With this option enabled, the player tries to
|
||||
detect whether a compositing window manager is active. If one is
|
||||
detected, the player disables timing adjustments as if the user had
|
||||
specified ``fps=-1`` (as they would be based on incorrect input). This
|
||||
means timing is somewhat less accurate than without compositing, but
|
||||
with the composited mode behavior of the NVIDIA driver, there is no
|
||||
hard playback speed limit even without the disabled logic. Enabled by
|
||||
default, use ``no-composite-detect`` to disable.
|
||||
``queuetime_windowed=<number>`` and ``queuetime_fs=<number>``
|
||||
Use VDPAU's presentation queue functionality to queue future video
|
||||
frame changes at most this many milliseconds in advance (default: 50).
|
||||
See below for additional information.
|
||||
``output_surfaces=<2-15>``
|
||||
Allocate this many output surfaces to display video frames (default:
|
||||
3). See below for additional information.
|
||||
|
||||
Using the VDPAU frame queueing functionality controlled by the queuetime
|
||||
options makes mpv's frame flip timing less sensitive to system CPU load and
|
||||
allows mpv to start decoding the next frame(s) slightly earlier, which can
|
||||
reduce jitter caused by individual slow-to-decode frames. However, the
|
||||
NVIDIA graphics drivers can make other window behavior such as window moves
|
||||
choppy if VDPAU is using the blit queue (mainly happens if you have the
|
||||
composite extension enabled) and this feature is active. If this happens on
|
||||
your system and it bothers you then you can set the queuetime value to 0 to
|
||||
disable this feature. The settings to use in windowed and fullscreen mode
|
||||
are separate because there should be no reason to disable this for
|
||||
fullscreen mode (as the driver issue should not affect the video itself).
|
||||
|
||||
You can queue more frames ahead by increasing the queuetime values and the
|
||||
``output_surfaces`` count (to ensure enough surfaces to buffer video for a
|
||||
certain time ahead you need at least as many surfaces as the video has
|
||||
frames during that time, plus two). This could help make video smoother in
|
||||
some cases. The main downsides are increased video RAM requirements for
|
||||
the surfaces and laggier display response to user commands (display
|
||||
changes only become visible some time after they're queued). The graphics
|
||||
driver implementation may also have limits on the length of maximum
|
||||
queuing time or number of queued surfaces that work well or at all.
|
||||
|
||||
``direct3d_shaders`` (Windows only)
|
||||
Video output driver that uses the Direct3D interface.
|
||||
|
||||
``prefer-stretchrect``
|
||||
Use ``IDirect3DDevice9::StretchRect`` over other methods if possible.
|
||||
|
||||
``disable-stretchrect``
|
||||
Never render the video using ``IDirect3DDevice9::StretchRect``.
|
||||
|
||||
``disable-textures``
|
||||
Never render the video using D3D texture rendering. Rendering with
|
||||
textures + shader will still be allowed. Add ``disable-shaders`` to
|
||||
completely disable video rendering with textures.
|
||||
|
||||
``disable-shaders``
|
||||
Never use shaders when rendering video.
|
||||
|
||||
``only-8bit``
|
||||
Never render YUV video with more than 8 bits per component.
|
||||
Using this flag will force software conversion to 8-bit.
|
||||
|
||||
``disable-texture-align``
|
||||
Normally texture sizes are always aligned to 16. With this option
|
||||
enabled, the video texture will always have exactly the same size as
|
||||
the video itself.
|
||||
|
||||
|
||||
Debug options. These might be incorrect, might be removed in the future,
|
||||
might crash, might cause slow downs, etc. Contact the developers if you
|
||||
actually need any of these for performance or proper operation.
|
||||
|
||||
``force-power-of-2``
|
||||
Always force textures to power of 2, even if the device reports
|
||||
non-power-of-2 texture sizes as supported.
|
||||
|
||||
``texture-memory=N``
|
||||
Only affects operation with shaders/texturing enabled, and (E)OSD.
|
||||
Values for N:
|
||||
|
||||
0
|
||||
default, will often use an additional shadow texture + copy
|
||||
1
|
||||
use ``D3DPOOL_MANAGED``
|
||||
2
|
||||
use ``D3DPOOL_DEFAULT``
|
||||
3
|
||||
use ``D3DPOOL_SYSTEMMEM``, but without shadow texture
|
||||
|
||||
``swap-discard``
|
||||
Use ``D3DSWAPEFFECT_DISCARD``, which might be faster.
|
||||
Might be slower too, as it must(?) clear every frame.
|
||||
|
||||
``exact-backbuffer``
|
||||
Always resize the backbuffer to window size.
|
||||
|
||||
``direct3d`` (Windows only)
|
||||
Same as ``direct3d_shaders``, but with the options ``disable-textures``
|
||||
and ``disable-shaders`` forced.
|
||||
|
||||
``corevideo`` (Mac OS X 10.6 and later)
|
||||
Mac OS X CoreVideo video output driver. Uses the CoreVideo APIs to fill
|
||||
PixelBuffers and generate OpenGL textures from them (useful as a fallback
|
||||
for ``opengl``).
|
||||
|
||||
``opengl``
|
||||
OpenGL video output driver. It supports extended scaling methods, dithering
|
||||
and color management.
|
||||
|
||||
By default, it tries to use fast and fail-safe settings. Use the alias
|
||||
``opengl-hq`` to use this driver with defaults set to high quality
|
||||
rendering.
|
||||
|
||||
Requires at least OpenGL 2.1 and the ``GL_ARB_texture_rg`` extension. For
|
||||
older drivers, ``opengl-old`` may work.
|
||||
|
||||
Some features are available with OpenGL 3 capable graphics drivers only
|
||||
(or if the necessary extensions are available).
|
||||
|
||||
``lscale=<filter>``
|
||||
|
||||
``bilinear``
|
||||
Bilinear hardware texture filtering (fastest, mid-quality).
|
||||
This is the default.
|
||||
|
||||
``lanczos2``
|
||||
Lanczos scaling with radius=2. Provides good quality and speed.
|
||||
This is the default when using ``opengl-hq``.
|
||||
|
||||
``lanczos3``
|
||||
Lanczos with radius=3.
|
||||
|
||||
``bicubic_fast``
|
||||
Bicubic filter. Has a blurring effect on the image, even if no
|
||||
scaling is done.
|
||||
|
||||
``sharpen3``
|
||||
Unsharp masking (sharpening) with radius=3 and a default strength
|
||||
of 0.5 (see ``lparam1``).
|
||||
|
||||
``sharpen5``
|
||||
Unsharp masking (sharpening) with radius=5 and a default strength
|
||||
of 0.5 (see ``lparam1``).
|
||||
|
||||
``mitchell``
|
||||
Mitchell-Netravali. The ``b`` and ``c`` parameters can be set with
|
||||
``lparam1`` and ``lparam2``. Both are set to 1/3 by default.
|
||||
|
||||
|
||||
There are some more filters. For a complete list, pass ``help`` as
|
||||
value, e.g.: ``mpv --vo=opengl:lscale=help``
|
||||
|
||||
``lparam1=<value>``
|
||||
Set filter parameters. Ignored if the filter is not tunable. These are
|
||||
unset by default, and use the filter specific default if applicable.
|
||||
|
||||
``lparam2=<value>``
|
||||
See ``lparam1``.
|
||||
|
||||
``scaler-resizes-only``
|
||||
Disable the scaler if the video image is not resized. In that case,
|
||||
``bilinear`` is used instead whatever is set with ``lscale``. Bilinear
|
||||
will reproduce the source image perfectly if no scaling is performed.
|
||||
Note that this option never affects ``cscale``, although the different
|
||||
processing chain might do chroma scaling differently if ``lscale`` is
|
||||
disabled.
|
||||
|
||||
``stereo=<value>``
|
||||
Select a method for stereo display. You may have to use ``--aspect`` to
|
||||
fix the aspect value. Experimental, do not expect too much from it.
|
||||
|
||||
no
|
||||
Normal 2D display
|
||||
red-cyan
|
||||
Convert side by side input to full-color red-cyan stereo.
|
||||
green-magenta
|
||||
Convert side by side input to full-color green-magenta stereo.
|
||||
quadbuffer
|
||||
Convert side by side input to quadbuffered stereo. Only supported
|
||||
by very few OpenGL cards.
|
||||
|
||||
``srgb``
|
||||
Enable gamma-correct scaling by working in linear light. This
|
||||
makes use of sRGB textures and framebuffers.
|
||||
This option forces the options ``indirect`` and ``gamma``.
|
||||
|
||||
.. note::
|
||||
|
||||
for YUV colorspaces, gamma 1/0.45 (2.222) is assumed. RGB input is
|
||||
always assumed to be in sRGB.
|
||||
|
||||
This option is not really useful, as gamma-correct scaling has not much
|
||||
influence on typical video playback. Most visible effect comes from
|
||||
slightly different gamma.
|
||||
|
||||
``pbo``
|
||||
Enable use of PBOs. This is faster, but can sometimes lead to sporadic
|
||||
and temporary image corruption.
|
||||
|
||||
``dither-depth=<N|no|auto>``
|
||||
Set dither target depth to N. Default: no.
|
||||
|
||||
no
|
||||
Disable any dithering done by mpv.
|
||||
auto
|
||||
Automatic selection. If output bit depth cannot be detected,
|
||||
8 bits per component are assumed.
|
||||
8
|
||||
Dither to 8 bit output.
|
||||
|
||||
Note that the depth of the connected video display device can not be
|
||||
detected. Often, LCD panels will do dithering on their own, which
|
||||
conflicts with ``opengl``'s dithering and leads to ugly output.
|
||||
|
||||
``dither-size-fruit=<2-8>``
|
||||
Set the size of the dither matrix (default: 6). The actual size of
|
||||
the matrix is ``(2^N) x (2^N)`` for an option value of ``N``, so a
|
||||
value of 6 gives a size of 64x64. The matrix is generated at startup
|
||||
time, and a large matrix can take rather long to compute (seconds).
|
||||
|
||||
Used in ``dither=fruit`` mode only.
|
||||
|
||||
``dither=<fruit|ordered|no>``
|
||||
Select dithering algorithm (default: fruit).
|
||||
|
||||
``temporal-dither``
|
||||
Enable temporal dithering. (Only active if dithering is enabled in
|
||||
general.) This changes between 8 different dithering pattern on each
|
||||
frame by changing the orientation of the tiled dithering matrix.
|
||||
Unfortunately, this can lead to flicker on LCD displays, since these
|
||||
have a high reaction time.
|
||||
|
||||
``debug``
|
||||
Check for OpenGL errors, i.e. call ``glGetError()``. Also request a
|
||||
debug OpenGL context (which does nothing with current graphics drivers
|
||||
as of this writing).
|
||||
|
||||
``swapinterval=<n>``
|
||||
Interval in displayed frames between two buffer swaps.
|
||||
1 is equivalent to enable VSYNC, 0 to disable VSYNC.
|
||||
|
||||
``no-scale-sep``
|
||||
When using a separable scale filter for luma, usually two filter
|
||||
passes are done. This is often faster. However, it forces
|
||||
conversion to RGB in an extra pass, so it can actually be slower
|
||||
if used with fast filters on small screen resolutions. Using
|
||||
this options will make rendering a single operation.
|
||||
Note that chroma scalers are always done as 1-pass filters.
|
||||
|
||||
``cscale=<n>``
|
||||
As ``lscale``, but for chroma (2x slower with little visible effect).
|
||||
Note that with some scaling filters, upscaling is always done in
|
||||
RGB. If chroma is not subsampled, this option is ignored, and the
|
||||
luma scaler is used instead. Setting this option is often useless.
|
||||
|
||||
``fancy-downscaling``
|
||||
When using convolution based filters, extend the filter size
|
||||
when downscaling. Trades quality for reduced downscaling performance.
|
||||
|
||||
``no-npot``
|
||||
Force use of power-of-2 texture sizes. For debugging only.
|
||||
Borders will be distorted due to filtering.
|
||||
|
||||
``glfinish``
|
||||
Call ``glFinish()`` before swapping buffers
|
||||
|
||||
``sw``
|
||||
Continue even if a software renderer is detected.
|
||||
|
||||
``backend=<sys>``
|
||||
The value ``auto`` (the default) selects the windowing backend. You
|
||||
can also pass ``help`` to get a complete list of compiled in backends
|
||||
(sorted by autoprobe order).
|
||||
|
||||
auto
|
||||
auto-select (default)
|
||||
cocoa
|
||||
Cocoa/OSX
|
||||
win
|
||||
Win32/WGL
|
||||
x11
|
||||
X11/GLX
|
||||
wayland
|
||||
Wayland/EGL
|
||||
|
||||
``indirect``
|
||||
Do YUV conversion and scaling as separate passes. This will first render
|
||||
the video into a video-sized RGB texture, and draw the result on screen.
|
||||
The luma scaler is used to scale the RGB image when rendering to screen.
|
||||
The chroma scaler is used only on YUV conversion, and only if the video
|
||||
is chroma-subsampled (usually the case).
|
||||
This mechanism is disabled on RGB input.
|
||||
Specifying this option directly is generally useful for debugging only.
|
||||
|
||||
``fbo-format=<fmt>``
|
||||
Selects the internal format of textures used for FBOs. The format can
|
||||
influence performance and quality of the video output. (FBOs are not
|
||||
always used, and typically only when using extended scalers.)
|
||||
``fmt`` can be one of: rgb, rgba, rgb8, rgb10, rgb16, rgb16f, rgb32f,
|
||||
rgba12, rgba16, rgba16f, rgba32f.
|
||||
Default: rgb.
|
||||
|
||||
``gamma``
|
||||
Always enable gamma control. (Disables delayed enabling.)
|
||||
|
||||
``icc-profile=<file>``
|
||||
Load an ICC profile and use it to transform linear RGB to screen output.
|
||||
Needs LittleCMS2 support compiled in.
|
||||
|
||||
``icc-cache=<file>``
|
||||
Store and load the 3D LUT created from the ICC profile in this file.
|
||||
This can be used to speed up loading, since LittleCMS2 can take a while
|
||||
to create the 3D LUT. Note that this file contains an uncompressed LUT.
|
||||
Its size depends on the ``3dlut-size``, and can be very big.
|
||||
|
||||
``icc-intent=<value>``
|
||||
0
|
||||
perceptual
|
||||
1
|
||||
relative colorimetric
|
||||
2
|
||||
saturation
|
||||
3
|
||||
absolute colorimetric (default)
|
||||
|
||||
``3dlut-size=<r>x<g>x<b>``
|
||||
Size of the 3D LUT generated from the ICC profile in each dimension.
|
||||
Default is 128x256x64.
|
||||
Sizes must be a power of two, and 256 at most.
|
||||
|
||||
``alpha``
|
||||
Try to create a framebuffer with alpha component. This only makes sense
|
||||
if the video contains alpha information (which is extremely rare). May
|
||||
not be supported on all platforms. If alpha framebuffers are
|
||||
unavailable, it silently falls back on a normal framebuffer. Note
|
||||
that when using FBO indirections (such as with ``opengl-hq``), an FBO
|
||||
format with alpha must be specified with the ``fbo-format`` option.
|
||||
|
||||
``chroma-location=<auto|center|left>``
|
||||
Set the YUV chroma sample location. auto means use the bitstream
|
||||
flags (default: auto).
|
||||
|
||||
``opengl-hq``
|
||||
Same as ``opengl``, but with default settings for high quality rendering.
|
||||
|
||||
This is equivalent to::
|
||||
|
||||
--vo=opengl:lscale=lanczos2:dither-depth=auto:pbo:fbo-format=rgb16
|
||||
|
||||
Note that some cheaper LCDs do dithering that gravely interferes with
|
||||
``opengl``'s dithering. Disabling dithering with ``dither-depth=no`` helps.
|
||||
|
||||
Unlike ``opengl``, ``opengl-hq`` makes use of FBOs by default. Sometimes you
|
||||
can achieve better quality or performance by changing the ``fbo-format``
|
||||
suboption to ``rgb16f``, ``rgb32f`` or ``rgb``. Known problems include
|
||||
Mesa/Intel not accepting ``rgb16``, Mesa sometimes not being compiled with
|
||||
float texture support, and some OSX setups being very slow with ``rgb16``
|
||||
but fast with ``rgb32f``.
|
||||
|
||||
``opengl-old``
|
||||
OpenGL video output driver, old version. Video size must be smaller
|
||||
than the maximum texture size of your OpenGL implementation. Intended to
|
||||
work even with the most basic OpenGL implementations, but also makes use
|
||||
of newer extensions which allow support for more color spaces.
|
||||
|
||||
The code performs very few checks, so if a feature does not work, this
|
||||
might be because it is not supported by your card and/or OpenGL
|
||||
implementation, even if you do not get any error message. Use ``glxinfo``
|
||||
or a similar tool to display the supported OpenGL extensions.
|
||||
|
||||
``(no-)ati-hack``
|
||||
ATI drivers may give a corrupted image when PBOs are used (when using
|
||||
``force-pbo``). This option fixes this, at the expense of using a bit
|
||||
more memory.
|
||||
``(no-)force-pbo``
|
||||
Always uses PBOs to transfer textures even if this involves an extra
|
||||
copy. Currently this gives a little extra speed with NVIDIA drivers
|
||||
and a lot more speed with ATI drivers. May need the ``ati-hack``
|
||||
suboption to work correctly.
|
||||
``(no-)scaled-osd``
|
||||
Scales the OSD and subtitles instead of rendering them at display size
|
||||
(default: disabled).
|
||||
``rectangle=<0,1,2>``
|
||||
Select usage of rectangular textures, which saves video RAM, but often
|
||||
is slower (default: 0).
|
||||
|
||||
0
|
||||
Use power-of-two textures (default).
|
||||
1
|
||||
Use the ``GL_ARB_texture_rectangle`` extension.
|
||||
2
|
||||
Use the ``GL_ARB_texture_non_power_of_two`` extension. In some
|
||||
cases only supported in software and thus very slow.
|
||||
|
||||
``swapinterval=<n>``
|
||||
Minimum interval between two buffer swaps, counted in displayed frames
|
||||
(default: 1). 1 is equivalent to enabling VSYNC, 0 to disabling VSYNC.
|
||||
Values below 0 will leave it at the system default. This limits the
|
||||
framerate to (horizontal refresh rate / n). Requires
|
||||
``GLX_SGI_swap_control`` support to work. With some (most/all?)
|
||||
implementations this only works in fullscreen mode.
|
||||
``ycbcr``
|
||||
Use the ``GL_MESA_ycbcr_texture`` extension to convert YUV to RGB. In
|
||||
most cases this is probably slower than doing software conversion to
|
||||
RGB.
|
||||
``yuv=<n>``
|
||||
Select the type of YUV to RGB conversion. The default is
|
||||
auto-detection deciding between values 0 and 2.
|
||||
|
||||
0
|
||||
Use software conversion. Compatible with all OpenGL versions.
|
||||
Provides brightness, contrast and saturation control.
|
||||
1
|
||||
Same as 2. This used to use NVIDIA-specific extensions, which
|
||||
did not provide any advantages over using fragment programs, except
|
||||
possibly on very ancient graphics cards. It produced a gray-ish
|
||||
output, which is why it has been removed.
|
||||
2
|
||||
Use a fragment program. Needs the ``GL_ARB_fragment_program``
|
||||
extension and at least three texture units. Provides brightness,
|
||||
contrast, saturation and hue control.
|
||||
3
|
||||
Use a fragment program using the ``POW`` instruction. Needs the
|
||||
``GL_ARB_fragment_program`` extension and at least three texture
|
||||
units. Provides brightness, contrast, saturation, hue and gamma
|
||||
control. Gamma can also be set independently for red, green and
|
||||
blue. Method 4 is usually faster.
|
||||
4
|
||||
Use a fragment program with additional lookup. Needs the
|
||||
``GL_ARB_fragment_program`` extension and at least four texture
|
||||
units. Provides brightness, contrast, saturation, hue and gamma
|
||||
control. Gamma can also be set independently for red, green and
|
||||
blue.
|
||||
5
|
||||
Use ATI-specific method (for older cards). This uses an
|
||||
ATI-specific extension (``GL_ATI_fragment_shader`` - not
|
||||
``GL_ARB_fragment_shader``!). At least three texture units are
|
||||
needed. Provides saturation and hue control. This method is fast
|
||||
but inexact.
|
||||
6
|
||||
Use a 3D texture to do conversion via lookup. Needs the
|
||||
``GL_ARB_fragment_program extension`` and at least four texture
|
||||
units. Extremely slow (software emulation) on some (all?) ATI
|
||||
cards since it uses a texture with border pixels. Provides
|
||||
brightness, contrast, saturation, hue and gamma control. Gamma can
|
||||
also be set independently for red, green and blue. Speed depends
|
||||
more on GPU memory bandwidth than other methods.
|
||||
|
||||
``lscale=<n>``
|
||||
Select the scaling function to use for luminance scaling. Only valid
|
||||
for yuv modes 2, 3, 4 and 6.
|
||||
|
||||
0
|
||||
Use simple linear filtering (default).
|
||||
1
|
||||
Use bicubic B-spline filtering (better quality). Needs one
|
||||
additional texture unit. Older cards will not be able to handle
|
||||
this for chroma at least in fullscreen mode.
|
||||
2
|
||||
Use cubic filtering in horizontal, linear filtering in vertical
|
||||
direction. Works on a few more cards than method 1.
|
||||
3
|
||||
Same as 1 but does not use a lookup texture. Might be faster on
|
||||
some cards.
|
||||
4
|
||||
Use experimental unsharp masking with 3x3 support and a default
|
||||
strength of 0.5 (see ``filter-strength``).
|
||||
5
|
||||
Use experimental unsharp masking with 5x5 support and a default
|
||||
strength of 0.5 (see ``filter-strength``).
|
||||
|
||||
``cscale=<n>``
|
||||
Select the scaling function to use for chrominance scaling. For
|
||||
details see ``lscale``.
|
||||
``filter-strength=<value>``
|
||||
Set the effect strength for the ``lscale``/``cscale`` filters that
|
||||
support it.
|
||||
``stereo=<value>``
|
||||
Select a method for stereo display. You may have to use ``--aspect`` to
|
||||
fix the aspect value. Experimental, do not expect too much from it.
|
||||
|
||||
0
|
||||
Normal 2D display
|
||||
1
|
||||
Convert side by side input to full-color red-cyan stereo.
|
||||
2
|
||||
Convert side by side input to full-color green-magenta stereo.
|
||||
3
|
||||
Convert side by side input to quadbuffered stereo. Only supported
|
||||
by very few OpenGL cards.
|
||||
|
||||
The following options are only useful if writing your own fragment programs.
|
||||
|
||||
``customprog=<filename>``
|
||||
Load a custom fragment program from ``<filename>``. See
|
||||
``TOOLS/edgedect.fp`` for an example.
|
||||
``customtex=<filename>``
|
||||
Load a custom "gamma ramp" texture from ``<filename>``. This can be used
|
||||
in combination with ``yuv=4`` or with the ``customprog`` option.
|
||||
``(no-)customtlin``
|
||||
If enabled (default) use ``GL_LINEAR`` interpolation, otherwise use
|
||||
``GL_NEAREST`` for customtex texture.
|
||||
``(no-)customtrect``
|
||||
If enabled, use ``texture_rectangle`` for the ``customtex`` texture.
|
||||
Default is disabled.
|
||||
``(no-)mipmapgen``
|
||||
If enabled, mipmaps for the video are automatically generated. This
|
||||
should be useful together with the ``customprog`` and the ``TXB``
|
||||
instruction to implement blur filters with a large radius. For most
|
||||
OpenGL implementations, this is very slow for any non-RGB formats.
|
||||
Default is disabled.
|
||||
|
||||
Normally there is no reason to use the following options; they mostly
|
||||
exist for testing purposes.
|
||||
|
||||
``(no-)glfinish``
|
||||
Call ``glFinish()`` before swapping buffers. Slower but in some cases
|
||||
more correct output (default: disabled).
|
||||
``(no-)manyfmts``
|
||||
Enables support for more (RGB and BGR) color formats (default: enabled).
|
||||
Needs OpenGL version >= 1.2.
|
||||
``slice-height=<0-...>``
|
||||
Number of lines copied to texture in one piece (default: 0). 0 for
|
||||
whole image.
|
||||
``sw``
|
||||
Continue even if a software renderer is detected.
|
||||
|
||||
``backend=<sys>``
|
||||
auto
|
||||
auto-select (default)
|
||||
cocoa
|
||||
Cocoa/OSX
|
||||
win
|
||||
Win32/WGL
|
||||
x11
|
||||
X11/GLX
|
||||
wayland
|
||||
Wayland/EGL
|
||||
|
||||
``sdl``
|
||||
SDL 2.0+ Render video output driver, depending on system with or without
|
||||
hardware acceleration. Should work on all platforms supported by SDL 2.0.
|
||||
For tuning, refer to your copy of the file ``SDL_hints.h``.
|
||||
|
||||
``sw``
|
||||
Continue even if a software renderer is detected.
|
||||
|
||||
``switch-mode``
|
||||
Instruct SDL to switch the monitor video mode when going fullscreen.
|
||||
|
||||
``null``
|
||||
Produces no video output. Useful for benchmarking.
|
||||
|
||||
``caca``
|
||||
Color ASCII art video output driver that works on a text console.
|
||||
|
||||
``image``
|
||||
Output each frame into an image file in the current directory. Each file
|
||||
takes the frame number padded with leading zeros as name.
|
||||
|
||||
``format=<format>``
|
||||
Select the image file format.
|
||||
|
||||
jpg
|
||||
JPEG files, extension .jpg. (Default.)
|
||||
jpeg
|
||||
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.
|
||||
|
||||
``png-compression=<0-9>``
|
||||
PNG compression factor (speed vs. file size tradeoff) (default: 7)
|
||||
``png-filter=<0-5>``
|
||||
Filter applied prior to PNG compression (0 = none; 1 = sub; 2 = up;
|
||||
3 = average; 4 = Paeth; 5 = mixed) (default: 5)
|
||||
``jpeg-quality=<0-100>``
|
||||
JPEG quality factor (default: 90)
|
||||
``(no-)jpeg-progressive``
|
||||
Specify standard or progressive JPEG (default: no).
|
||||
``(no-)jpeg-baseline``
|
||||
Specify use of JPEG baseline or not (default: yes).
|
||||
``jpeg-optimize=<0-100>``
|
||||
JPEG optimization factor (default: 100)
|
||||
``jpeg-smooth=<0-100>``
|
||||
smooth factor (default: 0)
|
||||
``jpeg-dpi=<1->``
|
||||
JPEG DPI (default: 72)
|
||||
``outdir=<dirname>``
|
||||
Specify the directory to save the image files to (default: ``./``).
|
||||
-2005
File diff suppressed because it is too large.
Load diff
@@ -1,243 +0,0 @@
|
||||
JSON IPC
|
||||
========
|
||||
|
||||
mpv can be controlled by external programs using the JSON-based IPC protocol. It
|
||||
can be enabled by specifying the path to a unix socket using the option
|
||||
``--input-unix-socket``. Clients can connect to this socket and send commands to
|
||||
the player or receive events from it.
|
||||
|
||||
.. warning::
|
||||
|
||||
This is not intended to be a secure network protocol. It is explicitly
|
||||
insecure: there is no authentication, no encryption, and the commands
|
||||
themselves are insecure too. For example, the ``run`` command is exposed,
|
||||
which can run arbitrary system commands. The use-case is controlling the
|
||||
player locally. This is not different from the MPlayer slave protocol.
|
||||
|
||||
Socat example
|
||||
-------------
|
||||
|
||||
You can use the ``socat`` tool to send commands (and receive reply) from the
|
||||
shell. Assuming mpv was started with:
|
||||
|
||||
::
|
||||
|
||||
mpv file.mkv --input-unix-socket=/tmp/mpvsocket
|
||||
|
||||
Then you can control it using socat:
|
||||
|
||||
::
|
||||
|
||||
> echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpvsocket
|
||||
{"data":190.482000,"error":"success"}
|
||||
|
||||
In this case, socat copies data between stdin/stdout and the mpv socket
|
||||
connection.
|
||||
|
||||
See the ``--idle`` option how to make mpv start without exiting immediately or
|
||||
playing a file.
|
||||
|
||||
It's also possible to send input.conf style text-only commands:
|
||||
|
||||
::
|
||||
|
||||
> echo 'show_text ${playback-time}' | socat - /tmp/mpvsocket
|
||||
|
||||
But you won't get a reply over the socket. (This particular command shows the
|
||||
playback time on the player's OSD.)
|
||||
|
||||
Protocol
|
||||
--------
|
||||
|
||||
Clients can execute commands on the player by sending JSON messages of the
|
||||
following form:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["command_name", "param1", "param2", ...] }
|
||||
|
||||
where ``command_name`` is the name of the command to be executed, followed by a
|
||||
list of parameters. Parameters must be formatted as native JSON values
|
||||
(integers, strings, booleans, ...). Every message **must** be terminated with
|
||||
``\n``. Additionally, ``\n`` must not appear anywhere inside the message. In
|
||||
practice this means that messages should be minified before being sent to mpv.
|
||||
|
||||
mpv will then send back a reply indicating whether the command was run
|
||||
correctly, and an additional field holding the command-specific return data (it
|
||||
can also be null).
|
||||
|
||||
::
|
||||
|
||||
{ "error": "success", "data": null }
|
||||
|
||||
mpv will also send events to clients with JSON messages of the following form:
|
||||
|
||||
::
|
||||
|
||||
{ "event": "event_name" }
|
||||
|
||||
where ``event_name`` is the name of the event. Additional event-specific fields
|
||||
can also be present. See `List of events`_ for a list of all supported events.
|
||||
|
||||
Because events can occur at any time, it may be difficult at times to determine
|
||||
which response goes with which command. Commands may optionally include a
|
||||
``request_id`` which, if provided in the command request, will be copied
|
||||
verbatim into the response. mpv does not intrepret the ``request_id`` in any
|
||||
way; it is solely for the use of the requester.
|
||||
|
||||
For example, this request:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["get_property", "time-pos"], "request_id": 100 }
|
||||
|
||||
Would generate this response:
|
||||
|
||||
::
|
||||
|
||||
{ "error": "success", "data": 1.468135, "request_id": 100 }
|
||||
|
||||
All commands, replies, and events are separated from each other with a line
|
||||
break character (``\n``).
|
||||
|
||||
If the first character (after skipping whitespace) is not ``{``, the command
|
||||
will be interpreted as non-JSON text command, as they are used in input.conf
|
||||
(or ``mpv_command_string()`` in the client API). Additionally, line starting
|
||||
with ``#`` and empty lines are ignored.
|
||||
|
||||
Currently, embedded 0 bytes terminate the current line, but you should not
|
||||
rely on this.
|
||||
|
||||
Commands
|
||||
--------
|
||||
|
||||
Additionally to the commands described in `List of Input Commands`_, a few
|
||||
extra commands can also be used as part of the protocol:
|
||||
|
||||
``client_name``
|
||||
Return the name of the client as string. This is the string ``ipc-N`` with
|
||||
N being an integer number.
|
||||
|
||||
``get_time_us``
|
||||
Return the current mpv internal time in microseconds as a number. This is
|
||||
basically the system time, with an arbitrary offset.
|
||||
|
||||
``get_property``
|
||||
Return the value of the given property. The value will be sent in the data
|
||||
field of the replay message.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["get_property", "volume"] }
|
||||
{ "data": 50.0, "error": "success" }
|
||||
|
||||
``get_property_string``
|
||||
Like ``get_property``, but the resulting data will always be a string.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["get_property_string", "volume"] }
|
||||
{ "data": "50.000000", "error": "success" }
|
||||
|
||||
``set_property``
|
||||
Set the given property to the given value. See `Properties`_ for more
|
||||
information about properties.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["set_property", "pause", true] }
|
||||
{ "error": "success" }
|
||||
|
||||
``set_property_string``
|
||||
Like ``set_property``, but the argument value must be passed as string.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["set_property_string", "pause", "yes"] }
|
||||
{ "error": "success" }
|
||||
|
||||
``observe_property``
|
||||
Watch a property for changes. If the given property is changed, then an
|
||||
event of type ``property-change`` will be generated
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["observe_property", 1, "volume"] }
|
||||
{ "error": "success" }
|
||||
{ "event": "property-change", "id": 1, "data": 52.0, "name": "volume" }
|
||||
|
||||
``observe_property_string``
|
||||
Like ``observe_property``, but the resulting data will always be a string.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["observe_property_string", 1, "volume"] }
|
||||
{ "error": "success" }
|
||||
{ "event": "property-change", "id": 1, "data": "52.000000", "name": "volume" }
|
||||
|
||||
``unobserve_property``
|
||||
Undo ``observe_property`` or ``observe_property_string``. This requires the
|
||||
numeric id passed to the observe command as argument.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
{ "command": ["unobserve_property", 1] }
|
||||
{ "error": "success" }
|
||||
|
||||
``request_log_messages``
|
||||
Enable output of mpv log messages. They will be received as events. The
|
||||
parameter to this command is the log-level (see ``mpv_request_log_messages``
|
||||
C API function).
|
||||
|
||||
Log message output is meant for humans only (mostly for debugging).
|
||||
Attempting to retrieve information by parsing these messages will just
|
||||
lead to breakages with future mpv releases. Instead, make a feature request,
|
||||
and ask for a proper event that returns the information you need.
|
||||
|
||||
``enable_event``, ``disable_event``
|
||||
Enables or disables the named event. Mirrors the ``mpv_request_event`` C
|
||||
API function. If the string ``all`` is used instead of an event name, all
|
||||
events are enabled or disabled.
|
||||
|
||||
By default, most events are enabled, and there is not much use for this
|
||||
command.
|
||||
|
||||
``suspend``
|
||||
Suspend the mpv main loop. There is a long-winded explanation of this in
|
||||
the C API function ``mpv_suspend()``. In short, this prevents the player
|
||||
from displaying the next video frame, so that you don't get blocked when
|
||||
trying to access the player.
|
||||
|
||||
``resume``
|
||||
Undo one ``suspend`` call. ``suspend`` increments an internal counter, and
|
||||
``resume`` decrements it. When 0 is reached, the player is actually resumed.
|
||||
|
||||
``get_version``
|
||||
Returns the client API version the C API of the remote mpv instance
|
||||
provides. (Also see ``DOCS/client-api-changes.rst``.)
|
||||
|
||||
UTF-8
|
||||
-----
|
||||
|
||||
Normally, all strings are in UTF-8. Sometimes it can happen that strings are
|
||||
in some broken encoding (often happens with file tags and such, and filenames
|
||||
on many Unixes are not required to be in UTF-8 either). This means that mpv
|
||||
sometimes sends invalid JSON. If that is a problem for the client application's
|
||||
parser, it should filter the raw data for invalid UTF-8 sequences and perform
|
||||
the desired replacement, before feeding the data to its JSON parser.
|
||||
|
||||
mpv will not attempt to construct invalid UTF-8 with broken escape sequences.
|
||||
@@ -1,812 +0,0 @@
|
||||
LUA SCRIPTING
|
||||
=============
|
||||
|
||||
mpv can load Lua scripts. Scripts passed to the ``--script`` option, or found in
|
||||
the ``scripts`` subdirectory of the mpv configuration directory (usually
|
||||
``~/.config/mpv/scripts/``) will be loaded on program start. mpv also appends the
|
||||
``scripts`` subdirectory to the end of Lua's path so you can import scripts from
|
||||
there too. Since it's added to the end, don't name scripts you want to import
|
||||
the same as Lua libraries because they will be overshadowed by them.
|
||||
|
||||
mpv provides the built-in module ``mp``, which contains functions to send
|
||||
commands to the mpv core and to retrieve information about playback state, user
|
||||
settings, file information, and so on.
|
||||
|
||||
These scripts can be used to control mpv in a similar way to slave mode.
|
||||
Technically, the Lua code uses the client API internally.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
A script which leaves fullscreen mode when the player is paused:
|
||||
|
||||
::
|
||||
|
||||
function on_pause_change(name, value)
|
||||
if value == true then
|
||||
mp.set_property("fullscreen", "no")
|
||||
end
|
||||
end
|
||||
mp.observe_property("pause", "bool", on_pause_change)
|
||||
|
||||
|
||||
Details on the script initialization and lifecycle
|
||||
--------------------------------------------------
|
||||
|
||||
Your script will be loaded by the player at program start from the ``scripts``
|
||||
configuration subdirectory, or from a path specified with the ``--script``
|
||||
option. Some scripts are loaded internally (like ``--osc``). Each script runs in
|
||||
its own thread. Your script is first run "as is", and once that is done, the event loop
|
||||
is entered. This event loop will dispatch events received by mpv and call your
|
||||
own event handlers which you have registered with ``mp.register_event``, or
|
||||
timers added with ``mp.add_timeout`` or similar.
|
||||
|
||||
When the player quits, all scripts will be asked to terminate. This happens via
|
||||
a ``shutdown`` event, which by default will make the event loop return. If your
|
||||
script got into an endless loop, mpv will probably behave fine during playback
|
||||
(unless the player is suspended, see ``mp.suspend``), but it won't terminate
|
||||
when quitting, because it's waiting on your script.
|
||||
|
||||
Internally, the C code will call the Lua function ``mp_event_loop`` after
|
||||
loading a Lua script. This function is normally defined by the default prelude
|
||||
loaded before your script (see ``player/lua/defaults.lua`` in the mpv sources).
|
||||
The event loop will wait for events and dispatch events registered with
|
||||
``mp.register_event``. It will also handle timers added with ``mp.add_timeout``
|
||||
and similar (by waiting with a timeout).
|
||||
|
||||
Since mpv 0.6.0, the player will wait until the script is fully loaded before
|
||||
continuing normal operation. The player considers a script as fully loaded as
|
||||
soon as it starts waiting for mpv events (or it exits). In practice this means
|
||||
the player will more or less hang until the script returns from the main chunk
|
||||
(and ``mp_event_loop`` is called), or the script calls ``mp_event_loop`` or
|
||||
``mp.dispatch_events`` directly. This is done to make it possible for a script
|
||||
to fully setup event handlers etc. before playback actually starts. In older
|
||||
mpv versions, this happened asynchronously.
|
||||
|
||||
mp functions
|
||||
------------
|
||||
|
||||
The ``mp`` module is preloaded, although it can be loaded manually with
|
||||
``require 'mp'``. It provides the core client API.
|
||||
|
||||
``mp.command(string)``
|
||||
Run the given command. This is similar to the commands used in input.conf.
|
||||
See `List of Input Commands`_.
|
||||
|
||||
By default, this will show something on the OSD (depending on the command),
|
||||
as if it was used in ``input.conf``. See `Input Command Prefixes`_ how
|
||||
to influence OSD usage per command.
|
||||
|
||||
Returns ``true`` on success, or ``nil, error`` on error.
|
||||
|
||||
``mp.commandv(arg1, arg2, ...)``
|
||||
Similar to ``mp.command``, but pass each command argument as separate
|
||||
parameter. This has the advantage that you don't have to care about
|
||||
quoting and escaping in some cases.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
mp.command("loadfile " .. filename .. " append")
|
||||
mp.commandv("loadfile", filename, "append")
|
||||
|
||||
These two commands are equivalent, except that the first version breaks
|
||||
if the filename contains spaces or certain special characters.
|
||||
|
||||
Note that properties are *not* expanded. You can use either ``mp.command``,
|
||||
the ``expand-properties`` prefix, or the ``mp.get_property`` family of
|
||||
functions.
|
||||
|
||||
Unlike ``mp.command``, this will not use OSD by default either (except
|
||||
for some OSD-specific commands).
|
||||
|
||||
``mp.command_native(table [,def])``
|
||||
Similar to ``mp.commandv``, but pass the argument list as table. This has
|
||||
the advantage that in at least some cases, arguments can be passed as
|
||||
native types.
|
||||
|
||||
Returns a result table on success (usually empty), or ``def, error`` on
|
||||
error. ``def`` is the second parameter provided to the function, and is
|
||||
nil if it's missing.
|
||||
|
||||
``mp.get_property(name [,def])``
|
||||
Return the value of the given property as string. These are the same
|
||||
properties as used in input.conf. See `Properties`_ for a list of
|
||||
properties. The returned string is formatted similar to ``${=name}``
|
||||
(see `Property Expansion`_).
|
||||
|
||||
Returns the string on success, or ``def, error`` on error. ``def`` is the
|
||||
second parameter provided to the function, and is nil if it's missing.
|
||||
|
||||
``mp.get_property_osd(name [,def])``
|
||||
Similar to ``mp.get_property``, but return the property value formatted for
|
||||
OSD. This is the same string as printed with ``${name}`` when used in
|
||||
input.conf.
|
||||
|
||||
Returns the string on success, or ``def, error`` on error. ``def`` is the
|
||||
second parameter provided to the function, and is an empty string if it's
|
||||
missing. Unlike ``get_property()``, assigning the return value to a variable
|
||||
will always result in a string.
|
||||
|
||||
``mp.get_property_bool(name [,def])``
|
||||
Similar to ``mp.get_property``, but return the property value as Boolean.
|
||||
|
||||
Returns a Boolean on success, or ``def, error`` on error.
|
||||
|
||||
``mp.get_property_number(name [,def])``
|
||||
Similar to ``mp.get_property``, but return the property value as number.
|
||||
|
||||
Note that while Lua does not distinguish between integers and floats,
|
||||
mpv internals do. This function simply request a double float from mpv,
|
||||
and mpv will usually convert integer property values to float.
|
||||
|
||||
Returns a number on success, or ``def, error`` on error.
|
||||
|
||||
``mp.get_property_native(name [,def])``
|
||||
Similar to ``mp.get_property``, but return the property value using the best
|
||||
Lua type for the property. Most time, this will return a string, Boolean,
|
||||
or number. Some properties (for example ``chapter-list``) are returned as
|
||||
tables.
|
||||
|
||||
Returns a value on success, or ``def, error`` on error. Note that ``nil``
|
||||
might be a possible, valid value too in some corner cases.
|
||||
|
||||
``mp.set_property(name, value)``
|
||||
Set the given property to the given string value. See ``mp.get_property``
|
||||
and `Properties`_ for more information about properties.
|
||||
|
||||
Returns true on success, or ``nil, error`` on error.
|
||||
|
||||
``mp.set_property_bool(name, value)``
|
||||
Similar to ``mp.set_property``, but set the given property to the given
|
||||
Boolean value.
|
||||
|
||||
``mp.set_property_number(name, value)``
|
||||
Similar to ``mp.set_property``, but set the given property to the given
|
||||
numeric value.
|
||||
|
||||
Note that while Lua does not distinguish between integers and floats,
|
||||
mpv internals do. This function will test whether the number can be
|
||||
represented as integer, and if so, it will pass an integer value to mpv,
|
||||
otherwise a double float.
|
||||
|
||||
``mp.set_property_native(name, value)``
|
||||
Similar to ``mp.set_property``, but set the given property using its native
|
||||
type.
|
||||
|
||||
Since there are several data types which can not represented natively in
|
||||
Lua, this might not always work as expected. For example, while the Lua
|
||||
wrapper can do some guesswork to decide whether a Lua table is an array
|
||||
or a map, this would fail with empty tables. Also, there are not many
|
||||
properties for which it makes sense to use this, instead of
|
||||
``set_property``, ``set_property_bool``, ``set_property_number``.
|
||||
For these reasons, this function should probably be avoided for now, except
|
||||
for properties that use tables natively.
|
||||
|
||||
``mp.get_time()``
|
||||
Return the current mpv internal time in seconds as a number. This is
|
||||
basically the system time, with an arbitrary offset.
|
||||
|
||||
``mp.add_key_binding(key, name|fn [,fn [,flags]])``
|
||||
Register callback to be run on a key binding. The binding will be mapped to
|
||||
the given ``key``, which is a string describing the physical key. This uses
|
||||
the same key names as in input.conf, and also allows combinations
|
||||
(e.g. ``ctrl+a``).
|
||||
|
||||
After calling this function, key presses will cause the function ``fn`` to
|
||||
be called (unless the user remapped the key with another binding).
|
||||
|
||||
The ``name`` argument should be a short symbolic string. It allows the user
|
||||
to remap the key binding via input.conf using the ``script_message``
|
||||
command, and the name of the key binding (see below for
|
||||
an example). The name should be unique across other bindings in the same
|
||||
script - if not, the previous binding with the same name will be
|
||||
overwritten. You can omit the name, in which case a random name is generated
|
||||
internally.
|
||||
|
||||
The last argument is used for optional flags. This is a table, which can
|
||||
have the following entries:
|
||||
|
||||
``repeatable``
|
||||
If set to ``true``, enables key repeat for this specific binding.
|
||||
|
||||
``complex``
|
||||
If set to ``true``, then ``fn`` is called on both key up and down
|
||||
events (as well as key repeat, if enabled), with the first
|
||||
argument being a table. This table has an ``event`` entry, which
|
||||
is set to one of the strings ``down``, ``repeat``, ``up`` or
|
||||
``press`` (the latter if key up/down can't be tracked). It further
|
||||
has an ``is_mouse`` entry, which tells whether the event was caused
|
||||
by a mouse button.
|
||||
|
||||
Internally, key bindings are dispatched via the ``script_message_to`` or
|
||||
``script_binding`` input commands and ``mp.register_script_message``.
|
||||
|
||||
Trying to map multiple commands to a key will essentially prefer a random
|
||||
binding, while the other bindings are not called. It is guaranteed that
|
||||
user defined bindings in the central input.conf are preferred over bindings
|
||||
added with this function (but see ``mp.add_forced_key_binding``).
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
function something_handler()
|
||||
print("the key was pressed")
|
||||
end
|
||||
mp.add_key_binding("x", "something", something_handler)
|
||||
|
||||
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 his input.conf to remap the command to the ``y`` key:
|
||||
|
||||
::
|
||||
|
||||
y script_binding something
|
||||
|
||||
|
||||
This will print the message when the key ``y`` is pressed. (``x`` will
|
||||
still work, unless the user remaps it.)
|
||||
|
||||
You can also explicitly send a message to a named script only. Assume the
|
||||
above script was using the filename ``fooscript.lua``:
|
||||
|
||||
::
|
||||
|
||||
y script_binding fooscript.something
|
||||
|
||||
``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 his
|
||||
input.conf. (``mp.add_key_binding`` overwrites default key bindings only,
|
||||
but not those by the user's input.conf.)
|
||||
|
||||
``mp.remove_key_binding(name)``
|
||||
Remove a key binding added with ``mp.add_key_binding`` or
|
||||
``mp.add_forced_key_binding``. Use the same name as you used when adding
|
||||
the bindings. It's not possible to remove bindings for which you omitted
|
||||
the name.
|
||||
|
||||
``mp.register_event(name, fn)``
|
||||
Call a specific function when an event happens. The event name is a string,
|
||||
and the function fn is a Lua function value.
|
||||
|
||||
Some events have associated data. This is put into a Lua table and passed
|
||||
as argument to fn. The Lua table by default contains a ``name`` field,
|
||||
which is a string containing the event name. If the event has an error
|
||||
associated, the ``error`` field is set to a string describing the error,
|
||||
on success it's not set.
|
||||
|
||||
If multiple functions are registered for the same event, they are run in
|
||||
registration order, which the first registered function running before all
|
||||
the other ones.
|
||||
|
||||
Returns true if such an event exists, false otherwise.
|
||||
|
||||
See `Events`_ and `List of events`_ for details.
|
||||
|
||||
``mp.unregister_event(fn)``
|
||||
Undo ``mp.register_event(..., fn)``. This removes all event handlers that
|
||||
are equal to the ``fn`` parameter. This uses normal Lua ``==`` comparison,
|
||||
so be careful when dealing with closures.
|
||||
|
||||
``mp.observe_property(name, type, fn)``
|
||||
Watch a property for changes. If the property ``name`` is changed, then
|
||||
the function ``fn(name)`` will be called. ``type`` can be ``nil``, or be
|
||||
set to one of ``none``, ``native``, ``bool``, ``string``, or ``number``.
|
||||
``none`` is the same as ``nil``. For all other values, the new value of
|
||||
the property will be passed as second argument to ``fn``, using
|
||||
``mp.get_property_<type>`` to retrieve it. This means if ``type`` is for
|
||||
example ``string``, ``fn`` is roughly called as in
|
||||
``fn(name, mp.get_property_string(name))``.
|
||||
|
||||
If possible, change events are coalesced. If a property is changed a bunch
|
||||
of times in a row, only the last change triggers the change function. (The
|
||||
exact behavior depends on timing and other things.)
|
||||
|
||||
In some cases the function is not called even if the property changes.
|
||||
Whether this can happen depends on the property.
|
||||
|
||||
If the ``type`` is ``none`` or ``nil``, sporadic property change events are
|
||||
possible. This means the change function ``fn`` can be called even if the
|
||||
property doesn't actually change.
|
||||
|
||||
``mp.unobserve_property(fn)``
|
||||
Undo ``mp.observe_property(..., fn)``. This removes all property handlers
|
||||
that are equal to the ``fn`` parameter. This uses normal Lua ``==``
|
||||
comparison, so be careful when dealing with closures.
|
||||
|
||||
``mp.add_timeout(seconds, fn)``
|
||||
Call the given function fn when the given number of seconds has elapsed.
|
||||
Note that the number of seconds can be fractional. For now, the timer's
|
||||
resolution may be as low as 50 ms, although this will be improved in the
|
||||
future.
|
||||
|
||||
This is a one-shot timer: it will be removed when it's fired.
|
||||
|
||||
Returns a timer object. See ``mp.add_periodic_timer`` for details.
|
||||
|
||||
``mp.add_periodic_timer(seconds, fn)``
|
||||
Call the given function periodically. This is like ``mp.add_timeout``, but
|
||||
the timer is re-added after the function fn is run.
|
||||
|
||||
Returns a timer object. The timer object provides the following methods:
|
||||
``stop()``
|
||||
Disable the timer. Does nothing if the timer is already disabled.
|
||||
This will remember the current elapsed time when stopping, so that
|
||||
``resume()`` essentially unpauses the timer.
|
||||
|
||||
``kill()``
|
||||
Disable the timer. Resets the elapsed time. ``resume()`` will
|
||||
restart the timer.
|
||||
|
||||
``resume()``
|
||||
Restart the timer. If the timer was disabled with ``stop()``, this
|
||||
will resume at the time it was stopped. If the timer was disabled
|
||||
with ``kill()``, or if it's a previously fired one-shot timer (added
|
||||
with ``add_timeout()``), this starts the timer from the beginning,
|
||||
using the initially configured timeout.
|
||||
|
||||
``timeout`` (RW)
|
||||
This field contains the current timeout period. This value is not
|
||||
updated as time progresses. It's only used to calculate when the
|
||||
timer should fire next when the timer expires.
|
||||
|
||||
If you write this, you can call ``t:kill() ; t:resume()`` to reset
|
||||
the current timeout to the new one. (``t:stop()`` won't use the
|
||||
new timeout.)
|
||||
|
||||
``oneshot`` (RW)
|
||||
Whether the timer is periodic (``false``) or fires just once
|
||||
(``true``). This value is used when the timer expires (but before
|
||||
the timer callback function fn is run).
|
||||
|
||||
Note that these are method, and you have to call them using ``:`` instead
|
||||
of ``.`` (Refer to http://www.lua.org/manual/5.2/manual.html#3.4.9 .)
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
seconds = 0
|
||||
timer = mp.add_periodic_timer(1, function()
|
||||
print("called every second")
|
||||
# stop it after 10 seconds
|
||||
seconds = seconds + 1
|
||||
if seconds >= 10 then
|
||||
timer:kill()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
``mp.get_opt(key)``
|
||||
Return a setting from the ``--script-opts`` option. It's up to the user and
|
||||
the script how this mechanism is used. Currently, all scripts can access
|
||||
this equally, so you should be careful about collisions.
|
||||
|
||||
``mp.get_script_name()``
|
||||
Return the name of the current script. The name is usually made of the
|
||||
filename of the script, with directory and file extension removed. If
|
||||
there are several script which would have the same name, it's made unique
|
||||
by appending a number.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
The script ``/path/to/fooscript.lua`` becomes ``fooscript``.
|
||||
|
||||
``mp.osd_message(text [,duration])``
|
||||
Show an OSD message on the screen. ``duration`` is in seconds, and is
|
||||
optional (uses ``--osd-duration`` by default).
|
||||
|
||||
Advanced mp functions
|
||||
---------------------
|
||||
|
||||
These also live in the ``mp`` module, but are documented separately as they
|
||||
are useful only in special situations.
|
||||
|
||||
``mp.suspend()``
|
||||
Suspend the mpv main loop. There is a long-winded explanation of this in
|
||||
the C API function ``mpv_suspend()``. In short, this prevents the player
|
||||
from displaying the next video frame, so that you don't get blocked when
|
||||
trying to access the player.
|
||||
|
||||
This is automatically called by the event handler.
|
||||
|
||||
``mp.resume()``
|
||||
Undo one ``mp.suspend()`` call. ``mp.suspend()`` increments an internal
|
||||
counter, and ``mp.resume()`` decrements it. When 0 is reached, the player
|
||||
is actually resumed.
|
||||
|
||||
``mp.resume_all()``
|
||||
This resets the internal suspend counter and resumes the player. (It's
|
||||
like calling ``mp.resume()`` until the player is actually resumed.)
|
||||
|
||||
You might want to call this if you're about to do something that takes a
|
||||
long time, but doesn't really need access to the player (like a network
|
||||
operation). Note that you still can access the player at any time.
|
||||
|
||||
``mp.get_wakeup_pipe()``
|
||||
Calls ``mpv_get_wakeup_pipe()`` and returns the read end of the wakeup
|
||||
pipe. (See ``client.h`` for details.)
|
||||
|
||||
``mp.get_next_timeout()``
|
||||
Return the relative time in seconds when the next timer (``mp.add_timeout``
|
||||
and similar) expires. If there is no timer, return ``nil``.
|
||||
|
||||
``mp.dispatch_events([allow_wait])``
|
||||
This can be used to run custom event loops. If you want to have direct
|
||||
control what the Lua script does (instead of being called by the default
|
||||
event loop), you can set the global variable ``mp_event_loop`` to your
|
||||
own function running the event loop. From your event loop, you should call
|
||||
``mp.dispatch_events()`` to dequeue and dispatch mpv events.
|
||||
|
||||
If the ``allow_wait`` parameter is set to ``true``, the function will block
|
||||
until the next event is received or the next timer expires. Otherwise (and
|
||||
this is the default behavior), it returns as soon as the event loop is
|
||||
emptied. It's strongly recommended to use ``mp.get_next_timeout()`` and
|
||||
``mp.get_wakeup_pipe()`` if you're interested in properly working
|
||||
notification of new events and working timers.
|
||||
|
||||
This function calls ``mp.suspend()`` and ``mp.resume_all()`` on its own.
|
||||
|
||||
``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,
|
||||
you can set the minimum log level of messages which should be received with
|
||||
the ``log-message`` event. See the description of this event for details.
|
||||
The level is a string, see ``msg.log`` for allowed log levels.
|
||||
|
||||
``mp.register_script_message(name, fn)``
|
||||
This is a helper to dispatch ``script_message`` or ``script_message_to``
|
||||
invocations to Lua functions. ``fn`` is called if ``script_message`` or
|
||||
``script_message_to`` (with this script as destination) is run
|
||||
with ``name`` as first parameter. The other parameters are passed to ``fn``.
|
||||
If a message with the given name is already registered, it's overwritten.
|
||||
|
||||
Used by ``mp.add_key_binding``, so be careful about name collisions.
|
||||
|
||||
``mp.unregister_script_message(name)``
|
||||
Undo a previous registration with ``mp.register_script_message``. Does
|
||||
nothing if the ``name`` wasn't registered.
|
||||
|
||||
mp.msg functions
|
||||
----------------
|
||||
|
||||
This module allows outputting messages to the terminal, and can be loaded
|
||||
with ``require 'mp.msg'``.
|
||||
|
||||
``msg.log(level, ...)``
|
||||
The level parameter is the message priority. It's a string and one of
|
||||
``fatal``, ``error``, ``warn``, ``info``, ``v``, ``debug``. The user's
|
||||
settings will determine which of these messages will be visible. Normally,
|
||||
all messages are visible, except ``v`` and ``debug``.
|
||||
|
||||
The parameters after that are all converted to strings. Spaces are inserted
|
||||
to separate multiple parameters.
|
||||
|
||||
You don't need to add newlines.
|
||||
|
||||
``msg.fatal(...)``, ``msg.error(...)``, ``msg.warn(...)``, ``msg.info(...)``, ``msg.verbose(...)``, ``msg.debug(...)``
|
||||
All of these are shortcuts and equivalent to the corresponding
|
||||
``msg.log(level, ...)`` call.
|
||||
|
||||
mp.options functions
|
||||
--------------------
|
||||
|
||||
mpv comes with a built-in module to manage options from config-files and the
|
||||
command-line. All you have to do is to supply a table with default options to
|
||||
the read_options function. The function will overwrite the default values
|
||||
with values found in the config-file and the command-line (in that order).
|
||||
|
||||
``options.read_options(table [, identifier])``
|
||||
A ``table`` with key-value pairs. The type of the default values is
|
||||
important for converting the values read from the config file or
|
||||
command-line back. Do not use ``nil`` as a default value!
|
||||
|
||||
The ``identifier`` is used to identify the config-file and the command-line
|
||||
options. These needs to unique to avoid collisions with other scripts.
|
||||
Defaults to ``mp.get_script_name()``.
|
||||
|
||||
|
||||
Example implementation::
|
||||
|
||||
require 'mp.options'
|
||||
local options = {
|
||||
optionA = "defaultvalueA",
|
||||
optionB = -0.5,
|
||||
optionC = true,
|
||||
}
|
||||
read_options(options, "myscript")
|
||||
print(options.optionA)
|
||||
|
||||
|
||||
The config file will be stored in ``lua-settings/identifier.conf`` in mpv's user
|
||||
folder. Comment lines can be started with # and stray spaces are not removed.
|
||||
Boolean values will be represented with yes/no.
|
||||
|
||||
Example config::
|
||||
|
||||
# comment
|
||||
optionA=Hello World
|
||||
optionB=9999
|
||||
optionC=no
|
||||
|
||||
|
||||
Command-line options are read from the ``--script-opts`` parameter. To avoid
|
||||
collisions, all keys have to be prefixed with ``identifier-``.
|
||||
|
||||
Example command-line::
|
||||
|
||||
--script-opts=myscript-optionA=TEST,myscript-optionB=0,myscript-optionC=yes
|
||||
|
||||
|
||||
mp.utils options
|
||||
----------------
|
||||
|
||||
This built-in module provides generic helper functions for Lua, and have
|
||||
strictly speaking nothing to do with mpv or video/audio playback. They are
|
||||
provided for convenience. Most compensate for Lua's scarce standard library.
|
||||
|
||||
Be warned that any of these functions might disappear any time. They are not
|
||||
strictly part of the guaranteed API.
|
||||
|
||||
``utils.getcwd()``
|
||||
Returns the directory that mpv was launched from. On error, ``nil, error``
|
||||
is returned.
|
||||
|
||||
``utils.readdir(path [, filter])``
|
||||
Enumerate all entries at the given path on the filesystem, and return them
|
||||
as array. Each entry is a directory entry (without the path).
|
||||
The list is unsorted (in whatever order the operating system returns it).
|
||||
|
||||
If the ``filter`` argument is given, it must be one of the following
|
||||
strings:
|
||||
|
||||
``files``
|
||||
List regular files only. This excludes directories, special files
|
||||
(like UNIX device files or FIFOs), and dead symlinks. It includes
|
||||
UNIX symlinks to regular files.
|
||||
|
||||
``dirs``
|
||||
List directories only, or symlinks to directories. ``.`` and ``..``
|
||||
are not included.
|
||||
|
||||
``normal``
|
||||
Include the results of both ``files`` and ``dirs``. (This is the
|
||||
default.)
|
||||
|
||||
``all``
|
||||
List all entries, even device files, dead symlinks, FIFOs, and the
|
||||
``.`` and ``..`` entries.
|
||||
|
||||
On error, ``nil, error`` is returned.
|
||||
|
||||
``utils.split_path(path)``
|
||||
Split a path into directory component and filename component, and return
|
||||
them. The first return value is always the directory. The second return
|
||||
value is the trailing part of the path, the directory entry.
|
||||
|
||||
``utils.join_path(p1, p2)``
|
||||
Return the concatenation of the 2 paths. Tries to be clever. For example,
|
||||
if ```p2`` is an absolute path, p2 is returned without change.
|
||||
|
||||
``utils.subprocess(t)``
|
||||
Runs an external process and waits until it exits. Returns process status
|
||||
and the captured output.
|
||||
|
||||
The parameter ``t`` is a table. The function reads the following entries:
|
||||
|
||||
``args``
|
||||
Array of strings. The first array entry is the executable. This
|
||||
can be either an absolute path, or a filename with no path
|
||||
components, in which case the ``PATH`` environment variable is
|
||||
used to resolve the executable. The other array elements are
|
||||
passed as command line arguments.
|
||||
|
||||
``cancellable``
|
||||
Optional. If set to ``true`` (default), then if the user stops
|
||||
playback or goes to the next file while the process is running,
|
||||
the process will be killed.
|
||||
|
||||
``max_size``
|
||||
Optional. The maximum size in bytes of the data that can be captured
|
||||
from stdout. (Default: 16 MB.)
|
||||
|
||||
The function returns a table as result with the following entries:
|
||||
|
||||
``status``
|
||||
The raw exit status of the process. It will be negative on error.
|
||||
|
||||
``stdout``
|
||||
Captured output stream as string, limited to ``max_size``.
|
||||
|
||||
``error``
|
||||
``nil`` on success. The string ``killed`` if the process was
|
||||
terminated in an unusual way. The string ``init`` if the process
|
||||
could not be started.
|
||||
|
||||
On Windows, ``killed`` is only returned when the process has been
|
||||
killed by mpv as a result of ``cancellable`` being set to ``true``.
|
||||
|
||||
``killed_by_us``
|
||||
Set to ``true`` if the process has been killed by mpv as a result
|
||||
of ``cancellable`` being set to ``true``.
|
||||
|
||||
In all cases, ``mp.resume_all()`` is implicitly called.
|
||||
|
||||
``utils.parse_json(str [, trail])``
|
||||
Parses the given string argument as JSON, and returns it as a Lua table. On
|
||||
error, returns ``nil, error``. (Currently, ``error`` is just a string
|
||||
reading ``error``, because there is no fine-grained error reporting of any
|
||||
kind.)
|
||||
|
||||
The returned value uses similar conventions as ``mp.get_property_native()``
|
||||
to distinguish empty objects and arrays.
|
||||
|
||||
If the ``trail`` parameter is ``true`` (or any value equal to ``true``),
|
||||
then trailing non-whitespace text is tolerated by the function, and the
|
||||
trailing text is returned as 3rd return value. (The 3rd return value is
|
||||
always there, but with ``trail`` set, no error is raised.)
|
||||
|
||||
``utils.format_json(v)``
|
||||
Format the given Lua table (or value) as a JSON string and return it. On
|
||||
error, returns ``nil, error``. (Errors usually only happen on value types
|
||||
incompatible with JSON.)
|
||||
|
||||
The argument value uses similar conventions as ``mp.set_property_native()``
|
||||
to distinguish empty objects and arrays.
|
||||
|
||||
``utils.to_string(v)``
|
||||
Turn the given value into a string. Formats tables and their contents. This
|
||||
doesn't do anything special; it is only needed because Lua is terrible.
|
||||
|
||||
Events
|
||||
------
|
||||
|
||||
Events are notifications from player core to scripts. You can register an
|
||||
event handler with ``mp.register_event``.
|
||||
|
||||
Note that all scripts (and other parts of the player) receive events equally,
|
||||
and there's no such thing as blocking other scripts from receiving events.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
function my_fn(event)
|
||||
print("start of playback!")
|
||||
end
|
||||
|
||||
mp.register_event("file-loaded", my_fn)
|
||||
|
||||
|
||||
|
||||
List of events
|
||||
--------------
|
||||
|
||||
``start-file``
|
||||
Happens right before a new file is loaded. When you receive this, the
|
||||
player is loading the file (or possibly already done with it).
|
||||
|
||||
``end-file``
|
||||
Happens after a file was unloaded. Typically, the player will load the
|
||||
next file right away, or quit if this was the last file.
|
||||
|
||||
The event has the ``reason`` field, which takes one of these values:
|
||||
|
||||
``eof``
|
||||
The file has ended. This can (but doesn't have to) include
|
||||
incomplete files or broken network connections under
|
||||
circumstances.
|
||||
|
||||
``stop``
|
||||
Playback was ended by a command.
|
||||
|
||||
``quit``
|
||||
Playback was ended by sending the quit command.
|
||||
|
||||
``error``
|
||||
An error happened. In this case, an ``error`` field is present with
|
||||
the error string.
|
||||
|
||||
``redirect``
|
||||
Happens with playlists and similar. Details see
|
||||
``MPV_END_FILE_REASON_REDIRECT`` in the C API.
|
||||
|
||||
``unknown``
|
||||
Unknown. Normally doesn't happen, unless the Lua API is out of sync
|
||||
with the C API. (Likewise, it could happen that your script gets
|
||||
reason strings that did not exist yet at the time your script was
|
||||
written.)
|
||||
|
||||
``file-loaded``
|
||||
Happens after a file was loaded and begins playback.
|
||||
|
||||
``seek``
|
||||
Happens on seeking. (This might include cases when the player seeks
|
||||
internally, even without user interaction. This includes e.g. segment
|
||||
changes when playing ordered chapters Matroska files.)
|
||||
|
||||
``playback-restart``
|
||||
Start of playback after seek or after file was loaded.
|
||||
|
||||
``idle``
|
||||
Idle mode is entered. This happens when playback ended, and the player was
|
||||
started with ``--idle`` or ``--force-window``. This mode is implicitly ended
|
||||
when the ``start-file`` or ``shutdown`` events happen.
|
||||
|
||||
``tick``
|
||||
Called after a video frame was displayed. This is a hack, and you should
|
||||
avoid using it. Use timers instead and maybe watch pausing/unpausing events
|
||||
to avoid wasting CPU when the player is paused.
|
||||
|
||||
``shutdown``
|
||||
Sent when the player quits, and the script should terminate. Normally
|
||||
handled automatically. See `Details on the script initialization and lifecycle`_.
|
||||
|
||||
``log-message``
|
||||
Receives messages enabled with ``mp.enable_messages``. The message data
|
||||
is contained in the table passed as first parameter to the event handler.
|
||||
The table contains, in addition to the default event fields, the following
|
||||
fields:
|
||||
|
||||
``prefix``
|
||||
The module prefix, identifies the sender of the message. This is what
|
||||
the terminal player puts in front of the message text when using the
|
||||
``--v`` option, and is also what is used for ``--msg-level``.
|
||||
|
||||
``level``
|
||||
The log level as string. See ``msg.log`` for possible log level names.
|
||||
Note that later versions of mpv might add new levels or remove
|
||||
(undocumented) existing ones.
|
||||
|
||||
``text``
|
||||
The log message. The text will end with a newline character. Sometimes
|
||||
it can contain multiple lines.
|
||||
|
||||
Keep in mind that these messages are meant to be hints for humans. You
|
||||
should not parse them, and prefix/level/text of messages might change
|
||||
any time.
|
||||
|
||||
``get-property-reply``
|
||||
Undocumented (not useful for Lua scripts).
|
||||
|
||||
``set-property-reply``
|
||||
Undocumented (not useful for Lua scripts).
|
||||
|
||||
``command-reply``
|
||||
Undocumented (not useful for Lua scripts).
|
||||
|
||||
``client-message``
|
||||
Undocumented (used internally).
|
||||
|
||||
``video-reconfig``
|
||||
Happens on video output or filter reconfig.
|
||||
|
||||
``audio-reconfig``
|
||||
Happens on audio output or filter reconfig.
|
||||
|
||||
The following events also happen, but are deprecated: ``tracks-changed``,
|
||||
``track-switched``, ``pause``, ``unpause``, ``metadata-update``,
|
||||
``chapter-change``. Use ``mp.observe_property()`` instead.
|
||||
|
||||
Extras
|
||||
------
|
||||
|
||||
This documents experimental features, or features that are "too special" to
|
||||
guarantee a stable interface.
|
||||
|
||||
``mp.add_hook(type, priority, fn)``
|
||||
Add a hook callback for ``type`` (a string identifying a certain kind of
|
||||
hook). These hooks allow the player to call script functions and wait for
|
||||
their result (normally, the Lua scripting interface is asynchronous from
|
||||
the point of view of the player core). ``priority`` is an arbitrary integer
|
||||
that allows ordering among hooks of the same kind. Using the value 50 is
|
||||
recommended as neutral default value. ``fn`` is the function that will be
|
||||
called during execution of the hook.
|
||||
|
||||
See `Hooks`_ for currently existing hooks and what they do - only the hook
|
||||
list is interesting; handling hook execution is done by the Lua script
|
||||
function automatically.
|
||||
@@ -1,953 +0,0 @@
|
||||
mpv
|
||||
###
|
||||
|
||||
##############
|
||||
a media player
|
||||
##############
|
||||
|
||||
:Copyright: GPLv2+
|
||||
:Manual section: 1
|
||||
:Manual group: multimedia
|
||||
|
||||
SYNOPSIS
|
||||
========
|
||||
|
||||
| **mpv** [options] [file|URL|PLAYLIST|-]
|
||||
| **mpv** [options] files
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
**mpv** is a media player based on MPlayer and mplayer2. It supports a wide variety of video
|
||||
file formats, audio and video codecs, and subtitle types. Special input URL
|
||||
types are available to read input from a variety of sources other than disk
|
||||
files. Depending on platform, a variety of different video and audio output
|
||||
methods are supported.
|
||||
|
||||
Usage examples to get you started quickly can be found at the end of this man
|
||||
page.
|
||||
|
||||
|
||||
INTERACTIVE CONTROL
|
||||
===================
|
||||
|
||||
mpv has a fully configurable, command-driven control layer which allows you
|
||||
to control mpv using keyboard, mouse, or remote control (there is no
|
||||
LIRC support - configure remotes as input devices instead).
|
||||
|
||||
See the ``--input-`` options for ways to customize it.
|
||||
|
||||
Keyboard Control
|
||||
----------------
|
||||
|
||||
LEFT and RIGHT
|
||||
Seek backward/forward 5 seconds. Shift+arrow does a 1 second exact seek
|
||||
(see ``--hr-seek``).
|
||||
|
||||
UP and DOWN
|
||||
Seek forward/backward 1 minute. Shift+arrow does a 5 second exact seek (see
|
||||
``--hr-seek``).
|
||||
|
||||
Ctrl+LEFT and Ctrl+RIGHT
|
||||
Seek to the previous/next subtitle. Subject to some restrictions and
|
||||
might not work always; see ``sub_seek`` command.
|
||||
|
||||
[ and ]
|
||||
Decrease/increase current playback speed by 10%.
|
||||
|
||||
{ and }
|
||||
Halve/double current playback speed.
|
||||
|
||||
BACKSPACE
|
||||
Reset playback speed to normal.
|
||||
|
||||
< and >
|
||||
Go backward/forward in the playlist.
|
||||
|
||||
ENTER
|
||||
Go forward in the playlist.
|
||||
|
||||
p / SPACE
|
||||
Pause (pressing again unpauses).
|
||||
|
||||
\.
|
||||
Step forward. Pressing once will pause, every consecutive press will
|
||||
play one frame and then go into pause mode again.
|
||||
|
||||
,
|
||||
Step backward. Pressing once will pause, every consecutive press will
|
||||
play one frame in reverse and then go into pause mode again.
|
||||
|
||||
q
|
||||
Stop playing and quit.
|
||||
|
||||
Q
|
||||
Like ``q``, but store the current playback position. Playing the same file
|
||||
later will resume at the old playback position if possible.
|
||||
|
||||
/ and *
|
||||
Decrease/increase volume.
|
||||
|
||||
9 and 0
|
||||
Decrease/increase volume.
|
||||
|
||||
m
|
||||
Mute sound.
|
||||
|
||||
\_
|
||||
Cycle through the available video tracks.
|
||||
|
||||
\#
|
||||
Cycle through the available audio tracks.
|
||||
|
||||
f
|
||||
Toggle fullscreen (see also ``--fs``).
|
||||
|
||||
ESC
|
||||
Exit fullscreen mode.
|
||||
|
||||
T
|
||||
Toggle stay-on-top (see also ``--ontop``).
|
||||
|
||||
w and e
|
||||
Decrease/increase pan-and-scan range.
|
||||
|
||||
o (also P)
|
||||
Show progression bar, elapsed time and total duration on the OSD.
|
||||
|
||||
O
|
||||
Toggle OSD states between normal and playback time/duration.
|
||||
|
||||
v
|
||||
Toggle subtitle visibility.
|
||||
|
||||
j and J
|
||||
Cycle through the available subtitles.
|
||||
|
||||
x and z
|
||||
Adjust subtitle delay by +/- 0.1 seconds.
|
||||
|
||||
l
|
||||
Set/clear A-B loop points. See ``ab_loop`` command for details.
|
||||
|
||||
L
|
||||
Toggle infinite looping.
|
||||
|
||||
Ctrl + and Ctrl -
|
||||
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
|
||||
``--ass-style-override`` for more info.
|
||||
|
||||
V
|
||||
Toggle subtitle VSFilter aspect compatibility mode. See
|
||||
``--ass-vsfilter-aspect-compat`` for more info.
|
||||
|
||||
r and t
|
||||
Move subtitles up/down.
|
||||
|
||||
s
|
||||
Take a screenshot.
|
||||
|
||||
S
|
||||
Take a screenshot, without subtitles. (Whether this works depends on VO
|
||||
driver support.)
|
||||
|
||||
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
|
||||
``--chapter-seek-threshold``.
|
||||
|
||||
Shift+PGUP and Shift+PGDWN
|
||||
Seek backward or forward by 10 minutes. (This used to be mapped to
|
||||
PGUP/PGDWN without Shift.)
|
||||
|
||||
d
|
||||
Activate/deactivate deinterlacer.
|
||||
|
||||
A
|
||||
Cycle aspect ratio override.
|
||||
|
||||
(The following keys are valid only when using a video output that supports the
|
||||
corresponding adjustment, or the software equalizer (``--vf=eq``).)
|
||||
|
||||
1 and 2
|
||||
Adjust contrast.
|
||||
|
||||
3 and 4
|
||||
Adjust brightness.
|
||||
|
||||
5 and 6
|
||||
Adjust gamma.
|
||||
|
||||
7 and 8
|
||||
Adjust saturation.
|
||||
|
||||
(The following keys are valid only on OS X.)
|
||||
|
||||
command + 0
|
||||
Resize video window to half its original size.
|
||||
(On other platforms, you can bind keys to change the ``window-scale``
|
||||
property.)
|
||||
|
||||
command + 1
|
||||
Resize video window to its original size.
|
||||
|
||||
command + 2
|
||||
Resize video window to double its original size.
|
||||
|
||||
command + f
|
||||
Toggle fullscreen (see also ``--fs``).
|
||||
|
||||
command + [ and command + ]
|
||||
Set video window alpha.
|
||||
|
||||
(The following keys are valid if you have a keyboard with multimedia keys.)
|
||||
|
||||
PAUSE
|
||||
Pause.
|
||||
|
||||
STOP
|
||||
Stop playing and quit.
|
||||
|
||||
PREVIOUS and NEXT
|
||||
Seek backward/forward 1 minute.
|
||||
|
||||
(The following keys are only valid if you compiled with TV or DVB input
|
||||
support.)
|
||||
|
||||
h and k
|
||||
Select previous/next channel.
|
||||
|
||||
Mouse Control
|
||||
-------------
|
||||
|
||||
button 3 and button 4
|
||||
Seek backward/forward 1 minute.
|
||||
|
||||
button 5 and button 6
|
||||
Decrease/increase volume.
|
||||
|
||||
|
||||
USAGE
|
||||
=====
|
||||
|
||||
Every *flag* option has a *no-flag* counterpart, e.g. the opposite of the
|
||||
``--fs`` option is ``--no-fs``. ``--fs=yes`` is same as ``--fs``, ``--fs=no``
|
||||
is the same as ``--no-fs``.
|
||||
|
||||
If an option is marked as *(XXX only)*, it will only work in combination with
|
||||
the *XXX* option or if *XXX* is compiled in.
|
||||
|
||||
Escaping spaces and other special characters
|
||||
--------------------------------------------
|
||||
|
||||
Keep in mind that the shell will partially parse and mangle the arguments you
|
||||
pass to mpv. For example, you might need to quote or escape options and
|
||||
filenames:
|
||||
|
||||
``mpv "filename with spaces.mkv" --title="window title"``
|
||||
|
||||
It gets more complicated if the suboption parser is involved. The suboption
|
||||
parser puts several options into a single string, and passes them to a
|
||||
component at once, instead of using multiple options on the level of the
|
||||
command line.
|
||||
|
||||
The suboption parser can quote strings with ``"``, ``'``, and ``[...]``.
|
||||
Additionally, there is a special form of quoting with ``%n%`` described below.
|
||||
|
||||
For example, the ``opengl`` VO can take multiple options:
|
||||
|
||||
``mpv test.mkv --vo=opengl:scale=lanczos:icc-profile=file.icc,xv``
|
||||
|
||||
This passes ``scale=lanczos`` and ``icc-profile=file.icc`` to ``opengl``,
|
||||
and also specifies ``xv`` as fallback VO. If the icc-profile path contains
|
||||
spaces or characters like ``,`` or ``:``, you need to quote them:
|
||||
|
||||
``mpv '--vo=opengl:icc-profile="file with spaces.icc",xv'``
|
||||
|
||||
Shells may actually strip some quotes from the string passed to the commandline,
|
||||
so the example quotes the string twice, ensuring that mpv receives the ``"``
|
||||
quotes.
|
||||
|
||||
The ``[...]`` form of quotes wraps everything between ``[`` and ``]``. It's
|
||||
useful with shells that don't interpret these characters in the middle of
|
||||
an argument (like bash). These quotes are balanced (since mpv 0.9.0): the ``[``
|
||||
and ``]`` nest, and the quote terminates on the last ``]`` that has no matching
|
||||
``[`` within the string. (For example, ``[a[b]c]`` results in ``a[b]c``.)
|
||||
|
||||
The fixed-length quoting syntax is intended for use with external
|
||||
scripts and programs.
|
||||
|
||||
It is started with ``%`` and has the following format::
|
||||
|
||||
%n%string_of_length_n
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``mpv --ao=pcm:file=%10%C:test.wav test.avi``
|
||||
|
||||
Or in a script:
|
||||
|
||||
``mpv --ao=pcm:file=%`expr length "$NAME"`%"$NAME" test.avi``
|
||||
|
||||
Suboptions passed to the client API are also subject to escaping. Using
|
||||
``mpv_set_option_string()`` is exactly like passing ``--name=data`` to the
|
||||
command line (but without shell processing of the string). Some options
|
||||
support passing values in a more structured way instead of flat strings, and
|
||||
can avoid the suboption parsing mess. For example, ``--vf`` supports
|
||||
``MPV_FORMAT_NODE``, which lets you pass suboptions as a nested data structure
|
||||
of maps and arrays. (``--vo`` supports this in the same way, although this
|
||||
fact is undocumented.)
|
||||
|
||||
Paths
|
||||
-----
|
||||
|
||||
Some care must be taken when passing arbitrary paths and filenames to mpv. For
|
||||
example, paths starting with ``-`` will be interpreted as options. Likewise,
|
||||
if a path contains the sequence ``://``, the string before that might be
|
||||
interpreted as protocol prefix, even though ``://`` can be part of a legal
|
||||
UNIX path. To avoid problems with arbitrary paths, you should be sure that
|
||||
absolute paths passed to mpv start with ``/``, and relative paths with ``./``.
|
||||
|
||||
The name ``-`` itself is interpreted as stdin, and will cause mpv to disable
|
||||
console controls. (Which makes it suitable for playing data piped to stdin.)
|
||||
|
||||
For paths passed to suboptions, the situation is further complicated by the
|
||||
need to escape special characters. To work this around, the path can be
|
||||
additionally wrapped in the fixed-length syntax, e.g. ``%n%string_of_length_n``
|
||||
(see above).
|
||||
|
||||
Some mpv options interpret paths starting with ``~``. Currently, the prefix
|
||||
``~~/`` expands to the mpv configuration directory (usually ``~/.config/mpv/``).
|
||||
``~/`` expands to the user's home directory. (The trailing ``/`` is always
|
||||
required.) There are the following paths as well:
|
||||
|
||||
================ ===============================================================
|
||||
Name Meaning
|
||||
================ ===============================================================
|
||||
``~~home/`` same as ``~~/``
|
||||
``~~global/`` the global config path, if available (not on win32)
|
||||
``~~osxbundle/`` the OSX bundle resource path (OSX only)
|
||||
``~~desktop/`` the path to the desktop (win32, OSX)
|
||||
================ ===============================================================
|
||||
|
||||
|
||||
Per-File Options
|
||||
----------------
|
||||
|
||||
When playing multiple files, any option given on the command line usually
|
||||
affects all files. Example::
|
||||
|
||||
mpv --a file1.mkv --b file2.mkv --c
|
||||
|
||||
=============== ===========================
|
||||
File Active options
|
||||
=============== ===========================
|
||||
file1.mkv ``--a --b --c``
|
||||
file2.mkv ``--a --b --c``
|
||||
=============== ===========================
|
||||
|
||||
(This is different from MPlayer and mplayer2.)
|
||||
|
||||
Also, if any option is changed at runtime (via input commands), they are not
|
||||
reset when a new file is played.
|
||||
|
||||
Sometimes, it is useful to change options per-file. This can be achieved by
|
||||
adding the special per-file markers ``--{`` and ``--}``. (Note that you must
|
||||
escape these on some shells.) Example::
|
||||
|
||||
mpv --a file1.mkv --b --\{ --c file2.mkv --d file3.mkv --e --\} file4.mkv --f
|
||||
|
||||
=============== ===========================
|
||||
File Active options
|
||||
=============== ===========================
|
||||
file1.mkv ``--a --b --f``
|
||||
file2.mkv ``--a --b --f --c --d --e``
|
||||
file3.mkv ``--a --b --f --c --d --e``
|
||||
file4.mkv ``--a --b --f``
|
||||
=============== ===========================
|
||||
|
||||
Additionally, any file-local option changed at runtime is reset when the current
|
||||
file stops playing. If option ``--c`` is changed during playback of
|
||||
``file2.mkv``, it is reset when advancing to ``file3.mkv``. This only affects
|
||||
file-local options. The option ``--a`` is never reset here.
|
||||
|
||||
CONFIGURATION FILES
|
||||
===================
|
||||
|
||||
Location and Syntax
|
||||
-------------------
|
||||
|
||||
You can put all of the options in configuration files which will be read every
|
||||
time mpv is run. The system-wide configuration file 'mpv.conf' is in your
|
||||
configuration directory (e.g. ``/etc/mpv`` or ``/usr/local/etc/mpv``), the
|
||||
user-specific one is ``~/.config/mpv/mpv.conf``. For details and platform
|
||||
specifics see the `FILES`_ section.
|
||||
User-specific options override system-wide options and options given on the
|
||||
command line override either. The syntax of the configuration files is
|
||||
``option=<value>``; everything after a *#* is considered a comment. Options
|
||||
that work without values can be enabled by setting them to *yes* and disabled by
|
||||
setting them to *no*. Even suboptions can be specified in this way.
|
||||
|
||||
.. admonition:: Example configuration file
|
||||
|
||||
::
|
||||
|
||||
# Use opengl video output by default.
|
||||
vo=opengl
|
||||
# Use quotes for text that can contain spaces:
|
||||
status-msg="Time: ${time-pos}"
|
||||
|
||||
Escaping spaces and special characters
|
||||
--------------------------------------
|
||||
|
||||
This is done like with command line options. The shell is not involved here,
|
||||
but option values still need to be quoted as a whole if it contains certain
|
||||
characters like spaces. A config entry can be quoted with ``"`` and ``'``,
|
||||
as well as with the fixed-length syntax (``%n%``) mentioned before. This is like
|
||||
passing the exact contents of the quoted string as command line option. C-style
|
||||
escapes are currently _not_ interpreted on this level, although some options do
|
||||
this manually. (This is a mess and should probably be changed at some point.)
|
||||
|
||||
Putting Command Line Options into the Configuration File
|
||||
--------------------------------------------------------
|
||||
|
||||
Almost all command line options can be put into the configuration file. Here
|
||||
is a small guide:
|
||||
|
||||
======================= ========================
|
||||
Option Configuration file entry
|
||||
======================= ========================
|
||||
``--flag`` ``flag``
|
||||
``-opt val`` ``opt=val``
|
||||
``--opt=val`` ``opt=val``
|
||||
``-opt "has spaces"`` ``opt="has spaces"``
|
||||
======================= ========================
|
||||
|
||||
File-specific Configuration Files
|
||||
---------------------------------
|
||||
|
||||
You can also write file-specific configuration files. If you wish to have a
|
||||
configuration file for a file called 'video.avi', create a file named
|
||||
'video.avi.conf' with the file-specific options in it and put it in
|
||||
``~/.config/mpv/``. You can also put the configuration file in the same directory
|
||||
as the file to be played. Both require you to set the ``--use-filedir-conf``
|
||||
option (either on the command line or in your global config file). If a
|
||||
file-specific configuration file is found in the same directory, no
|
||||
file-specific configuration is loaded from ``~/.config/mpv``. In addition, the
|
||||
``--use-filedir-conf`` option enables directory-specific configuration files.
|
||||
For this, mpv first tries to load a mpv.conf from the same directory
|
||||
as the file played and then tries to load any file-specific configuration.
|
||||
|
||||
|
||||
Profiles
|
||||
--------
|
||||
|
||||
To ease working with different configurations, profiles can be defined in the
|
||||
configuration files. A profile starts with its name in square brackets,
|
||||
e.g. ``[my-profile]``. All following options will be part of the profile. A
|
||||
description (shown by ``--profile=help``) can be defined with the
|
||||
``profile-desc`` option. To end the profile, start another one or use the
|
||||
profile name ``default`` to continue with normal options.
|
||||
|
||||
.. admonition:: Example mpv profile
|
||||
|
||||
::
|
||||
|
||||
[vo.vdpau]
|
||||
# Use hardware decoding
|
||||
hwdec=vdpau
|
||||
|
||||
[protocol.dvd]
|
||||
profile-desc="profile for dvd:// streams"
|
||||
alang=en
|
||||
|
||||
[extension.flv]
|
||||
profile-desc="profile for .flv files"
|
||||
vf=flip
|
||||
|
||||
[ao.alsa]
|
||||
device=spdif
|
||||
|
||||
|
||||
TAKING SCREENSHOTS
|
||||
==================
|
||||
|
||||
Screenshots of the currently played file can be taken using the 'screenshot'
|
||||
input mode command, which is by default bound to the ``s`` key. Files named
|
||||
``shotNNNN.jpg`` will be saved in the working directory, using the first
|
||||
available number - no files will be overwritten.
|
||||
|
||||
A screenshot will usually contain the unscaled video contents at the end of the
|
||||
video filter chain and subtitles. By default, ``S`` takes screenshots without
|
||||
subtitles, while ``s`` includes subtitles.
|
||||
|
||||
Unlike with MPlayer, the ``screenshot`` video filter is not required. This
|
||||
filter was never required in mpv, and has been removed.
|
||||
|
||||
TERMINAL STATUS LINE
|
||||
====================
|
||||
|
||||
During playback, mpv shows the playback status on the terminal. It looks like
|
||||
something like this:
|
||||
|
||||
``AV: 00:03:12 / 00:24:25 (13%) A-V: -0.000``
|
||||
|
||||
The status line can be overridden with the ``--term-status-msg`` option.
|
||||
|
||||
The following is a list of things that can show up in the status line. Input
|
||||
properties, that can be used to get the same information manually, are also
|
||||
listed.
|
||||
|
||||
- ``AV:`` or ``V:`` (video only) or ``A:`` (audio only)
|
||||
- The current time position in ``HH:MM:SS`` format (``playback-time`` property)
|
||||
- The total file duration (absent if unknown) (``length`` property)
|
||||
- Playback speed, e.g. `` x2.0``. Only visible if the speed is not normal. This
|
||||
is the user-requested speed, and not the actual speed (usually they should
|
||||
be the same, unless playback is too slow). (``speed`` property.)
|
||||
- Playback percentage, e.g. ``(13%)``. How much of the file has been played.
|
||||
Normally calculated out of playback position and duration, but can fallback
|
||||
to other methods (like byte position) if these are not available.
|
||||
(``percent-pos`` property.)
|
||||
- The audio/video sync as ``A-V: 0.000``. This is the difference between
|
||||
audio and video time. Normally it should be 0 or close to 0. If it's growing,
|
||||
it might indicate a playback problem. (``avsync`` property.)
|
||||
- Total A/V sync change, e.g. ``ct: -0.417``. Normally invisible. Can show up
|
||||
if there is audio "missing", or not enough frames can be dropped. Usually
|
||||
this will indicate a problem. (``total-avsync-change`` property.)
|
||||
- Encoding state in ``{...}``, only shown in encoding mode.
|
||||
- Display sync state. If display sync is active (``display-sync-active``
|
||||
property), this shows ``DS: +0.02598%``, where the number is the speed change
|
||||
factor applied to audio to achieve sync to display, expressed in percent
|
||||
deviation from 1.0 (``audio-speed-correction`` property). In sync modes which
|
||||
don't resample, this will always be ``+0.00000%``.
|
||||
- Missed frames, e.g. ``Missed: 4``. (``vo-missed-frame-count`` property.) Shows
|
||||
up in display sync mode only. This is incremented each time a frame took
|
||||
longer to display than intended.
|
||||
- Dropped frames, e.g. ``Dropped: 4``. Shows up only if the count is not 0. Can
|
||||
grow if the video framerate is higher than that of the display, or if video
|
||||
rendering is too slow. Also can be incremented on "hiccups" and when the video
|
||||
frame couldn't be displayed on time. (``vo-drop-frame-count`` property.)
|
||||
If the decoder drops frames, the number of decoder-dropped frames is appended
|
||||
to the display as well, e.g.: ``Dropped: 4/34``. This happens only if
|
||||
decoder frame dropping is enabled with the ``--framedrop`` options.
|
||||
(``drop-frame-count`` property.)
|
||||
- Cache state, e.g. ``Cache: 2s+134KB``. Visible if the stream cache is enabled.
|
||||
The first value shows the amount of video buffered in the demuxer in seconds,
|
||||
the second value shows *additional* data buffered in the stream cache in
|
||||
kilobytes. (``demuxer-cache-duration`` and ``cache-used`` properties.)
|
||||
|
||||
|
||||
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.
|
||||
|
||||
Note that not all prefixes are documented here. Undocumented prefixes are
|
||||
either aliases to documented protocols, or are just redirections to
|
||||
protocols implemented and documented in FFmpeg.
|
||||
|
||||
``-``
|
||||
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.
|
||||
|
||||
``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.
|
||||
|
||||
``dvdnav://`` is an old alias for ``dvd://`` and does exactly the same
|
||||
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.
|
||||
|
||||
``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://track[-endtrack][:speed][/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.
|
||||
|
||||
For example, ``mpv av://lavfi:mandelbrot`` makes use of the libavfilter
|
||||
wrapper included in libavdevice, and will use the ``mandelbrot`` source
|
||||
filter to generate input data.
|
||||
|
||||
``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 UNIX FD (for example 123). This is similar to
|
||||
piping data to stdin via ``-``, but can use an arbitrary file descriptor.
|
||||
Will not work correctly on MS Windows.
|
||||
|
||||
``edl://[edl specification as in edl-mpv.rst]``
|
||||
Stitch together parts of multiple files and play them.
|
||||
|
||||
``null://``
|
||||
Simulate an empty file.
|
||||
|
||||
``memory://data``
|
||||
Use the ``data`` part as source data.
|
||||
|
||||
PSEUDO GUI MODE
|
||||
===============
|
||||
|
||||
mpv has no official GUI, other than the OSC (`ON SCREEN CONTROLLER`_), which
|
||||
is not a full GUI and is not meant to be. However, to compensate for the lack
|
||||
of expected GUI behavior, mpv will in some cases start with some settings
|
||||
changed to behave slightly more like a GUI mode.
|
||||
|
||||
Currently this happens only in the following cases:
|
||||
|
||||
- if started using the ``mpv.desktop`` file on Linux (e.g. started from menus
|
||||
or file associations provided by desktop environments)
|
||||
- if started from explorer.exe on Windows (technically, if it was started on
|
||||
Windows, and all of the stdout/stderr/stdin handles are unset)
|
||||
- manually adding ``--profile=pseudo-gui`` to the command line
|
||||
|
||||
This mode implicitly adds ``--profile=pseudo-gui`` to the command line, with
|
||||
the ``pseudo-gui`` profile being predefined with the following contents:
|
||||
|
||||
::
|
||||
|
||||
[pseudo-gui]
|
||||
terminal=no
|
||||
force-window=yes
|
||||
idle=once
|
||||
screenshot-directory=~~desktop/
|
||||
|
||||
This follows the mpv config file format. To customize pseudo-GUI mode, you can
|
||||
put your own ``pseudo-gui`` profile into your ``mpv.conf``. This profile will
|
||||
enhance the default profile, rather than overwrite it.
|
||||
|
||||
The profile always overrides other settings in ``mpv.conf``.
|
||||
|
||||
|
||||
.. include:: options.rst
|
||||
|
||||
.. include:: ao.rst
|
||||
|
||||
.. include:: vo.rst
|
||||
|
||||
.. include:: af.rst
|
||||
|
||||
.. include:: vf.rst
|
||||
|
||||
.. include:: encode.rst
|
||||
|
||||
.. include:: input.rst
|
||||
|
||||
.. include:: osc.rst
|
||||
|
||||
.. include:: lua.rst
|
||||
|
||||
.. include:: ipc.rst
|
||||
|
||||
.. include:: changes.rst
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
=====================
|
||||
|
||||
There are a number of environment variables that can be used to control the
|
||||
behavior of mpv.
|
||||
|
||||
``HOME``, ``XDG_CONFIG_HOME``
|
||||
Used to determine mpv config directory. If ``XDG_CONFIG_HOME`` is not set,
|
||||
``$HOME/.config/mpv`` is used.
|
||||
|
||||
``$HOME/.mpv`` is always added to the list of config search paths with a
|
||||
lower priority.
|
||||
|
||||
``XDG_CONFIG_DIRS``
|
||||
If set, XDG-style system configuration directories are used. Otherwise,
|
||||
the UNIX convention (``PREFIX/etc/mpv/``) is used.
|
||||
|
||||
``TERM``
|
||||
Used to determine terminal type.
|
||||
|
||||
``MPV_HOME``
|
||||
Directory where mpv looks for user settings. Overrides ``HOME``, and mpv
|
||||
will try to load the config file as ``$MPV_HOME/mpv.conf``.
|
||||
|
||||
``MPV_VERBOSE`` (see also ``-v`` and ``--msg-level``)
|
||||
Set the initial verbosity level across all message modules (default: 0).
|
||||
This is an integer, and the resulting verbosity corresponds to the number
|
||||
of ``--v`` options passed to the command line.
|
||||
|
||||
``MPV_LEAK_REPORT``
|
||||
If set to ``1``, enable internal talloc leak reporting. Note that this can
|
||||
cause trouble with multithreading, so only developers should use this.
|
||||
|
||||
``LADSPA_PATH``
|
||||
Specifies the search path for LADSPA plugins. If it is unset, fully
|
||||
qualified path names must be used.
|
||||
|
||||
``DISPLAY``
|
||||
Standard X11 display name to use.
|
||||
|
||||
FFmpeg/Libav:
|
||||
This library accesses various environment variables. However, they are not
|
||||
centrally documented, and documenting them is not our job. Therefore, this
|
||||
list is incomplete.
|
||||
|
||||
Notable environment variables:
|
||||
|
||||
``http_proxy``
|
||||
URL to proxy for ``http://`` and ``https://`` URLs.
|
||||
|
||||
``no_proxy``
|
||||
List of domain patterns for which no proxy should be used.
|
||||
List entries are separated by ``,``. Patterns can include ``*``.
|
||||
|
||||
libdvdcss:
|
||||
``DVDCSS_CACHE``
|
||||
Specify a directory in which to store title key values. This will
|
||||
speed up descrambling of DVDs which are in the cache. The
|
||||
``DVDCSS_CACHE`` directory is created if it does not exist, and a
|
||||
subdirectory is created named after the DVD's title or manufacturing
|
||||
date. If ``DVDCSS_CACHE`` is not set or is empty, libdvdcss will use
|
||||
the default value which is ``${HOME}/.dvdcss/`` under Unix and
|
||||
the roaming application data directory (``%APPDATA%``) under
|
||||
Windows. The special value "off" disables caching.
|
||||
|
||||
``DVDCSS_METHOD``
|
||||
Sets the authentication and decryption method that libdvdcss will use
|
||||
to read scrambled discs. Can be one of ``title``, ``key`` or ``disc``.
|
||||
|
||||
key
|
||||
is the default method. libdvdcss will use a set of calculated
|
||||
player keys to try and get the disc key. This can fail if the drive
|
||||
does not recognize any of the player keys.
|
||||
|
||||
disc
|
||||
is a fallback method when key has failed. Instead of using player
|
||||
keys, libdvdcss will crack the disc key using a brute force
|
||||
algorithm. This process is CPU intensive and requires 64 MB of
|
||||
memory to store temporary data.
|
||||
|
||||
title
|
||||
is the fallback when all other methods have failed. It does not
|
||||
rely on a key exchange with the DVD drive, but rather uses a crypto
|
||||
attack to guess the title key. On rare cases this may fail because
|
||||
there is not enough encrypted data on the disc to perform a
|
||||
statistical attack, but on the other hand it is the only way to
|
||||
decrypt a DVD stored on a hard disc, or a DVD with the wrong region
|
||||
on an RPC2 drive.
|
||||
|
||||
``DVDCSS_RAW_DEVICE``
|
||||
Specify the raw device to use. Exact usage will depend on your
|
||||
operating system, the Linux utility to set up raw devices is raw(8)
|
||||
for instance. Please note that on most operating systems, using a raw
|
||||
device requires highly aligned buffers: Linux requires a 2048 bytes
|
||||
alignment (which is the size of a DVD sector).
|
||||
|
||||
``DVDCSS_VERBOSE``
|
||||
Sets the libdvdcss verbosity level.
|
||||
|
||||
:0: Outputs no messages at all.
|
||||
:1: Outputs error messages to stderr.
|
||||
:2: Outputs error messages and debug messages to stderr.
|
||||
|
||||
``DVDREAD_NOKEYS``
|
||||
Skip retrieving all keys on startup. Currently disabled.
|
||||
|
||||
``HOME``
|
||||
FIXME: Document this.
|
||||
|
||||
|
||||
EXIT CODES
|
||||
==========
|
||||
|
||||
Normally **mpv** returns 0 as exit code after finishing playback successfully.
|
||||
If errors happen, the following exit codes can be returned:
|
||||
|
||||
:1: Error initializing mpv. This is also returned if unknown options are
|
||||
passed to mpv.
|
||||
:2: The file passed to mpv couldn't be played. This is somewhat fuzzy:
|
||||
currently, playback of a file is considered to be successful if
|
||||
initialization was mostly successful, even if playback fails
|
||||
immediately after initialization.
|
||||
:3: There were some files that could be played, and some files which
|
||||
couldn't (using the definition of success from above).
|
||||
:4: Quit due to a signal, Ctrl+c in a VO window (by default), or from the
|
||||
default quit key bindings in encoding mode.
|
||||
|
||||
Note that quitting the player manually will always lead to exit code 0,
|
||||
overriding the exit code that would be returned normally. Also, the ``quit``
|
||||
input command can take an exit code: in this case, that exit code is returned.
|
||||
|
||||
FILES
|
||||
=====
|
||||
|
||||
For Windows-specifics, see `FILES ON WINDOWS`_ section.
|
||||
|
||||
``/usr/local/etc/mpv/mpv.conf``
|
||||
mpv system-wide settings (depends on ``--prefix`` passed to configure - mpv
|
||||
in default configuration will use ``/usr/local/etc/mpv/`` as config
|
||||
directory, while most Linux distributions will set it to ``/etc/mpv/``).
|
||||
|
||||
``~/.config/mpv/mpv.conf``
|
||||
mpv user settings (see `CONFIGURATION FILES`_ section)
|
||||
|
||||
``~/.config/mpv/input.conf``
|
||||
key bindings (see `INPUT.CONF`_ section)
|
||||
|
||||
``~/.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
|
||||
and files with no ``.lua`` extension are ignored. The ``--load-scripts=no``
|
||||
option disables loading these files.
|
||||
|
||||
``~/.config/mpv/watch_later/``
|
||||
Contains temporary config files needed for resuming playback of files with
|
||||
the watch later feature. See for example the ``Q`` key binding, or the
|
||||
``quit_watch_later`` input command.
|
||||
|
||||
Each file is a small config file which is loaded if the corresponding media
|
||||
file is loaded. It contains the playback position and some (not necessarily
|
||||
all) settings that were changed during playback. The filenames are hashed
|
||||
from the full paths of the media files. It's in general not possible to
|
||||
extract the media filename from this hash. However, you can set the
|
||||
``--write-filename-in-watch-later-config`` option, and the player will
|
||||
add the media filename to the contents of the resume config file.
|
||||
|
||||
``~/.config/mpv/lua-settings/osc.conf``
|
||||
This is loaded by the OSC script. See the `ON SCREEN CONTROLLER`_ docs
|
||||
for details.
|
||||
|
||||
Other files in this directory are specific to the corresponding scripts
|
||||
as well, and the mpv core doesn't touch them.
|
||||
|
||||
Note that the environment variables ``$XDG_CONFIG_HOME`` and ``$MPV_HOME`` can
|
||||
override the standard directory ``~/.config/mpv/``.
|
||||
|
||||
Also, the old config location at ``~/.mpv/`` is still read, and if the XDG
|
||||
variant does not exist, will still be preferred.
|
||||
|
||||
FILES ON WINDOWS
|
||||
================
|
||||
|
||||
On win32 (if compiled with MinGW, but not Cygwin), the default config file
|
||||
locations are different. They are generally located under ``%APPDATA%/mpv/``.
|
||||
For example, the path to mpv.conf is ``%APPDATA%/mpv/mpv.conf``, which maps to
|
||||
a system and user-specific path, for example
|
||||
|
||||
``C:\users\USERNAME\Application Data\mpv\mpv.conf``
|
||||
|
||||
You can find the exact path by running ``echo %APPDATA%\mpv\mpv.conf`` in cmd.exe.
|
||||
|
||||
Other config files (such as ``input.conf``) are in the same directory. See the
|
||||
`FILES`_ section above.
|
||||
|
||||
The environment variable ``$MPV_HOME`` completely overrides these, like on
|
||||
UNIX.
|
||||
|
||||
If a directory named ``portable_config`` next to the mpv.exe exists, all
|
||||
config will be loaded from this directory only. Watch later config files are
|
||||
written to this directory as well. (This exists on Windows only and is redundant
|
||||
with ``$MPV_HOME``. However, since Windows is very scripting unfriendly, a
|
||||
wrapper script just setting ``$MPV_HOME``, like you could do it on other
|
||||
systems, won't work. ``portable_config`` is provided for convenience to get
|
||||
around this restriction.)
|
||||
|
||||
Config files located in the same directory as ``mpv.exe`` are loaded with
|
||||
lower priority. Some config files are loaded only once, which means that
|
||||
e.g. of 2 ``input.conf`` files located in two config directories, only the
|
||||
one from the directory with higher priority will be loaded.
|
||||
|
||||
A third config directory with lowest priority is the directory named ``mpv``
|
||||
in the same directory as ``mpv.exe``. This used to be the directory with
|
||||
highest priority, but is now discouraged to use and might be removed in the
|
||||
future.
|
||||
|
||||
Note that mpv likes to mix ``/`` and ``\`` path separators for simplicity.
|
||||
kernel32.dll accepts this, but cmd.exe does not.
|
||||
|
||||
EXAMPLES OF MPV USAGE
|
||||
=====================
|
||||
|
||||
Blu-ray playback:
|
||||
- ``mpv bd:////path/to/disc``
|
||||
- ``mpv bd:// --bluray-device=/path/to/disc``
|
||||
|
||||
Play in Japanese with English subtitles:
|
||||
``mpv dvd://1 --alang=ja --slang=en``
|
||||
|
||||
Play only chapters 5, 6, 7:
|
||||
``mpv dvd://1 --chapter=5-7``
|
||||
|
||||
Play only titles 5, 6, 7:
|
||||
``mpv dvd://5-7``
|
||||
|
||||
Play a multi-angle DVD:
|
||||
``mpv dvd://1 --dvd-angle=2``
|
||||
|
||||
Play from a different DVD device:
|
||||
``mpv dvd://1 --dvd-device=/dev/dvd2``
|
||||
|
||||
Play DVD video from a directory with VOB files:
|
||||
``mpv dvd://1 --dvd-device=/path/to/directory/``
|
||||
|
||||
Stream from HTTP:
|
||||
``mpv http://example.com/example.avi``
|
||||
|
||||
Stream using RTSP:
|
||||
``mpv rtsp://server.example.com/streamName``
|
||||
|
||||
Play a libavfilter graph:
|
||||
``mpv avdevice://lavfi:mandelbrot``
|
||||
|
||||
AUTHORS
|
||||
=======
|
||||
|
||||
mpv is a MPlayer fork based on mplayer2, which in turn is a fork of MPlayer.
|
||||
|
||||
MPlayer was initially written by Arpad Gereoffy. See the ``AUTHORS`` file for
|
||||
a list of some of the many other contributors.
|
||||
|
||||
MPlayer is (C) 2000-2013 The MPlayer Team
|
||||
|
||||
This man page was written mainly by Gabucino, Jonas Jermann and Diego Biurrun.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,270 +0,0 @@
|
||||
ON SCREEN CONTROLLER
|
||||
====================
|
||||
|
||||
The On Screen Controller (short: OSC) is a minimal GUI integrated with mpv to
|
||||
offer basic mouse-controllability. It is intended to make interaction easier
|
||||
for new users and to enable precise and direct seeking.
|
||||
|
||||
The OSC is enabled by default if mpv was compiled with Lua support. It can be
|
||||
disabled entirely using the ``--osc=no`` option.
|
||||
|
||||
Using the OSC
|
||||
-------------
|
||||
|
||||
By default, the OSC will show up whenever the mouse is moved inside the
|
||||
player window and will hide if the mouse is not moved outside the OSC for
|
||||
0.5 seconds or if the mouse leaves the window.
|
||||
|
||||
The Interface
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
+------------------+-----------+--------------------+
|
||||
| playlist prev | title | playlist next |
|
||||
+-------+------+---+--+------+-+----+------+--------+
|
||||
| audio | skip | seek | | seek | skip | full |
|
||||
+-------+ back | back | play | frwd | frwd | screen |
|
||||
| sub | | | | | | |
|
||||
+-------+------+------+------+------+------+--------+
|
||||
| seekbar |
|
||||
+----------------+--------------+-------------------+
|
||||
| time passed | cache status | time remaining |
|
||||
+----------------+--------------+-------------------+
|
||||
|
||||
|
||||
playlist prev
|
||||
============= ================================================
|
||||
left-click play previous file in playlist
|
||||
shift+L-click show playlist
|
||||
============= ================================================
|
||||
|
||||
title
|
||||
| Displays current media-title or filename
|
||||
|
||||
============= ================================================
|
||||
left-click show playlist position and length and full title
|
||||
right-click show filename
|
||||
============= ================================================
|
||||
|
||||
playlist next
|
||||
============= ================================================
|
||||
left-click play next file in playlist
|
||||
shift+L-click show playlist
|
||||
============= ================================================
|
||||
|
||||
audio and sub
|
||||
| Displays selected track and amount of available tracks
|
||||
|
||||
============= ================================================
|
||||
left-click cycle audio/sub tracks forward
|
||||
right-click cycle audio/sub tracks backwards
|
||||
shift+L-click show available audio/sub tracks
|
||||
============= ================================================
|
||||
|
||||
skip back
|
||||
============= ================================================
|
||||
left-click go to beginning of chapter / previous chapter
|
||||
shift+L-click show chapters
|
||||
============= ================================================
|
||||
|
||||
seek back
|
||||
============= ================================================
|
||||
left-click skip back 5 seconds
|
||||
right-click skip back 30 seconds
|
||||
shift-L-click skip back 1 frame
|
||||
============= ================================================
|
||||
|
||||
play
|
||||
============= ================================================
|
||||
left-click toggle play/pause
|
||||
============= ================================================
|
||||
|
||||
seek frwd
|
||||
============= ================================================
|
||||
left-click skip forward 10 seconds
|
||||
right-click skip forward 60 seconds
|
||||
shift-L-click skip forward 1 frame
|
||||
============= ================================================
|
||||
|
||||
skip frwd
|
||||
============= ================================================
|
||||
left-click go to next chapter
|
||||
shift+L-click show chapters
|
||||
============= ================================================
|
||||
|
||||
fullscreen
|
||||
============= ================================================
|
||||
left-click toggle fullscreen
|
||||
============= ================================================
|
||||
|
||||
seekbar
|
||||
| Indicates current playback position and position of chapters
|
||||
|
||||
============= ================================================
|
||||
left-click seek to position
|
||||
============= ================================================
|
||||
|
||||
time passed
|
||||
| Shows current playback position timestamp
|
||||
|
||||
============= ================================================
|
||||
left-click toggle displaying timecodes with milliseconds
|
||||
============= ================================================
|
||||
|
||||
cache status
|
||||
| Shows current cache fill status (only visible when below 45%)
|
||||
|
||||
time remaining
|
||||
| Shows remaining playback time timestamp
|
||||
|
||||
============= ================================================
|
||||
left-click toggle between total and remaining time
|
||||
============= ================================================
|
||||
|
||||
Key Bindings
|
||||
~~~~~~~~~~~~
|
||||
|
||||
These key bindings are active by default if nothing else is already bound to
|
||||
these keys. In case of collision, the function needs to be bound to a
|
||||
different key. See the `Script Commands`_ section.
|
||||
|
||||
============= ================================================
|
||||
del Hide the OSC permanently until mpv is restarted.
|
||||
============= ================================================
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
The OSC offers limited configuration through a config file
|
||||
``lua-settings/osc.conf`` placed in mpv's user dir and through the
|
||||
``--script-opts`` command-line option. Options provided through the command-line
|
||||
will override those from the config file.
|
||||
|
||||
Config Syntax
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The config file must exactly follow the following syntax::
|
||||
|
||||
# this is a comment
|
||||
optionA=value1
|
||||
optionB=value2
|
||||
|
||||
``#`` can only be used at the beginning of a line and there may be no
|
||||
spaces around the ``=`` or anywhere else.
|
||||
|
||||
Command-line Syntax
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To avoid collisions with other scripts, all options need to be prefixed with
|
||||
``osc-``.
|
||||
|
||||
Example::
|
||||
|
||||
--script-opts=osc-optionA=value1,osc-optionB=value2
|
||||
|
||||
|
||||
Configurable Options
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
``showwindowed``
|
||||
| Default: yes
|
||||
| Enable the OSC when windowed
|
||||
|
||||
``showfullscreen``
|
||||
| Default: yes
|
||||
| Enable the OSC when fullscreen
|
||||
|
||||
``scalewindowed``
|
||||
| Default: 1.0
|
||||
| Scale factor of the OSC when windowed
|
||||
|
||||
``scalefullscreen``
|
||||
| Default: 1.0
|
||||
| Scale factor of the OSC when fullscreen
|
||||
|
||||
``scaleforcedwindow``
|
||||
| Default: 2.0
|
||||
| Scale factor of the OSC when rendered on a forced (dummy) window
|
||||
|
||||
``vidscale``
|
||||
| Default: yes
|
||||
| Scale the OSC with the video
|
||||
| ``no`` tries to keep the OSC size constant as much as the window size allows
|
||||
|
||||
``valign``
|
||||
| Default: 0.8
|
||||
| Vertical alignment, -1 (top) to 1 (bottom)
|
||||
|
||||
``halign``
|
||||
| Default: 0.0
|
||||
| Horizontal alignment, -1 (left) to 1 (right)
|
||||
|
||||
``boxalpha``
|
||||
| Default: 80
|
||||
| Alpha of the background box, 0 (opaque) to 255 (fully transparent)
|
||||
|
||||
``hidetimeout``
|
||||
| Default: 500
|
||||
| Duration in ms until the OSC hides if no mouse movement, negative value
|
||||
disables auto-hide
|
||||
|
||||
``fadeduration``
|
||||
| Default: 200
|
||||
| Duration of fade out in ms, 0 = no fade
|
||||
|
||||
``deadzonesize``
|
||||
| Default: 0
|
||||
| Size of the deadzone. The deadzone is an area that makes the mouse act
|
||||
like leaving the window. Movement there won't make the OSC show up and
|
||||
it will hide immediately if the mouse enters it. The deadzone starts
|
||||
at the window border opposite to the OSC and the size controls how much
|
||||
of the window it will span. Values between 0 and 1.
|
||||
|
||||
``minmousemove``
|
||||
| Default: 3
|
||||
| Minimum amount of pixels the mouse has to move between ticks to make
|
||||
the OSC show up
|
||||
|
||||
``layout``
|
||||
| Default: box
|
||||
| The layout for the OSC. Currently available are: box, slimbox,
|
||||
bottombar and topbar.
|
||||
|
||||
``seekbarstyle``
|
||||
| Default: slider
|
||||
| Sets the style of the seekbar, slider (diamond marker) or bar (fill)
|
||||
|
||||
``timetotal``
|
||||
| Default: no
|
||||
| Show total time instead of time remaining
|
||||
|
||||
``timems``
|
||||
| Default: no
|
||||
| Display timecodes with milliseconds
|
||||
|
||||
Script Commands
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
The OSC script listens to certain script commands. These commands can bound
|
||||
in ``input.conf``, or sent by other scripts.
|
||||
|
||||
``enable-osc``
|
||||
Undoes ``disable-osc`` or the effect of the ``del`` key.
|
||||
|
||||
``disable-osc``
|
||||
Hide the OSC permanently. This is also what the ``del`` key does.
|
||||
|
||||
``osc-message``
|
||||
Show a message on screen using the OSC. First argument is the message,
|
||||
second the duration in seconds.
|
||||
|
||||
|
||||
Example
|
||||
|
||||
You could put this into ``input.conf`` to hide the OSC with the ``a`` key and
|
||||
to unhide it with ``b``::
|
||||
|
||||
a script_message disable-osc
|
||||
b script_message enable-osc
|
||||
|
||||
-828
@@ -1,828 +0,0 @@
|
||||
VIDEO FILTERS
|
||||
=============
|
||||
|
||||
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.
|
||||
|
||||
You can also set defaults for each filter. The defaults are applied before the
|
||||
normal filter parameters.
|
||||
|
||||
``--vf-defaults=<filter1[=parameter1:parameter2:...],filter2,...>``
|
||||
Set defaults for each filter.
|
||||
|
||||
.. note::
|
||||
|
||||
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.
|
||||
|
||||
Video filters are managed in lists. There are a few commands to manage the
|
||||
filter list.
|
||||
|
||||
``--vf-add=<filter1[,filter2,...]>``
|
||||
Appends the filters given as arguments to the filter list.
|
||||
|
||||
``--vf-pre=<filter1[,filter2,...]>``
|
||||
Prepends the filters given as arguments to the filter list.
|
||||
|
||||
``--vf-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).
|
||||
|
||||
``--vf-clr``
|
||||
Completely empties the filter list.
|
||||
|
||||
With filters that support it, you can access parameters by their name.
|
||||
|
||||
``--vf=<filter>=help``
|
||||
Prints the parameter names and parameter value ranges for a particular
|
||||
filter.
|
||||
|
||||
``--vf=<filter=named_parameter1=value1[:named_parameter2=value2:...]>``
|
||||
Sets a named parameter to the given value. Use on and off or yes and no to
|
||||
set flag parameters.
|
||||
|
||||
Available filters are:
|
||||
|
||||
``crop[=w:h:x:y]``
|
||||
Crops the given part of the image and discards the rest. Useful to remove
|
||||
black bands from widescreen videos.
|
||||
|
||||
``<w>,<h>``
|
||||
Cropped width and height, defaults to original width and height.
|
||||
``<x>,<y>``
|
||||
Position of the cropped picture, defaults to center.
|
||||
|
||||
``expand[=w:h:x:y:aspect:round]``
|
||||
Expands (not scales) video resolution to the given value and places the
|
||||
unscaled original at coordinates x, y.
|
||||
|
||||
``<w>,<h>``
|
||||
Expanded width,height (default: original width,height). Negative
|
||||
values for w and h are treated as offsets to the original size.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``expand=0:-50:0:0``
|
||||
Adds a 50 pixel border to the bottom of the picture.
|
||||
|
||||
``<x>,<y>``
|
||||
position of original image on the expanded image (default: center)
|
||||
|
||||
``<aspect>``
|
||||
Expands to fit an aspect instead of a resolution (default: 0).
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``expand=800::::4/3``
|
||||
Expands to 800x600, unless the source is higher resolution, in
|
||||
which case it expands to fill a 4/3 aspect.
|
||||
|
||||
``<round>``
|
||||
Rounds up to make both width and height divisible by <r> (default: 1).
|
||||
|
||||
``flip``
|
||||
Flips the image upside down.
|
||||
|
||||
``mirror``
|
||||
Mirrors the image on the Y axis.
|
||||
|
||||
``rotate[=0|90|180|270]``
|
||||
Rotates the image by a multiple of 90 degrees clock-wise.
|
||||
|
||||
``scale[=w:h:param:param2:chr-drop:noup:arnd``
|
||||
Scales the image with the software scaler (slow) and performs a YUV<->RGB
|
||||
color space conversion (see also ``--sws``).
|
||||
|
||||
All parameters are optional.
|
||||
|
||||
``<w>:<h>``
|
||||
scaled width/height (default: original width/height)
|
||||
|
||||
:0: scaled d_width/d_height
|
||||
:-1: original width/height
|
||||
:-2: Calculate w/h using the other dimension and the prescaled
|
||||
aspect ratio.
|
||||
:-3: Calculate w/h using the other dimension and the original
|
||||
aspect ratio.
|
||||
:-(n+8): Like -n above, but rounding the dimension to the closest
|
||||
multiple of 16.
|
||||
|
||||
``<param>[:<param2>]`` (see also ``--sws``)
|
||||
Set some scaling parameters depending on the type of scaler selected
|
||||
with ``--sws``::
|
||||
|
||||
--sws=2 (bicubic): B (blurring) and C (ringing)
|
||||
0.00:0.60 default
|
||||
0.00:0.75 VirtualDub's "precise bicubic"
|
||||
0.00:0.50 Catmull-Rom spline
|
||||
0.33:0.33 Mitchell-Netravali spline
|
||||
1.00:0.00 cubic B-spline
|
||||
|
||||
--sws=7 (Gaussian): sharpness (0 (soft) - 100 (sharp))
|
||||
|
||||
--sws=9 (Lanczos): filter length (1-10)
|
||||
|
||||
``<chr-drop>``
|
||||
chroma skipping
|
||||
|
||||
:0: Use all available input lines for chroma (default).
|
||||
:1: Use only every 2. input line for chroma.
|
||||
:2: Use only every 4. input line for chroma.
|
||||
:3: Use only every 8. input line for chroma.
|
||||
|
||||
``<noup>``
|
||||
Disallow upscaling past the original dimensions.
|
||||
|
||||
:0: Allow upscaling (default).
|
||||
:1: Disallow upscaling if one dimension exceeds its original value.
|
||||
:2: Disallow upscaling if both dimensions exceed their original values.
|
||||
|
||||
``<arnd>``
|
||||
Accurate rounding for the vertical scaler, which may be faster or
|
||||
slower than the default rounding.
|
||||
|
||||
:no: Disable accurate rounding (default).
|
||||
:yes: Enable accurate rounding.
|
||||
|
||||
``dsize[=w:h:aspect-method:r:aspect]``
|
||||
Changes the intended display size/aspect at an arbitrary point in the
|
||||
filter chain. Aspect can be given as a fraction (4/3) or floating point
|
||||
number (1.33). Alternatively, you may specify the exact display width and
|
||||
height desired. Note that this filter does *not* do any scaling itself; it
|
||||
just affects what later scalers (software or hardware) will do when
|
||||
auto-scaling to the correct aspect.
|
||||
|
||||
``<w>,<h>``
|
||||
New display width and height.
|
||||
|
||||
Can also be these special values:
|
||||
|
||||
:0: original display width and height
|
||||
:-1: original video width and height (default)
|
||||
:-2: Calculate w/h using the other dimension and the original display
|
||||
aspect ratio.
|
||||
:-3: Calculate w/h using the other dimension and the original video
|
||||
aspect ratio.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``dsize=800:-2``
|
||||
Specifies a display resolution of 800x600 for a 4/3 aspect
|
||||
video, or 800x450 for a 16/9 aspect video.
|
||||
|
||||
``<aspect-method>``
|
||||
Modifies width and height according to original aspect ratios.
|
||||
|
||||
:-1: Ignore original aspect ratio (default).
|
||||
:0: Keep display aspect ratio by using ``<w>`` and ``<h>`` as maximum
|
||||
resolution.
|
||||
:1: Keep display aspect ratio by using ``<w>`` and ``<h>`` as minimum
|
||||
resolution.
|
||||
:2: Keep video aspect ratio by using ``<w>`` and ``<h>`` as maximum
|
||||
resolution.
|
||||
:3: Keep video aspect ratio by using ``<w>`` and ``<h>`` as minimum
|
||||
resolution.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``dsize=800:600:0``
|
||||
Specifies a display resolution of at most 800x600, or smaller,
|
||||
in order to keep aspect.
|
||||
|
||||
``<r>``
|
||||
Rounds up to make both width and height divisible by ``<r>``
|
||||
(default: 1).
|
||||
|
||||
``<aspect>``
|
||||
Force an aspect ratio.
|
||||
|
||||
``format=fmt=<value>:colormatrix=<value>:...``
|
||||
Restricts the color space for the next filter without doing any conversion.
|
||||
Use together with the scale filter for a real conversion.
|
||||
|
||||
.. note::
|
||||
|
||||
For a list of available formats, see ``format=fmt=help``.
|
||||
|
||||
``<fmt>``
|
||||
Format name, e.g. rgb15, bgr24, 420p, etc. (default: don't change).
|
||||
``<outfmt>``
|
||||
Format name that should be substituted for the output. If they do not
|
||||
have the same bytes per pixel and chroma subsamplimg, it will fail.
|
||||
``<colormatrix>``
|
||||
Controls the YUV to RGB color space conversion when playing video. There
|
||||
are various standards. Normally, BT.601 should be used for SD video, and
|
||||
BT.709 for HD video. (This is done by default.) Using incorrect color space
|
||||
results in slightly under or over saturated and shifted colors.
|
||||
|
||||
These options are not always supported. Different video outputs provide
|
||||
varying degrees of support. The ``opengl`` and ``vdpau`` video output
|
||||
drivers usually offer full support. The ``xv`` output can set the color
|
||||
space if the system video driver supports it, but not input and output
|
||||
levels. The ``scale`` video filter can configure color space and input
|
||||
levels, but only if the output format is RGB (if the video output driver
|
||||
supports RGB output, you can force this with ``-vf scale,format=rgba``).
|
||||
|
||||
If this option is set to ``auto`` (which is the default), the video's
|
||||
color space flag will be used. If that flag is unset, the color space
|
||||
will be selected automatically. This is done using a simple heuristic that
|
||||
attempts to distinguish SD and HD video. If the video is larger than
|
||||
1279x576 pixels, BT.709 (HD) will be used; otherwise BT.601 (SD) is
|
||||
selected.
|
||||
|
||||
Available color spaces are:
|
||||
|
||||
:auto: automatic selection (default)
|
||||
:bt.601: ITU-R BT.601 (SD)
|
||||
:bt.709: ITU-R BT.709 (HD)
|
||||
:bt.2020-ncl: ITU-R BT.2020 non-constant luminance system
|
||||
:bt.2020-cl: ITU-R BT.2020 constant luminance system
|
||||
:smpte-240m: SMPTE-240M
|
||||
|
||||
``<colorlevels>``
|
||||
YUV color levels used with YUV to RGB conversion. This option is only
|
||||
necessary when playing broken files which do not follow standard color
|
||||
levels or which are flagged wrong. If the video does not specify its
|
||||
color range, it is assumed to be limited range.
|
||||
|
||||
The same limitations as with ``<colormatrix>`` apply.
|
||||
|
||||
Available color ranges are:
|
||||
|
||||
:auto: automatic selection (normally limited range) (default)
|
||||
:limited: limited range (16-235 for luma, 16-240 for chroma)
|
||||
:full: full range (0-255 for both luma and chroma)
|
||||
|
||||
``<outputlevels>``
|
||||
RGB color levels used with YUV to RGB conversion. Normally, output devices
|
||||
such as PC monitors use full range color levels. However, some TVs and
|
||||
video monitors expect studio RGB levels. Providing full range output to a
|
||||
device expecting studio level input results in crushed blacks and whites,
|
||||
the reverse in dim gray blacks and dim whites.
|
||||
|
||||
The same limitations as with ``<colormatrix>`` apply.
|
||||
|
||||
Available color ranges are:
|
||||
|
||||
:auto: automatic selection (equals to full range) (default)
|
||||
:limited: limited range (16-235 per component), studio levels
|
||||
:full: full range (0-255 per component), PC levels
|
||||
|
||||
.. note::
|
||||
|
||||
It is advisable to use your graphics driver's color range option
|
||||
instead, if available.
|
||||
|
||||
``<primaries>``
|
||||
RGB primaries the source file was encoded with. Normally this should be set
|
||||
in the file header, but when playing broken or mistagged files this can be
|
||||
used to override the setting.
|
||||
|
||||
This option only affects video output drivers that perform color
|
||||
management, for example ``opengl`` with the ``target-prim`` or
|
||||
``icc-profile`` suboptions set.
|
||||
|
||||
If this option is set to ``auto`` (which is the default), the video's
|
||||
primaries flag will be used. If that flag is unset, the color space will
|
||||
be selected automatically, using the following heuristics: If the
|
||||
``<colormatrix>`` is set or determined as BT.2020 or BT.709, the
|
||||
corresponding primaries are used. Otherwise, if the video height is
|
||||
exactly 576 (PAL), BT.601-625 is used. If it's exactly 480 or 486 (NTSC),
|
||||
BT.601-525 is used. If the video resolution is anything else, BT.709 is
|
||||
used.
|
||||
|
||||
Available primaries are:
|
||||
|
||||
:auto: automatic selection (default)
|
||||
:bt.601-525: ITU-R BT.601 (SD) 525-line systems (NTSC, SMPTE-C)
|
||||
:bt.601-625: ITU-R BT.601 (SD) 625-line systems (PAL, SECAM)
|
||||
:bt.709: ITU-R BT.709 (HD) (same primaries as sRGB)
|
||||
:bt.2020: ITU-R BT.2020 (UHD)
|
||||
:apple: Apple RGB
|
||||
:adobe: Adobe RGB (1998)
|
||||
:prophoto: ProPhoto RGB (ROMM)
|
||||
:cie1931: CIE 1931 RGB
|
||||
|
||||
``<gamma>``
|
||||
Gamma function the source file was encoded with. Normally this should be set
|
||||
in the file header, but when playing broken or mistagged files this can be
|
||||
used to override the setting.
|
||||
|
||||
This option only affects video output drivers that perform color management.
|
||||
|
||||
If this option is set to ``auto`` (which is the default), the gamma will
|
||||
be set to BT.1886 for YCbCr content, sRGB for RGB content and Linear for
|
||||
XYZ content.
|
||||
|
||||
Available gamma functions are:
|
||||
|
||||
:auto: automatic selection (default)
|
||||
:bt.1886: ITU-R BT.1886 (approximation of BT.601/BT.709/BT.2020 curve)
|
||||
:srgb: IEC 61966-2-4 (sRGB)
|
||||
:linear: Linear light
|
||||
:gamma1.8: Pure power curve (gamma 1.8)
|
||||
:gamma2.2: Pure power curve (gamma 2.2)
|
||||
:gamma2.8: Pure power curve (gamma 2.8)
|
||||
:prophoto: ProPhoto RGB (ROMM) curve
|
||||
|
||||
``<stereo-in>``
|
||||
Set the stereo mode the video is assumed to be encoded in. Takes the
|
||||
same values as the ``--video-stereo-mode`` option.
|
||||
|
||||
``<stereo-out>``
|
||||
Set the stereo mode the video should be displayed as. Takes the
|
||||
same values as the ``--video-stereo-mode`` option.
|
||||
|
||||
``<rotate>``
|
||||
Set the rotation the video is assumed to be encoded with in degrees.
|
||||
The special value ``-1`` uses the input format.
|
||||
|
||||
``<dw>``, ``<dh>``
|
||||
Set the display size. Note that setting the display size such that
|
||||
the video is scaled in both directions instead of just changing the
|
||||
aspect ratio is an implementation detail, and might change later.
|
||||
|
||||
``<dar>``
|
||||
Set the display aspect ratio of the video frame. This is a float,
|
||||
but values such as ``[16:9]`` can be passed too (``[...]`` for quoting
|
||||
to prevent the option parser from interpreting the ``:`` character).
|
||||
|
||||
|
||||
``noformat[=fmt]``
|
||||
Restricts the color space for the next filter without doing any conversion.
|
||||
Unlike the format filter, this will allow any color space except the one
|
||||
you specify.
|
||||
|
||||
.. note:: For a list of available formats, see ``noformat=fmt=help``.
|
||||
|
||||
``<fmt>``
|
||||
Format name, e.g. rgb15, bgr24, 420p, etc. (default: 420p).
|
||||
|
||||
``lavfi=graph[:sws-flags[:o=opts]]``
|
||||
Filter video using FFmpeg's libavfilter.
|
||||
|
||||
``<graph>``
|
||||
The libavfilter graph string. The filter must have a single video input
|
||||
pad and a single video output pad.
|
||||
|
||||
See `<https://ffmpeg.org/ffmpeg-filters.html>`_ for syntax and available
|
||||
filters.
|
||||
|
||||
.. warning::
|
||||
|
||||
If you want to use the full filter syntax with this option, you have
|
||||
to quote the filter graph in order to prevent mpv's syntax and the
|
||||
filter graph syntax from clashing.
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``-vf lavfi=[gradfun=20:30,vflip]``
|
||||
``gradfun`` filter with nonsense parameters, followed by a
|
||||
``vflip`` filter. (This demonstrates how libavfilter takes a
|
||||
graph and not just a single filter.) The filter graph string is
|
||||
quoted with ``[`` and ``]``. This requires no additional quoting
|
||||
or escaping with some shells (like bash), while others (like
|
||||
zsh) require additional ``"`` quotes around the option string.
|
||||
|
||||
``'--vf=lavfi="gradfun=20:30,vflip"'``
|
||||
Same as before, but uses quoting that should be safe with all
|
||||
shells. The outer ``'`` quotes make sure that the shell does not
|
||||
remove the ``"`` quotes needed by mpv.
|
||||
|
||||
``'--vf=lavfi=graph="gradfun=radius=30:strength=20,vflip"'``
|
||||
Same as before, but uses named parameters for everything.
|
||||
|
||||
``<sws-flags>``
|
||||
If libavfilter inserts filters for pixel format conversion, this
|
||||
option gives the flags which should be passed to libswscale. This
|
||||
option is numeric and takes a bit-wise combination of ``SWS_`` flags.
|
||||
|
||||
See ``http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libswscale/swscale.h``.
|
||||
|
||||
``<o>``
|
||||
Set AVFilterGraph options. These should be documented by FFmpeg.
|
||||
|
||||
.. admonition:: Example
|
||||
|
||||
``'--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
|
||||
content. The ``pullup`` filter makes use of future context in making its
|
||||
decisions. It is stateless in the sense that it does not lock onto a pattern
|
||||
to follow, but it instead looks forward to the following fields in order to
|
||||
identify matches and rebuild progressive frames.
|
||||
|
||||
``jl``, ``jr``, ``jt``, and ``jb``
|
||||
These options set the amount of "junk" to ignore at the left, right,
|
||||
top, and bottom of the image, respectively. Left/right are in units of
|
||||
8 pixels, while top/bottom are in units of 2 lines. The default is 8
|
||||
pixels on each side.
|
||||
|
||||
``sb`` (strict breaks)
|
||||
Setting this option to 1 will reduce the chances of ``pullup``
|
||||
generating an occasional mismatched frame, but it may also cause an
|
||||
excessive number of frames to be dropped during high motion sequences.
|
||||
Conversely, setting it to -1 will make ``pullup`` match fields more
|
||||
easily. This may help processing of video where there is slight
|
||||
blurring between the fields, but may also cause there to be interlaced
|
||||
frames in the output.
|
||||
|
||||
``mp`` (metric plane)
|
||||
This option may be set to ``u`` or ``v`` to use a chroma plane instead of the
|
||||
luma plane for doing ``pullup``'s computations. This may improve accuracy
|
||||
on very clean source material, but more likely will decrease accuracy,
|
||||
especially if there is chroma noise (rainbow effect) or any grayscale
|
||||
video. The main purpose of setting ``mp`` to a chroma plane is to reduce
|
||||
CPU load and make pullup usable in realtime on slow machines.
|
||||
|
||||
``yadif=[mode:interlaced-only]``
|
||||
Yet another deinterlacing filter
|
||||
|
||||
``<mode>``
|
||||
:frame: Output 1 frame for each frame.
|
||||
:field: Output 1 frame for each field.
|
||||
:frame-nospatial: Like ``frame`` but skips spatial interlacing check.
|
||||
:field-nospatial: Like ``field`` but skips spatial interlacing check.
|
||||
|
||||
``<interlaced-only>``
|
||||
:no: Deinterlace all frames (default).
|
||||
:yes: Only deinterlace frames marked as interlaced (default if this
|
||||
filter is inserted via ``deinterlace`` property).
|
||||
|
||||
This filter, is automatically inserted when using the ``D`` key (or any
|
||||
other key that toggles the ``deinterlace`` property or when using the
|
||||
``--deinterlace`` switch), assuming the video output does not have native
|
||||
deinterlacing support.
|
||||
|
||||
If you just want to set the default mode, put this filter and its options
|
||||
into ``--vf-defaults`` instead, and enable deinterlacing with ``D`` or
|
||||
``--deinterlace``.
|
||||
|
||||
Also note that the ``D`` key is stupid enough to insert an interlacer twice
|
||||
when inserting yadif with ``--vf``, so using the above methods is
|
||||
recommended.
|
||||
|
||||
``sub=[=bottom-margin:top-margin]``
|
||||
Moves subtitle rendering to an arbitrary point in the filter chain, or force
|
||||
subtitle rendering in the video filter as opposed to using video output OSD
|
||||
support.
|
||||
|
||||
``<bottom-margin>``
|
||||
Adds a black band at the bottom of the frame. The SSA/ASS renderer can
|
||||
place subtitles there (with ``--sub-use-margins``).
|
||||
``<top-margin>``
|
||||
Black band on the top for toptitles (with ``--sub-use-margins``).
|
||||
|
||||
.. admonition:: Examples
|
||||
|
||||
``--vf=sub,eq``
|
||||
Moves sub rendering before the eq filter. This will put both
|
||||
subtitle colors and video under the influence of the video equalizer
|
||||
settings.
|
||||
|
||||
``stereo3d[=in:out]``
|
||||
Stereo3d converts between different stereoscopic image formats.
|
||||
|
||||
``<in>``
|
||||
Stereoscopic image format of input. Possible values:
|
||||
|
||||
``sbsl`` or ``side_by_side_left_first``
|
||||
side by side parallel (left eye left, right eye right)
|
||||
``sbsr`` or ``side_by_side_right_first``
|
||||
side by side crosseye (right eye left, left eye right)
|
||||
``abl`` or ``above_below_left_first``
|
||||
above-below (left eye above, right eye below)
|
||||
``abr`` or ``above_below_right_first``
|
||||
above-below (right eye above, left eye below)
|
||||
``ab2l`` or ``above_below_half_height_left_first``
|
||||
above-below with half height resolution (left eye above, right eye
|
||||
below)
|
||||
``ab2r`` or ``above_below_half_height_right_first``
|
||||
above-below with half height resolution (right eye above, left eye
|
||||
below)
|
||||
|
||||
``<out>``
|
||||
Stereoscopic image format of output. Possible values are all the input
|
||||
formats as well as:
|
||||
|
||||
``arcg`` or ``anaglyph_red_cyan_gray``
|
||||
anaglyph red/cyan gray (red filter on left eye, cyan filter on
|
||||
right eye)
|
||||
``arch`` or ``anaglyph_red_cyan_half_color``
|
||||
anaglyph red/cyan half colored (red filter on left eye, cyan filter
|
||||
on right eye)
|
||||
``arcc`` or ``anaglyph_red_cyan_color``
|
||||
anaglyph red/cyan color (red filter on left eye, cyan filter on
|
||||
right eye)
|
||||
``arcd`` or ``anaglyph_red_cyan_dubois``
|
||||
anaglyph red/cyan color optimized with the least-squares
|
||||
projection of Dubois (red filter on left eye, cyan filter on right
|
||||
eye)
|
||||
``agmg`` or ``anaglyph_green_magenta_gray``
|
||||
anaglyph green/magenta gray (green filter on left eye, magenta
|
||||
filter on right eye)
|
||||
``agmh`` or ``anaglyph_green_magenta_half_color``
|
||||
anaglyph green/magenta half colored (green filter on left eye,
|
||||
magenta filter on right eye)
|
||||
``agmc`` or ``anaglyph_green_magenta_color``
|
||||
anaglyph green/magenta colored (green filter on left eye, magenta
|
||||
filter on right eye)
|
||||
``aybg`` or ``anaglyph_yellow_blue_gray``
|
||||
anaglyph yellow/blue gray (yellow filter on left eye, blue filter
|
||||
on right eye)
|
||||
``aybh`` or ``anaglyph_yellow_blue_half_color``
|
||||
anaglyph yellow/blue half colored (yellow filter on left eye, blue
|
||||
filter on right eye)
|
||||
``aybc`` or ``anaglyph_yellow_blue_color``
|
||||
anaglyph yellow/blue colored (yellow filter on left eye, blue
|
||||
filter on right eye)
|
||||
``irl`` or ``interleave_rows_left_first``
|
||||
Interleaved rows (left eye has top row, right eye starts on next
|
||||
row)
|
||||
``irr`` or ``interleave_rows_right_first``
|
||||
Interleaved rows (right eye has top row, left eye starts on next
|
||||
row)
|
||||
``ml`` or ``mono_left``
|
||||
mono output (left eye only)
|
||||
``mr`` or ``mono_right``
|
||||
mono output (right eye only)
|
||||
|
||||
``gradfun[=strength[:radius|:size=<size>]]``
|
||||
Fix the banding artifacts that are sometimes introduced into nearly flat
|
||||
regions by truncation to 8-bit color depth. Interpolates the gradients that
|
||||
should go where the bands are, and dithers them.
|
||||
|
||||
``<strength>``
|
||||
Maximum amount by which the filter will change any one pixel. Also the
|
||||
threshold for detecting nearly flat regions (default: 1.5).
|
||||
|
||||
``<radius>``
|
||||
Neighborhood to fit the gradient to. Larger radius makes for smoother
|
||||
gradients, but also prevents the filter from modifying pixels near
|
||||
detailed regions (default: disabled).
|
||||
|
||||
``<size>``
|
||||
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
|
||||
native VapourSynth video source. The mpv source will answer frame
|
||||
requests only within a small window of frames (the size of this window
|
||||
is controlled with the ``buffered-frames`` parameter), and requests outside
|
||||
of that will return errors. As such, you can't use the full power of
|
||||
VapourSynth, but you can use certain filters.
|
||||
|
||||
If you just want to play video generated by a VapourSynth (i.e. using
|
||||
a native VapourSynth video source), it's better to use ``vspipe`` and a
|
||||
FIFO to feed the video to mpv. The same applies if the filter script
|
||||
requires random frame access (see ``buffered-frames`` parameter).
|
||||
|
||||
This filter is experimental. If it turns out that it works well and is
|
||||
used, it will be ported to libavfilter. Otherwise, it will be just removed.
|
||||
|
||||
``file``
|
||||
Filename of the script source. Currently, this is always a python
|
||||
script. The variable ``video_in`` is set to the mpv video source,
|
||||
and it is expected that the script reads video from it. (Otherwise,
|
||||
mpv will decode no video, and the video packet queue will overflow,
|
||||
eventually leading to audio being stopped.) The script is also
|
||||
expected to pass through timestamps using the ``_DurationNum`` and
|
||||
``_DurationDen`` frame properties.
|
||||
|
||||
.. admonition:: Example:
|
||||
|
||||
::
|
||||
|
||||
import vapoursynth as vs
|
||||
core = vs.get_core()
|
||||
core.std.AddBorders(video_in, 10, 10, 20, 20).set_output()
|
||||
|
||||
.. warning::
|
||||
|
||||
The script will be reloaded on every seek. This is done to reset
|
||||
the filter properly on discontinuities.
|
||||
|
||||
``buffered-frames``
|
||||
Maximum number of decoded video frames that should be buffered before
|
||||
the filter (default: 4). This specifies the maximum number of frames
|
||||
the script can requests backwards. E.g. if ``buffered-frames=5``, and
|
||||
the script just requested frame 15, it can still request frame 10, but
|
||||
frame 9 is not available anymore. If it requests frame 30, mpv will
|
||||
decode 15 more frames, and keep only frames 25-30.
|
||||
|
||||
The actual number of buffered frames also depends on the value of the
|
||||
``concurrent-frames`` option. Currently, both option values are
|
||||
multiplied to get the final buffer size.
|
||||
|
||||
(Normally, VapourSynth source filters must provide random access, but
|
||||
mpv was made for playback, and does not provide frame-exact random
|
||||
access. The way this video filter works is a compromise to make simple
|
||||
filters work anyway.)
|
||||
|
||||
``concurrent-frames``
|
||||
Number of frames that should be requested in parallel. The
|
||||
level of concurrency depends on the filter and how quickly mpv can
|
||||
decode video to feed the filter. This value should probably be
|
||||
proportional to the number of cores on your machine. Most time,
|
||||
making it higher than the number of cores can actually make it
|
||||
slower.
|
||||
|
||||
By default, this uses the special value ``auto``, which sets the option
|
||||
to the number of detected logical CPU cores.
|
||||
|
||||
The following variables are defined by mpv:
|
||||
|
||||
``video_in``
|
||||
The mpv video source as vapoursynth clip. Note that this has no length
|
||||
set, which confuses many filters. Using ``Trim`` on the clip with a
|
||||
high dummy length can turn it into a finite clip.
|
||||
|
||||
``video_in_dw``, ``video_in_dh``
|
||||
Display size of the video. Can be different from video size if the
|
||||
video does not use square pixels (e.g. DVD).
|
||||
|
||||
``container_fps``
|
||||
FPS value as reported by file headers. This value can be wrong or
|
||||
completely broken (e.g. 0 or NaN). Even if the value is correct,
|
||||
if another filter changes the real FPS (by dropping or inserting
|
||||
frames), the value of this variable might not be useful. Note that
|
||||
the ``--fps`` command line option overrides this value.
|
||||
|
||||
Useful for some filters which insist on having a FPS.
|
||||
|
||||
``display_fps``
|
||||
Refresh rate of the current display. Note that this value can be 0.
|
||||
|
||||
``vapoursynth-lazy``
|
||||
The same as ``vapoursynth``, but doesn't load Python scripts. Instead, a
|
||||
custom backend using Lua and the raw VapourSynth API is used. The syntax
|
||||
is completely different, and absolutely no convenience features are
|
||||
provided. There's no type checking either, and you can trigger crashes.
|
||||
|
||||
.. admonition:: Example:
|
||||
|
||||
::
|
||||
|
||||
video_out = invoke("morpho", "Open", {clip = video_in})
|
||||
|
||||
The special variable ``video_in`` is the mpv video source, while the
|
||||
special variable ``video_out`` is used to read video from. The 1st argument
|
||||
is the plugin (queried with ``getPluginByNs``), the 2nd is the filter name,
|
||||
and the 3rd argument is a table with the arguments. Positional arguments
|
||||
are not supported. The types must match exactly. Since Lua is terrible and
|
||||
can't distinguish integers and floats, integer arguments must be prefixed
|
||||
with ``i_``, in which case the prefix is removed and the argument is cast
|
||||
to an integer. Should the argument's name start with ``i_``, you're out of
|
||||
luck.
|
||||
|
||||
Clips (VSNodeRef) are passed as light userdata, so trying to pass any
|
||||
other userdata type will result in hard crashes.
|
||||
|
||||
``vavpp``
|
||||
VA-AP-API video post processing. Works with ``--vo=vaapi`` and ``--vo=opengl``
|
||||
only. Currently deinterlaces. This filter is automatically inserted if
|
||||
deinterlacing is requested (either using the ``D`` key, by default mapped to
|
||||
the command ``cycle deinterlace``, or the ``--deinterlace`` option).
|
||||
|
||||
``deint=<method>``
|
||||
Select the deinterlacing algorithm.
|
||||
|
||||
no
|
||||
Don't perform deinterlacing.
|
||||
first-field
|
||||
Show only first field (going by ``--field-dominance``).
|
||||
bob
|
||||
bob deinterlacing (default).
|
||||
weave, motion-adaptive, motion-compensated
|
||||
Advanced deinterlacing algorithms. Whether these actually work
|
||||
depends on the GPU hardware, the GPU drivers, driver bugs, and
|
||||
mpv bugs.
|
||||
|
||||
``<interlaced-only>``
|
||||
:no: Deinterlace all frames.
|
||||
:yes: Only deinterlace frames marked as interlaced (default).
|
||||
|
||||
``vdpaupp``
|
||||
VDPAU video post processing. Works with ``--vo=vdpau`` and ``--vo=opengl``
|
||||
only. This filter is automatically inserted if deinterlacing is requested
|
||||
(either using the ``D`` key, by default mapped to the command
|
||||
``cycle deinterlace``, or the ``--deinterlace`` option). When enabling
|
||||
deinterlacing, it is always preferred over software deinterlacer filters
|
||||
if the ``vdpau`` VO is used, and also if ``opengl`` is used and hardware
|
||||
decoding was activated at least once (i.e. vdpau was loaded).
|
||||
|
||||
``sharpen=<-1-1>``
|
||||
For positive values, apply a sharpening algorithm to the video, for
|
||||
negative values a blurring algorithm (default: 0).
|
||||
``denoise=<0-1>``
|
||||
Apply a noise reduction algorithm to the video (default: 0; no noise
|
||||
reduction).
|
||||
``deint=<yes|no>``
|
||||
Whether deinterlacing is enabled (default: no). If enabled, it will use
|
||||
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
|
||||
confusion, it's recommended not to use the ``--vo=vdpau`` suboptions
|
||||
related to filtering.
|
||||
|
||||
first-field
|
||||
Show only first field.
|
||||
bob
|
||||
Bob deinterlacing.
|
||||
temporal
|
||||
Motion-adaptive temporal deinterlacing. May lead to A/V desync
|
||||
with slow video hardware and/or high resolution.
|
||||
temporal-spatial
|
||||
Motion-adaptive temporal deinterlacing with edge-guided spatial
|
||||
interpolation. Needs fast video hardware.
|
||||
``chroma-deint``
|
||||
Makes temporal deinterlacers operate both on luma and chroma (default).
|
||||
Use no-chroma-deint to solely use luma and speed up advanced
|
||||
deinterlacing. Useful with slow video memory.
|
||||
``pullup``
|
||||
Try to apply inverse telecine, needs motion adaptive temporal
|
||||
deinterlacing.
|
||||
``interlaced-only=<yes|no>``
|
||||
If ``yes`` (default), only deinterlace frames marked as interlaced.
|
||||
``hqscaling=<0-9>``
|
||||
0
|
||||
Use default VDPAU scaling (default).
|
||||
1-9
|
||||
Apply high quality VDPAU scaling (needs capable hardware).
|
||||
|
||||
``vdpaurb``
|
||||
VDPAU video read back. Works with ``--vo=vdpau`` and ``--vo=opengl`` only.
|
||||
This filter will read back frames decoded by VDPAU so that other filters,
|
||||
which are not normally compatible with VDPAU, can be used like normal.
|
||||
This filter must be specified before ``vdpaupp`` in the filter chain if
|
||||
``vdpaupp`` is used.
|
||||
|
||||
``buffer=<num>``
|
||||
Buffer ``<num>`` frames in the filter chain. This filter is probably pretty
|
||||
useless, except for debugging. (Note that this won't help smoothing out
|
||||
latencies with decoding, because the filter will never output a frame if
|
||||
the buffer isn't full, except on EOF.)
|
||||
-1060
File diff suppressed because it is too large.
Load diff
@@ -1,451 +0,0 @@
|
||||
CHANGES FROM OTHER VERSIONS OF 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.
|
||||
|
||||
.. note::
|
||||
These lists are incomplete.
|
||||
|
||||
General Changes from MPlayer to mpv
|
||||
-----------------------------------
|
||||
|
||||
This listing is about changes introduced by mplayer2 and mpv relatively to
|
||||
MPlayer.
|
||||
|
||||
Player
|
||||
~~~~~~
|
||||
|
||||
* New name for the binary (``mpv``). New location for config files (either
|
||||
``~/.config/mpv/mpv.conf``, or if you want, ``~/.mpv/config``).
|
||||
* Encoding functionality (replacement for MEncoder, see the `ENCODING`_ section).
|
||||
* Support for Lua scripting (see the `LUA SCRIPTING`_ section).
|
||||
* Better pause handling (e.g. do not unpause on a command).
|
||||
* Precise seeking support.
|
||||
* Improvements in audio/video sync handling.
|
||||
* Do not lose settings when playing a new file in the same player instance.
|
||||
* Slave mode compatibility broken (see below).
|
||||
* Re-enable screensaver while the player is paused.
|
||||
* Allow resuming playback at a later point with ``Shift+q``, also see the
|
||||
``quit_watch_later`` input command.
|
||||
* ``--keep-open`` option to stop the player from closing the window and
|
||||
exiting after playback ends.
|
||||
* A client API, that allows embedding **mpv** into applications
|
||||
(see ``libmpv/client.h`` in the sources).
|
||||
|
||||
Input
|
||||
~~~~~
|
||||
|
||||
* Improved default keybindings. MPlayer bindings are also available (see
|
||||
``etc/mplayer-input.conf`` in the source tree).
|
||||
* Improved responsiveness on user input.
|
||||
* Support for modifier keys (alt, shift, ctrl) in input.conf.
|
||||
* Allow customizing whether a key binding for seeking shows the video time, the
|
||||
OSD bar, or nothing (see the `Input Command Prefixes`_ section).
|
||||
* Support mapping multiple commands to one key.
|
||||
* Classic LIRC support was removed. Install remotes as input devices instead.
|
||||
This way they will send X11 key events to the mpv window, which can be bound
|
||||
using the normal ``input.conf``.
|
||||
Also see: http://github.com/mpv-player/mpv/wiki/IR-remotes
|
||||
* Joystick support was removed. It was considered useless and was the cause
|
||||
of some problems (e.g. a laptop's accelerator being recognized as joystick).
|
||||
* Support for relative seeking by percentage.
|
||||
|
||||
Audio
|
||||
~~~~~
|
||||
|
||||
* Support for gapless audio (see the ``--gapless-audio`` option).
|
||||
* Support for OSS4 volume control.
|
||||
* Improved support for PulseAudio.
|
||||
* Make ``--softvol`` default (**mpv** is not a mixer control panel).
|
||||
* By default, do pitch correction if playback speed is increased.
|
||||
* Improved downmixing and output of surround audio:
|
||||
|
||||
- Instead of using hardcoded pan filters to do remixing, libavresample is used
|
||||
- Channel maps are used to identify the channel layout, so e.g. ``3.0`` and
|
||||
``2.1`` audio can be distinguished.
|
||||
|
||||
Video
|
||||
~~~~~
|
||||
|
||||
* Wayland support.
|
||||
* Native support for VAAPI and VDA. Improved VDPAU video output.
|
||||
* Improved OpenGL output (see the ``opengl-hq`` video output).
|
||||
* Make hardware decoding work with the ``opengl`` video output.
|
||||
* Support for libavfilter (for video->video and audio->audio). This allows
|
||||
using most of FFmpeg's filters, which improve greatly on the old MPlayer
|
||||
filters in features, performance, and correctness.
|
||||
* More correct color reproduction (color matrix generation), including support
|
||||
for BT.2020 (Ultra HD) and linear XYZ (Digital Cinema) inputs.
|
||||
* Support for color managed displays, via ICC profiles.
|
||||
* High-quality image resamplers (see the ``opengl`` ``scale`` suboption).
|
||||
* Support for scaling in (sigmoidized) linear light.
|
||||
* Better subtitle rendering using libass by default.
|
||||
* Improvements when playing multiple files (``-fixed-vo`` is default, do not
|
||||
reset settings by default when playing a new file).
|
||||
* Replace image video outputs (``--vo=jpeg`` etc.) with ``--vo=image``.
|
||||
* Removal of ``--vo=gif89a``, ``--vo=md5sum``, ``--vo=yuv4mpeg``, as encoding
|
||||
can handle these use cases. For yuv4mpeg, for example, use::
|
||||
|
||||
mpv input.mkv -o output.y4m --no-audio --oautofps --oneverdrop
|
||||
|
||||
* Image subtitles (DVDs etc.) are rendered in color and use more correct
|
||||
positioning (color for image subs can be disabled with ``--sub-gray``).
|
||||
* Support for the X11 video output is removed, since it was considered
|
||||
deprecated. SDL video output can still be used as a fallback.
|
||||
|
||||
OSD and terminal
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
* Cleaned up terminal output: nicer status line, less useless noise.
|
||||
* Improved OSD rendering using libass, with full Unicode support.
|
||||
* New OSD bar with chapter marks. Not positioned in the middle of the video
|
||||
(this can be customized with the ``--osd-bar-align-y`` option).
|
||||
* Display list of chapters and audio/subtitle tracks on OSD (see the
|
||||
`Properties`_ section).
|
||||
|
||||
Screenshots
|
||||
~~~~~~~~~~~
|
||||
|
||||
* Instant screenshots without 1-frame delay.
|
||||
* Support for taking screenshots even with hardware decoding.
|
||||
* Support for saving screenshots as JPEG or PNG.
|
||||
* Support for configurable file names.
|
||||
* Support for taking screenshots with or without subtitles.
|
||||
|
||||
Note that the ``screenshot`` video filter is not needed anymore, and should not
|
||||
be put into the mpv config file.
|
||||
|
||||
Miscellaneous
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
* Better MKV support (e.g. ordered chapters, 3D metadata).
|
||||
* Matroska edition switching at runtime.
|
||||
* Support for playing URLs of popular streaming sites directly.
|
||||
(e.g. ``mpv https://www.youtube.com/watch?v=...``).
|
||||
Requires a recent version of ``youtube-dl`` to be installed. Can be
|
||||
disabled with ``ytdl=no`` in the mpv config file.
|
||||
* Support for precise scrolling which scales the parameter of commands. If the
|
||||
input doesn't support precise scrolling the scale factor stays 1.
|
||||
* Allow changing/adjusting video filters at runtime. (This is also used to make
|
||||
the ``D`` key insert vf_yadif if deinterlacing is not supported otherwise).
|
||||
* Improved support for .cue files.
|
||||
|
||||
Mac OS X
|
||||
~~~~~~~~
|
||||
|
||||
* Native OpenGL backend.
|
||||
* Cocoa event loop is independent from MPlayer's event loop, so user
|
||||
actions like accessing menus and live resizing do not block the playback.
|
||||
* Apple Remote support.
|
||||
* Media Keys support.
|
||||
* VDA support using libavcodec hwaccel API instead of FFmpeg's decoder with up
|
||||
to 2-2.5x reduction in CPU usage.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
* Improved support for Unicode file names.
|
||||
* Improved window handling.
|
||||
* Do not block playback when moving the window.
|
||||
* Improved Direct3D video output.
|
||||
* Added WASAPI audio output.
|
||||
|
||||
Internal changes
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
* Switch to GPLv2+ (see ``Copyright`` file for details).
|
||||
* Removal of lots of cruft:
|
||||
|
||||
- Internal GUI (replaced by the OSC, see the `ON SCREEN CONTROLLER`_ section).
|
||||
- MEncoder (replaced by native encoding, see the `ENCODING`_ section).
|
||||
- OSD menu.
|
||||
- Kernel video drivers for Linux 2.4 (including VIDIX).
|
||||
- Teletext support.
|
||||
- Support for dead platforms.
|
||||
- Most built-in demuxers have been replaced by their libavformat counterparts.
|
||||
- Built-in network support has been replaced by libavformat's (which also
|
||||
supports https URLs).
|
||||
- Embedded copies of libraries (such as FFmpeg).
|
||||
|
||||
* General code cleanups (including refactoring or rewrites of many parts).
|
||||
* New build system.
|
||||
* Many bug fixes and removal of long-standing issues.
|
||||
* Generally preferring FFmpeg/Libav over internal demuxers, decoders, and
|
||||
filters.
|
||||
|
||||
Detailed Listing of User-visible Changes
|
||||
----------------------------------------
|
||||
|
||||
This listing is about changed command line switches, slave commands, and similar
|
||||
things. Completely removed features are not listed.
|
||||
|
||||
Command Line Switches
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* There is a new command line syntax, which is generally preferred over the old
|
||||
syntax. ``-optname optvalue`` becomes ``--optname=optvalue``.
|
||||
|
||||
The old syntax will not be removed. However, the new syntax is mentioned in
|
||||
all documentation and so on, and unlike the old syntax is not ambiguous,
|
||||
so it is a good thing to know about this change.
|
||||
* In general, negating switches like ``-noopt`` now have to be written as
|
||||
``-no-opt`` or ``--no-opt``.
|
||||
* Per-file options are not the default anymore. You can explicitly specify
|
||||
file-local options. See ``Usage`` section.
|
||||
* Many options have been renamed, removed or changed semantics. Some options
|
||||
that are required for a good playback experience with MPlayer are now
|
||||
superfluous or even worse than the defaults, so make sure to read the manual
|
||||
before trying to use your existing configuration with **mpv**.
|
||||
* Table of renamed/replaced switches:
|
||||
|
||||
=========================== ========================================
|
||||
Old New
|
||||
=========================== ========================================
|
||||
``-no<opt>`` ``--no-<opt>`` (add a dash)
|
||||
``-a52drc level`` ``--ad-lavc-ac3drc=level``
|
||||
``-ac spdifac3`` ``--ad=spdif:ac3`` (see ``--ad=help``)
|
||||
``-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``
|
||||
``-ass-bottom-margin`` ``--vf=sub=bottom:top``
|
||||
``-ass`` ``--sub-ass``
|
||||
``-audiofile-cache`` (removed; the main cache settings are used)
|
||||
``-audiofile`` ``--audio-file``
|
||||
``-benchmark`` ``--untimed`` (no stats)
|
||||
``-capture`` ``--stream-capture=<filename>``
|
||||
``-channels`` ``--audio-channels`` (changed semantics)
|
||||
``-cursor-autohide-delay`` ``--cursor-autohide``
|
||||
``-delay`` ``--audio-delay``
|
||||
``-dumpstream`` ``--stream-dump=<filename>``
|
||||
``-dvdangle`` ``--dvd-angle``
|
||||
``-endpos`` ``--length``
|
||||
``-fixed-vo`` (removed; always the default)
|
||||
``-font`` ``--osd-font``
|
||||
``-forcedsubsonly`` ``--sub-forced-only``
|
||||
``-forceidx`` ``--index``
|
||||
``-format`` ``--audio-format``
|
||||
``-fsmode-dontuse`` (removed)
|
||||
``-fstype`` ``--x11-netwm`` (changed semantics)
|
||||
``-hardframedrop`` ``--framedrop=hard``
|
||||
``-identify`` (removed; use TOOLS/mpv_identify.sh)
|
||||
``-idx`` ``--index``
|
||||
``-lavdopts ...`` ``--vd-lavc-...``
|
||||
``-lavfdopts`` ``--demuxer-lavf-...``
|
||||
``-loop 0`` ``--loop=inf``
|
||||
``-mixer-channel`` AO suboptions (``alsa``, ``oss``)
|
||||
``-mixer`` AO suboptions (``alsa``, ``oss``)
|
||||
``-mouse-movements`` ``--input-cursor``
|
||||
``-msgcolor`` ``--msg-color``
|
||||
``-msglevel`` ``--msg-level`` (changed semantics)
|
||||
``-msgmodule`` ``--msg-module``
|
||||
``-name`` ``--x11-name``
|
||||
``-noar`` ``--no-input-appleremote``
|
||||
``-noautosub`` ``--no-sub-auto``
|
||||
``-noconsolecontrols`` ``--no-input-terminal``
|
||||
``-nosound`` ``--no-audio``
|
||||
``-osdlevel`` ``--osd-level``
|
||||
``-panscanrange`` ``--video-zoom``, ``--video-pan-x/y``
|
||||
``-playing-msg`` ``--term-playing-msg``
|
||||
``-pp ...`` ``'--vf=lavfi=[pp=...]'``
|
||||
``-pphelp`` (See FFmpeg libavfilter documentation.)
|
||||
``-rawaudio ...`` ``--demuxer-rawaudio-...``
|
||||
``-rawvideo ...`` ``--demuxer-rawvideo-...``
|
||||
``-spugauss`` ``--sub-gauss``
|
||||
``-srate`` ``--audio-samplerate``
|
||||
``-ss`` ``--start``
|
||||
``-ssf <sub>`` ``--sws-...``
|
||||
``-stop-xscreensaver`` ``--stop-screensaver``
|
||||
``-sub-fuzziness`` ``--sub-auto``
|
||||
``-sub`` ``--sub-file``
|
||||
``-subcp`` ``--sub-codepage``
|
||||
``-subdelay`` ``--sub-delay``
|
||||
``-subfile`` ``--sub-file``
|
||||
``-subfont-*`` ``--sub-text-*``, ``--osd-*``
|
||||
``-subfont-text-scale`` ``--sub-scale``
|
||||
``-subfont`` ``--sub-text-font``
|
||||
``-subfps`` ``--sub-fps``
|
||||
``-subpos`` ``--sub-pos``
|
||||
``-sws`` ``--sws-scaler``
|
||||
``-tvscan`` ``--tv-scan``
|
||||
``-use-filename-title`` ``--title='${filename}'``
|
||||
``-vc ffh264vdpau`` (etc.) ``--hwdec=vdpau``
|
||||
``-vobsub`` ``--sub-file`` (pass the .idx file)
|
||||
``-x W``, ``-y H`` ``--geometry=WxH`` + ``--no-keepaspect``
|
||||
``-xineramascreen`` ``--screen`` (different values)
|
||||
``-xy W`` ``--autofit=W``
|
||||
``-zoom`` Inverse available as ``--video-unscaled``
|
||||
``dvdnav://`` Removed.
|
||||
``dvd://1`` ``dvd://0`` (0-based offset)
|
||||
=========================== ========================================
|
||||
|
||||
.. note::
|
||||
|
||||
``-opt val`` becomes ``--opt=val``.
|
||||
|
||||
.. note::
|
||||
|
||||
Quite some video filters, video outputs, audio filters, audio outputs, had
|
||||
changes in their option parsing. These aren't mentioned in the table above.
|
||||
|
||||
Also, some video and audio filters have been removed, and you have to use
|
||||
libavfilter (using ``--vf=lavfi=[...]`` or ``--af=lavfi=[...]``) to get
|
||||
them back.
|
||||
|
||||
input.conf and Slave Commands
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Table of renamed input commands:
|
||||
|
||||
This lists only commands that are not always gracefully handled by the
|
||||
internal legacy translation layer. If an input.conf contains any legacy
|
||||
commands, a warning will be printed when starting the player. The warnings
|
||||
also show the replacement commands.
|
||||
|
||||
Properties containing ``_`` to separate words use ``-`` instead.
|
||||
|
||||
+--------------------------------+----------------------------------------+
|
||||
| Old | New |
|
||||
+================================+========================================+
|
||||
| ``pt_step 1 [0|1]`` | ``playlist_next [weak|force]`` |
|
||||
| | (translation layer cannot deal with |
|
||||
| | whitespace) |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``pt_step -1 [0|1]`` | ``playlist_prev [weak|force] (same)`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``switch_ratio [<ratio>]`` | ``set video-aspect <ratio>`` |
|
||||
| | |
|
||||
| | ``set video-aspect 0`` (reset aspect) |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``step_property_osd <prop>`` | ``cycle <prop> <step>`` (wraps), |
|
||||
| ``<step> <dir>`` | ``add <prop> <step>`` (clamps). |
|
||||
| | ``<dir>`` parameter unsupported. Use |
|
||||
| | a negative ``<step>`` instead. |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``step_property <prop>`` | Prefix ``cycle`` or ``add`` with |
|
||||
| ``<step> <dir>`` | ``no-osd``: ``no-osd cycle <prop>`` |
|
||||
| | ``<step>`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``osd_show_property_text`` | ``show_text <text>`` |
|
||||
| ``<text>`` | The property expansion format string |
|
||||
| | syntax slightly changed. |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``osd_show_text`` | Now does the same as |
|
||||
| | ``osd_show_property_text``. Use the |
|
||||
| | ``raw`` prefix to disable property |
|
||||
| | expansion. |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``show_tracks`` | ``show_text ${track-list}`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``show_chapters`` | ``show_text ${chapter-list}`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``af_switch``, ``af_add``, ... | ``af set|add|...`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_start_scan`` | ``set tv-scan yes`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_set_channel <val>`` | ``set tv-channel <val>`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_step_channel`` | ``cycle tv-channel`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``dvb_set_channel <v1> <v2>`` | ``set dvb-channel <v1>-<v2>`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``dvb_step_channel`` | ``cycle dvb-channel`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_set_freq <val>`` | ``set tv-freq <val>`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_step_freq`` | ``cycle tv-freq`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_set_norm <norm>`` | ``set tv-norm <norm>`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
| ``tv_step_norm`` | ``cycle tv-norm`` |
|
||||
+--------------------------------+----------------------------------------+
|
||||
|
||||
.. note::
|
||||
|
||||
Due to lack of hardware and users using the TV/DVB/PVR features, and
|
||||
due to the need to cleanup the related command code, it's possible
|
||||
that the new commands are buggy or behave worse. This can be improved
|
||||
if testers are available. Otherwise, some of the TV code will be
|
||||
removed at some point.
|
||||
|
||||
Slave mode
|
||||
~~~~~~~~~~
|
||||
|
||||
* Slave mode was removed. A proper slave mode application needed tons of code
|
||||
and hacks to get
|
||||
it right. The main problem is that slave mode is a bad and incomplete
|
||||
interface, and to get around that, applications parsed output messages
|
||||
intended for users. It is hard to know which messages exactly are parsed by
|
||||
slave mode applications. This makes it virtually impossible to improve
|
||||
terminal output intended for users without possibly breaking something.
|
||||
|
||||
This is absolutely insane, and since initial improvements to **mpv** quickly
|
||||
made slave mode incompatible to most applications, it was removed as useless
|
||||
cruft. The client API (see below) is provided instead.
|
||||
|
||||
``--identify`` was replaced by the ``TOOLS/mpv_identify.sh`` wrapper script.
|
||||
|
||||
* For some time (until including release 0.4.x), mpv supported a
|
||||
``--slave-broken`` option. The following options are equivalent:
|
||||
|
||||
::
|
||||
|
||||
--input-file=/dev/stdin --input-terminal=no
|
||||
|
||||
|
||||
Assuming the system supports ``/dev/stdin``.
|
||||
|
||||
(The option was added back in 0.5.1 and sets exactly these options. It was
|
||||
removed in 0.10.x again.)
|
||||
|
||||
* A JSON RPC protocol giving access to the client API is also supported. See
|
||||
`JSON IPC`_ for more information.
|
||||
|
||||
* **mpv** also provides a client API, which can be used to embed the player
|
||||
by loading it as shared library. (See ``libmpv/client.h`` in the sources.)
|
||||
It might also be possible to implement a custom slave mode-like protocol
|
||||
using Lua scripting.
|
||||
|
||||
Policy for Removed Features
|
||||
---------------------------
|
||||
|
||||
**mpv** is in active development. If something is in the way of more important
|
||||
development (such as fixing bugs or implementing new features), we sometimes
|
||||
remove features. Usually this happens only with old features that either seem
|
||||
to be useless, or are not used by anyone. Often these are obscure, or
|
||||
"inherited", or were marked experimental, but never received any particular
|
||||
praise by any users.
|
||||
|
||||
Sometimes, features are replaced by something new. The new code will be either
|
||||
simpler or more powerful, but doesn't necessarily provide everything the old
|
||||
feature did.
|
||||
|
||||
We can not exclude that we accidentally remove features that are actually
|
||||
popular. Generally, we do not know how much a specific functionality is used.
|
||||
If you miss a feature and think it should be re-added, please open an issue
|
||||
on the mpv bug tracker. Hopefully, a solution can be found. Often, it turns
|
||||
out that re-adding something is not much of a problem, or that there are
|
||||
better alternatives.
|
||||
|
||||
Why this Fork?
|
||||
--------------
|
||||
|
||||
mplayer2 is practically dead, and mpv started out as a branch containing
|
||||
new/experimental development. (Some of it was merged right *after* the fork
|
||||
was made public, seemingly as an acknowledgment that development, or at
|
||||
least merging, should have been more active.)
|
||||
|
||||
MPlayer is focused on not breaking anything, but is stuck with a horrible
|
||||
codebase resistant to cleanup. (Unless you do what mpv did - merciless and
|
||||
consequent pruning of bad, old code.) Cleanup and keeping broken things
|
||||
conflict, so the kind of development mpv strives for can't be done within
|
||||
MPlayer due to clashing development policies.
|
||||
|
||||
Additionally, mplayer2 already had lots of changes over MPlayer, which would
|
||||
have needed to be backported to the MPlayer codebase. This would not only
|
||||
have been hard (several years of diverging development), but also would have
|
||||
been impossible due to the aforementioned MPlayer development policy.
|
||||
@@ -1,113 +0,0 @@
|
||||
Release Policy
|
||||
==============
|
||||
|
||||
Once or twice a month, a new release is cut off of the master branch and is
|
||||
assigned a 0.X.Y version number, where X is incremented each time a release
|
||||
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.
|
||||
|
||||
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.
|
||||
We try our best to keep it deployable at all times.
|
||||
|
||||
Releases other than the latest release are unsupported and unmaintained.
|
||||
|
||||
Release procedure
|
||||
-----------------
|
||||
|
||||
- Merge master into branch release/current.
|
||||
|
||||
- Create and/or update the `RELEASE_NOTES` file.
|
||||
|
||||
- Create and/or update the `VERSION` file.
|
||||
|
||||
- Update `DOCS/client-api-changes.rst` (on major releases).
|
||||
|
||||
- Create tag v0.X.Y.
|
||||
|
||||
- Push branch and tag to GitHub.
|
||||
|
||||
- Create a new GitHub release using the content of `RELEASE_NOTES` related to
|
||||
the new version.
|
||||
|
||||
Release notes template
|
||||
----------------------
|
||||
|
||||
Here is a template that can be used for writing the `RELEASE_NOTES` file.
|
||||
|
||||
```markdown
|
||||
Release 0.X.Y
|
||||
=============
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
New
|
||||
~~~
|
||||
|
||||
- List of new features
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
||||
- List of removed features
|
||||
|
||||
Deprecated
|
||||
~~~~~~~~~~
|
||||
|
||||
- List of deprecated features
|
||||
|
||||
Behavior
|
||||
--------
|
||||
|
||||
- List of user-visible changes in behavior
|
||||
|
||||
Options and Commands
|
||||
--------------------
|
||||
|
||||
Added
|
||||
~~~~~
|
||||
|
||||
- List of added options and commands
|
||||
|
||||
Changed
|
||||
~~~~~~~
|
||||
|
||||
- List of changed options and commands
|
||||
|
||||
Renamed
|
||||
~~~~~~~
|
||||
|
||||
- List of renamed options and commands
|
||||
|
||||
Deprecated
|
||||
~~~~~~~~~~
|
||||
|
||||
- List of deprecated options and commands
|
||||
|
||||
Removed
|
||||
~~~~~~~
|
||||
|
||||
- List of removed options and commands
|
||||
|
||||
Fixes and Minor Enhancements
|
||||
----------------------------
|
||||
|
||||
- List of fixes and minor enhancements
|
||||
|
||||
This listing is not complete. There are many more bug fixes and changes. The
|
||||
complete change log can be viewed by running `git log <start>..<end>` in
|
||||
the git repository.
|
||||
```
|
||||
|
||||
Note that the "Release 0.X.Y" title should be removed when creating a new GitHub
|
||||
release.
|
||||
|
||||
When creating a new point release its changes should be added on top of the
|
||||
`RELEASE_NOTES` file (with the appropriate title) so that all the changes in
|
||||
the current 0.X branch will be included. This way the `RELEASE_NOTES` file
|
||||
can be used by distributors as changelog for point releases too.
|
||||
+56
-88
@@ -1,11 +1,12 @@
|
||||
This file intends to give a big picture overview of how mpv is structured.
|
||||
NOTE: DOCS/OUTDATED-tech/* may contain more detailed information, but most of it
|
||||
is possibly or definitely outdated. This file intends to give a big
|
||||
picture of how mpv is structured.
|
||||
|
||||
player/*.c:
|
||||
Essentially makes up the player applications, including the main() function
|
||||
and the playback loop.
|
||||
|
||||
Generally, it accesses all other subsystems, initializes them, and pushes
|
||||
data between them during playback.
|
||||
mpvcore/mplayer.c:
|
||||
This contains the main play loop, anything related to mpv and playback
|
||||
related initializations. It also contains the main function. Generally, it
|
||||
accesses all other subsystems, initializes them, and pushes data between
|
||||
them during playback.
|
||||
|
||||
The structure is as follows (as of commit e13c05366557cb):
|
||||
* main():
|
||||
@@ -17,12 +18,12 @@ player/*.c:
|
||||
* check help options etc. (call handle_help_options()), possibly exit
|
||||
* call play_files() function that works down the playlist:
|
||||
* run idle loop (idle_loop()), until there are files in the
|
||||
playlist or an exit command was given (only if --idle it set)
|
||||
playlist or an exit command was given (slave mode only)
|
||||
* actually load and play a file in play_current_file():
|
||||
* run all the dozens of functions to load the file and
|
||||
initialize playback
|
||||
* run a small loop that does normal playback, until the file is
|
||||
done or a command terminates playback
|
||||
done or a slave command terminates playback
|
||||
(on each iteration, run_playloop() is called, which is rather
|
||||
big and complicated - it decodes some audio and video on
|
||||
each frame, waits for input, etc.)
|
||||
@@ -31,30 +32,17 @@ player/*.c:
|
||||
* loop, or exit if no next file or quit is requested
|
||||
(see enum stop_play_reason)
|
||||
* call exit_player_with_rc()
|
||||
* run_playloop():
|
||||
* calls fill_audio_out_buffers()
|
||||
This checks whether new audio needs to be decoded, and pushes it
|
||||
to the AO.
|
||||
* calls write_video()
|
||||
Decode new video, and push it to the VO.
|
||||
* determines whether playback of the current file has ended
|
||||
* determines when to start playback after seeks
|
||||
* and calls a whole lot of other stuff
|
||||
(Really, this function does everything.)
|
||||
|
||||
Things worth saying about the playback core:
|
||||
- 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 d_video/d_audio/d_sub
|
||||
- the currently played tracks are in sh_video and sh_audio
|
||||
- the timeline stuff is used only with MKV ordered chapters (and some other
|
||||
minor features: cue, edl)
|
||||
- most state is in MPContext (mp_core.h), which is not available to the
|
||||
subsystems
|
||||
- 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
|
||||
of a changed situation in a subsystem
|
||||
|
||||
I like to call the player/*.c files the "frontend".
|
||||
I like to call mplayer.c (and some other files) the "frontend".
|
||||
|
||||
talloc.h & talloc.c:
|
||||
Hierarchical memory manager copied from Samba. It's like a malloc() with
|
||||
@@ -75,7 +63,8 @@ talloc.h & talloc.c:
|
||||
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
|
||||
as in it doesn't require valgrind.) You can enable it by passing the option
|
||||
--leak-report as first parameter, or better, setting the
|
||||
MPV_LEAK_REPORT environment variable to "1":
|
||||
export MPV_LEAK_REPORT=1
|
||||
This will list all unfree'd allocations on exit.
|
||||
@@ -87,54 +76,38 @@ talloc.h & talloc.c:
|
||||
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.)
|
||||
mpvcore/mp_core.h:
|
||||
Data structures for mplayer.c and command.c. They are usually not accessed
|
||||
by other parts of mpv for the sake of modularization.
|
||||
|
||||
player/command.c:
|
||||
This contains the implementation for client API commands and properties.
|
||||
Properties are essentially dynamic variables changed by certain commands.
|
||||
This is basically responsible for all user commands, like initiating
|
||||
seeking, switching tracks, etc. It calls into other player/*.c files,
|
||||
where most of the work is done, but also calls other parts of mpv.
|
||||
Note that there are lots of global variables floating around everywhere
|
||||
else. This is an ongoing transition, and eventually there should be no
|
||||
global variables anymore.
|
||||
|
||||
player/core.h:
|
||||
Data structures and function prototypes for most of player/*.c. They are
|
||||
usually not accessed by other parts of mpv for the sake of modularization.
|
||||
options.h contains the global option struct MPOpts, and its default values
|
||||
are in defaultopts.c for some reason.
|
||||
|
||||
player/client.c:
|
||||
This implements the client API (libmpv/client.h). For the most part, this
|
||||
just calls into other parts of the player. This also manages a ringbuffer
|
||||
of events from player to clients.
|
||||
|
||||
options/options.h, options/options.c
|
||||
options.h contains the global option struct MPOpts. The option declarations
|
||||
(option names, types, and MPOpts offsets for the option parser) are in
|
||||
options.c. Most default values for options and MPOpts are in
|
||||
mp_default_opts at the end of options.c.
|
||||
|
||||
MPOpts is unfortunately quite monolithic, and virtually accessed by
|
||||
everything.But some components (like video outputs and video filters) have
|
||||
their own sub-option tables separate from MPOpts.
|
||||
|
||||
The actual option parser is spread over m_option.c, m_config.c, and
|
||||
parser-mpcmd.c, and uses the option table in options.c.
|
||||
|
||||
input/input.c:
|
||||
This translates keyboard input comming from VOs and other sources (such
|
||||
as remote control devices like Apple IR or client API commands) to the
|
||||
mpvcore/input/input.c:
|
||||
This translates keyboard input comming from libvo and other sources (such
|
||||
as remote control devices like Apple IR or slave mode commands) to the
|
||||
key bindings listed in the user's (or the builtin) input.conf and turns
|
||||
them into items of type struct mp_cmd. These commands are queued, and read
|
||||
by playloop.c. They get pushed with run_command() to command.c.
|
||||
by mplayer.c. They get pushed with run_command() to command.c.
|
||||
|
||||
Note that keyboard input and commands used by the client API are the same.
|
||||
The client API only uses the command parser though, and has its own queue
|
||||
of input commands somewhere else.
|
||||
Note that keyboard input and slave mode input are essentially the same
|
||||
things. Just looking at input.conf should make this clear. (The other
|
||||
direction of slave mode communication, mpv to application, consists of
|
||||
random mp_msg() calls all over the code in all parts of the player.)
|
||||
|
||||
common/msg.h:
|
||||
All terminal output must go through mp_msg().
|
||||
mpvcore/command.c:
|
||||
This contains the implementation for slave commands and properties.
|
||||
Properties are essentially dynamic variables changed by certain commands.
|
||||
This is basically responsible for all user commands, like initiating
|
||||
seeking, switching tracks, etc. It calls into mplayer.c, where most of the
|
||||
work is done, but also into other parts of mpv.
|
||||
|
||||
mpvcore/mp_msg.h:
|
||||
All terminal output should go through mp_msg().
|
||||
|
||||
stream/*:
|
||||
File input is implemented here. stream.h/.c provides a simple stream based
|
||||
@@ -193,7 +166,7 @@ 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_config() call can change the video
|
||||
VOs can be reconfigured at runtime. A config() call can change the video
|
||||
resolution and format, without destroying the window.
|
||||
|
||||
vo_vdpau and vo_opengl should be taken as reference.
|
||||
@@ -209,18 +182,15 @@ audio/decode/:
|
||||
|
||||
audio/filter/:
|
||||
Audio filter chain. af_lavrresample is inserted if any form of conversion
|
||||
between audio formats is needed. (af_convert24.c and af_convertsignendian.c
|
||||
are also used for some formats not directly supported by FFmpeg.)
|
||||
between audio formats is needed. (af_format.c is also used for some corner
|
||||
cases.)
|
||||
|
||||
audio/out/:
|
||||
Audio outputs.
|
||||
|
||||
Unlike VOs, AOs can't be reconfigured on a format change. On audio format
|
||||
changes, the AO will simply be closed and re-opened.
|
||||
|
||||
There are wrappers to support for two types of audio APIs: push.c and
|
||||
pull.c. ao.c calls into one of these. They contain generic code to deal
|
||||
with the data flow these APIs impose.
|
||||
Unlike VOs, AOs can't be reconfigured on a format change. Without
|
||||
--gapless-audio, even playing a new file will close and re-open the audio
|
||||
device.
|
||||
|
||||
Note that mpv synchronizes the video to the audio. That's the reason
|
||||
why buggy audio drivers can have a bad influence on playback quality.
|
||||
@@ -228,19 +198,17 @@ audio/out/:
|
||||
sub/:
|
||||
Contains subtitle and OSD rendering.
|
||||
|
||||
osd.c/.h is actually the OSD code. It queries dec_sub.c to retrieve
|
||||
sub.c/.h is actually the OSD code. It queries dec_sub.c to retrieve
|
||||
decoded/rendered subtitles. osd_libass.c is the actual implementation of
|
||||
the OSD text renderer (which uses libass, and takes care of all the tricky
|
||||
fontconfig/freetype API usage and text layouting).
|
||||
|
||||
The VOs call osd.c to render OSD and subtitle (via e.g. osd_draw()). osd.c
|
||||
in turn asks dec_sub.c for subtitle overlay bitmaps, which relays the
|
||||
request to one of the sd_*.c subtitle decoders/renderers.
|
||||
|
||||
Subtitle loading is in demux/. The MPlayer subreader.c is mostly gone - parts
|
||||
of it survive in demux_subreader.c. It's used as last fallback, or to handle
|
||||
some text subtitle types on Libav. It should go away eventually. Normally,
|
||||
subtitles are loaded via demux_lavf.c.
|
||||
Subtitle loading is now in demux/ instead. demux_libass.c wraps loading
|
||||
.ass subtitles via libass. demux_lavf.c loads most subtitle types via
|
||||
FFmpeg. demux_subreader.c is the old MPlayer code. It's used as last
|
||||
fallback, or to handle some text subtitle types on Libav. (It also can
|
||||
load UTF-16 encoded subtitles without requiring the use of -subcp.)
|
||||
demux_subreader.c should eventually go away (maybe).
|
||||
|
||||
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
|
||||
@@ -255,8 +223,8 @@ sub/:
|
||||
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
|
||||
mpvcore/timeline/:
|
||||
A timeline is the abstraction used by mplayer.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.
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
waf build system overview
|
||||
=========================
|
||||
|
||||
mpv's new build system is based on waf and it should completely replace the
|
||||
custom ./configure + Makefile based system inherited from MPlayer.
|
||||
|
||||
Goals and the choice of waf
|
||||
===========================
|
||||
|
||||
The new system comes with some goals, which can be summed up as: be as good as
|
||||
the old one at what it did well (customizability) and fix some of it's major
|
||||
shortcomings:
|
||||
|
||||
1) The build system must be uniform in how it handles any single feature check.
|
||||
Repetition and boilerplate have to be avoided.
|
||||
|
||||
When adding a new feature using the old configure, one had to add a fair
|
||||
amount of code to the shell script to do option parsing, detection of the
|
||||
feature and declaration of variables for the Makefile to pickup. The worst
|
||||
part is this pieces are spread apart in the configure and copy pasted for
|
||||
any single case. That brings us to..
|
||||
|
||||
2) --enable-feature has to be overridden by the user and helps them understand that
|
||||
they have libraries missing and should install them for the feature to be
|
||||
enabled.
|
||||
|
||||
3) Must be customizable, hackable, pleasant to the developer eyes and to work
|
||||
with in general.
|
||||
|
||||
4) Must have separate configuration and build steps.
|
||||
|
||||
Goal 2 comes as a given on pretty much any build system, since autotools made
|
||||
this behaviour very popular among users (and rightly so).
|
||||
|
||||
Goal 1+3 were somewhat harder to accomplish as it looks like all of the build
|
||||
systems we evaluated (waf included!) had problems with them. For reference we
|
||||
had proof of concept build systems with waf, CMake and autotools.
|
||||
|
||||
What puts waf apart from CMake and autotools, is that projects using it use
|
||||
Python to program their build system. Also while the Waf Book shows really
|
||||
simple API usages, you can write your own build system on top of waf that is
|
||||
tailored to the project's specific needs.
|
||||
|
||||
mpv's custom configure step on top of waf
|
||||
=========================================
|
||||
|
||||
To some extents mpv has a custom build system written on top of waf. This
|
||||
document will not go over the standard waf behaviour as that is documented in
|
||||
the `Waf book <http://docs.waf.googlecode.com/git/book_17/single.html>`_.
|
||||
|
||||
All of the configuration process is handled with a declarative approach. Lists
|
||||
of dictionaries define the checks, and some custom Python code traverses these
|
||||
lists and depending on the check definition it calls into the actual waf API.
|
||||
|
||||
A simple example using pkg-config would be::
|
||||
|
||||
{
|
||||
'name': '--vdpau',
|
||||
'desc': 'VDPAU acceleration',
|
||||
'deps': [ 'x11' ],
|
||||
'func': check_pkg_config('vdpau', '>= 0.2'),
|
||||
}
|
||||
|
||||
This defines a feature called ``vdpau`` which can be enabled or disabled by
|
||||
the users with configure flags (that's the meaning of ``--``). This feature
|
||||
depends on another feature whose name is ``x11``, and the autodetection check
|
||||
consists of running ``pkg-config`` and looking for ``vdpau`` with version
|
||||
``>= 0.2``. If the check succeeds a ``#define HAVE_VDPAU 1`` will be added to
|
||||
``config.h``, if not ``#define HAVE_VDPAU 0`` will be added.
|
||||
|
||||
The defines names are automatically prepended with ``HAVE_``, capitalized and
|
||||
special characters are replaced with underscores. This happens in
|
||||
``waftools/inflectors.py``.
|
||||
|
||||
Mandatory fields:
|
||||
-----------------
|
||||
|
||||
``name``: indicates the unique identifier used by the custom dependency code
|
||||
to refer to a feature. If the unique identifier is prepended with ``--``
|
||||
the build system will also generate options for ``./waf configure`` so that
|
||||
the feature can be enabled and disabled.
|
||||
|
||||
``desc``: this is the textual representation of the feature used in the
|
||||
interactions with the users.
|
||||
|
||||
``func``: function that will perform the check. These functions are defined in
|
||||
``waftools/checks``. The reusable checks are all functions that return
|
||||
functions. The return functions will then be applied using waf's configuration
|
||||
context.
|
||||
|
||||
The source code for the reusable checks is a bit convoluted, but it should be
|
||||
easy to pick up their usage from the ``wscript``. Their signature mirrors
|
||||
the semantics of some of the shell functions used in mplayer.
|
||||
|
||||
If someone expresses some interest, I will extend this document with official
|
||||
documentation for each check function.
|
||||
|
||||
Optional fields
|
||||
---------------
|
||||
|
||||
``deps``: list of dependencies of this feature. It is a list of names of
|
||||
other features as defined in the ``name`` field (minus the eventual leading
|
||||
``--``). All of the dependencies must be satisfied. If they are not the check
|
||||
will be skipped without even running ``func``.
|
||||
|
||||
``deps_any``: like deps but it is satisfied even if only one of the dependencies
|
||||
is satisfied. You can think of ``deps`` as a 'and' condition and ``deps_any``
|
||||
as a 'or' condition.
|
||||
|
||||
``deps_neg``: like deps but it is satisfied when none of the dependencies is
|
||||
satisfied.
|
||||
|
||||
``req``: defaults to False. If set to True makes this feature a hard
|
||||
dependency of mpv (configuration will fail if autodetection fails). If set to
|
||||
True you must also provide ``fmsg``.
|
||||
|
||||
``fmsg``: string with the failure message in case a required dependency is not
|
||||
satisfied.
|
||||
|
||||
``os_specific_checks``: this takes a dictionary that has ``os-`` dependencies
|
||||
as keys (such as ``os-win32``), and by values has another dictionary that is
|
||||
merged on top of the current feature definition only for that specific OS.
|
||||
For example::
|
||||
|
||||
{
|
||||
'name': '--pthreads',
|
||||
'desc': 'POSIX threads',
|
||||
'func': check_pthreads,
|
||||
'os_specific_checks': {
|
||||
'os-win32': {
|
||||
'func': check_pthreads_w32_static.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
will override the value of ``func`` with ``check_pthreads_w32_static`` only
|
||||
if the target OS of the build is Windows.
|
||||
|
||||
``groups``: groups a dependency with another one. This can be used to disabled
|
||||
all the grouped dependencies with one ``--disable-``. At the moment this is
|
||||
only used for OpenGL backends, where you want to disable them when
|
||||
``--disable-gl`` is passed to the configure.
|
||||
|
||||
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 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.
|
||||
|
||||
All of the custom Python for this is inside the function ``filtered_sources``
|
||||
contained in the file ``waftools/dependencies.py``.
|
||||
|
||||
Also ``dependencies_use`` and ``dependencies_includes`` collect cflags and
|
||||
ldflags that were generated from the features checks in the configure step.
|
||||
@@ -1,284 +1,625 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
0. Definitions.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
1. Source Code.
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
14. Revised Versions of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
NO WARRANTY
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
@@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
@@ -304,37 +645,30 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,471 @@
|
||||
# MPlayer Makefile
|
||||
#
|
||||
# copyright (c) 2008 Diego Biurrun
|
||||
# Rewritten entirely from a set of Makefiles written by Arpi and many others.
|
||||
#
|
||||
# This file is part of MPlayer.
|
||||
#
|
||||
# MPlayer is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# MPlayer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
include config.mak
|
||||
|
||||
###### variable declarations #######
|
||||
|
||||
SOURCES_AUDIO_INPUT-$(ALSA) += stream/ai_alsa1x.c
|
||||
SOURCES_AUDIO_INPUT-$(OSS) += stream/ai_oss.c
|
||||
SOURCES-$(AUDIO_INPUT) += $(SOURCES_AUDIO_INPUT-yes)
|
||||
SOURCES-$(CDDA) += stream/stream_cdda.c \
|
||||
stream/cdinfo.c
|
||||
SOURCES-$(DVBIN) += stream/dvb_tune.c \
|
||||
stream/stream_dvb.c
|
||||
SOURCES-$(DVDREAD) += stream/stream_dvd.c \
|
||||
stream/stream_dvd_common.c
|
||||
|
||||
SOURCES-$(HAVE_SYS_MMAN_H) += audio/filter/af_export.c
|
||||
SOURCES-$(LADSPA) += audio/filter/af_ladspa.c
|
||||
SOURCES-$(LIBASS) += sub/ass_mp.c sub/sd_ass.c \
|
||||
demux/demux_libass.c
|
||||
|
||||
SOURCES-$(LIBBLURAY) += stream/stream_bluray.c
|
||||
SOURCES-$(LIBBS2B) += audio/filter/af_bs2b.c
|
||||
|
||||
SOURCES-$(LIBPOSTPROC) += video/filter/vf_pp.c
|
||||
SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c
|
||||
|
||||
SOURCES-$(MACOSX_BUNDLE) += osdep/macosx_bundle.m
|
||||
SOURCES-$(COCOA) += video/out/cocoa_common.m \
|
||||
osdep/macosx_application.m \
|
||||
osdep/macosx_events.m \
|
||||
osdep/ar/HIDRemote.m
|
||||
SOURCES-$(MNG) += demux/demux_mng.c
|
||||
SOURCES-$(MPG123) += audio/decode/ad_mpg123.c
|
||||
|
||||
SOURCES-$(NEED_GETTIMEOFDAY) += osdep/gettimeofday.c
|
||||
SOURCES-$(NEED_GLOB) += osdep/glob-win.c
|
||||
|
||||
SOURCES-$(PRIORITY) += osdep/priority.c
|
||||
SOURCES-$(PVR) += stream/stream_pvr.c
|
||||
SOURCES-$(RADIO) += stream/stream_radio.c
|
||||
SOURCES-$(RADIO_CAPTURE) += stream/audio_in.c
|
||||
SOURCES-$(STREAM_CACHE) += stream/cache.c
|
||||
|
||||
SOURCES-$(TV) += stream/stream_tv.c stream/tv.c \
|
||||
stream/frequencies.c stream/tvi_dummy.c
|
||||
|
||||
SOURCES-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
|
||||
SOURCES-$(VCD) += stream/stream_vcd.c
|
||||
SOURCES-$(DUMMY_OSD) += sub/osd_dummy.c
|
||||
SOURCES-$(LIBASS_OSD) += sub/osd_libass.c
|
||||
|
||||
SOURCES-$(ALSA) += audio/out/ao_alsa.c
|
||||
SOURCES-$(CACA) += video/out/vo_caca.c
|
||||
SOURCES-$(SDL) += audio/out/ao_sdl.c
|
||||
SOURCES-$(SDL2) += video/out/vo_sdl.c
|
||||
SOURCES-$(COREAUDIO) += audio/out/ao_coreaudio.c \
|
||||
audio/out/ao_coreaudio_utils.c \
|
||||
audio/out/ao_coreaudio_properties.c
|
||||
SOURCES-$(COREVIDEO) += video/out/vo_corevideo.c
|
||||
SOURCES-$(DIRECT3D) += video/out/vo_direct3d.c \
|
||||
video/out/w32_common.c
|
||||
SOURCES-$(DSOUND) += audio/out/ao_dsound.c
|
||||
SOURCES-$(WASAPI) += audio/out/ao_wasapi.c
|
||||
SOURCES-$(GL) += video/out/gl_common.c video/out/gl_osd.c \
|
||||
video/out/vo_opengl.c video/out/gl_lcms.c \
|
||||
video/out/gl_video.c video/out/dither.c \
|
||||
video/out/vo_opengl_old.c \
|
||||
video/out/pnm_loader.c
|
||||
|
||||
SOURCES-$(ENCODING) += video/out/vo_lavc.c audio/out/ao_lavc.c \
|
||||
mpvcore/encode_lavc.c
|
||||
|
||||
SOURCES-$(GL_WIN32) += video/out/w32_common.c video/out/gl_w32.c
|
||||
SOURCES-$(GL_X11) += video/out/x11_common.c video/out/gl_x11.c
|
||||
SOURCES-$(GL_COCOA) += video/out/gl_cocoa.c
|
||||
SOURCES-$(GL_WAYLAND) += video/out/wayland_common.c \
|
||||
video/out/gl_wayland.c
|
||||
|
||||
SOURCES-$(JACK) += audio/out/ao_jack.c
|
||||
SOURCES-$(JOYSTICK) += mpvcore/input/joystick.c
|
||||
SOURCES-$(LIBQUVI) += mpvcore/resolve_quvi.c
|
||||
SOURCES-$(LIBQUVI9) += mpvcore/resolve_quvi9.c
|
||||
SOURCES-$(LIRC) += mpvcore/input/lirc.c
|
||||
SOURCES-$(OPENAL) += audio/out/ao_openal.c
|
||||
SOURCES-$(OSS) += audio/out/ao_oss.c
|
||||
SOURCES-$(PULSE) += audio/out/ao_pulse.c
|
||||
SOURCES-$(PORTAUDIO) += audio/out/ao_portaudio.c
|
||||
SOURCES-$(RSOUND) += audio/out/ao_rsound.c
|
||||
SOURCES-$(VDPAU) += video/vdpau.c video/out/vo_vdpau.c
|
||||
SOURCES-$(VDPAU_DEC) += video/decode/vdpau.c
|
||||
SOURCES-$(VDPAU_DEC_OLD) += video/decode/vdpau_old.c
|
||||
|
||||
SOURCES-$(X11) += video/out/vo_x11.c video/out/x11_common.c
|
||||
SOURCES-$(XV) += video/out/vo_xv.c
|
||||
|
||||
SOURCES-$(VF_LAVFI) += video/filter/vf_lavfi.c
|
||||
SOURCES-$(AF_LAVFI) += audio/filter/af_lavfi.c
|
||||
|
||||
ifeq ($(HAVE_AVUTIL_REFCOUNTING),no)
|
||||
SOURCES-yes += video/decode/lavc_dr1.c
|
||||
endif
|
||||
|
||||
SOURCES-$(DLOPEN) += video/filter/vf_dlopen.c
|
||||
|
||||
SOURCES = talloc.c \
|
||||
audio/audio.c \
|
||||
audio/chmap.c \
|
||||
audio/chmap_sel.c \
|
||||
audio/fmt-conversion.c \
|
||||
audio/format.c \
|
||||
audio/mixer.c \
|
||||
audio/reorder_ch.c \
|
||||
audio/decode/ad_lavc.c \
|
||||
audio/decode/ad_spdif.c \
|
||||
audio/decode/dec_audio.c \
|
||||
audio/filter/af.c \
|
||||
audio/filter/af_center.c \
|
||||
audio/filter/af_channels.c \
|
||||
audio/filter/af_delay.c \
|
||||
audio/filter/af_dummy.c \
|
||||
audio/filter/af_equalizer.c \
|
||||
audio/filter/af_extrastereo.c \
|
||||
audio/filter/af_force.c \
|
||||
audio/filter/af_format.c \
|
||||
audio/filter/af_hrtf.c \
|
||||
audio/filter/af_karaoke.c \
|
||||
audio/filter/af_lavcac3enc.c \
|
||||
audio/filter/af_lavrresample.c \
|
||||
audio/filter/af_pan.c \
|
||||
audio/filter/af_scaletempo.c \
|
||||
audio/filter/af_sinesuppress.c \
|
||||
audio/filter/af_sub.c \
|
||||
audio/filter/af_surround.c \
|
||||
audio/filter/af_sweep.c \
|
||||
audio/filter/af_tools.c \
|
||||
audio/filter/af_drc.c \
|
||||
audio/filter/af_volume.c \
|
||||
audio/filter/filter.c \
|
||||
audio/filter/window.c \
|
||||
audio/out/ao.c \
|
||||
audio/out/ao_null.c \
|
||||
audio/out/ao_pcm.c \
|
||||
demux/codec_tags.c \
|
||||
demux/demux.c \
|
||||
demux/demux_edl.c \
|
||||
demux/demux_cue.c \
|
||||
demux/demux_lavf.c \
|
||||
demux/demux_mf.c \
|
||||
demux/demux_mkv.c \
|
||||
demux/demux_subreader.c \
|
||||
demux/demux_raw.c \
|
||||
demux/ebml.c \
|
||||
demux/mf.c \
|
||||
mpvcore/asxparser.c \
|
||||
mpvcore/av_common.c \
|
||||
mpvcore/av_log.c \
|
||||
mpvcore/av_opts.c \
|
||||
mpvcore/bstr.c \
|
||||
mpvcore/charset_conv.c \
|
||||
mpvcore/codecs.c \
|
||||
mpvcore/command.c \
|
||||
mpvcore/cpudetect.c \
|
||||
mpvcore/m_config.c \
|
||||
mpvcore/m_option.c \
|
||||
mpvcore/m_property.c \
|
||||
mpvcore/mp_common.c \
|
||||
mpvcore/mp_msg.c \
|
||||
mpvcore/mp_ring.c \
|
||||
mpvcore/mplayer.c \
|
||||
mpvcore/options.c \
|
||||
mpvcore/parser-cfg.c \
|
||||
mpvcore/parser-mpcmd.c \
|
||||
mpvcore/path.c \
|
||||
mpvcore/playlist.c \
|
||||
mpvcore/playlist_parser.c \
|
||||
mpvcore/screenshot.c \
|
||||
mpvcore/version.c \
|
||||
mpvcore/input/input.c \
|
||||
mpvcore/timeline/tl_edl.c \
|
||||
mpvcore/timeline/tl_matroska.c \
|
||||
mpvcore/timeline/tl_cue.c \
|
||||
osdep/io.c \
|
||||
osdep/numcores.c \
|
||||
osdep/timer.c \
|
||||
stream/cookies.c \
|
||||
stream/stream.c \
|
||||
stream/stream_avdevice.c \
|
||||
stream/stream_file.c \
|
||||
stream/stream_lavf.c \
|
||||
stream/stream_memory.c \
|
||||
stream/stream_mf.c \
|
||||
stream/stream_null.c \
|
||||
sub/dec_sub.c \
|
||||
sub/draw_bmp.c \
|
||||
sub/find_subfiles.c \
|
||||
sub/img_convert.c \
|
||||
sub/sd_lavc.c \
|
||||
sub/sd_lavc_conv.c \
|
||||
sub/sd_lavf_srt.c \
|
||||
sub/sd_microdvd.c \
|
||||
sub/sd_movtext.c \
|
||||
sub/sd_spu.c \
|
||||
sub/sd_srt.c \
|
||||
sub/spudec.c \
|
||||
sub/sub.c \
|
||||
video/csputils.c \
|
||||
video/fmt-conversion.c \
|
||||
video/image_writer.c \
|
||||
video/img_format.c \
|
||||
video/mp_image.c \
|
||||
video/mp_image_pool.c \
|
||||
video/sws_utils.c \
|
||||
video/decode/dec_video.c \
|
||||
video/decode/vd.c \
|
||||
video/decode/vd_lavc.c \
|
||||
video/filter/vf.c \
|
||||
video/filter/pullup.c \
|
||||
video/filter/vf_crop.c \
|
||||
video/filter/vf_delogo.c \
|
||||
video/filter/vf_divtc.c \
|
||||
video/filter/vf_down3dright.c \
|
||||
video/filter/vf_dsize.c \
|
||||
video/filter/vf_eq.c \
|
||||
video/filter/vf_expand.c \
|
||||
video/filter/vf_flip.c \
|
||||
video/filter/vf_format.c \
|
||||
video/filter/vf_gradfun.c \
|
||||
video/filter/vf_hqdn3d.c \
|
||||
video/filter/vf_ilpack.c \
|
||||
video/filter/vf_mirror.c \
|
||||
video/filter/vf_noformat.c \
|
||||
video/filter/vf_noise.c \
|
||||
video/filter/vf_phase.c \
|
||||
video/filter/vf_pullup.c \
|
||||
video/filter/vf_rotate.c \
|
||||
video/filter/vf_scale.c \
|
||||
video/filter/vf_screenshot.c \
|
||||
video/filter/vf_softpulldown.c \
|
||||
video/filter/vf_stereo3d.c \
|
||||
video/filter/vf_sub.c \
|
||||
video/filter/vf_swapuv.c \
|
||||
video/filter/vf_unsharp.c \
|
||||
video/filter/vf_vo.c \
|
||||
video/filter/vf_yadif.c \
|
||||
video/out/bitmap_packer.c \
|
||||
video/out/aspect.c \
|
||||
video/out/filter_kernels.c \
|
||||
video/out/vo.c \
|
||||
video/out/vo_null.c \
|
||||
video/out/vo_image.c \
|
||||
osdep/$(GETCH) \
|
||||
osdep/$(TIMER) \
|
||||
$(SOURCES-yes)
|
||||
|
||||
OBJECTS += $(addsuffix .o, $(basename $(SOURCES)))
|
||||
OBJECTS-$(PE_EXECUTABLE) += osdep/mpv-rc.o
|
||||
OBJECTS += $(OBJECTS-yes)
|
||||
|
||||
DEP_FILES = $(patsubst %.S,%.d,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SOURCES:.m=.d) $(SOURCES:.m=.d))))
|
||||
|
||||
ALL_TARGETS += mpv$(EXESUF)
|
||||
|
||||
INSTALL_BIN += install-mpv
|
||||
INSTALL_BIN_STRIP += install-mpv-strip
|
||||
INSTALL_MAN =
|
||||
|
||||
ifeq ($(BUILD_MAN),yes)
|
||||
INSTALL_MAN += install-mpv-man
|
||||
ALL_TARGETS += DOCS/man/en/mpv.1
|
||||
endif
|
||||
|
||||
DIRS = . \
|
||||
audio \
|
||||
audio/decode \
|
||||
audio/filter \
|
||||
audio/out \
|
||||
core \
|
||||
mpvcore/input \
|
||||
mpvcore/timeline \
|
||||
demux \
|
||||
osdep \
|
||||
stream \
|
||||
sub \
|
||||
video \
|
||||
video/decode \
|
||||
video/filter \
|
||||
video/out
|
||||
|
||||
|
||||
ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2)))
|
||||
ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS))
|
||||
ADD_ALL_EXESUFS = $(1) $(call ADDSUFFIXES,$(EXESUFS_ALL),$(1))
|
||||
|
||||
###### brief build output #######
|
||||
|
||||
ifndef V
|
||||
$(eval override CC = @printf "CC\t$$@\n"; $(CC))
|
||||
$(eval override RM = @$(RM))
|
||||
endif
|
||||
|
||||
###### generic rules #######
|
||||
|
||||
all: $(ALL_TARGETS)
|
||||
|
||||
%.1: %.rst
|
||||
$(RST2MAN) $< $@
|
||||
|
||||
%.o: %.S
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.cpp
|
||||
$(CC) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.m
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%-rc.o: %.rc
|
||||
$(WINDRES) -I. $< $@
|
||||
|
||||
mpv$(EXESUF): $(OBJECTS)
|
||||
mpv$(EXESUF):
|
||||
$(CC) -o $@ $^ $(EXTRALIBS)
|
||||
|
||||
mpvcore/input/input.c: mpvcore/input/input_conf.h
|
||||
mpvcore/input/input_conf.h: TOOLS/file2string.pl etc/input.conf
|
||||
./$^ >$@
|
||||
|
||||
MKVLIB_DEPS = TOOLS/lib/Parse/Matroska.pm \
|
||||
TOOLS/lib/Parse/Matroska/Definitions.pm \
|
||||
TOOLS/lib/Parse/Matroska/Element.pm \
|
||||
TOOLS/lib/Parse/Matroska/Reader.pm \
|
||||
TOOLS/lib/Parse/Matroska/Utils.pm \
|
||||
|
||||
demux/ebml.c demux/demux_mkv.c: demux/ebml_types.h
|
||||
demux/ebml_types.h: TOOLS/matroska.pl $(MKVLIB_DEPS)
|
||||
./$< --generate-header > $@
|
||||
|
||||
demux/ebml.c: demux/ebml_defs.c
|
||||
demux/ebml_defs.c: TOOLS/matroska.pl $(MKVLIB_DEPS)
|
||||
./$< --generate-definitions > $@
|
||||
|
||||
video/out/gl_video.c: video/out/gl_video_shaders.h
|
||||
video/out/gl_video_shaders.h: TOOLS/file2string.pl video/out/gl_video_shaders.glsl
|
||||
./$^ >$@
|
||||
|
||||
sub/osd_libass.c: sub/osd_font.h
|
||||
sub/osd_font.h: TOOLS/file2string.pl sub/osd_font.otf
|
||||
./$^ >$@
|
||||
|
||||
# ./configure must be rerun if it changed
|
||||
config.mak: configure
|
||||
@echo "############################################################"
|
||||
@echo "####### Please run ./configure again - it's changed! #######"
|
||||
@echo "############################################################"
|
||||
|
||||
version.h .version: version.sh
|
||||
./$<
|
||||
|
||||
# Force version.sh to run to potentially regenerate version.h
|
||||
-include .version
|
||||
|
||||
%$(EXESUF): %.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
|
||||
###### dependency declarations / specific CFLAGS ######
|
||||
|
||||
mpvcore/version.c osdep/mpv-rc.o: version.h
|
||||
|
||||
osdep/mpv-rc.o: osdep/mpv.exe.manifest etc/mpv-icon.ico
|
||||
|
||||
DOCS/man/en/mpv.1: DOCS/man/en/af.rst \
|
||||
DOCS/man/en/ao.rst \
|
||||
DOCS/man/en/changes.rst \
|
||||
DOCS/man/en/encode.rst \
|
||||
DOCS/man/en/input.rst \
|
||||
DOCS/man/en/options.rst \
|
||||
DOCS/man/en/vf.rst \
|
||||
DOCS/man/en/vo.rst
|
||||
|
||||
|
||||
###### installation / clean / generic rules #######
|
||||
|
||||
install: $(INSTALL_BIN) $(INSTALL_MAN)
|
||||
install-no-man: $(INSTALL_BIN)
|
||||
install-strip: $(INSTALL_BIN_STRIP) $(INSTALL_MAN)
|
||||
install-strip-no-man: $(INSTALL_BIN_STRIP)
|
||||
|
||||
install-dirs:
|
||||
if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi
|
||||
|
||||
install-%: %$(EXESUF) install-dirs
|
||||
$(INSTALL) -m 755 $< $(BINDIR)
|
||||
|
||||
install-%-strip: %$(EXESUF) install-dirs
|
||||
$(INSTALL) -m 755 -s $< $(BINDIR)
|
||||
|
||||
install-mpv-man: install-mpv-man-en
|
||||
|
||||
install-mpv-man-en: DOCS/man/en/mpv.1
|
||||
if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
|
||||
$(INSTALL) -m 644 DOCS/man/en/mpv.1 $(MANDIR)/man1/
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BINDIR)/mpv$(EXESUF)
|
||||
$(RM) $(MANDIR)/man1/mpv.1
|
||||
$(RM) $(MANDIR)/en/man1/mpv.1
|
||||
|
||||
clean:
|
||||
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
|
||||
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
|
||||
-$(RM) $(call ADD_ALL_EXESUFS,mpv)
|
||||
-$(RM) DOCS/man/en/mpv.1
|
||||
-$(RM) version.h
|
||||
-$(RM) mpvcore/input/input_conf.h
|
||||
-$(RM) video/out/vdpau_template.c
|
||||
-$(RM) demux/ebml_types.h demux/ebml_defs.c
|
||||
-$(RM) video/out/gl_video_shaders.h
|
||||
-$(RM) sub/osd_font.h
|
||||
|
||||
distclean: clean
|
||||
-$(RM) config.log config.mak config.h TAGS tags
|
||||
|
||||
TAGS:
|
||||
$(RM) $@; find . -name '*.[chS]' -o -name '*.asm' | xargs etags -a
|
||||
|
||||
tags:
|
||||
$(RM) $@; find . -name '*.[chS]' -o -name '*.asm' | xargs ctags -a
|
||||
|
||||
osxbundle:
|
||||
@TOOLS/osxbundle.py mpv
|
||||
|
||||
osxbundle-skip-deps:
|
||||
@TOOLS/osxbundle.py --skip-deps mpv
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
.PHONY: all *install* *clean .version
|
||||
|
||||
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
||||
# so this saves some time on slow systems.
|
||||
.SUFFIXES:
|
||||
|
||||
# If a command returns failure but changed its target file, delete the
|
||||
# (presumably malformed) file. Otherwise the file would be considered to
|
||||
# be up to date if make is restarted.
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
@@ -1,93 +1,40 @@
|
||||

|
||||
mpv
|
||||
===
|
||||
|
||||
## mpv
|
||||
[](https://travis-ci.org/mpv-player/mpv)
|
||||
|
||||
--------------
|
||||
Overview
|
||||
--------
|
||||
|
||||
|
||||
* [Overview](#overview)
|
||||
* [Downloads](#downloads)
|
||||
* [Compilation](#compilation)
|
||||
* [FFmpeg vs. Libav](#ffmpeg-vs-libav)
|
||||
* [Release cycle](#release-cycle)
|
||||
* [Bug reports](#bug-reports)
|
||||
* [Contributing](#contributing)
|
||||
* [Relation to MPlayer and mplayer2](#relation-to-mplayer-and-mplayer2)
|
||||
* [Wiki](https://github.com/mpv-player/mpv/wiki)
|
||||
* [Man pages](http://mpv.io/manual/master/)
|
||||
* [Contact](#contact)
|
||||
* [License](#license)
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
**mpv** is a media player based on MPlayer and mplayer2. It supports a wide
|
||||
**mpv** is a movie player based on MPlayer and mplayer2. It supports a wide
|
||||
variety of video file formats, audio and video codecs, and subtitle types.
|
||||
|
||||
Releases can be found on the [release list][releases].
|
||||
|
||||
## Downloads
|
||||
|
||||
|
||||
For semi-official builds and third-party packages please see
|
||||
[mpv.io](http://mpv.io/installation/).
|
||||
|
||||
## Compilation
|
||||
If you are wondering what's different from mplayer2 and MPlayer you can read
|
||||
more about the [changes][changes].
|
||||
|
||||
Compilation
|
||||
-----------
|
||||
|
||||
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
|
||||
script './bootstrap.py' will download the latest version of waf that was tested
|
||||
with the build system.
|
||||
|
||||
For a list of the available build options use `./waf configure --help`. If
|
||||
you think you have support for some feature installed but configure fails to
|
||||
detect it, the file `build/config.log` may contain information about the
|
||||
reasons for the failure.
|
||||
|
||||
NOTE: To avoid cluttering the output with unreadable spam, `--help` only shows
|
||||
one of the two switches for each option. If the option is autodetected by
|
||||
default, the `--disable-***` switch is printed; if the option is disabled by
|
||||
default, the `--enable-***` switch is printed. Either way, you can use
|
||||
`--enable-***` or `--disable-**` regardless of what is printed by `--help`.
|
||||
|
||||
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.
|
||||
external libraries. Below is a list of some important requirements. For
|
||||
more information see the output of `./configure --help` for a list of options,
|
||||
or look at the list of enabled and disabled features printed after running
|
||||
`./configure`. If you think you have support for some feature installed
|
||||
but configure fails to detect it, the file `config.log` may contain
|
||||
information about the reasons for the failure.
|
||||
|
||||
Essential dependencies (incomplete list):
|
||||
|
||||
- gcc or clang
|
||||
- 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 2.4.0 or Libav 11 is required.
|
||||
- zlib
|
||||
- iconv (normally provided by the system libc)
|
||||
- libass (OSD, OSC, text subtitles)
|
||||
- Lua (optional, required for the OSC pseudo-GUI and youtube-dl integration)
|
||||
- libjpeg (optional, used for screenshots only)
|
||||
- Enca (optional, for subtitle charset detection)
|
||||
- vdpau and vaapi libraries for hardware decoding on Linux (optional)
|
||||
|
||||
Libass dependencies:
|
||||
|
||||
- gcc or clang, yasm on x86 and x86_64
|
||||
- Audio output development headers (libasound, pulseaudio)
|
||||
- fribidi, freetype, fontconfig development headers (for libass)
|
||||
- harfbuzz (optional, required for correct rendering of combining characters,
|
||||
particularly for correct rendering of non-English text on OSX, and
|
||||
Arabic/Indic scripts on any platform)
|
||||
|
||||
FFmpeg dependencies:
|
||||
|
||||
- gcc or clang, yasm on x86 and x86_64
|
||||
- OpenSSL (has to be explicitly enabled when compiling ffmpeg)
|
||||
- libass
|
||||
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libpostproc)
|
||||
- libjpeg
|
||||
- libquvi if you want to play Youtube videos directly
|
||||
- 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
|
||||
@@ -100,94 +47,37 @@ If you are running Mac OSX and using homebrew we provide [homebrew-mpv][homebrew
|
||||
to date formula that compiles mpv with sensible dependencies and defaults for
|
||||
OSX.
|
||||
|
||||
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].
|
||||
configure --enable-* parameters
|
||||
-------------------------------
|
||||
|
||||
## FFmpeg vs. Libav
|
||||
The --enable-* parameters unconditionally force options on, completely
|
||||
skipping autodetection. This behavior is unlike what you may be used to from
|
||||
autoconf-based configure scripts that can decide to override you. This greater
|
||||
level of control comes at a price. You may have to provide the correct compiler
|
||||
and linker flags yourself.
|
||||
If you used one of these options and experience a compilation or
|
||||
linking failure, make sure you have passed the necessary compiler/linker flags
|
||||
to configure.
|
||||
|
||||
Bug reports
|
||||
-----------
|
||||
|
||||
Generally, mpv should work with the latest release as well as the git version
|
||||
of both FFmpeg and Libav. But FFmpeg is preferred, and some mpv features work
|
||||
with FFmpeg only (subtitle formats in particular).
|
||||
|
||||
|
||||
## Release cycle
|
||||
|
||||
|
||||
Every few months, a new release is cut off of the master branch and is assigned
|
||||
a 0.X.0 version number.
|
||||
|
||||
As part of the maintenance process, minor releases are made, which are assigned
|
||||
0.X.Y version numbers. Minor releases contain bug fixes only. They never merge
|
||||
the master branch, and no features are added to it. Only the latest release is
|
||||
maintained.
|
||||
|
||||
The goal of releases is to provide stability and an unchanged base for the sake
|
||||
of Linux distributions. If you want the newest features, just use the master
|
||||
branch, which is stable most of the time, except sometimes, when it's not.
|
||||
|
||||
Releases other than the latest release are unsupported and unmaintained.
|
||||
|
||||
See the [release policy document][release-policy] for more information.
|
||||
|
||||
## Bug reports
|
||||
|
||||
|
||||
Please use the [issue tracker][issue-tracker] provided by GitHub to send us bug
|
||||
Please use the [issue tracker][issue tracker] provided by GitHub to send us bug
|
||||
reports or feature requests.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
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.
|
||||
|
||||
## Relation to MPlayer and mplayer2
|
||||
Contacts
|
||||
--------
|
||||
|
||||
You can find us on IRC in `#mpv-player` on `irc.freenode.net`
|
||||
|
||||
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
|
||||
list of changes is located [here][mplayer-changes].
|
||||
|
||||
## Contact
|
||||
|
||||
|
||||
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`
|
||||
- **Developer IRC Channel**: `#mpv-devel` on `irc.freenode.net`
|
||||
|
||||
To contact the `mpv` team in private write to `mpv-team@googlegroups.com`. Use
|
||||
only if discretion is required.
|
||||
|
||||
[releases]: https://github.com/mpv-player/mpv/releases
|
||||
[changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/man/en/changes.rst
|
||||
[mpv-build]: https://github.com/mpv-player/mpv-build
|
||||
[homebrew-mpv]: https://github.com/mpv-player/homebrew-mpv
|
||||
[issue-tracker]: https://github.com/mpv-player/mpv/issues
|
||||
[ffmpeg_vs_libav]: https://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav
|
||||
[release-policy]: https://github.com/mpv-player/mpv/blob/master/DOCS/release-policy.md
|
||||
[windows_compilation]: https://github.com/mpv-player/mpv/blob/master/DOCS/compile-windows.md
|
||||
[mplayer-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/mplayer-changes.rst
|
||||
|
||||
## License
|
||||
|
||||
|
||||
[GPLv2](https://github.com/mpv-player/mpv/blob/master/LICENSE)
|
||||
[issue tracker]: https://github.com/mpv-player/mpv/issues
|
||||
-1058
File diff suppressed because it is too large.
Load diff
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
from functools import partial
|
||||
|
||||
sys_re = re.compile("^/System")
|
||||
usr_re = re.compile("^/usr/lib/")
|
||||
exe_re = re.compile("@executable_path")
|
||||
|
||||
def is_user_lib(objfile, libname):
|
||||
return not sys_re.match(libname) and \
|
||||
not usr_re.match(libname) and \
|
||||
not exe_re.match(libname) and \
|
||||
not "libobjc." in libname and \
|
||||
not "libSystem." in libname and \
|
||||
not "libc." in libname and \
|
||||
not "libgcc." in libname and \
|
||||
not os.path.basename(libname) == 'Python' and \
|
||||
not os.path.basename(objfile) in libname
|
||||
|
||||
def otool(objfile):
|
||||
command = "otool -L %s | grep -e '\t' | awk '{ print $1 }'" % objfile
|
||||
output = subprocess.check_output(command, shell = True)
|
||||
return filter(partial(is_user_lib, objfile), output.split())
|
||||
|
||||
def install_name_tool_change(old, new, objfile):
|
||||
subprocess.call(["install_name_tool", "-change", old, new, objfile])
|
||||
|
||||
def install_name_tool_id(name, objfile):
|
||||
subprocess.call(["install_name_tool", "-id", name, objfile])
|
||||
|
||||
def libraries(objfile, result = dict()):
|
||||
libs_list = otool(objfile)
|
||||
result[objfile] = set(libs_list)
|
||||
|
||||
for lib in libs_list:
|
||||
if lib not in result:
|
||||
libraries(lib, result)
|
||||
|
||||
return result
|
||||
|
||||
def leafs(libs_dict, processed = []):
|
||||
result = []
|
||||
processed = set(processed)
|
||||
|
||||
for objfile, libs in libs_dict.items():
|
||||
if libs <= processed:
|
||||
result.append(objfile)
|
||||
|
||||
return result
|
||||
|
||||
def lib_path(binary):
|
||||
return os.path.join(os.path.dirname(binary), 'lib')
|
||||
|
||||
def lib_name(lib):
|
||||
return os.path.join("@executable_path", "lib", os.path.basename(lib))
|
||||
|
||||
def process_libraries(libs_dict, binary, processed = []):
|
||||
ls = leafs(libs_dict, processed)
|
||||
diff = set(ls) - set(processed)
|
||||
if diff == set([binary]):
|
||||
return
|
||||
|
||||
for src in diff:
|
||||
name = lib_name(src)
|
||||
dst = os.path.join(lib_path(binary), os.path.basename(src))
|
||||
|
||||
shutil.copy(src, dst)
|
||||
os.chmod(dst, 0o755)
|
||||
install_name_tool_id(name, dst)
|
||||
|
||||
if src in libs_dict[binary]:
|
||||
install_name_tool_change(src, name, binary)
|
||||
|
||||
for p in processed:
|
||||
if p in libs_dict[src]:
|
||||
install_name_tool_change(p, lib_name(p), dst)
|
||||
|
||||
process_libraries(libs_dict, binary, ls)
|
||||
|
||||
def main():
|
||||
binary = os.path.abspath(sys.argv[1])
|
||||
if not os.path.exists(lib_path(binary)):
|
||||
os.makedirs(lib_path(binary))
|
||||
libs = libraries(binary)
|
||||
print(libs)
|
||||
process_libraries(libs, binary)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/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
|
||||
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
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
: "${MPV:=mpv}"
|
||||
: "${ILDETECT_MPV:=$MPV}"
|
||||
: "${ILDETECT_MPVFLAGS:=--start=35% --length=35}"
|
||||
: "${ILDETECT_DRY_RUN:=}"
|
||||
: "${ILDETECT_QUIET:=}"
|
||||
: "${ILDETECT_RUN_INTERLACED_ONLY:=}"
|
||||
: "${ILDETECT_FORCE_RUN:=}"
|
||||
|
||||
# This script uses ffmpeg's "idet" filter for interlace detection. In the
|
||||
# long run this should replace ildetect.sh+ildetect.so.
|
||||
|
||||
# exit status:
|
||||
# 0 progressive
|
||||
# 1 telecine
|
||||
# 2 interlaced
|
||||
# 8 unknown
|
||||
# 16 detect fail
|
||||
# 17+ mpv's status | 16
|
||||
|
||||
testfun()
|
||||
{
|
||||
$ILDETECT_MPV "$@" \
|
||||
--vf-add=lavfi="[idet]" --msg-level ffmpeg=v \
|
||||
--o= --vo=null --no-audio --untimed \
|
||||
$ILDETECT_MPVFLAGS \
|
||||
| { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \
|
||||
| grep "Parsed_idet_0: Multi frame detection: "
|
||||
}
|
||||
|
||||
judge()
|
||||
{
|
||||
tff=0
|
||||
bff=0
|
||||
progressive=0
|
||||
undetermined=0
|
||||
while read -r _ _ _ _ _ _ tff1 _ bff1 _ progressive1 _ undetermined1 _; do
|
||||
case "$tff1$bff1$progressive1$undetermined1" in
|
||||
*[!0-9]*)
|
||||
printf >&2 'ERROR: Unrecognized idet output: %s\n' "$out"
|
||||
exit 16
|
||||
;;
|
||||
esac
|
||||
tff=$((tff + tff1))
|
||||
bff=$((bff + bff1))
|
||||
progressive=$((progressive + progressive1))
|
||||
undetermined=$((undetermined + undetermined1))
|
||||
done <<EOF
|
||||
$(testfun "$@" | sed 's/:/: /g')
|
||||
EOF
|
||||
|
||||
interlaced=$((bff + tff))
|
||||
determined=$((interlaced + progressive))
|
||||
|
||||
if [ "$undetermined" -gt "$determined" ] || [ "$determined" -lt 250 ]; then
|
||||
echo >&2 "ERROR: Less than 50% or 250 frames are determined."
|
||||
[ -n "$ILDETECT_FORCE_RUN" ] || exit 8
|
||||
echo >&2 "Assuming interlacing."
|
||||
if [ "$tff" -gt $((bff * 10)) ]; then
|
||||
verdict="interlaced-tff"
|
||||
elif [ "$bff" -gt $((tff * 10)) ]; then
|
||||
verdict="interlaced-bff"
|
||||
else
|
||||
verdict="interlaced"
|
||||
fi
|
||||
elif [ $((interlaced * 20)) -gt "$progressive" ]; then
|
||||
# At least 5% of the frames are interlaced!
|
||||
if [ "$tff" -gt $((bff * 10)) ]; then
|
||||
verdict="interlaced-tff"
|
||||
elif [ "$bff" -gt $((tff * 10)) ]; then
|
||||
verdict="interlaced-bff"
|
||||
else
|
||||
echo >&2 "ERROR: Content is interlaced, but can't determine field order."
|
||||
[ -n "$ILDETECT_FORCE_RUN" ] || exit 8
|
||||
echo >&2 "Assuming interlacing with default field order."
|
||||
verdict="interlaced"
|
||||
fi
|
||||
else
|
||||
# Likely progressive
|
||||
verdict="progressive"
|
||||
fi
|
||||
|
||||
printf '%s\n' "$verdict"
|
||||
}
|
||||
|
||||
judge "$@" --vf-clr
|
||||
case "$verdict" in
|
||||
progressive)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
[ -n "$ILDETECT_RUN_INTERLACED_ONLY" ] || \
|
||||
$ILDETECT_MPV "$@"
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 0
|
||||
;;
|
||||
interlaced-tff)
|
||||
judge "$@" --vf-clr --vf-pre=lavfi=\[setfield=tff\],pullup
|
||||
case "$verdict" in
|
||||
progressive)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
$ILDETECT_MPV "$@" --vf-pre=lavfi=\[setfield=tff\],pullup
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
$ILDETECT_MPV "$@" --vf-pre=lavfi=\[setfield=tff\],yadif
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
interlaced-bff)
|
||||
judge "$@" --vf-clr --vf-pre=lavfi=\[setfield=bff\],pullup
|
||||
case "$verdict" in
|
||||
progressive)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
$ILDETECT_MPV "$@" --vf-pre=lavfi=\[setfield=bff\],pullup
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
$ILDETECT_MPV "$@" --vf-pre=lavfi=\[setfield=bff\],yadif
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
interlaced)
|
||||
judge "$@" --vf-clr --vf-pre=pullup
|
||||
case "$verdict" in
|
||||
progressive)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
$ILDETECT_MPV "$@" --vf-pre=pullup
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
[ -n "$ILDETECT_DRY_RUN" ] || \
|
||||
$ILDETECT_MPV "$@" --vf-pre=yadif
|
||||
r=$?
|
||||
[ $r -eq 0 ] || exit $((r | 16))
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo >&2 "ERROR: Internal error."
|
||||
exit 16
|
||||
;;
|
||||
esac
|
||||
@@ -84,7 +84,7 @@ sub elem_by_hexid {
|
||||
# used by elem when setting the 'valname' key
|
||||
use constant TYPE_MAP => {
|
||||
uint => 'uint64_t',
|
||||
str => 'char *',
|
||||
str => 'struct bstr',
|
||||
binary => 'struct bstr',
|
||||
ebml_id => 'uint32_t',
|
||||
float => 'double',
|
||||
@@ -232,7 +232,6 @@ sub define_matroska {
|
||||
elem('Block', 'a1', 'binary'),
|
||||
elem('BlockDuration', '9b', 'uint'),
|
||||
elem('ReferenceBlock*', 'fb', 'sint'),
|
||||
elem('DiscardPadding', '75A2', 'sint'),
|
||||
}),
|
||||
elem('SimpleBlock*', 'a3', 'binary'),
|
||||
}),
|
||||
@@ -257,8 +256,6 @@ sub define_matroska {
|
||||
elem('CodecPrivate', '63a2', 'binary'),
|
||||
elem('CodecName', '258688', 'str'),
|
||||
elem('CodecDecodeAll', 'aa', 'uint'),
|
||||
elem('CodecDelay', '56AA', 'uint'),
|
||||
elem('SeekPreRoll', '56BB', 'uint'),
|
||||
elem('Video', 'e0', {
|
||||
elem('FlagInterlaced', '9a', 'uint'),
|
||||
elem('PixelWidth', 'b0', 'uint'),
|
||||
@@ -268,7 +265,6 @@ sub define_matroska {
|
||||
elem('DisplayUnit', '54b2', 'uint'),
|
||||
elem('FrameRate', '2383e3', 'float'),
|
||||
elem('ColourSpace', '2eb524', 'binary'),
|
||||
elem('StereoMode', '53b8', 'uint'),
|
||||
}),
|
||||
elem('Audio', 'e1', {
|
||||
elem('SamplingFrequency', 'b5', 'float'),
|
||||
@@ -296,8 +292,6 @@ sub define_matroska {
|
||||
elem('CueTrackPositions*', 'b7', {
|
||||
elem('CueTrack', 'f7', 'uint'),
|
||||
elem('CueClusterPosition', 'f1', 'uint'),
|
||||
elem('CueRelativePosition','f0', 'uint'),
|
||||
elem('CueDuration', 'b2', 'uint'),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -132,8 +132,7 @@ sub _bin2int($) {
|
||||
# creates a floating-point number with the given mantissa and exponent
|
||||
sub _ldexp {
|
||||
my ($mantissa, $exponent) = @_;
|
||||
my $r = new Math::BigRat($mantissa);
|
||||
return $r * Math::BigRat->new(2)**$exponent;
|
||||
return $mantissa * Math::BigRat->new(2)**$exponent;
|
||||
}
|
||||
|
||||
# NOTE: the read_* functions are hard to read because they're ports
|
||||
@@ -253,27 +252,25 @@ bytes from the internal filehandle.
|
||||
Only lengths C<4> and C<8> are supported (C C<float> and C<double>).
|
||||
|
||||
=cut
|
||||
{
|
||||
my $b1 = new Math::BigInt 1;
|
||||
sub read_float {
|
||||
my ($self, $length) = @_;
|
||||
my $i = $self->read_uint($length);
|
||||
my $f;
|
||||
|
||||
sub read_float {
|
||||
my ($self, $length) = @_;
|
||||
my $i = new Math::BigInt $self->read_uint($length)->bstr;
|
||||
my $f;
|
||||
use bigrat try => BIGINT_TRY;
|
||||
|
||||
# These evil expressions reinterpret an unsigned int as IEEE binary floats
|
||||
if ($length == 4) {
|
||||
$f = _ldexp(($i & ((1<<23) - 1)) + (1<<23), ($i>>23 & ((1<<8) - 1)) - 150);
|
||||
$f = -$f if $i & ($b1<<31);
|
||||
} elsif ($length == 8) {
|
||||
$f = _ldexp(($i & (($b1<<52) - 1)) + ($b1<<52), ($i>>52 & ((1<<12) - 1)) - 1075);
|
||||
$f = -$f if $i & ($b1<<63);
|
||||
} else {
|
||||
croak "Matroska Syntax error: unsupported IEEE float byte size $length";
|
||||
}
|
||||
|
||||
return $f;
|
||||
# These evil expressions reinterpret an unsigned int as IEEE binary floats
|
||||
if ($length == 4) {
|
||||
$f = _ldexp(($i & (1<<23 - 1)) + (1<<23), ($i>>23 & (1<<8 - 1)) - 150);
|
||||
$f = -$f if $i & (1<<31);
|
||||
} elsif ($length == 8) {
|
||||
$f = _ldexp(($i & (1<<52 - 1)) + (1<<52), ($i>>52 & (1<<12 - 1)) - 1075);
|
||||
$f = -$f if $i & (1<<63);
|
||||
} else {
|
||||
croak "Matroska Syntax error: unsupported IEEE float byte size $length";
|
||||
}
|
||||
|
||||
return $f;
|
||||
}
|
||||
|
||||
=method read_ebml_id($length)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
mpv lua scripts
|
||||
===============
|
||||
|
||||
The lua scripts in this folder can be loaded on a one-time basis by
|
||||
adding the option
|
||||
|
||||
--script=/path/to/script.lua
|
||||
|
||||
to mpv's command line.
|
||||
|
||||
Where appropriate, they may also be placed in ~/.config/mpv/scripts/ from
|
||||
where they will be automatically loaded when mpv starts.
|
||||
|
||||
Some of these are just for testing mpv internals.
|
||||
@@ -1,13 +0,0 @@
|
||||
local utils = require("mp.utils")
|
||||
|
||||
mp.observe_property("audio-device-list", "native", function(name, val)
|
||||
print("Audio device list changed:")
|
||||
for index, e in ipairs(val) do
|
||||
print(" - '" .. e.name .. "' (" .. e.description .. ")")
|
||||
end
|
||||
end)
|
||||
|
||||
mp.observe_property("audio-out-detected-device", "native", function(name, val)
|
||||
print("Detected audio device changed:")
|
||||
print(" - '" .. val)
|
||||
end)
|
||||
@@ -1,113 +0,0 @@
|
||||
-- This script uses the lavfi cropdetect filter to automatically
|
||||
-- insert a crop filter with appropriate parameters for the currently
|
||||
-- playing video.
|
||||
--
|
||||
-- It registers the key-binding "C" (shift+c), which when pressed,
|
||||
-- inserts the filter vf=lavfi=cropdetect. After 1 second, it then
|
||||
-- inserts the filter vf=crop=w:h:x:y, where w,h,x,y are determined
|
||||
-- from the vf-metadata gathered by cropdetect. The cropdetect filter
|
||||
-- is removed immediately after the crop filter is inserted as it is
|
||||
-- no longer needed.
|
||||
--
|
||||
-- If the "C" key is pressed again, the crop filter is removed
|
||||
-- restoring playback to its original state.
|
||||
--
|
||||
-- Since the crop parameters are determined from the 1 second of video
|
||||
-- between inserting the cropdetect and crop filters, the "C" key
|
||||
-- should be pressed at a position in the video where the crop region
|
||||
-- is unambiguous (i.e., not a black frame, black background title
|
||||
-- card, or dark scene).
|
||||
--
|
||||
-- The default delay between insertion of the cropdetect and
|
||||
-- crop filters may be overridden by adding
|
||||
--
|
||||
-- --script-opts=autocrop.detect_seconds=<number of seconds>
|
||||
--
|
||||
-- to mpv's arguments. This may be desirable to allow cropdetect more
|
||||
-- time to collect data.
|
||||
require "mp.msg"
|
||||
|
||||
script_name = mp.get_script_name()
|
||||
cropdetect_label = string.format("%s-cropdetect", script_name)
|
||||
crop_label = string.format("%s-crop", script_name)
|
||||
|
||||
-- number of seconds to gather cropdetect data
|
||||
detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name)))
|
||||
if not detect_seconds then
|
||||
detect_seconds = 1
|
||||
end
|
||||
|
||||
function del_filter_if_present(label)
|
||||
-- necessary because mp.command('vf del @label:filter') raises an
|
||||
-- error if the filter doesn't exist
|
||||
local vfs = mp.get_property_native("vf")
|
||||
for i,vf in pairs(vfs) do
|
||||
if vf["label"] == label then
|
||||
table.remove(vfs, i)
|
||||
mp.set_property_native("vf", vfs)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function autocrop_start()
|
||||
-- exit if cropdetection is already in progress
|
||||
if timer then
|
||||
mp.msg.warn("already cropdetecting!")
|
||||
return
|
||||
end
|
||||
|
||||
-- if there's a crop filter, remove it and exit
|
||||
if del_filter_if_present(crop_label) then
|
||||
return
|
||||
end
|
||||
|
||||
-- insert the cropdetect filter
|
||||
ret=mp.command(
|
||||
string.format(
|
||||
'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"',
|
||||
cropdetect_label
|
||||
)
|
||||
)
|
||||
-- wait to gather data
|
||||
timer=mp.add_timeout(detect_seconds, do_crop)
|
||||
end
|
||||
|
||||
function do_crop()
|
||||
-- get the metadata
|
||||
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"]
|
||||
and cropdetect_metadata["lavfi.cropdetect.h"]
|
||||
and cropdetect_metadata["lavfi.cropdetect.x"]
|
||||
and cropdetect_metadata["lavfi.cropdetect.y"]
|
||||
then
|
||||
mp.command(string.format("vf add @%s:crop=%s:%s:%s:%s",
|
||||
crop_label,
|
||||
cropdetect_metadata["lavfi.cropdetect.w"],
|
||||
cropdetect_metadata["lavfi.cropdetect.h"],
|
||||
cropdetect_metadata["lavfi.cropdetect.x"],
|
||||
cropdetect_metadata["lavfi.cropdetect.y"]))
|
||||
else
|
||||
mp.msg.error(
|
||||
"Got empty crop data. You might need to increase detect_seconds."
|
||||
)
|
||||
end
|
||||
else
|
||||
mp.msg.error(
|
||||
"No crop data. Was the cropdetect filter successfully inserted?"
|
||||
)
|
||||
mp.msg.error(
|
||||
"Does your version of ffmpeg/libav support AVFrame metadata?"
|
||||
)
|
||||
end
|
||||
-- remove the cropdetect filter
|
||||
del_filter_if_present(cropdetect_label)
|
||||
timer=nil
|
||||
end
|
||||
|
||||
mp.add_key_binding("C", "auto_crop", autocrop_start)
|
||||
@@ -1,145 +0,0 @@
|
||||
-- This script uses the lavfi idet filter to automatically insert the
|
||||
-- appropriate deinterlacing filter based on a short section of the
|
||||
-- currently playing video.
|
||||
--
|
||||
-- It registers the key-binding ctrl+d, which when pressed, inserts the filters
|
||||
-- ``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 mpv's ``field-dominance`` property.
|
||||
--
|
||||
-- OPTIONS:
|
||||
-- The default detection time may be overridden by adding
|
||||
--
|
||||
-- --script-opts=autodeint.detect_seconds=<number of seconds>
|
||||
--
|
||||
-- to mpv's arguments. This may be desirable to allow idet more
|
||||
-- time to collect data.
|
||||
--
|
||||
-- To see counts of the various types of frames for each detection phase,
|
||||
-- the verbosity can be increased with
|
||||
--
|
||||
-- --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)
|
||||
ivtc_detect_label = string.format("%s-ivtc-detect", script_name)
|
||||
|
||||
-- number of seconds to gather cropdetect data
|
||||
detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name)))
|
||||
if not detect_seconds then
|
||||
detect_seconds = 4
|
||||
end
|
||||
|
||||
function del_filter_if_present(label)
|
||||
-- necessary because mp.command('vf del @label:filter') raises an
|
||||
-- error if the filter doesn't exist
|
||||
local vfs = mp.get_property_native("vf")
|
||||
|
||||
for i,vf in pairs(vfs) do
|
||||
if vf["label"] == label then
|
||||
table.remove(vfs, i)
|
||||
mp.set_property_native("vf", vfs)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function start_detect()
|
||||
-- exit if detection is already in progress
|
||||
if timer then
|
||||
mp.msg.warn("already detecting!")
|
||||
return
|
||||
end
|
||||
|
||||
mp.set_property("deinterlace","no")
|
||||
del_filter_if_present(pullup_label)
|
||||
|
||||
-- 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
|
||||
|
||||
-- wait to gather data
|
||||
timer = mp.add_timeout(detect_seconds, select_filter)
|
||||
end
|
||||
|
||||
function stop_detect()
|
||||
del_filter_if_present(detect_label)
|
||||
del_filter_if_present(ivtc_detect_label)
|
||||
timer = nil
|
||||
end
|
||||
|
||||
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))
|
||||
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)
|
||||
mp.msg.verbose(label.." interlaced-bff = "..num_bff)
|
||||
mp.msg.verbose(label.." undetermined = "..num_undetermined)
|
||||
|
||||
if num_determined < num_undetermined then
|
||||
mp.msg.warn("majority undetermined frames")
|
||||
end
|
||||
if num_progressive > 20*num_interlaced then
|
||||
return progressive
|
||||
elseif num_tff > 10*num_bff then
|
||||
return interlaced_tff
|
||||
elseif num_bff > 10*num_tff then
|
||||
return interlaced_bff
|
||||
else
|
||||
return interlaced
|
||||
end
|
||||
end
|
||||
|
||||
function select_filter()
|
||||
-- handle the first detection filter results
|
||||
verdict = judge(detect_label)
|
||||
if verdict == progressive then
|
||||
mp.msg.info("progressive: doing nothing")
|
||||
stop_detect()
|
||||
return
|
||||
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
|
||||
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", mp.get_property("field-dominance")))
|
||||
del_filter_if_present(pullup_label)
|
||||
mp.set_property("deinterlace","yes")
|
||||
stop_detect()
|
||||
end
|
||||
end
|
||||
|
||||
mp.add_key_binding("ctrl+d", script_name, start_detect)
|
||||
@@ -1,124 +0,0 @@
|
||||
-- This script automatically loads playlist entries before and after the
|
||||
-- the currently played file. It does so by scanning the directory a file is
|
||||
-- located in when starting playback. It sorts the directory entries
|
||||
-- alphabetically, and adds entries before and after the current file to
|
||||
-- the internal playlist. (It stops if the it would add an already existing
|
||||
-- playlist entry at the same position - this makes it "stable".)
|
||||
-- Add at most 5000 * 2 files when starting a file (before + after).
|
||||
MAXENTRIES = 5000
|
||||
|
||||
function Set (t)
|
||||
local set = {}
|
||||
for _, v in pairs(t) do set[v] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
EXTENSIONS = Set {
|
||||
'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp',
|
||||
'mp3', 'wav', 'ogv', 'flac', 'm4a', 'wma',
|
||||
}
|
||||
|
||||
mputils = require 'mp.utils'
|
||||
|
||||
function add_files_at(index, files)
|
||||
index = index - 1
|
||||
local oldcount = mp.get_property_number("playlist-count", 1)
|
||||
for i = 1, #files do
|
||||
mp.commandv("loadfile", files[i], "append")
|
||||
mp.commandv("playlist_move", oldcount + i - 1, index + i - 1)
|
||||
end
|
||||
end
|
||||
|
||||
function get_extension(path)
|
||||
return string.match(path, "%.([^%.]+)$" )
|
||||
end
|
||||
|
||||
table.filter = function(t, iter)
|
||||
for i = #t, 1, -1 do
|
||||
if not iter(t[i]) then
|
||||
table.remove(t, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function find_and_add_entries()
|
||||
local path = mp.get_property("path", "")
|
||||
local dir, filename = mputils.split_path(path)
|
||||
if #dir == 0 then
|
||||
return
|
||||
end
|
||||
local pl_count = mp.get_property_number("playlist-count", 1)
|
||||
if (pl_count > 1 and autoload == nil) or
|
||||
(pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
|
||||
return
|
||||
else
|
||||
autoload = true
|
||||
end
|
||||
|
||||
local files = mputils.readdir(dir, "files")
|
||||
if files == nil then
|
||||
return
|
||||
end
|
||||
table.filter(files, function (v, k)
|
||||
local ext = get_extension(v)
|
||||
if ext == nil then
|
||||
return false
|
||||
end
|
||||
return EXTENSIONS[string.lower(ext)]
|
||||
end)
|
||||
table.sort(files, function (a, b)
|
||||
return string.lower(a) < string.lower(b)
|
||||
end)
|
||||
|
||||
if dir == "." then
|
||||
dir = ""
|
||||
end
|
||||
|
||||
local pl = mp.get_property_native("playlist", {})
|
||||
local pl_current = mp.get_property_number("playlist-pos", 0) + 1
|
||||
-- Find the current pl entry (dir+"/"+filename) in the sorted dir list
|
||||
local current
|
||||
for i = 1, #files do
|
||||
if files[i] == filename then
|
||||
current = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if current == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local append = {[-1] = {}, [1] = {}}
|
||||
for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
|
||||
for i = 1, MAXENTRIES do
|
||||
local file = files[current + i * direction]
|
||||
local pl_e = pl[pl_current + i * direction]
|
||||
if file == nil or file[1] == "." then
|
||||
break
|
||||
end
|
||||
|
||||
local filepath = dir .. file
|
||||
if pl_e then
|
||||
-- If there's a playlist entry, and it's the same file, stop.
|
||||
if pl_e.filename == filepath then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if direction == -1 then
|
||||
if pl_current == 1 then -- never add additional entries in the middle
|
||||
mp.msg.info("Prepending " .. file)
|
||||
table.insert(append[-1], 1, filepath)
|
||||
end
|
||||
else
|
||||
mp.msg.info("Adding " .. file)
|
||||
table.insert(append[1], filepath)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
add_files_at(pl_current + 1, append[1])
|
||||
add_files_at(pl_current, append[-1])
|
||||
end
|
||||
|
||||
mp.register_event("start-file", find_and_add_entries)
|
||||
@@ -1,56 +0,0 @@
|
||||
-- This script cycles between deinterlacing, pullup (inverse
|
||||
-- telecine), and both filters off. It uses the "deinterlace" property
|
||||
-- so that a hardware deinterlacer will be used if available.
|
||||
--
|
||||
-- It overrides the default deinterlace toggle keybinding "D"
|
||||
-- (shift+d), so that rather than merely cycling the "deinterlace" property
|
||||
-- between on and off, it adds a "pullup" step to the cycle.
|
||||
--
|
||||
-- It provides OSD feedback as to the actual state of the two filters
|
||||
-- after each cycle step/keypress.
|
||||
--
|
||||
-- Note: if hardware decoding is enabled, pullup filter will likely
|
||||
-- fail to insert.
|
||||
--
|
||||
-- TODO: It might make sense to use hardware assisted vdpaupp=pullup,
|
||||
-- if available, but I don't have hardware to test it. Patch welcome.
|
||||
|
||||
script_name = mp.get_script_name()
|
||||
pullup_label = string.format("%s-pullup", script_name)
|
||||
|
||||
function pullup_on()
|
||||
for i,vf in pairs(mp.get_property_native('vf')) do
|
||||
if vf['label'] == pullup_label then
|
||||
return "yes"
|
||||
end
|
||||
end
|
||||
return "no"
|
||||
end
|
||||
|
||||
function do_cycle()
|
||||
if pullup_on() == "yes" then
|
||||
-- if pullup is on remove it
|
||||
mp.command(string.format("vf del @%s:pullup", pullup_label))
|
||||
return
|
||||
elseif mp.get_property("deinterlace") == "yes" then
|
||||
-- if deinterlace is on, turn it off and insert pullup filter
|
||||
mp.set_property("deinterlace", "no")
|
||||
mp.command(string.format("vf add @%s:pullup", pullup_label))
|
||||
return
|
||||
else
|
||||
-- if neither is on, turn on deinterlace
|
||||
mp.set_property("deinterlace", "yes")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function cycle_deinterlace_pullup_handler()
|
||||
do_cycle()
|
||||
-- independently determine current state and give user feedback
|
||||
mp.osd_message(string.format("deinterlace: %s\n"..
|
||||
"pullup: %s",
|
||||
mp.get_property("deinterlace"),
|
||||
pullup_on()))
|
||||
end
|
||||
|
||||
mp.add_key_binding("D", "cycle-deinterlace-pullup", cycle_deinterlace_pullup_handler)
|
||||
@@ -1,99 +0,0 @@
|
||||
-- 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)
|
||||
@@ -1,14 +0,0 @@
|
||||
-- Test script for property change notification mechanism.
|
||||
-- Note that watching/reading some properties can be very expensive, or
|
||||
-- require the player to synchronously wait on network (when playing
|
||||
-- remote files), so you should in general only watch properties you
|
||||
-- are interested in.
|
||||
|
||||
local utils = require("mp.utils")
|
||||
|
||||
for i,name in ipairs(mp.get_property_native("property-list")) do
|
||||
mp.observe_property(name, "native", function(name, val)
|
||||
print("property '" .. name .. "' changed to '" ..
|
||||
utils.to_string(val) .. "'")
|
||||
end)
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
--makes mpv disable ontop when pausing and re-enable it again when resuming playback
|
||||
--please note that this won't do anything if ontop was not enabled before pausing
|
||||
|
||||
local was_ontop = false
|
||||
|
||||
mp.observe_property("pause", "bool", function(name, value)
|
||||
local ontop = mp.get_property_native("ontop")
|
||||
if value then
|
||||
if ontop then
|
||||
mp.set_property_native("ontop", false)
|
||||
was_ontop = true
|
||||
end
|
||||
else
|
||||
if was_ontop and not ontop then
|
||||
mp.set_property_native("ontop", true)
|
||||
end
|
||||
was_ontop = false
|
||||
end
|
||||
end)
|
||||
@@ -1,20 +0,0 @@
|
||||
-- This script pauses playback when minimizing the window, and resumes playback
|
||||
-- if it's brought back again. If the player was already paused when minimizing,
|
||||
-- then try not to mess with the pause state.
|
||||
|
||||
local did_minimize = false
|
||||
|
||||
mp.observe_property("window-minimized", "bool", function(name, value)
|
||||
local pause = mp.get_property_native("pause")
|
||||
if value == true then
|
||||
if pause == false then
|
||||
mp.set_property_native("pause", true)
|
||||
did_minimize = true
|
||||
end
|
||||
elseif value == false then
|
||||
if did_minimize and (pause == true) then
|
||||
mp.set_property_native("pause", false)
|
||||
end
|
||||
did_minimize = false
|
||||
end
|
||||
end)
|
||||
@@ -1,71 +0,0 @@
|
||||
-- Rebuild the terminal status line as a lua script
|
||||
-- Be aware that this will require more cpu power!
|
||||
-- Also, this is based on a rather old version of the
|
||||
-- builtin mpv status line.
|
||||
|
||||
-- Add a string to the status line
|
||||
function atsl(s)
|
||||
newStatus = newStatus .. s
|
||||
end
|
||||
|
||||
function update_status_line()
|
||||
-- Reset the status line
|
||||
newStatus = ""
|
||||
|
||||
if mp.get_property_bool("pause") then
|
||||
atsl("(Paused) ")
|
||||
elseif mp.get_property_bool("paused-for-cache") then
|
||||
atsl("(Buffering) ")
|
||||
end
|
||||
|
||||
if mp.get_property("vid") ~= "no" then
|
||||
atsl("A")
|
||||
end
|
||||
if mp.get_property("aid") ~= "no" then
|
||||
atsl("V")
|
||||
end
|
||||
|
||||
atsl(": ")
|
||||
|
||||
atsl(mp.get_property_osd("time-pos"))
|
||||
|
||||
atsl(" / ");
|
||||
atsl(mp.get_property_osd("duration"));
|
||||
|
||||
atsl(" (")
|
||||
atsl(mp.get_property_osd("percent-pos", -1))
|
||||
atsl("%)")
|
||||
|
||||
local r = mp.get_property_number("speed", -1)
|
||||
if r ~= 1 then
|
||||
atsl(string.format(" x%4.2f", r))
|
||||
end
|
||||
|
||||
r = mp.get_property_number("avsync", nil)
|
||||
if r ~= nil then
|
||||
atsl(string.format(" A-V: %7.3f", r))
|
||||
end
|
||||
|
||||
r = mp.get_property("total-avsync-change", 0)
|
||||
if math.abs(r) > 0.05 then
|
||||
atsl(string.format(" ct:%7.3f", r))
|
||||
end
|
||||
|
||||
r = mp.get_property_number("drop-frame-count", -1)
|
||||
if r > 0 then
|
||||
atsl(" Late: ")
|
||||
atsl(r)
|
||||
end
|
||||
|
||||
r = mp.get_property_number("cache", 0)
|
||||
if r > 0 then
|
||||
atsl(string.format(" Cache: %d%% ", r))
|
||||
end
|
||||
|
||||
-- Set the new status line
|
||||
mp.set_property("options/term-status-msg", newStatus)
|
||||
end
|
||||
|
||||
-- Register the event
|
||||
mp.register_event("tick", update_status_line)
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
-- zones.lua: mpv script for handling commands depending on where the mouse pointer is at,
|
||||
-- mostly for mouse wheel handling, by configuring it via input.conf, e.g.:
|
||||
--
|
||||
-- Ported from avih's ( https://github.com/avih ) zones.js
|
||||
--
|
||||
-- Vertical positions can be top, middle, bottom or "*" to represent the whole column.
|
||||
-- Horizontal positions can be left, middle, bottom or "*" to represent the whole row.
|
||||
-- "default" will be the fallback command to be used if no command is assigned to that area.
|
||||
--
|
||||
-- input.conf example of use:
|
||||
-- # wheel up/down with mouse
|
||||
-- MOUSE_BTN3 script_message_to zones commands "middle-right: add brightness 1" "*-left: add volume 5" "default: seek 10"
|
||||
-- MOUSE_BTN4 script_message_to zones commands "middle-right: add brightness -1" "*-left: add volume -5" "default: seek -10"
|
||||
|
||||
local ZONE_THRESH_PERCENTAGE = 20;
|
||||
-- sides get 20% each, mid gets 60%, same vertically
|
||||
|
||||
local msg = mp.msg
|
||||
|
||||
function getMouseZone()
|
||||
-- returns the mouse zone as two strings [top/middle/bottom], [left/middle/right], e.g. "middle", "right"
|
||||
|
||||
local screenW, screenH = mp.get_osd_resolution()
|
||||
local mouseX, mouseY = mp.get_mouse_pos()
|
||||
|
||||
local threshY = screenH * ZONE_THRESH_PERCENTAGE / 100
|
||||
local threshX = screenW * ZONE_THRESH_PERCENTAGE / 100
|
||||
|
||||
local yZone = (mouseY < threshY) and "top" or (mouseY < (screenH - threshY)) and "middle" or "bottom"
|
||||
local xZone = (mouseX < threshX) and "left" or (mouseX < (screenW - threshX)) and "middle" or "right"
|
||||
|
||||
return yZone, xZone
|
||||
end
|
||||
|
||||
function main (...)
|
||||
local arg={...}
|
||||
msg.debug('commands: \n\t'..table.concat(arg,'\n\t'))
|
||||
|
||||
local keyY, keyX = getMouseZone()
|
||||
msg.debug("mouse at: " .. keyY .. '-' .. keyX)
|
||||
|
||||
local fallback = nil
|
||||
|
||||
for i, v in ipairs(arg) do
|
||||
cmdY = v:match("^([%w%*]+)%-?[%w%*]*:")
|
||||
cmdX = v:match("^[%w%*]*%-([%w%*]+)%s*:")
|
||||
cmd = v:match("^[%S]-%s*:%s*(.+)")
|
||||
msg.debug('cmdY: '..tostring(cmdY))
|
||||
msg.debug('cmdX: '..tostring(cmdX))
|
||||
msg.debug('cmd : '..tostring(cmd))
|
||||
|
||||
if (cmdY == keyY and cmdX == keyX) then
|
||||
msg.verbose("running cmd: "..cmd)
|
||||
mp.command(cmd)
|
||||
return
|
||||
elseif (cmdY == "*" and cmdX == keyX) or
|
||||
(cmdY == keyY and cmdX == "*") then
|
||||
msg.verbose("running cmd: "..cmd)
|
||||
mp.command(cmd)
|
||||
return
|
||||
elseif cmdY == "default" then
|
||||
fallback = cmd
|
||||
end
|
||||
end
|
||||
if fallback ~= nil then
|
||||
msg.verbose("running cmd: "..fallback)
|
||||
mp.command(fallback)
|
||||
return
|
||||
else
|
||||
msg.debug("no command assigned for "..keyY .. '-' .. keyX)
|
||||
return
|
||||
end
|
||||
end
|
||||
mp.register_script_message("commands", main)
|
||||
+4
-4
@@ -56,7 +56,7 @@ sub generate_c_header {
|
||||
my $l = max(map { length $_->{valname} } values %{$el->{subelements}});
|
||||
|
||||
# Output each variable, with pointers for array (multiple) elements
|
||||
for my $subel (sort { $a->{definename} cmp $b->{definename} } values %{$el->{subelements}}) {
|
||||
for my $subel (values %{$el->{subelements}}) {
|
||||
printf " %-${l}s %s%s;\n",
|
||||
$subel->{valname}, $subel->{multiple}?'*':' ', $subel->{fieldname};
|
||||
}
|
||||
@@ -64,7 +64,7 @@ sub generate_c_header {
|
||||
|
||||
# Output a counter variable for each element
|
||||
# (presence/absence for scalars, item count for arrays)
|
||||
for my $subel (sort values %{$el->{subelements}}) {
|
||||
for my $subel (values %{$el->{subelements}}) {
|
||||
print " int n_$subel->{fieldname};\n"
|
||||
}
|
||||
print "};\n";
|
||||
@@ -101,7 +101,7 @@ sub generate_c_definitions {
|
||||
|
||||
# define a field for each subelement
|
||||
# also does lots of macro magic, but doesn't open a scope
|
||||
for my $subel (sort { $a->{definename} cmp $b->{definename} } values %{$el->{subelements}}) {
|
||||
for my $subel (values %{$el->{subelements}}) {
|
||||
print "F($subel->{definename}, $subel->{fieldname}, ".
|
||||
($subel->{multiple}?'1':'0').")\n";
|
||||
}
|
||||
@@ -166,4 +166,4 @@ sub process_elem {
|
||||
} else {
|
||||
print "$elem->{type} ". $elem->get_value ."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
+150
-127
@@ -17,134 +17,157 @@
|
||||
# When multiple files were specified, their info will be put into FOO_* for the
|
||||
# first file, FOO_1_* for the second file, FOO_2_* for the third file, etc.
|
||||
|
||||
__midentify__main() {
|
||||
|
||||
case "$0" in
|
||||
mpv_identify.sh|*/mpv_identify.sh)
|
||||
# we are NOT being sourced
|
||||
[ -n "$1" ] && set -- '' "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
cat >&2 <<EOF
|
||||
Usage 1 (for humans only): $0 filename.mkv
|
||||
will print all property values.
|
||||
Note that this output really shouldn't be parsed, as the
|
||||
format is subject to change.
|
||||
|
||||
Usage 2 (for use by scripts): see top of this file
|
||||
|
||||
NOTE: for mkv with ordered chapters, this may
|
||||
not always identify the specified file, but the
|
||||
file providing the first chapter. Specify
|
||||
--no-ordered-chapters to prevent this.
|
||||
EOF
|
||||
return 2
|
||||
fi
|
||||
|
||||
local LF="
|
||||
"
|
||||
|
||||
local nextprefix="$1"
|
||||
shift
|
||||
|
||||
if [ -n "$nextprefix" ]; then
|
||||
# in case of error, we always want this unset
|
||||
unset "${nextprefix}path"
|
||||
fi
|
||||
|
||||
local allprops="
|
||||
filename
|
||||
path
|
||||
stream-start
|
||||
stream-end
|
||||
stream-length
|
||||
|
||||
demuxer
|
||||
|
||||
length
|
||||
chapters
|
||||
editions
|
||||
titles
|
||||
|
||||
audio
|
||||
audio-bitrate
|
||||
audio-codec
|
||||
audio-format
|
||||
channels
|
||||
samplerate
|
||||
|
||||
video
|
||||
angle
|
||||
video-bitrate
|
||||
video-codec
|
||||
video-format
|
||||
video-aspect
|
||||
fps
|
||||
width
|
||||
height
|
||||
dwidth
|
||||
dheight
|
||||
|
||||
sub
|
||||
"
|
||||
# TODO add metadata support once mpv can do it
|
||||
|
||||
local propstr="X-MIDENTIFY-START:$LF"
|
||||
local key
|
||||
for key in $allprops; do
|
||||
propstr="${propstr}X-MIDENTIFY: $key \${=$key}$LF"
|
||||
key="$(printf '%s\n' "$key" | tr - _)"
|
||||
unset "$nextprefix$key"
|
||||
done
|
||||
|
||||
local fileindex=0
|
||||
local prefix=
|
||||
local line
|
||||
while IFS= read -r line; do
|
||||
case "$line" in
|
||||
X-MIDENTIFY-START:)
|
||||
if [ -n "$nextprefix" ]; then
|
||||
prefix="$nextprefix"
|
||||
if [ "$fileindex" -gt 0 ]; then
|
||||
nextprefix="${prefix%${fileindex}_}"
|
||||
fi
|
||||
fileindex="$((fileindex+1))"
|
||||
nextprefix="${nextprefix}${fileindex}_"
|
||||
for key in $allprops; do
|
||||
key="$(printf '%s\n' "$key" | tr - _)"
|
||||
unset "$nextprefix$key"
|
||||
done
|
||||
else
|
||||
if [ "$fileindex" -gt 0 ]; then
|
||||
printf '\n'
|
||||
fi
|
||||
fileindex="$((fileindex+1))"
|
||||
fi
|
||||
case "$0" in
|
||||
mpv_identify.sh|*/mpv_identify.sh)
|
||||
# we are NOT being sourced
|
||||
case "$1" in
|
||||
'')
|
||||
;;
|
||||
X-MIDENTIFY:\ *)
|
||||
local key="${line#X-MIDENTIFY: }"
|
||||
local value="${key#* }"
|
||||
key="${key%% *}"
|
||||
key="$(printf '%s\n' "$key" | tr - _)"
|
||||
if [ -n "$nextprefix" ]; then
|
||||
if [ -z "$prefix" ]; then
|
||||
echo >&2 "Got X-MIDENTIFY: without X-MIDENTIFY-START:"
|
||||
elif [ -n "$value" ]; then
|
||||
eval "$prefix$key"='"$value"'
|
||||
fi
|
||||
else
|
||||
if [ -n "$value" ]; then
|
||||
printf '%s=%s\n' "$key" "$value"
|
||||
fi
|
||||
fi
|
||||
*)
|
||||
set -- '' "$@"
|
||||
;;
|
||||
esac
|
||||
done <<EOF
|
||||
$(${MPV:-mpv} --term-playing-msg="$propstr" --vo=null --ao=null \
|
||||
--frames=1 --quiet --no-cache --no-config -- "$@")
|
||||
EOF
|
||||
}
|
||||
;;
|
||||
esac
|
||||
|
||||
__midentify__main "$@"
|
||||
if [ $# -lt 2 ]; then
|
||||
echo >&2 "Usage 1 (for humans only): $0 filename.mkv"
|
||||
echo >&2 "will print all property values."
|
||||
echo >&2 "Note that this output really shouldn't be parsed, as the"
|
||||
echo >&2 "format is subject to change."
|
||||
echo >&2
|
||||
echo >&2 "Usage 2 (for use by scripts): see top of this file"
|
||||
echo >&2
|
||||
echo >&2 "NOTE: for mkv with ordered chapters, this may"
|
||||
echo >&2 "not always identify the specified file, but the"
|
||||
echo >&2 "file providing the first chapter. Specify"
|
||||
echo >&2 "--no-ordered-chapters to prevent this."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MPV" ]; then
|
||||
MPV="mpv"
|
||||
fi
|
||||
|
||||
__midentify__LF="
|
||||
"
|
||||
|
||||
__midentify__nextprefix=$1
|
||||
shift
|
||||
|
||||
if [ -n "$__midentify__nextprefix" ]; then
|
||||
# in case of error, we always want this unset
|
||||
eval unset $__midentify__nextprefix'path'
|
||||
fi
|
||||
|
||||
__midentify__allprops="
|
||||
filename
|
||||
path
|
||||
stream-start
|
||||
stream-end
|
||||
stream-length
|
||||
|
||||
demuxer
|
||||
|
||||
length
|
||||
chapters
|
||||
editions
|
||||
titles
|
||||
|
||||
audio
|
||||
audio-bitrate
|
||||
audio-codec
|
||||
audio-format
|
||||
channels
|
||||
samplerate
|
||||
|
||||
video
|
||||
angle
|
||||
video-bitrate
|
||||
video-codec
|
||||
video-format
|
||||
aspect
|
||||
fps
|
||||
width
|
||||
height
|
||||
dwidth
|
||||
dheight
|
||||
|
||||
sub
|
||||
"
|
||||
# TODO add metadata support once mpv can do it
|
||||
|
||||
__midentify__propstr="X-MIDENTIFY-START:$__midentify__LF"
|
||||
for __midentify__key in $__midentify__allprops; do
|
||||
__midentify__propstr=$__midentify__propstr"X-MIDENTIFY: $__midentify__key \${=$__midentify__key}$__midentify__LF"
|
||||
__midentify__key=`echo "$__midentify__key" | tr - _`
|
||||
eval unset $__midentify__nextprefix$__midentify__key
|
||||
done
|
||||
|
||||
__midentify__output=`$MPV --playing-msg="$__midentify__propstr" --vo=null --ao=null --frames=1 --quiet "$@"`
|
||||
__midentify__fileindex=0
|
||||
__midentify__prefix=
|
||||
while :; do
|
||||
case "$__midentify__output" in
|
||||
'')
|
||||
break
|
||||
;;
|
||||
*$__midentify__LF*)
|
||||
__midentify__line=${__midentify__output%%$__midentify__LF*}
|
||||
__midentify__output=${__midentify__output#*$__midentify__LF}
|
||||
;;
|
||||
*)
|
||||
__midentify__line=$__midentify__output
|
||||
__midentify__output=
|
||||
;;
|
||||
esac
|
||||
case "$__midentify__line" in
|
||||
X-MIDENTIFY-START:)
|
||||
if [ -n "$__midentify__nextprefix" ]; then
|
||||
__midentify__prefix=$__midentify__nextprefix
|
||||
if [ $__midentify__fileindex -gt 0 ]; then
|
||||
__midentify__nextprefix=${__midentify__prefix%$__midentify__fileindex\_}
|
||||
fi
|
||||
__midentify__fileindex=$(($__midentify__fileindex+1))
|
||||
__midentify__nextprefix=$__midentify__nextprefix$__midentify__fileindex\_
|
||||
for __midentify__key in $__midentify__allprops; do
|
||||
__midentify__key=`echo "$__midentify__key" | tr - _`
|
||||
eval unset $__midentify__nextprefix$__midentify__key
|
||||
done
|
||||
else
|
||||
if [ $__midentify__fileindex -gt 0 ]; then
|
||||
echo
|
||||
fi
|
||||
__midentify__fileindex=$(($__midentify__fileindex+1))
|
||||
fi
|
||||
;;
|
||||
X-MIDENTIFY:\ *)
|
||||
__midentify__key=${__midentify__line#X-MIDENTIFY:\ }
|
||||
__midentify__value=${__midentify__key#* }
|
||||
__midentify__key=${__midentify__key%% *}
|
||||
__midentify__key=`echo "$__midentify__key" | tr - _`
|
||||
if [ -n "$__midentify__nextprefix" ]; then
|
||||
if [ -z "$__midentify__prefix" ]; then
|
||||
echo >&2 "Got X-MIDENTIFY: without X-MIDENTIFY-START:"
|
||||
elif [ -n "$__midentify__value" ]; then
|
||||
eval $__midentify__prefix$__midentify__key=\$__midentify__value
|
||||
fi
|
||||
else
|
||||
if [ -n "$__midentify__value" ]; then
|
||||
echo "$__midentify__key=$__midentify__value"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
unset __midentify__fileindex
|
||||
unset __midentify__allprops
|
||||
unset __midentify__key
|
||||
unset __midentify__LF
|
||||
unset __midentify__line
|
||||
unset __midentify__output
|
||||
unset __midentify__nextprefix
|
||||
unset __midentify__prefix
|
||||
unset __midentify__propstr
|
||||
unset __midentify__value
|
||||
@@ -1,998 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Original version (C) 2000 Pontscho/fresh!mindworkz pontscho@makacs.poliod.hu
|
||||
# Cleanups all over the place (c) 2001 pl
|
||||
# Rewritten for mpv in 2014.
|
||||
#
|
||||
#
|
||||
# Warning: this is not officially supported. Use on your own risk. Might require
|
||||
# modifications when used on systems other than Linux. Contributors
|
||||
# are not expected to update these files when making changes to the
|
||||
# normal/preferred waf build system.
|
||||
#
|
||||
#
|
||||
# This configure script is *not* autoconf-based and has different semantics.
|
||||
# It attempts to autodetect all settings and options where possible. It is
|
||||
# possible to override autodetection with the --enable-option/--disable-option
|
||||
# command line parameters. --enable-option forces the option on skipping
|
||||
# autodetection. Yes, this means that compilation may fail and yes, this is not
|
||||
# how autoconf-based configure scripts behave.
|
||||
#
|
||||
# configure generates a series of configuration files:
|
||||
# - config.h contains #defines that are used in the C code.
|
||||
# - config.mak is included from the Makefiles.
|
||||
#
|
||||
# If you want to add a new check for $feature, look at the existing checks
|
||||
# and try to use helper functions where you can.
|
||||
#############################################################################
|
||||
|
||||
# Prevent locale nonsense from breaking basic text processing utils
|
||||
export LC_ALL=C
|
||||
|
||||
# Store the configure line that was used
|
||||
configuration="$*"
|
||||
|
||||
# Prefer these macros to full length text !
|
||||
# These macros only return an error code - NO display is done
|
||||
command_check() {
|
||||
echo >> "$TMPLOG"
|
||||
echo "$@" >> "$TMPLOG"
|
||||
"$@" >> "$TMPLOG" 2>&1
|
||||
TMPRES="$?"
|
||||
echo >> "$TMPLOG"
|
||||
return "$TMPRES"
|
||||
}
|
||||
|
||||
compile_check() {
|
||||
source="$1"
|
||||
shift
|
||||
echo >> "$TMPLOG"
|
||||
cat "$source" >> "$TMPLOG"
|
||||
echo >> "$TMPLOG"
|
||||
echo "$_cc $OURCFLAGS $CFLAGS $source $extra_cflags $_ld_static $extra_ldflags $libs_mplayer -o $TMPEXE $@" >> "$TMPLOG"
|
||||
rm -f "$TMPEXE"
|
||||
$_cc $OURCFLAGS $CFLAGS "$source" $extra_cflags $_ld_static $extra_ldflags $libs_mplayer -o "$TMPEXE" $@ >> "$TMPLOG" 2>&1
|
||||
TMPRES="$?"
|
||||
echo >> "$TMPLOG"
|
||||
echo >> "$TMPLOG"
|
||||
return "$TMPRES"
|
||||
}
|
||||
|
||||
cflag_check() {
|
||||
echo "int main(void) { return 0; }" > $TMPC
|
||||
compile_check $TMPC $@
|
||||
}
|
||||
|
||||
statement_check() {
|
||||
echo "" > $TMPC
|
||||
for _header in $1 ; do echo "#include <$_header>" >> $TMPC ; done
|
||||
echo "int main(void) { $2; return 0; }" >> $TMPC
|
||||
shift 2
|
||||
compile_check $TMPC $@
|
||||
}
|
||||
|
||||
pkg_config_add() {
|
||||
echo >> "$TMPLOG"
|
||||
echo "$_pkg_config --cflags $@" >> "$TMPLOG"
|
||||
ctmp=$($_pkg_config --cflags "$@" 2>> "$TMPLOG") || return $?
|
||||
echo >> "$TMPLOG"
|
||||
echo "$_pkg_config --libs $@" >> "$TMPLOG"
|
||||
ltmp=$($_pkg_config --libs "$@" 2>> "$TMPLOG") || return $?
|
||||
echo >> "$TMPLOG"
|
||||
echo "cflags: $ctmp" >> "$TMPLOG"
|
||||
echo "libs: $ltmp" >> "$TMPLOG"
|
||||
echo >> "$TMPLOG"
|
||||
extra_cflags="$extra_cflags $ctmp"
|
||||
libs_mplayer="$libs_mplayer $ltmp"
|
||||
}
|
||||
|
||||
# Display error message, flushes tempfile, exit
|
||||
die () {
|
||||
echo
|
||||
echo "Error: $@" >&2
|
||||
echo >&2
|
||||
rm -f "$TMPEXE" "$TMPC"
|
||||
echo "Check \"$TMPLOG\" if you do not understand why it failed."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Use this before starting a check
|
||||
echocheck() {
|
||||
echo "============ Checking for $@ ============" >> "$TMPLOG"
|
||||
echo ${_echo_n} "Checking for $@ ... ${_echo_c}"
|
||||
}
|
||||
|
||||
# Use this to echo the results of a check
|
||||
echores() {
|
||||
test "$res_comment" && res_comment="($res_comment)"
|
||||
echo "Result is: $@ $res_comment" >> "$TMPLOG"
|
||||
echo "##########################################" >> "$TMPLOG"
|
||||
echo "" >> "$TMPLOG"
|
||||
echo "$@ $res_comment"
|
||||
res_comment=""
|
||||
}
|
||||
|
||||
# Check how echo works in this /bin/sh
|
||||
case $(echo -n) in
|
||||
-n) _echo_n= _echo_c='\c' ;; # SysV echo
|
||||
*) _echo_n='-n ' _echo_c= ;; # BSD echo
|
||||
esac
|
||||
|
||||
# setind $a b sets the variable named by the value of the variable a to b
|
||||
setind() { eval "$1=\"\$2\"" ; }
|
||||
|
||||
# Generate --enable-NAME/--disable-NAME options, set $1 to the option value.
|
||||
# Since shell has no data structures, do a weird statemachine thing.
|
||||
# Arguments: "_name"($1) "description"($2) "default"($3)
|
||||
# If "default"($3) is empty, use "auto"
|
||||
# Option name: a leading "_" in name is stripped, further "_" are changed to "-"
|
||||
opt_yes_no() {
|
||||
_name=$(echo "$1" | sed 's/^_//' | tr _ -)
|
||||
_defval="$3"
|
||||
test -z "$_defval" && _defval=auto
|
||||
|
||||
case "$_opt_state_mode" in
|
||||
init)
|
||||
setind "$1" "$_defval"
|
||||
;;
|
||||
help)
|
||||
if test "$_defval" = yes || test "$_defval" = auto ; then
|
||||
_defdesc=enable
|
||||
test "$_defval" = auto && _defdesc=auto
|
||||
printf " %-21s disable $2 [$_defdesc]\n" "--disable-$_name"
|
||||
unset _defdesc
|
||||
else
|
||||
printf " %-21s enable $2 [disable]\n" "--enable-$_name"
|
||||
fi
|
||||
;;
|
||||
parse)
|
||||
if test "$_opt_state_name" = "--enable-$_name" ; then
|
||||
setind "$1" yes
|
||||
_opt_state_known=yes
|
||||
elif test "$_opt_state_name" = "--disable-$_name" ; then
|
||||
setind "$1" no
|
||||
_opt_state_known=yes
|
||||
elif test "$_opt_state_name" = "--auto-$_name" ; then
|
||||
setind "$1" auto
|
||||
_opt_state_known=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
unset _name
|
||||
unset _defval
|
||||
}
|
||||
|
||||
options_state_machine() {
|
||||
_opt_state_mode=$1
|
||||
_opt_state_name=$2
|
||||
_opt_state_known=no
|
||||
|
||||
opt_yes_no _gl "OpenGL video output"
|
||||
opt_yes_no _libguess "libguess"
|
||||
opt_yes_no _termios "termios database for key codes"
|
||||
opt_yes_no _iconv "iconv for encoding conversion"
|
||||
opt_yes_no _vm "X video mode extensions"
|
||||
opt_yes_no _dvb "DVB input"
|
||||
opt_yes_no _tv "TV interface (TV/DVB grabbers)" yes
|
||||
opt_yes_no _tv_v4l2 "Video4Linux2 TV interface"
|
||||
opt_yes_no _libv4l2 "libv4l2"
|
||||
opt_yes_no _pvr "Video4Linux2 MPEG PVR"
|
||||
opt_yes_no _smb "Samba (SMB) input"
|
||||
opt_yes_no _lcms2 "LCMS2 support"
|
||||
opt_yes_no _bluray "Blu-ray support"
|
||||
opt_yes_no _dvdread "libdvdread"
|
||||
opt_yes_no _dvdnav "libdvdnav"
|
||||
opt_yes_no _enca "ENCA charset oracle library"
|
||||
opt_yes_no _uchardet "uchardet charset detection library"
|
||||
opt_yes_no _libass "subtitle rendering with libass"
|
||||
opt_yes_no _libavdevice "libavdevice demuxers"
|
||||
opt_yes_no _libavfilter "libavfilter"
|
||||
opt_yes_no _jpeg "support for writing JPEG screenshots"
|
||||
opt_yes_no _libcdio "libcdio support"
|
||||
opt_yes_no _librubberband "librubberband support"
|
||||
opt_yes_no _ffmpeg "skip FFmpeg/Libav autodetection"
|
||||
opt_yes_no _libavresample "libavresample (preferred over libswresample)"
|
||||
opt_yes_no _libswresample "libswresample"
|
||||
opt_yes_no _caca "CACA video output"
|
||||
opt_yes_no _sdl2 "SDL2 video and audio outputs" no
|
||||
opt_yes_no _xv "Xv video output"
|
||||
opt_yes_no _vdpau "VDPAU acceleration"
|
||||
opt_yes_no _vaapi "VAAPI acceleration"
|
||||
opt_yes_no _xrandr "Xrandr support (used for monitor FPS detection)"
|
||||
opt_yes_no _xinerama "Xinerama support"
|
||||
opt_yes_no _x11 "X11 video output"
|
||||
opt_yes_no _wayland "Wayland video output"
|
||||
opt_yes_no _xss "support for disabling screensaver via xss"
|
||||
opt_yes_no _alsa "ALSA audio output"
|
||||
opt_yes_no _ossaudio "OSS audio output"
|
||||
opt_yes_no _rsound "RSound audio output"
|
||||
opt_yes_no _sndio "sndio audio output"
|
||||
opt_yes_no _pulse "Pulseaudio audio output"
|
||||
opt_yes_no _jack "JACK audio output"
|
||||
opt_yes_no _openal "OpenAL audio output"
|
||||
opt_yes_no _shm "X11/Xv shared memory"
|
||||
opt_yes_no _lua "Lua scripting"
|
||||
opt_yes_no _vapoursynth "VapourSynth filter bridge (Python)"
|
||||
opt_yes_no _vapoursynth_lazy "VapourSynth filter bridge (Lua)"
|
||||
opt_yes_no _libarchive "libarchive"
|
||||
opt_yes_no _encoding "encoding functionality" yes
|
||||
opt_yes_no _build_man "building manpage"
|
||||
}
|
||||
|
||||
show_help(){
|
||||
cat << EOF
|
||||
Usage: $0 [OPTIONS]...
|
||||
|
||||
Configuration:
|
||||
-h, --help display this help and exit
|
||||
|
||||
Installation directories:
|
||||
--prefix=DIR prefix directory for installation [/usr/local]
|
||||
--bindir=DIR directory for installing binaries [PREFIX/bin]
|
||||
--datadir=DIR directory for installing machine independent
|
||||
data files (skins, etc) [PREFIX/share/mpv]
|
||||
--mandir=DIR directory for installing man pages [PREFIX/share/man]
|
||||
--confdir=DIR directory for installing configuration files
|
||||
[PREFIX/etc/mpv]
|
||||
|
||||
Compilation options:
|
||||
--cc=COMPILER C compiler to build mpv [gcc]
|
||||
--pkg-config=PKGCONFIG pkg-config to find some libraries [pkg-config]
|
||||
--enable-static build a statically linked binary
|
||||
--disable-debug compile-in debugging information [enable]
|
||||
--disable-optimization compile without -O2 [enable]
|
||||
|
||||
Use these options if autodetection fails:
|
||||
--extra-cflags=FLAGS extra CFLAGS
|
||||
--extra-ldflags=FLAGS extra LDFLAGS
|
||||
--extra-libs=FLAGS extra linker flags
|
||||
|
||||
Features:
|
||||
EOF
|
||||
options_state_machine help
|
||||
cat << EOF
|
||||
|
||||
This configure script is NOT autoconf-based, even though its output is similar.
|
||||
It will try to autodetect all configuration options. If you --enable an option
|
||||
it will be forcefully turned on, skipping autodetection. This can break
|
||||
compilation, so you need to know what you are doing.
|
||||
EOF
|
||||
exit 0
|
||||
} #show_help()
|
||||
|
||||
# GOTCHA: the variables below defines the default behavior for autodetection
|
||||
# and have - unless stated otherwise - at least 2 states : yes no
|
||||
# If autodetection is available then the third state is: auto
|
||||
_pkg_config=auto
|
||||
_cc=auto
|
||||
test -n "$CC" && _cc="$CC"
|
||||
_opt=-O2
|
||||
_prefix="/usr/local"
|
||||
options_state_machine init
|
||||
for ac_option do
|
||||
case "$ac_option" in
|
||||
--help|-help|-h)
|
||||
show_help
|
||||
;;
|
||||
--prefix=*)
|
||||
_prefix=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--bindir=*)
|
||||
_bindir=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--mandir=*)
|
||||
_mandir=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--confdir=*)
|
||||
_confdir=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--extra-cflags=*)
|
||||
extra_cflags="$extra_cflags $(echo $ac_option | cut -d '=' -f 2-)"
|
||||
;;
|
||||
--extra-ldflags=*)
|
||||
extra_ldflags="$extra_ldflags $(echo $ac_option | cut -d '=' -f 2-)"
|
||||
;;
|
||||
--extra-libs=*)
|
||||
libs_mplayer=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--cc=*)
|
||||
_cc=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--pkg-config=*)
|
||||
_pkg_config=$(echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--enable-static)
|
||||
_ld_static='-static'
|
||||
;;
|
||||
--disable-static)
|
||||
_ld_static=''
|
||||
;;
|
||||
--enable-optimization)
|
||||
_opt='-O2'
|
||||
;;
|
||||
--enable-optimization=*)
|
||||
_opt=$(echo $_echo_n '-O'$_echo_c; echo $ac_option | cut -d '=' -f 2)
|
||||
;;
|
||||
--disable-optimization)
|
||||
_opt=
|
||||
;;
|
||||
*)
|
||||
options_state_machine parse "$ac_option"
|
||||
if test "$_opt_state_known" != yes ; then
|
||||
echo "Unknown parameter: $ac_option" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$_bindir" && _bindir="$_prefix/bin"
|
||||
test -z "$_mandir" && _mandir="$_prefix/share/man"
|
||||
test -z "$_confdir" && _confdir="$_prefix/etc/mpv"
|
||||
|
||||
mplayer_tmpdir=$(mktemp -d -p ${TMPDIR:=/tmp} mpv-configure-XXXXXX)
|
||||
test -n "$mplayer_tmpdir" || die "Unable to create tmpdir."
|
||||
trap 'rm -rf "$mplayer_tmpdir"' EXIT
|
||||
|
||||
mkdir old_build 2> /dev/null
|
||||
|
||||
TMPLOG="old_build/config.log"
|
||||
|
||||
rm -f "$TMPLOG"
|
||||
echo Parameters configure was run with: > "$TMPLOG"
|
||||
echo CFLAGS="'$CFLAGS'" PKG_CONFIG_PATH="'$PKG_CONFIG_PATH'" ./configure $configuration >> "$TMPLOG"
|
||||
echo >> "$TMPLOG"
|
||||
|
||||
TMPC="$mplayer_tmpdir/tmp.c"
|
||||
TMPEXE="$mplayer_tmpdir/tmp"
|
||||
CONFIG_MAK="$mplayer_tmpdir/config.mak"
|
||||
CONFIG_H="$mplayer_tmpdir/config.h"
|
||||
|
||||
echo > $CONFIG_MAK
|
||||
echo > $CONFIG_H
|
||||
|
||||
test "$_pkg_config" = auto && _pkg_config=pkg-config
|
||||
test "$_cc" = auto && _cc=cc
|
||||
|
||||
extra_cflags="-I. -D_GNU_SOURCE $extra_cflags"
|
||||
|
||||
_rst2man=rst2man
|
||||
test -f "$(which rst2man.py)" && _rst2man=rst2man.py
|
||||
|
||||
echocheck "whether to build manpages with rst2man"
|
||||
if test "$_build_man" = auto ; then
|
||||
_build_man=no
|
||||
command_check "$_rst2man" --version && _build_man=yes
|
||||
fi
|
||||
echores "$_build_man"
|
||||
|
||||
echocheck "working compiler"
|
||||
cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ."
|
||||
echores "yes"
|
||||
|
||||
echocheck "perl"
|
||||
command_check perl -Mv5.8 -e';' || die "Perl is not functioning correctly or is ancient. Install the latest perl available."
|
||||
echores yes
|
||||
|
||||
echocheck "compiler support of -pipe option"
|
||||
cflag_check -pipe -I. && _pipe="-pipe" && echores "yes" || echores "no"
|
||||
|
||||
addcflags() { cflag_check "$@" && OURCFLAGS="$OURCFLAGS $@" ; }
|
||||
|
||||
OURCFLAGS="-std=c99 -Wall $_opt"
|
||||
|
||||
addcflags -g -g3 -ggdb
|
||||
addcflags -Wundef -Wmissing-prototypes -Wshadow -Wno-switch -Wparentheses -Wpointer-arith -Wno-redundant-decls -Wno-pointer-sign -Werror=implicit-function-declaration -Wno-error=deprecated-declarations -Wno-error=unused-function
|
||||
# clang
|
||||
addcflags -Wno-logical-op-parentheses -fcolor-diagnostics -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare
|
||||
# extra
|
||||
addcflags -Wno-format-zero-length -Wempty-body -Wdisabled-optimization -Wstrict-prototypes
|
||||
|
||||
cflag_check -MD -MP && DEPFLAGS="-MD -MP"
|
||||
cflag_check -lm && _ld_lm="-lm"
|
||||
|
||||
extra_ldflags="$extra_ldflags $LDFLAGS"
|
||||
extra_cflags="$extra_cflags $CPPFLAGS"
|
||||
|
||||
# If $1 is "yes", define $2 as 1 in config.h, else define it as 0
|
||||
define_yes_no() {
|
||||
if test "$1" = yes ; then
|
||||
echo "#define $2 1" >> $CONFIG_H
|
||||
else
|
||||
echo "#define $2 0" >> $CONFIG_H
|
||||
fi
|
||||
}
|
||||
|
||||
# Write the results of a check to config.mak/.h.
|
||||
# Arguments: "yes/no"($1) "name"($2)
|
||||
check_yes_no() {
|
||||
define_yes_no $1 "HAVE_$2"
|
||||
echo "$2 = $1" >> $CONFIG_MAK
|
||||
}
|
||||
|
||||
check_trivial() {
|
||||
echocheck "$1"
|
||||
check_yes_no $2 $3
|
||||
echores "$2"
|
||||
}
|
||||
|
||||
# Arguments: "message"($1) "setting"($2) "name"($3) "code"($4)
|
||||
# Also, $5 - $N can be libraries needed - it'll try each separately.
|
||||
# Use " " as first entry if you want to try with no libraries too.
|
||||
check_compile() {
|
||||
_res="$2"
|
||||
_name="$3"
|
||||
_code="$4"
|
||||
echocheck "$1"
|
||||
if test $_res = auto ; then
|
||||
_res=no
|
||||
if test $# -gt 4 ; then
|
||||
shift 4
|
||||
else
|
||||
shift $#
|
||||
fi
|
||||
while true ; do
|
||||
compile_check "$_code" "$1" && libs_mplayer="$libs_mplayer $1" && _res=yes && break
|
||||
test -z "$1" && break
|
||||
shift
|
||||
done
|
||||
fi
|
||||
check_yes_no $_res $_name
|
||||
echores $_res
|
||||
test $_res = yes && return 0 || return 1
|
||||
}
|
||||
|
||||
# Arguments: "message"($1) "setting"($2) "name"($3) "include"($4) "statement"($5)
|
||||
# Also, $6 - $N can be libraries needed - it'll try each separately.
|
||||
# Use " " as first entry if you want to try with no libraries too.
|
||||
check_statement_libs() {
|
||||
_res="$2"
|
||||
_name="$3"
|
||||
_inc="$4"
|
||||
_st="$5"
|
||||
echocheck "$1"
|
||||
if test $_res = auto ; then
|
||||
_res=no
|
||||
if test $# -gt 5 ; then
|
||||
shift 5
|
||||
else
|
||||
shift $#
|
||||
fi
|
||||
while true ; do
|
||||
statement_check "$_inc" "$_st" "$1" && libs_mplayer="$libs_mplayer $1" && _res=yes && break
|
||||
test -z "$1" && break
|
||||
shift
|
||||
done
|
||||
fi
|
||||
check_yes_no $_res $_name
|
||||
echores $_res
|
||||
test $_res = yes && return 0 || return 1
|
||||
}
|
||||
|
||||
# Print "yes" if previous command succeeded, else "no"
|
||||
defretval() { # shell is retarded?
|
||||
if test $? = 0 ; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
}
|
||||
|
||||
echocheck "dynamic loader"
|
||||
_dl=no
|
||||
for _ld_tmp in "" "-ldl"; do
|
||||
statement_check dlfcn.h 'dlopen("", 0)' $_ld_tmp && _ld_dl="$_ld_tmp" && _dl=yes && break
|
||||
done
|
||||
define_yes_no $_dl HAVE_LIBDL
|
||||
echores "$_dl"
|
||||
|
||||
echocheck "pthread"
|
||||
cflag_check -pthread && _ld_pthread="$_ld_pthread -pthread"
|
||||
cflag_check -lpthread && _ld_pthread="$_ld_pthread -lpthread"
|
||||
cflag_check -lrt && _ld_pthread="$_ld_pthread -lrt"
|
||||
extra_cflags="$extra_cflags -D_REENTRANT -D_THREAD_SAFE"
|
||||
compile_check waftools/fragments/pthreads.c "$_ld_pthread" || die "Unable to find pthreads support."
|
||||
echores "yes"
|
||||
|
||||
check_statement_libs "support for stdatomic.h" auto STDATOMIC \
|
||||
stdatomic.h 'atomic_int_least64_t test = ATOMIC_VAR_INIT(123); int test2 = atomic_load(&test)' \
|
||||
" " "-latomic"
|
||||
_stdatomic=$(defretval)
|
||||
|
||||
_atomic=auto
|
||||
test "$_stdatomic" = yes && _atomic=no
|
||||
check_statement_libs "compiler support for __atomic built-ins" $_atomic ATOMIC_BUILTINS \
|
||||
stdint.h 'int64_t test = 0; test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)' \
|
||||
" " "-latomic"
|
||||
_atomic=$(defretval)
|
||||
|
||||
_sync=auto
|
||||
(test "$_atomic" = yes || test "$_stdatomic" = yes ) && _sync=no
|
||||
check_statement_libs "compiler support for __sync built-ins" $_sync SYNC_BUILTINS \
|
||||
stdint.h 'int64_t test = 0; test = __sync_add_and_fetch(&test, 1)'
|
||||
_sync=$(defretval)
|
||||
|
||||
_any_atomic=yes
|
||||
if test "$_atomic" = no && test "$_sync" = no && test "$_stdatomic" = no ; then
|
||||
echo "your compiler must support either stdatomic.h, or __atomic, or __sync built-ins."
|
||||
_any_atomic=no
|
||||
fi
|
||||
define_yes_no $_any_atomic HAVE_ATOMICS
|
||||
|
||||
check_compile "iconv" $_iconv ICONV waftools/fragments/iconv.c " " "-liconv" "-liconv $_ld_dl"
|
||||
_iconv=$(defretval)
|
||||
if test "$_iconv" != yes ; then
|
||||
die "Unable to find iconv which should be part of standard compilation environment. Aborting. If you really mean to compile without iconv support use --disable-iconv."
|
||||
fi
|
||||
|
||||
_soundcard_header=sys/soundcard.h
|
||||
_check_snd=yes
|
||||
check_statement_libs "sys/soundcard.h" auto SYS_SOUNDCARD_H sys/soundcard.h
|
||||
test $(defretval) = yes && _soundcard_header=sys/soundcard.h && _check_snd=no
|
||||
check_statement_libs "soundcard.h" $_check_snd SOUNDCARD_H soundcard.h
|
||||
test $(defretval) = yes && _soundcard_header=soundcard.h
|
||||
|
||||
check_statement_libs "sys/videoio.h" auto SYS_VIDEOIO_H sys/videoio.h
|
||||
|
||||
_termios_ok=no
|
||||
check_statement_libs "termios.h" $_termios TERMIOS_H termios.h
|
||||
test $(defretval) = yes && _termios_ok=yes && _termios=no
|
||||
check_statement_libs "sys/termios.h" $_termios SYS_TERMIOS_H 'sys/termios.h'
|
||||
test $(defretval) = yes && _termios_ok=yes
|
||||
define_yes_no $_termios_ok HAVE_TERMIOS
|
||||
|
||||
check_statement_libs "shm" $_shm SHM "sys/types.h sys/ipc.h sys/shm.h" \
|
||||
"shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0);"
|
||||
|
||||
echocheck "pkg-config"
|
||||
if $($_pkg_config --version > /dev/null 2>&1); then
|
||||
if test "$_ld_static"; then
|
||||
_pkg_config="$_pkg_config --static"
|
||||
fi
|
||||
echores "yes"
|
||||
else
|
||||
_pkg_config=false
|
||||
echores "no"
|
||||
fi
|
||||
|
||||
# Arguments: "message"($1) "setting"($2) "name"($3) "pkg-config string"($4)
|
||||
# The name will be used as "#define HAVE_$name 1/0" in config.h, and as
|
||||
# "$name = yes/no" in config.mak
|
||||
# "setting"($2) is yes/no/auto and represents the --enable/--disable option
|
||||
check_pkg_config() {
|
||||
echocheck "$1"
|
||||
_res=$2
|
||||
if test "$2" = auto ; then
|
||||
_res=no
|
||||
if pkg_config_add "$4" ; then
|
||||
_res=yes
|
||||
fi
|
||||
fi
|
||||
check_yes_no $_res $3
|
||||
echores "$_res"
|
||||
test $_res = yes && return 0 || return 1
|
||||
}
|
||||
|
||||
check_pkg_config "libguess support" $_libguess LIBGUESS 'libguess >= 1.0'
|
||||
|
||||
check_pkg_config "Samba support (libsmbclient)" $_smb LIBSMBCLIENT 'smbclient >= 0.2.0'
|
||||
|
||||
_wlver="1.6.0"
|
||||
check_pkg_config "Wayland" $_wayland WAYLAND "wayland-client >= $_wlver wayland-cursor >= $_wlver xkbcommon >= 0.3.0"
|
||||
_wayland=$(defretval)
|
||||
|
||||
check_pkg_config "X11" $_x11 X11 "x11"
|
||||
_x11=$(defretval)
|
||||
|
||||
# Disable X11 dependencies
|
||||
_xext=auto
|
||||
if test "$_x11" = no ; then
|
||||
_xss=no
|
||||
_xext=no
|
||||
_xv=no
|
||||
_vdpau=no
|
||||
_vaapi=no
|
||||
_xinerama=no
|
||||
_vm=no
|
||||
fi
|
||||
|
||||
check_pkg_config "Xss screensaver extensions" $_xss XSS "xscrnsaver"
|
||||
|
||||
check_pkg_config "X extensions" $_xext XEXT "xext"
|
||||
|
||||
check_pkg_config "Xv" $_xv XV "xv"
|
||||
|
||||
check_pkg_config "VDPAU" $_vdpau VDPAU "vdpau >= 0.2"
|
||||
_vdpau=$(defretval)
|
||||
define_yes_no $_vdpau HAVE_VDPAU_HWACCEL
|
||||
|
||||
check_pkg_config "VAAPI" $_vaapi VAAPI 'libva >= 0.32.0 libva-x11 >= 0.32.0'
|
||||
_vaapi=$(defretval)
|
||||
define_yes_no $_vaapi HAVE_VAAPI_HWACCEL
|
||||
|
||||
if test "$_vaapi" = yes ; then
|
||||
check_pkg_config "VAAPI VPP" auto VAAPI_VPP 'libva >= 0.34.0'
|
||||
else
|
||||
check_yes_no no VAAPI_VPP
|
||||
fi
|
||||
|
||||
check_pkg_config "Xinerama" $_xinerama XINERAMA 'xinerama'
|
||||
|
||||
check_pkg_config "Xrandr" $_xrandr XRANDR 'xrandr >= 1.2.0'
|
||||
|
||||
check_pkg_config "CACA" $_caca CACA 'caca >= 0.99.beta18'
|
||||
|
||||
check_compile "DVB" $_dvb DVB waftools/fragments/dvb.c
|
||||
_dvbin=$(defretval)
|
||||
check_yes_no $_dvbin DVBIN
|
||||
|
||||
check_statement_libs "JPEG support" $_jpeg JPEG "stdio.h jpeglib.h" "" "-ljpeg $_ld_lm"
|
||||
|
||||
_gl_x11_egl=no
|
||||
(test "$_x11" = no && test "$_wayland" = no) && _gl=no
|
||||
echocheck "OpenGL"
|
||||
#Note: this test is run even with --enable-gl since we autodetect linker flags
|
||||
if test "$_gl" != no ; then
|
||||
cat > $TMPC << EOF
|
||||
#if defined(GL_WAYLAND) || defined(EGL_X11)
|
||||
#include <EGL/egl.h>
|
||||
#else
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
int main(int argc, char *argv[]) {
|
||||
#if defined(GL_WAYLAND)
|
||||
eglCreateContext(NULL, NULL, EGL_NO_CONTEXT, NULL);
|
||||
#else
|
||||
glXCreateContext(NULL, NULL, NULL, True);
|
||||
#endif
|
||||
glFinish();
|
||||
return !GL_INVALID_FRAMEBUFFER_OPERATION; // check correct glext.h
|
||||
}
|
||||
EOF
|
||||
_gl=no
|
||||
if test "$_x11" = yes ; then
|
||||
for _ld_tmp in "" -lGL "-lGL -lXdamage" "-lGL $_ld_pthread" ; do
|
||||
if compile_check $TMPC $_ld_tmp $_ld_lm ; then
|
||||
_gl=yes
|
||||
_gl_x11=yes
|
||||
libs_mplayer="$libs_mplayer $_ld_tmp $_ld_dl"
|
||||
test "$_gl_x11" = yes && res_comment="$res_comment x11"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test "$_wayland" = yes && compile_check $TMPC -DGL_WAYLAND -lGL -lEGL &&
|
||||
pkg_config_add "wayland-egl >= 9.0.0"; then
|
||||
_gl=yes
|
||||
_gl_wayland=yes
|
||||
libs_mplayer="$libs_mplayer -lGL -lEGL"
|
||||
test "$_gl_wayland" = yes && res_comment="$res_comment wayland"
|
||||
else
|
||||
_gl_wayland=no
|
||||
fi
|
||||
if test "$_x11" = yes && test "$_gl" = yes && pkg_config_add "egl"; then
|
||||
_gl_x11_egl=yes
|
||||
res_comment="$res_comment x11egl"
|
||||
fi
|
||||
else
|
||||
_gl=no
|
||||
fi
|
||||
|
||||
if test "$_gl" = no ; then
|
||||
_gl_x11=no
|
||||
_gl_wayland=no
|
||||
_gl_x11_egl=no
|
||||
fi
|
||||
check_yes_no $_gl GL
|
||||
check_yes_no $_gl_x11 GL_X11
|
||||
check_yes_no $_gl_x11_egl EGL_X11
|
||||
check_yes_no $_gl_wayland GL_WAYLAND
|
||||
echores "$_gl"
|
||||
|
||||
echocheck "VDPAU with OpenGL/X11"
|
||||
_vdpau_gl_x11=no
|
||||
(test "$_gl_x11" = yes && test "$_vdpau" = yes) && _vdpau_gl_x11=yes
|
||||
check_yes_no $_vdpau_gl_x11 VDPAU_GL_X11
|
||||
echores "$_vdpau_gl_x11"
|
||||
|
||||
_vaapi_glx=no
|
||||
(test "$_gl_x11" = yes && test "$_vaapi" = yes) && _vaapi_glx=auto
|
||||
check_pkg_config "VAAPI with OpenGL/X11" $_vaapi_glx VAAPI_GLX 'libva-glx >= 0.32.0'
|
||||
|
||||
check_pkg_config "SDL 2.0" $_sdl2 SDL2 'sdl2'
|
||||
|
||||
check_statement_libs "OSS Audio" $_ossaudio OSS_AUDIO $_soundcard_header "int x = SNDCTL_DSP_SETFRAGMENT;"
|
||||
|
||||
check_statement_libs "RSound" $_rsound RSOUND rsound.h 'rsd_init(NULL);' -lrsound
|
||||
|
||||
check_statement_libs "sndio" $_sndio SNDIO sndio.h 'struct sio_par par; sio_initpar(&par); const char *s = SIO_DEVANY' -lsndio
|
||||
|
||||
check_pkg_config "PulseAudio" $_pulse PULSE 'libpulse >= 1.0'
|
||||
|
||||
check_pkg_config "JACK" $_jack JACK 'jack'
|
||||
|
||||
check_pkg_config "OpenAL" $_openal OPENAL 'openal >= 1.13'
|
||||
|
||||
check_pkg_config "ALSA audio" $_alsa ALSA 'alsa >= 1.0.9'
|
||||
|
||||
check_pkg_config "Blu-ray support" $_bluray LIBBLURAY 'libbluray >= 0.3.0'
|
||||
|
||||
check_pkg_config "dvdread" $_dvdread DVDREAD 'dvdread >= 4.1.0'
|
||||
|
||||
check_pkg_config "dvdnav" $_dvdnav DVDNAV 'dvdnav >= 4.2.0'
|
||||
|
||||
check_pkg_config "libcdio" $_libcdio CDDA 'libcdio_paranoia'
|
||||
|
||||
check_pkg_config "rubberband" $_librubberband RUBBERBAND 'rubberband'
|
||||
|
||||
_oldass=$_libass
|
||||
check_pkg_config "SSA/ASS support" $_libass LIBASS 'libass'
|
||||
_libass=$(defretval)
|
||||
if test $_oldass != no && test $_libass = no ; then
|
||||
die "Unable to find development files for libass. Aborting. If you really mean to compile without libass support use --disable-libass."
|
||||
fi
|
||||
|
||||
_dummy_osd=yes
|
||||
test $_libass = yes && _dummy_osd=no
|
||||
echo "LIBASS_OSD = $_libass" >> $CONFIG_MAK
|
||||
echo "DUMMY_OSD = $_dummy_osd" >> $CONFIG_MAK
|
||||
|
||||
check_pkg_config "ENCA" $_enca ENCA 'enca'
|
||||
check_pkg_config "uchardet" $_uchardet UCHARDET 'uchardet'
|
||||
|
||||
check_pkg_config "zlib" auto ZLIB 'zlib'
|
||||
test $(defretval) = no && die "Unable to find development files for zlib."
|
||||
|
||||
check_pkg_config "LCMS2 support" $_lcms2 LCMS2 'lcms2 >= 2.6'
|
||||
|
||||
check_pkg_config "FFmpeg/Libav" $_ffmpeg FFMPEG \
|
||||
"libavutil >= 54.02.0 libavcodec >= 56.1.0 libavformat >= 56.01.0 libswscale >= 2.1.3"
|
||||
test $(defretval) = no && die "Unable to find development files for some of the required Libav libraries above. Aborting."
|
||||
|
||||
check_pkg_config "Libswresample" $_libswresample LIBSWRESAMPLE 'libswresample >= 1.1.100'
|
||||
_libswresample=$(defretval)
|
||||
|
||||
_libavresample=auto
|
||||
test $_libswresample = yes && _libavresample=no
|
||||
check_pkg_config "Libavresample" $_libavresample LIBAVRESAMPLE 'libavresample >= 2.1.0'
|
||||
_libavresample=$(defretval)
|
||||
|
||||
if test "$_libswresample" = no && test "$_libavresample" = no ; then
|
||||
die "No resampler found. Install libavresample or libswresample (FFmpeg)."
|
||||
fi
|
||||
|
||||
# Arguments: "message"($1) "define"($2) "header"($3) "code"($4)
|
||||
api_statement_check() {
|
||||
echocheck "$1"
|
||||
_res=no
|
||||
statement_check "$3" "$4" && _res=yes
|
||||
define_yes_no $_res "$2"
|
||||
echores "$_res"
|
||||
}
|
||||
|
||||
api_statement_check \
|
||||
"libavcodec avcodec_enum_to_chroma_pos API" \
|
||||
HAVE_AVCODEC_CHROMA_POS_API \
|
||||
libavcodec/avcodec.h \
|
||||
'int x, y; avcodec_enum_to_chroma_pos(&x, &y, AVCHROMA_LOC_UNSPECIFIED)'
|
||||
|
||||
api_statement_check \
|
||||
"libavutil AVFrame metadata" \
|
||||
HAVE_AVFRAME_METADATA \
|
||||
libavutil/frame.h \
|
||||
'av_frame_get_metadata(NULL)'
|
||||
|
||||
api_statement_check \
|
||||
"libavutil AVFrame skip samples metadata" \
|
||||
HAVE_AVFRAME_SKIP_SAMPLES \
|
||||
libavutil/frame.h \
|
||||
'enum AVFrameSideDataType type = AV_FRAME_DATA_SKIP_SAMPLES'
|
||||
|
||||
api_statement_check \
|
||||
"libavutil av_version_info()" \
|
||||
HAVE_AV_VERSION_INFO \
|
||||
libavutil/avutil.h \
|
||||
'const char *x = av_version_info()'
|
||||
|
||||
api_statement_check \
|
||||
"libavutil new pixdesc fields" \
|
||||
HAVE_AV_NEW_PIXDESC \
|
||||
libavutil/pixdesc.h \
|
||||
'AVComponentDescriptor d; int x = d.depth'
|
||||
|
||||
check_pkg_config "libavfilter" $_libavfilter LIBAVFILTER 'libavfilter >= 5.0.0'
|
||||
|
||||
check_pkg_config "libavdevice" $_libavdevice LIBAVDEVICE 'libavdevice >= 55.0.0'
|
||||
|
||||
check_trivial "TV interface" $_tv TV
|
||||
|
||||
check_statement_libs "Video 4 Linux 2 TV interface" $_tv_v4l2 TV_V4L2 \
|
||||
"sys/time.h linux/videodev2.h"
|
||||
_tv_v4l2=$(defretval)
|
||||
check_trivial "TV audio input" $_tv_v4l2 AUDIO_INPUT
|
||||
|
||||
test $_tv_v4l2 = no && _libv4l2=no
|
||||
check_pkg_config "libv4l2 support" $_libv4l2 LIBV4L2 'libv4l2'
|
||||
|
||||
test "$_tv_v4l2" = no && _pvr=no
|
||||
check_compile "Video 4 Linux 2 MPEG PVR interface" $_pvr PVR waftools/fragments/pvr.c
|
||||
|
||||
# Note: Lua has no official .pc file, so there are different OS-specific ones.
|
||||
# Also, we support luajit, which is compatible to 5.1.
|
||||
|
||||
test_lua() {
|
||||
if test "$_lua" = auto && $_pkg_config "$1" ; then
|
||||
check_pkg_config "Lua ($1)" $_lua LUA "$1"
|
||||
_lua=$(defretval)
|
||||
fi
|
||||
}
|
||||
|
||||
test_lua "lua >= 5.1.0 lua < 5.2.0"
|
||||
test_lua "lua5.1 >= 5.1.0" # debian
|
||||
test_lua "lua51 >= 5.1.0" # OpenBSD
|
||||
test_lua "luajit >= 2.0.0"
|
||||
test_lua "lua5.2 >= 5.2.0" # debian
|
||||
test_lua "lua52 >= 5.2.0" # OpenBSD
|
||||
test_lua "lua >= 5.2.0"
|
||||
|
||||
test "$_lua" != yes && check_yes_no no LUA
|
||||
|
||||
if ! ( $_pkg_config 'vapoursynth >= 24' ) ; then
|
||||
_vapoursynth=no
|
||||
_vapoursynth_lazy=no
|
||||
fi
|
||||
check_pkg_config "VapourSynth support (Python)" $_vapoursynth VAPOURSYNTH 'vapoursynth >= 23 vapoursynth-script >= 23'
|
||||
_vapoursynth=$(defretval)
|
||||
if test "$_lua" = no ; then
|
||||
_vapoursynth_lazy=no
|
||||
fi
|
||||
check_pkg_config "VapourSynth support (Lua)" $_vapoursynth_lazy VAPOURSYNTH_LAZY 'vapoursynth >= 23'
|
||||
_vapoursynth_lazy=$(defretval)
|
||||
|
||||
_vapoursynth_core=yes
|
||||
if test "$_vapoursynth" = no && test "$_vapoursynth_lazy" = no ; then
|
||||
_vapoursynth_core=no
|
||||
fi
|
||||
check_trivial "VapourSynth core" $_vapoursynth_core VAPOURSYNTH_CORE
|
||||
|
||||
check_pkg_config "libarchive support" $_libarchive LIBARCHIVE 'libarchive >= 3.0.0'
|
||||
|
||||
check_trivial "encoding" $_encoding ENCODING
|
||||
|
||||
# needs dlopen on unix
|
||||
_dlopen="$_dl"
|
||||
check_yes_no $_dlopen DLOPEN
|
||||
|
||||
extra_ldflags="$extra_ldflags $_ld_pthread"
|
||||
libs_mplayer="$libs_mplayer $_ld_dl"
|
||||
|
||||
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
|
||||
|
||||
# This is done so waf builds won't conflict with this. In fact, waf and old
|
||||
# build system can coexist in parallel, at the same time. This is because
|
||||
# waf always does out-of-tree builds, while this build system does always
|
||||
# in-tree builds.
|
||||
|
||||
if test ! -f Makefile ; then
|
||||
ln -s TOOLS/old-makefile Makefile
|
||||
fi
|
||||
|
||||
cat > old_build/config.mak << EOF
|
||||
# -------- Generated by configure -----------
|
||||
export LC_ALL = C
|
||||
|
||||
CONFIGURATION = $configuration
|
||||
|
||||
prefix = \$(DESTDIR)$_prefix
|
||||
BINDIR = \$(DESTDIR)$_bindir
|
||||
MANDIR = \$(DESTDIR)$_mandir
|
||||
CONFDIR = \$(DESTDIR)$_confdir
|
||||
|
||||
CC = $_cc
|
||||
INSTALL = install
|
||||
|
||||
CFLAGS = -Iold_build $OURCFLAGS $CFLAGS $extra_cflags
|
||||
DEPFLAGS = $DEPFLAGS
|
||||
|
||||
EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $libs_mplayer $end_ldflags
|
||||
|
||||
RST2MAN = $_rst2man
|
||||
BUILD_MAN = $_build_man
|
||||
|
||||
# features
|
||||
EOF
|
||||
cat $CONFIG_MAK >> old_build/config.mak
|
||||
|
||||
cat > $TMPC << EOF
|
||||
/*----------------------------------------------------------------------------
|
||||
** This file has been automatically generated by configure any changes in it
|
||||
** will be lost when you run configure again.
|
||||
** Instead of modifying definitions here, use the --enable/--disable options
|
||||
** of the configure script! See ./configure --help for details.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MPV_CONFIG_H
|
||||
#define MPV_CONFIG_H
|
||||
|
||||
#define CONFIGURATION "$configuration"
|
||||
|
||||
#define MPV_CONFDIR "$_confdir"
|
||||
|
||||
/* we didn't bother to add actual config checks for this, or they are
|
||||
for platforms not supported by this configure script */
|
||||
#define HAVE_BSD_FSTATFS 0
|
||||
#define HAVE_LINUX_FSTATFS 1
|
||||
#define HAVE_VDA_AV_VDA_ALLOC_CONTEXT 0
|
||||
#define HAVE_VDA_HWACCEL 0
|
||||
#define HAVE_VDA_LIBAVCODEC_REFCOUNTING 0
|
||||
#define HAVE_VDA_GL 0
|
||||
#define HAVE_GL_COCOA 0
|
||||
#define HAVE_COCOA 0
|
||||
#define HAVE_COCOA_APPLICATION 0
|
||||
#define HAVE_COREVIDEO 0
|
||||
#define HAVE_COREAUDIO 0
|
||||
#define HAVE_GL_WIN32 0
|
||||
#define HAVE_DIRECT3D 0
|
||||
#define HAVE_DSOUND 0
|
||||
#define HAVE_WASAPI 0
|
||||
#define HAVE_DOS_PATHS 0
|
||||
#define HAVE_PRIORITY 0
|
||||
#define HAVE_GLOB 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_SDL1 0
|
||||
#define HAVE_WAIO 0
|
||||
#define HAVE_POSIX_SPAWN 1
|
||||
#define HAVE_GLIBC_THREAD_NAME (!!__GLIBC__)
|
||||
#define HAVE_OSX_THREAD_NAME 0
|
||||
#define HAVE_BSD_THREAD_NAME 0
|
||||
#define HAVE_NETBSD_THREAD_NAME 0
|
||||
#define HAVE_DXVA2_HWACCEL 0
|
||||
#define HAVE_FCHMOD 0
|
||||
#define HAVE_RPI 0
|
||||
#define HAVE_RPI_GLES 0
|
||||
#define HAVE_AV_PIX_FMT_MMAL 0
|
||||
#define HAVE_DRM 0
|
||||
#define HAVE_VIDEOTOOLBOX_HWACCEL 0
|
||||
#define HAVE_VIDEOTOOLBOX_GL 0
|
||||
#define HAVE_VIDEOTOOLBOX_VDA_GL 0
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#define DEFAULT_CDROM_DEVICE "/dev/rcd0c"
|
||||
#define DEFAULT_DVD_DEVICE "/dev/rcd0c"
|
||||
#else
|
||||
#define DEFAULT_CDROM_DEVICE "/dev/cdrom"
|
||||
#define DEFAULT_DVD_DEVICE "/dev/dvd"
|
||||
#endif
|
||||
#define PATH_DEV_DSP "/dev/dsp"
|
||||
#define PATH_DEV_MIXER "/dev/mixer"
|
||||
|
||||
EOF
|
||||
cat $CONFIG_H >> $TMPC
|
||||
echo '#endif /* MPV_CONFIG_H */' >> $TMPC
|
||||
|
||||
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
|
||||
cmp -s "$TMPC" old_build/config.h || mv -f "$TMPC" old_build/config.h
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Configuration successful. See $TMPLOG for details.
|
||||
|
||||
NOTE: The --enable-* parameters unconditionally force options on, completely
|
||||
skipping autodetection. This behavior is unlike what you may be used to from
|
||||
autoconf-based configure scripts that can decide to override you. This greater
|
||||
level of control comes at a price. You may have to provide the correct compiler
|
||||
and linker flags yourself.
|
||||
If you used one of these options and experience a compilation or
|
||||
linking failure, make sure you have passed the necessary compiler/linker flags
|
||||
to configure.
|
||||
|
||||
WARNING: The ./old-configure + make build system you are using is deprecated in
|
||||
favour of waf and will be removed in a future version of mpv. Check the
|
||||
README for instructions on how to build mpv with the new build system.
|
||||
This will not work correctly on MinGW, Cygwin, OSX, and other systems.
|
||||
|
||||
EOF
|
||||
@@ -1,483 +0,0 @@
|
||||
# MPlayer Makefile
|
||||
#
|
||||
# copyright (c) 2008 Diego Biurrun
|
||||
# Rewritten entirely from a set of Makefiles written by Arpi and many others.
|
||||
#
|
||||
# This file is part of MPlayer.
|
||||
#
|
||||
# MPlayer is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# MPlayer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
include old_build/config.mak
|
||||
|
||||
###### variable declarations #######
|
||||
|
||||
SOURCES_AUDIO_INPUT-$(ALSA) += stream/ai_alsa1x.c
|
||||
SOURCES_AUDIO_INPUT-$(OSS_AUDIO)+= stream/ai_oss.c
|
||||
SOURCES_AUDIO_INPUT-$(SNDIO) += stream/ai_sndio.c
|
||||
SOURCES-$(AUDIO_INPUT) += $(SOURCES_AUDIO_INPUT-yes)
|
||||
SOURCES-$(CDDA) += stream/stream_cdda.c
|
||||
SOURCES-$(DVBIN) += stream/dvb_tune.c \
|
||||
stream/stream_dvb.c
|
||||
SOURCES-$(DVDREAD) += stream/stream_dvd.c \
|
||||
stream/stream_dvd_common.c
|
||||
SOURCES-$(DVDNAV) += stream/stream_dvdnav.c \
|
||||
stream/stream_dvd_common.c
|
||||
|
||||
SOURCES-$(RUBBERBAND) += audio/filter/af_rubberband.c
|
||||
SOURCES-$(LIBASS) += sub/ass_mp.c sub/sd_ass.c \
|
||||
demux/demux_libass.c
|
||||
|
||||
SOURCES-$(LIBBLURAY) += stream/stream_bluray.c
|
||||
|
||||
SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c
|
||||
|
||||
SOURCES-$(PVR) += stream/stream_pvr.c
|
||||
|
||||
SOURCES-$(TV) += stream/stream_tv.c stream/tv.c \
|
||||
stream/frequencies.c stream/tvi_dummy.c \
|
||||
demux/demux_tv.c
|
||||
|
||||
SOURCES-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
|
||||
SOURCES-$(DUMMY_OSD) += sub/osd_dummy.c
|
||||
SOURCES-$(LIBASS_OSD) += sub/osd_libass.c
|
||||
|
||||
SOURCES-$(ALSA) += audio/out/ao_alsa.c
|
||||
SOURCES-$(CACA) += video/out/vo_caca.c
|
||||
SOURCES-$(SDL2) += audio/out/ao_sdl.c video/out/vo_sdl.c
|
||||
SOURCES-$(GL) += video/out/opengl/common.c \
|
||||
video/out/opengl/osd.c \
|
||||
video/out/opengl/lcms.c \
|
||||
video/out/opengl/video.c \
|
||||
video/out/opengl/video_shaders.c \
|
||||
video/out/dither.c \
|
||||
video/out/opengl/hwdec.c \
|
||||
video/out/opengl/utils.c \
|
||||
video/out/vo_opengl.c \
|
||||
video/out/vo_opengl_cb.c
|
||||
|
||||
SOURCES-$(ENCODING) += video/out/vo_lavc.c audio/out/ao_lavc.c \
|
||||
common/encode_lavc.c
|
||||
|
||||
SOURCES-$(GL_X11) += video/out/x11_common.c video/out/opengl/x11.c
|
||||
SOURCES-$(EGL_X11) += video/out/x11_common.c video/out/opengl/x11egl.c
|
||||
SOURCES-$(GL_WAYLAND) += video/out/wayland_common.c \
|
||||
video/out/opengl/wayland.c
|
||||
|
||||
SOURCES-$(JACK) += audio/out/ao_jack.c
|
||||
SOURCES-$(OPENAL) += audio/out/ao_openal.c
|
||||
SOURCES-$(OSS_AUDIO) += audio/out/ao_oss.c
|
||||
SOURCES-$(PULSE) += audio/out/ao_pulse.c
|
||||
SOURCES-$(RSOUND) += audio/out/ao_rsound.c
|
||||
SOURCES-$(SNDIO) += audio/out/ao_sndio.c
|
||||
SOURCES-$(VDPAU) += video/vdpau.c video/vdpau_mixer.c \
|
||||
video/out/vo_vdpau.c video/decode/vdpau.c \
|
||||
video/filter/vf_vdpaupp.c \
|
||||
video/filter/vf_vdpaurb.c
|
||||
SOURCES-$(VDPAU_GL_X11) += video/out/opengl/hwdec_vdpau.c
|
||||
SOURCES-$(VAAPI) += video/out/vo_vaapi.c \
|
||||
video/decode/vaapi.c \
|
||||
video/vaapi.c
|
||||
SOURCES-$(VAAPI_VPP) += video/filter/vf_vavpp.c
|
||||
SOURCES-$(VAAPI_GLX) += video/out/opengl/hwdec_vaglx.c
|
||||
|
||||
SOURCES-$(XV) += video/out/x11_common.c video/out/vo_xv.c
|
||||
SOURCES-$(WAYLAND) += video/out/vo_wayland.c \
|
||||
video/out/wayland_common.c \
|
||||
video/out/wayland/buffer.c \
|
||||
video/out/wayland/memfile.c
|
||||
|
||||
SOURCES-$(LIBAVFILTER) += video/filter/vf_lavfi.c \
|
||||
video/filter/vf_gradfun.c \
|
||||
video/filter/vf_pullup.c \
|
||||
video/filter/vf_rotate.c \
|
||||
video/filter/vf_yadif.c \
|
||||
audio/filter/af_lavfi.c
|
||||
|
||||
SOURCES-$(LUA) += player/lua.c
|
||||
SOURCES-$(VAPOURSYNTH_CORE) += video/filter/vf_vapoursynth.c
|
||||
SOURCES-$(LIBARCHIVE) += demux/demux_libarchive.c \
|
||||
stream/stream_libarchive.c
|
||||
SOURCES-$(DLOPEN) += video/filter/vf_dlopen.c
|
||||
|
||||
SOURCES = audio/audio.c \
|
||||
audio/audio_buffer.c \
|
||||
audio/chmap.c \
|
||||
audio/chmap_sel.c \
|
||||
audio/fmt-conversion.c \
|
||||
audio/format.c \
|
||||
audio/mixer.c \
|
||||
audio/decode/ad_lavc.c \
|
||||
audio/decode/ad_spdif.c \
|
||||
audio/decode/dec_audio.c \
|
||||
audio/filter/af.c \
|
||||
audio/filter/af_channels.c \
|
||||
audio/filter/af_delay.c \
|
||||
audio/filter/af_equalizer.c \
|
||||
audio/filter/af_format.c \
|
||||
audio/filter/af_lavcac3enc.c \
|
||||
audio/filter/af_lavrresample.c \
|
||||
audio/filter/af_pan.c \
|
||||
audio/filter/af_scaletempo.c \
|
||||
audio/filter/af_drc.c \
|
||||
audio/filter/af_volume.c \
|
||||
audio/filter/tools.c \
|
||||
audio/out/ao.c \
|
||||
audio/out/ao_null.c \
|
||||
audio/out/ao_pcm.c \
|
||||
audio/out/pull.c \
|
||||
audio/out/push.c \
|
||||
common/av_common.c \
|
||||
common/av_log.c \
|
||||
common/codecs.c \
|
||||
common/common.c \
|
||||
common/msg.c \
|
||||
common/playlist.c \
|
||||
common/tags.c \
|
||||
common/version.c \
|
||||
demux/codec_tags.c \
|
||||
demux/cue.c \
|
||||
demux/demux.c \
|
||||
demux/demux_edl.c \
|
||||
demux/demux_cue.c \
|
||||
demux/demux_disc.c \
|
||||
demux/demux_lavf.c \
|
||||
demux/demux_mf.c \
|
||||
demux/demux_mkv.c \
|
||||
demux/demux_mkv_timeline.c \
|
||||
demux/demux_playlist.c \
|
||||
demux/demux_rar.c \
|
||||
demux/demux_raw.c \
|
||||
demux/demux_subreader.c \
|
||||
demux/ebml.c \
|
||||
demux/packet.c \
|
||||
demux/timeline.c \
|
||||
input/cmd_list.c \
|
||||
input/cmd_parse.c \
|
||||
input/event.c \
|
||||
input/input.c \
|
||||
input/ipc.c \
|
||||
input/keycodes.c \
|
||||
misc/bstr.c \
|
||||
misc/charset_conv.c \
|
||||
misc/dispatch.c \
|
||||
misc/json.c \
|
||||
misc/rendezvous.c \
|
||||
misc/ring.c \
|
||||
options/m_config.c \
|
||||
options/m_option.c \
|
||||
options/m_property.c \
|
||||
options/options.c \
|
||||
options/parse_commandline.c \
|
||||
options/parse_configfile.c \
|
||||
options/path.c \
|
||||
osdep/io.c \
|
||||
osdep/path-unix.c \
|
||||
osdep/semaphore_osx.c \
|
||||
osdep/subprocess.c \
|
||||
osdep/subprocess-posix.c \
|
||||
osdep/terminal-unix.c \
|
||||
osdep/timer.c \
|
||||
osdep/timer-linux.c \
|
||||
osdep/threads.c \
|
||||
player/audio.c \
|
||||
player/client.c \
|
||||
player/configfiles.c \
|
||||
player/command.c \
|
||||
player/external_files.c \
|
||||
player/loadfile.c \
|
||||
player/main.c \
|
||||
player/misc.c \
|
||||
player/osd.c \
|
||||
player/playloop.c \
|
||||
player/screenshot.c \
|
||||
player/scripting.c \
|
||||
player/sub.c \
|
||||
player/video.c \
|
||||
stream/cache.c \
|
||||
stream/cache_file.c \
|
||||
stream/cookies.c \
|
||||
stream/rar.c \
|
||||
stream/stream.c \
|
||||
stream/stream_avdevice.c \
|
||||
stream/stream_edl.c \
|
||||
stream/stream_file.c \
|
||||
stream/stream_lavf.c \
|
||||
stream/stream_memory.c \
|
||||
stream/stream_mf.c \
|
||||
stream/stream_null.c \
|
||||
stream/stream_rar.c \
|
||||
sub/dec_sub.c \
|
||||
sub/draw_bmp.c \
|
||||
sub/img_convert.c \
|
||||
sub/osd.c \
|
||||
sub/sd_lavc.c \
|
||||
sub/sd_lavc_conv.c \
|
||||
sub/sd_lavf_srt.c \
|
||||
sub/sd_microdvd.c \
|
||||
sub/sd_movtext.c \
|
||||
sub/sd_srt.c \
|
||||
ta/ta.c \
|
||||
ta/ta_utils.c \
|
||||
ta/ta_talloc.c \
|
||||
video/csputils.c \
|
||||
video/fmt-conversion.c \
|
||||
video/image_writer.c \
|
||||
video/img_format.c \
|
||||
video/mp_image.c \
|
||||
video/mp_image_pool.c \
|
||||
video/sws_utils.c \
|
||||
video/decode/dec_video.c \
|
||||
video/decode/vd_lavc.c \
|
||||
video/filter/vf.c \
|
||||
video/filter/vf_buffer.c \
|
||||
video/filter/vf_crop.c \
|
||||
video/filter/vf_dsize.c \
|
||||
video/filter/vf_eq.c \
|
||||
video/filter/vf_expand.c \
|
||||
video/filter/vf_flip.c \
|
||||
video/filter/vf_format.c \
|
||||
video/filter/vf_mirror.c \
|
||||
video/filter/vf_noformat.c \
|
||||
video/filter/vf_scale.c \
|
||||
video/filter/vf_stereo3d.c \
|
||||
video/filter/vf_sub.c \
|
||||
video/out/bitmap_packer.c \
|
||||
video/out/aspect.c \
|
||||
video/out/filter_kernels.c \
|
||||
video/out/vo.c \
|
||||
video/out/vo_null.c \
|
||||
video/out/vo_image.c \
|
||||
video/out/win_state.c \
|
||||
$(SOURCES-yes)
|
||||
|
||||
OBJECTS += $(addsuffix .o, $(basename $(SOURCES)))
|
||||
OBJECTS += $(OBJECTS-yes)
|
||||
|
||||
DEP_FILES = $(patsubst %.S,%.d,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SOURCES:.m=.d) $(SOURCES:.m=.d))))
|
||||
|
||||
ALL_TARGETS += mpv
|
||||
|
||||
INSTALL_BIN += install-mpv
|
||||
INSTALL_BIN_STRIP += install-mpv-strip
|
||||
INSTALL_MAN =
|
||||
|
||||
ifeq ($(BUILD_MAN),yes)
|
||||
INSTALL_MAN += install-mpv-man
|
||||
ALL_TARGETS += DOCS/man/mpv.1
|
||||
endif
|
||||
|
||||
DIRS = . \
|
||||
audio \
|
||||
audio/decode \
|
||||
audio/filter \
|
||||
audio/out \
|
||||
common \
|
||||
compat \
|
||||
input \
|
||||
player/timeline \
|
||||
demux \
|
||||
misc \
|
||||
options \
|
||||
osdep \
|
||||
osdep/ar \
|
||||
player \
|
||||
stream \
|
||||
sub \
|
||||
ta \
|
||||
video \
|
||||
video/decode \
|
||||
video/filter \
|
||||
video/out
|
||||
|
||||
|
||||
ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2)))
|
||||
ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS))
|
||||
|
||||
###### brief build output #######
|
||||
|
||||
ifndef V
|
||||
$(eval override CC = @printf "CC\t$$@\n"; $(CC))
|
||||
$(eval override RM = @$(RM))
|
||||
endif
|
||||
|
||||
###### generic rules #######
|
||||
|
||||
all: $(ALL_TARGETS)
|
||||
|
||||
%.1: %.rst
|
||||
$(RST2MAN) $< $@
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
mpv: $(OBJECTS) osdep/main-fn-unix.o
|
||||
$(CC) -o $@ $^ $(EXTRALIBS)
|
||||
|
||||
input/input.c: input/input_conf.h
|
||||
input/input_conf.h: TOOLS/file2string.pl etc/input.conf
|
||||
./$^ >$@
|
||||
|
||||
MKVLIB_DEPS = TOOLS/lib/Parse/Matroska.pm \
|
||||
TOOLS/lib/Parse/Matroska/Definitions.pm \
|
||||
TOOLS/lib/Parse/Matroska/Element.pm \
|
||||
TOOLS/lib/Parse/Matroska/Reader.pm \
|
||||
TOOLS/lib/Parse/Matroska/Utils.pm \
|
||||
|
||||
demux/ebml.c demux/demux_mkv.c: demux/ebml_types.h
|
||||
demux/ebml_types.h: TOOLS/matroska.pl $(MKVLIB_DEPS)
|
||||
./$< --generate-header > $@
|
||||
|
||||
demux/ebml.c: demux/ebml_defs.c
|
||||
demux/ebml_defs.c: TOOLS/matroska.pl $(MKVLIB_DEPS)
|
||||
./$< --generate-definitions > $@
|
||||
|
||||
video/out/x11_common.c: video/out/x11_icon.inc
|
||||
video/out/x11_icon.inc: TOOLS/file2string.pl video/out/x11_icon.bin
|
||||
./$^ >$@
|
||||
|
||||
sub/osd_libass.c: sub/osd_font.h
|
||||
sub/osd_font.h: TOOLS/file2string.pl sub/osd_font.otf
|
||||
./$^ >$@
|
||||
|
||||
player/lua/%.inc: TOOLS/file2string.pl player/lua/%.lua
|
||||
./$^ >$@
|
||||
|
||||
player/lua.c: player/lua/defaults.inc \
|
||||
player/lua/assdraw.inc \
|
||||
player/lua/osc.inc \
|
||||
player/lua/ytdl_hook.inc \
|
||||
player/lua/options.inc
|
||||
|
||||
etc/_mpv: TOOLS/zsh.pl ./mpv
|
||||
./$< > $@
|
||||
|
||||
# ./configure must be rerun if it changed
|
||||
config.mak: configure
|
||||
@echo "############################################################"
|
||||
@echo "####### Please run ./configure again - it's changed! #######"
|
||||
@echo "############################################################"
|
||||
|
||||
old_build/version.h .version: version.sh
|
||||
./version.sh --versionh=old_build/version.h
|
||||
|
||||
# Force version.sh to run to potentially regenerate version.h
|
||||
-include .version
|
||||
|
||||
%: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
|
||||
###### dependency declarations / specific CFLAGS ######
|
||||
|
||||
common/version.c: old_build/version.h
|
||||
|
||||
DOCS/man/mpv.1: DOCS/man/af.rst \
|
||||
DOCS/man/ao.rst \
|
||||
DOCS/man/changes.rst \
|
||||
DOCS/man/encode.rst \
|
||||
DOCS/man/input.rst \
|
||||
DOCS/man/options.rst \
|
||||
DOCS/man/vf.rst \
|
||||
DOCS/man/vo.rst
|
||||
|
||||
###### installation / clean / generic rules #######
|
||||
|
||||
install: $(INSTALL_BIN) install-data $(INSTALL_MAN)
|
||||
install-no-man: $(INSTALL_BIN) install-data
|
||||
install-strip: $(INSTALL_BIN_STRIP) install-data $(INSTALL_MAN)
|
||||
install-strip-no-man: $(INSTALL_BIN_STRIP) install-data
|
||||
|
||||
install-dirs:
|
||||
if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi
|
||||
|
||||
install-%: % install-dirs
|
||||
$(INSTALL) -m 755 $< $(BINDIR)
|
||||
|
||||
install-%-strip: % install-dirs
|
||||
$(INSTALL) -m 755 -s $< $(BINDIR)
|
||||
|
||||
install-mpv-man: install-mpv-man-en
|
||||
|
||||
install-mpv-man-en: DOCS/man/mpv.1
|
||||
if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
|
||||
$(INSTALL) -m 644 DOCS/man/mpv.1 $(MANDIR)/man1/
|
||||
|
||||
ICONSIZES = 16x16 32x32 64x64
|
||||
|
||||
define ICON_INSTALL_RULE
|
||||
install-mpv-icon-$(size): etc/mpv-icon-8bit-$(size).png
|
||||
$(INSTALL) -d $(prefix)/share/icons/hicolor/$(size)/apps
|
||||
$(INSTALL) -m 644 etc/mpv-icon-8bit-$(size).png $(prefix)/share/icons/hicolor/$(size)/apps/mpv.png
|
||||
endef
|
||||
|
||||
$(foreach size,$(ICONSIZES),$(eval $(ICON_INSTALL_RULE)))
|
||||
|
||||
install-mpv-icons: $(foreach size,$(ICONSIZES),install-mpv-icon-$(size))
|
||||
|
||||
install-mpv-desktop: etc/mpv.desktop
|
||||
$(INSTALL) -d $(prefix)/share/applications
|
||||
$(INSTALL) -m 644 etc/mpv.desktop $(prefix)/share/applications/
|
||||
|
||||
install-mpv-config: etc/encoding-profiles.conf
|
||||
$(INSTALL) -d $(CONFDIR)
|
||||
$(INSTALL) -m 644 etc/encoding-profiles.conf $(CONFDIR)
|
||||
|
||||
install-mpv-zsh: etc/_mpv
|
||||
$(INSTALL) -d $(prefix)/share/zsh/vendor-completions
|
||||
$(INSTALL) -m 644 etc/_mpv $(prefix)/share/zsh/vendor-completions/
|
||||
|
||||
install-data: install-mpv-icons install-mpv-desktop install-mpv-config install-mpv-zsh
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BINDIR)/mpv
|
||||
$(RM) $(MANDIR)/man1/mpv.1 $(MANDIR)/man1/mpv.1
|
||||
$(RM) $(prefix)/share/applications/mpv.desktop
|
||||
$(RM) $(prefix)/share/zsh/vendor-completions/_mpv
|
||||
$(RM) $(foreach size,$(ICONSIZES),$(prefix)/share/icons/hicolor/$(size)/apps/mpv.png)
|
||||
|
||||
clean:
|
||||
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
|
||||
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
|
||||
-$(RM) mpv
|
||||
-$(RM) DOCS/man/*/mpv.1
|
||||
-$(RM) old_build/version.h version.h
|
||||
-$(RM) input/input_conf.h
|
||||
-$(RM) video/out/vdpau_template.c
|
||||
-$(RM) demux/ebml_types.h demux/ebml_defs.c
|
||||
-$(RM) video/out/x11_icon.inc
|
||||
-$(RM) sub/osd_font.h
|
||||
-$(RM) player/lua/defaults.inc
|
||||
-$(RM) player/lua/assdraw.inc
|
||||
-$(RM) player/lua/osc.inc
|
||||
-$(RM) player/lua/ytdl_hook.inc
|
||||
-$(RM) player/lua/options.inc
|
||||
|
||||
distclean: clean
|
||||
-$(RM) config.log old_build/config.h old_build/config.mak Makefile
|
||||
-rmdir old_build/
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
.PHONY: all *install* *clean .version
|
||||
|
||||
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
||||
# so this saves some time on slow systems.
|
||||
.SUFFIXES:
|
||||
|
||||
# If a command returns failure but changed its target file, delete the
|
||||
# (presumably malformed) file. Otherwise the file would be considered to
|
||||
# be up to date if make is restarted.
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
+74
-15
@@ -1,46 +1,105 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import fileinput
|
||||
from optparse import OptionParser
|
||||
from textwrap import dedent
|
||||
|
||||
def sh(command):
|
||||
return os.popen(command).read()
|
||||
|
||||
def bundle_path(binary_name):
|
||||
return "%s.app" % binary_name
|
||||
def dylib_lst(input_file):
|
||||
return sh("otool -L %s | grep -e '\t' | awk '{ print $1 }'" % input_file)
|
||||
|
||||
sys_re = re.compile("/System")
|
||||
exe_re = re.compile("@executable_path")
|
||||
binary_name = sys.argv[1]
|
||||
|
||||
def is_user_lib(libname, input_file):
|
||||
return not sys_re.match(libname) and \
|
||||
not exe_re.match(libname) and \
|
||||
not "libobjc" in libname and \
|
||||
not "libSystem" in libname and \
|
||||
not "libgcc" in libname and \
|
||||
not os.path.basename(input_file) in libname and \
|
||||
not libname == ''
|
||||
|
||||
def user_dylib_lst(input_file):
|
||||
return [lib for lib in dylib_lst(input_file).split("\n") if
|
||||
is_user_lib(lib, input_file)]
|
||||
|
||||
def bundle_name(binary_name):
|
||||
return os.path.basename(bundle_path(binary_name))
|
||||
return "%s.app" % binary_name
|
||||
|
||||
def target_plist(binary_name):
|
||||
return os.path.join(bundle_path(binary_name), 'Contents', 'Info.plist')
|
||||
return os.path.join(bundle_name(binary_name), 'Contents', 'Info.plist')
|
||||
|
||||
def target_directory(binary_name):
|
||||
return os.path.join(bundle_path(binary_name), 'Contents', 'MacOS')
|
||||
return os.path.join(bundle_name(binary_name), 'Contents', 'MacOS')
|
||||
|
||||
def target_binary(binary_name):
|
||||
return os.path.join(target_directory(binary_name),
|
||||
os.path.basename(binary_name))
|
||||
return os.path.join(target_directory(binary_name), binary_name)
|
||||
|
||||
def copy_bundle(binary_name):
|
||||
if os.path.isdir(bundle_path(binary_name)):
|
||||
shutil.rmtree(bundle_path(binary_name))
|
||||
if os.path.isdir(bundle_name(binary_name)):
|
||||
shutil.rmtree(bundle_name(binary_name))
|
||||
shutil.copytree(
|
||||
os.path.join('TOOLS', 'osxbundle', bundle_name(binary_name)),
|
||||
bundle_path(binary_name))
|
||||
bundle_name(binary_name))
|
||||
|
||||
def copy_binary(binary_name):
|
||||
shutil.copy(binary_name, target_binary(binary_name))
|
||||
|
||||
def run_install_name_tool(target_file, dylib_path, dest_dir, root=True):
|
||||
new_dylib_path = os.path.join("@executable_path", "lib",
|
||||
os.path.basename(dylib_path))
|
||||
|
||||
sh("install_name_tool -change %s %s %s" % \
|
||||
(dylib_path, new_dylib_path, target_file))
|
||||
if root:
|
||||
sh("install_name_tool -id %s %s" % \
|
||||
(new_dylib_path, os.path.join(dest_dir,
|
||||
os.path.basename(dylib_path))))
|
||||
|
||||
def cp_dylibs(target_file, dest_dir):
|
||||
for dylib_path in user_dylib_lst(target_file):
|
||||
dylib_dest_path = os.path.join(dest_dir, os.path.basename(dylib_path))
|
||||
|
||||
try:
|
||||
shutil.copy(dylib_path, dylib_dest_path)
|
||||
except IOError:
|
||||
if re.match("dylib$", target_file):
|
||||
reinstall_what = target_file
|
||||
else:
|
||||
reinstall_what = dylib_path
|
||||
|
||||
sys.exit(dedent("""\
|
||||
%s uses library %s which is not available anymore.
|
||||
This is most likely because you uninstalled %s.
|
||||
Please reinstall %s to fix it's dependencies.""" % \
|
||||
(target_file, dylib_path, dylib_path, reinstall_what) ))
|
||||
|
||||
os.chmod(dylib_dest_path, 0o755)
|
||||
cp_dylibs(dylib_dest_path, dest_dir)
|
||||
|
||||
def fix_dylibs_paths(target_file, dest_dir, root=True):
|
||||
for dylib_path in user_dylib_lst(target_file):
|
||||
dylib_dest_path = os.path.join(dest_dir, os.path.basename(dylib_path))
|
||||
run_install_name_tool(target_file, dylib_path, dest_dir, root)
|
||||
fix_dylibs_paths(dylib_dest_path, dest_dir, False)
|
||||
|
||||
def apply_plist_template(plist_file, version):
|
||||
for line in fileinput.input(plist_file, inplace=1):
|
||||
print (line.rstrip().replace('${VERSION}', version))
|
||||
sh("sed -i -e 's/{{VERSION}}/%s/g' %s" % (version, plist_file))
|
||||
|
||||
def bundle_dependencies(binary_name):
|
||||
lib_bundle_directory = os.path.join(target_directory(binary_name), "lib")
|
||||
cp_dylibs(binary_name, lib_bundle_directory)
|
||||
fix_dylibs_paths(target_binary(binary_name), lib_bundle_directory)
|
||||
|
||||
def main():
|
||||
version = sh("./version.sh").strip()
|
||||
version = sh("TOOLS/osxbundle/version.sh").strip()
|
||||
|
||||
usage = "usage: %prog [options] arg"
|
||||
parser = OptionParser(usage)
|
||||
@@ -65,7 +124,7 @@ def main():
|
||||
|
||||
if options.deps:
|
||||
print("> bundling dependencies")
|
||||
sh(" ".join(["TOOLS/dylib-unhell.py", target_binary(binary_name)]))
|
||||
bundle_dependencies(binary_name)
|
||||
|
||||
print("done.")
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
@@ -35,7 +35,7 @@
|
||||
<string>wma</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<string>audio.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Audio file</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@@ -86,9 +86,7 @@
|
||||
<string>VCD</string>
|
||||
<string>VFW</string>
|
||||
<string>VOB</string>
|
||||
<string>WEBM</string>
|
||||
<string>WMV</string>
|
||||
<string>MK3D</string>
|
||||
<string>asf</string>
|
||||
<string>avi</string>
|
||||
<string>cpk</string>
|
||||
@@ -121,12 +119,10 @@
|
||||
<string>vcd</string>
|
||||
<string>vfw</string>
|
||||
<string>vob</string>
|
||||
<string>webm</string>
|
||||
<string>wmv</string>
|
||||
<string>mk3d</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<string>movie.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Movie file</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@@ -161,7 +157,7 @@
|
||||
<string>utf</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<string>subtitles.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Subtitles file</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@@ -185,7 +181,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${VERSION}</string>
|
||||
<string>{{VERSION}}</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>CFBundleURLTypes</key>
|
||||
@@ -194,672 +190,59 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>mpv Custom Protocol</string>
|
||||
<string>Real Time (Streaming) Protocol</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>mpv</string>
|
||||
<string>rtp</string>
|
||||
<string>rtsp</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>Streaming Protocol</string>
|
||||
<string>File over HTTP/FTP/UDP</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>icyx</string>
|
||||
<string>udp</string>
|
||||
<string>ftp</string>
|
||||
<string>http_proxy</string>
|
||||
<string>http</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>Microsoft Media Services</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>mms</string>
|
||||
<string>mmst</string>
|
||||
<string>http</string>
|
||||
<string>https</string>
|
||||
<string>httpproxy</string>
|
||||
<string>rtp</string>
|
||||
<string>rtsp</string>
|
||||
<string>ftp</string>
|
||||
<string>udp</string>
|
||||
<string>smb</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>CD/DVD/Bluray Media</string>
|
||||
<string>Cuesheet</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>cdda</string>
|
||||
<string>cue</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>CD/DVD Media</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>dvdnav</string>
|
||||
<string>dvd</string>
|
||||
<string>vcd</string>
|
||||
<string>bd</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>AC3 Audio</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.ac3</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://wiki.multimedia.cx/index.php?title=AC3</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>ac3</string>
|
||||
<string>a52</string>
|
||||
<string>eac3</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>DTS Audio</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.dts</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://wiki.multimedia.cx/index.php?title=DTS</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>dts</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Free Lossless Audio Codec</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.flac</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://flac.sourceforge.net/format.html</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>flac</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Matroska Audio</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.mka</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.matroska.org</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>mka</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Ogg Audio</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.ogg-audio</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://xiph.org/ogg</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>ogg</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>PCM Audio</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.pcm</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/Pulse-code_modulation</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>pcm</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.audio</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Windows Media Audio</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.wma</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/Windows_Media_Audio</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>wma</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Audio Video Interleave</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.avi</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.the-labs.com/Video/odmlff2-avidef.pdf</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>avi</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>DIVX Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.divx</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.divx.com</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>divx</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>DV Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.dv</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/DV</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>dv</string>
|
||||
<string>hdv</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Flash Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.flv</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/Flash_Video</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>flv</string>
|
||||
<string>f4v</string>
|
||||
<string>f4p</string>
|
||||
<string>swf</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>MPEG-2 Transport Stream</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.mts</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/.m2ts</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>trp</string>
|
||||
<string>m2t</string>
|
||||
<string>m2ts</string>
|
||||
<string>mts</string>
|
||||
<string>mtv</string>
|
||||
<string>ts</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Matroska Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.mkv</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.matroska.org</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>mkv</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Matroska stereoscopic/3D video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.mk3d</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.matroska.org</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>mk3d</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>WebM Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.webm</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.webmproject.org</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>webm</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Ogg Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.ogv</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://xiph.org/ogg</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>ogm</string>
|
||||
<string>ogv</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Real Media</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.rmvb</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.real.com</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>rmvb</string>
|
||||
<string>rm</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Video Object</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.vob</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/VOB</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>vob</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Windows Media Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.wmv</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/Windows_Media_Video</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>wmv</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>XVID Video</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.xvid</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.xvid.org</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>xvid</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>AVC raw stream</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.h264</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://www.itu.int/rec/T-REC-H.264</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>264</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>HEVC raw stream</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.hevc</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://hevc.info</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>hevc</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YUV stream</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.yuv</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/YUV</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>yuv</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.movie</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YUV4MPEG2 stream</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.y4m</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://wiki.multimedia.cx/index.php?title=YUV4MPEG2</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>y4m</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.plain-text</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>SubRip Subtitle</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.subrip</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/SubRip</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>srt</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.plain-text</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>MicroDVD Subtitle</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.sub</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/MicroDVD</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>sub</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.plain-text</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>SubStation Alpha Subtitle</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.ass</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>https://github.com/libass/libass</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>ass</string>
|
||||
<string>ssa</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>VobSub Subtitle</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.vobsub</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/DirectVobSub</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>idx</string>
|
||||
<string>sub</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.plain-text</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>SAMI Subtitle</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>document.icns</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>io.mpv.smi</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>http://en.wikipedia.org/wiki/SAMI</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>smi</string>
|
||||
<string>smil</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<dir>/System/Library/Fonts</dir>
|
||||
<dir>/Library/Fonts</dir>
|
||||
<dir>~/Library/Fonts</dir>
|
||||
<dir>/Network/Library/Fonts</dir>
|
||||
<cachedir>~/.fontconfig</cachedir>
|
||||
|
||||
<!--
|
||||
Accept deprecated 'mono' alias, replacing it with 'monospace'
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="any" name="family">
|
||||
<string>mono</string>
|
||||
</test>
|
||||
<edit name="family" mode="assign" binding="same">
|
||||
<string>monospace</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!--
|
||||
Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="any" name="family">
|
||||
<string>sans serif</string>
|
||||
</test>
|
||||
<edit name="family" mode="assign" binding="same">
|
||||
<string>sans-serif</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!--
|
||||
Accept deprecated 'sans' alias, replacing it with 'sans-serif'
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="any" name="family">
|
||||
<string>sans</string>
|
||||
</test>
|
||||
<edit name="family" mode="assign" binding="same">
|
||||
<string>sans-serif</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<config>
|
||||
<!--
|
||||
These are the default Unicode chars that are expected to be blank
|
||||
in fonts. All other blank chars are assumed to be broken and
|
||||
won't appear in the resulting charsets
|
||||
-->
|
||||
<blank>
|
||||
<int>0x0020</int> <!-- SPACE -->
|
||||
<int>0x00A0</int> <!-- NO-BREAK SPACE -->
|
||||
<int>0x00AD</int> <!-- SOFT HYPHEN -->
|
||||
<int>0x034F</int> <!-- COMBINING GRAPHEME JOINER -->
|
||||
<int>0x0600</int> <!-- ARABIC NUMBER SIGN -->
|
||||
<int>0x0601</int> <!-- ARABIC SIGN SANAH -->
|
||||
<int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER -->
|
||||
<int>0x0603</int> <!-- ARABIC SIGN SAFHA -->
|
||||
<int>0x06DD</int> <!-- ARABIC END OF AYAH -->
|
||||
<int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK -->
|
||||
<int>0x115F</int> <!-- HANGUL CHOSEONG FILLER -->
|
||||
<int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
|
||||
<int>0x1680</int> <!-- OGHAM SPACE MARK -->
|
||||
<int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ -->
|
||||
<int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA -->
|
||||
<int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR -->
|
||||
<int>0x2000</int> <!-- EN QUAD -->
|
||||
<int>0x2001</int> <!-- EM QUAD -->
|
||||
<int>0x2002</int> <!-- EN SPACE -->
|
||||
<int>0x2003</int> <!-- EM SPACE -->
|
||||
<int>0x2004</int> <!-- THREE-PER-EM SPACE -->
|
||||
<int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
|
||||
<int>0x2006</int> <!-- SIX-PER-EM SPACE -->
|
||||
<int>0x2007</int> <!-- FIGURE SPACE -->
|
||||
<int>0x2008</int> <!-- PUNCTUATION SPACE -->
|
||||
<int>0x2009</int> <!-- THIN SPACE -->
|
||||
<int>0x200A</int> <!-- HAIR SPACE -->
|
||||
<int>0x200B</int> <!-- ZERO WIDTH SPACE -->
|
||||
<int>0x200C</int> <!-- ZERO WIDTH NON-JOINER -->
|
||||
<int>0x200D</int> <!-- ZERO WIDTH JOINER -->
|
||||
<int>0x200E</int> <!-- LEFT-TO-RIGHT MARK -->
|
||||
<int>0x200F</int> <!-- RIGHT-TO-LEFT MARK -->
|
||||
<int>0x2028</int> <!-- LINE SEPARATOR -->
|
||||
<int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
|
||||
<int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
|
||||
<int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
|
||||
<int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING -->
|
||||
<int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
|
||||
<int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
|
||||
<int>0x202F</int> <!-- NARROW NO-BREAK SPACE -->
|
||||
<int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE -->
|
||||
<int>0x2060</int> <!-- WORD JOINER -->
|
||||
<int>0x2061</int> <!-- FUNCTION APPLICATION -->
|
||||
<int>0x2062</int> <!-- INVISIBLE TIMES -->
|
||||
<int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
|
||||
<int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
|
||||
<int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
|
||||
<int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
|
||||
<int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
|
||||
<int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
|
||||
<int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
|
||||
<int>0x2800</int> <!-- BRAILLE PATTERN BLANK -->
|
||||
<int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
|
||||
<int>0x3164</int> <!-- HANGUL FILLER -->
|
||||
<int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
|
||||
<int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER -->
|
||||
<int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
|
||||
<int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
|
||||
<int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
|
||||
</blank>
|
||||
<!--
|
||||
Rescan configuration every 30 seconds when FcFontSetList is called
|
||||
-->
|
||||
<rescan>
|
||||
<int>30</int>
|
||||
</rescan>
|
||||
</config>
|
||||
</fontconfig>
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
profile=pseudo-gui
|
||||
Binary file not shown.
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Extract revision number from file used by daily tarball snapshots
|
||||
# or from "git describe" output
|
||||
git_revision=$(cat snapshot_version 2> /dev/null)
|
||||
test $git_revision || test ! -d .git || \
|
||||
git_revision=`git describe --match "v[0-9]*" --always`
|
||||
git_revision=$(expr "$git_revision" : v*'\(.*\)')
|
||||
test $git_revision || git_revision=UNKNOWN
|
||||
|
||||
# releases extract the version number from the VERSION file
|
||||
version=$(cat VERSION 2> /dev/null)
|
||||
test $version || version=$git_revision
|
||||
|
||||
echo $version
|
||||
@@ -1,147 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import matplotlib.pyplot as plot
|
||||
import sys
|
||||
import re
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
events = ".*"
|
||||
if len(sys.argv) > 2:
|
||||
events = sys.argv[2]
|
||||
event_regex = re.compile(events)
|
||||
|
||||
"""
|
||||
This script is meant to display stats written by mpv --dump-stats=filename.
|
||||
In general, each line in that file is an event of the form:
|
||||
|
||||
<timestamp in microseconds> <text> '#' <comment>
|
||||
|
||||
e.g.:
|
||||
|
||||
10474959 start flip #cplayer
|
||||
|
||||
<text> is what MP_STATS(log, "...") writes. The rest is added by msg.c.
|
||||
|
||||
Currently, the following event types are supported:
|
||||
|
||||
'signal' <name> singular event
|
||||
'start' <name> start of the named event
|
||||
'end' <name> end of the named event
|
||||
'value' <float> <name> a normal value (as opposed to event)
|
||||
'event-timed' <ts> <name> singular event at the given timestamp
|
||||
'value-timed' <ts> <float> <name> a value for an event at the given timestamp
|
||||
'range-timed' <ts1> <ts2> <name> like start/end, but explicit times
|
||||
<name> singular event (same as 'signal')
|
||||
|
||||
"""
|
||||
|
||||
class G:
|
||||
events = {}
|
||||
start = None
|
||||
# http://matplotlib.org/api/markers_api.html#module-matplotlib.markers
|
||||
markers = ["o", "8", "s", "p", "*", "h", "+", "x", "D"]
|
||||
|
||||
def find_marker():
|
||||
if len(G.markers) == 0:
|
||||
return "o"
|
||||
m = G.markers[0]
|
||||
G.markers = G.markers[1:]
|
||||
return m
|
||||
|
||||
class Event:
|
||||
pass
|
||||
|
||||
def get_event(event, evtype):
|
||||
if event not in G.events:
|
||||
e = Event()
|
||||
e.name = event
|
||||
e.vals = []
|
||||
e.type = evtype
|
||||
e.marker = "o"
|
||||
if e.type == "event-signal":
|
||||
e.marker = find_marker()
|
||||
if not event_regex.match(e.name):
|
||||
return e
|
||||
G.events[event] = e
|
||||
return G.events[event]
|
||||
|
||||
SCALE = 1e6 # microseconds to seconds
|
||||
|
||||
for line in [line.split("#")[0].strip() for line in open(filename, "r")]:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
ts, event = line.split(" ", 1)
|
||||
ts = int(ts) / SCALE
|
||||
if G.start is None:
|
||||
G.start = ts
|
||||
ts = ts - G.start
|
||||
if event.startswith("start "):
|
||||
e = get_event(event[6:], "event")
|
||||
e.vals.append((ts, 0))
|
||||
e.vals.append((ts, 1))
|
||||
elif event.startswith("end "):
|
||||
e = get_event(event[4:], "event")
|
||||
e.vals.append((ts, 1))
|
||||
e.vals.append((ts, 0))
|
||||
elif event.startswith("value "):
|
||||
_, val, name = event.split(" ", 2)
|
||||
val = float(val)
|
||||
e = get_event(name, "value")
|
||||
e.vals.append((ts, val))
|
||||
elif event.startswith("event-timed "):
|
||||
_, val, name = event.split(" ", 2)
|
||||
val = int(val) / SCALE - G.start
|
||||
e = get_event(name, "event-signal")
|
||||
e.vals.append((val, 1))
|
||||
elif event.startswith("range-timed "):
|
||||
_, ts1, ts2, name = event.split(" ", 3)
|
||||
ts1 = int(ts1) / SCALE - G.start
|
||||
ts2 = int(ts2) / SCALE - G.start
|
||||
e = get_event(name, "event")
|
||||
e.vals.append((ts1, 0))
|
||||
e.vals.append((ts1, 1))
|
||||
e.vals.append((ts2, 1))
|
||||
e.vals.append((ts2, 0))
|
||||
elif event.startswith("value-timed "):
|
||||
_, tsval, val, name = event.split(" ", 3)
|
||||
tsval = int(tsval) / SCALE - G.start
|
||||
val = float(val)
|
||||
e = get_event(name, "value")
|
||||
e.vals.append((tsval, val))
|
||||
elif event.startswith("signal "):
|
||||
name = event.split(" ", 2)[1]
|
||||
e = get_event(name, "event-signal")
|
||||
e.vals.append((ts, 1))
|
||||
else:
|
||||
e = get_event(event, "event-signal")
|
||||
e.vals.append((ts, 1))
|
||||
|
||||
# deterministically sort them; make sure the legend is sorted too
|
||||
G.sevents = list(G.events.values())
|
||||
G.sevents.sort(key=lambda x: x.name)
|
||||
hasval = False
|
||||
for e, index in zip(G.sevents, range(len(G.sevents))):
|
||||
m = len(G.sevents)
|
||||
if e.type == "value":
|
||||
hasval = True
|
||||
else:
|
||||
e.vals = [(x, y * (m - index) / m) for (x, y) in e.vals]
|
||||
|
||||
fig = plot.figure()
|
||||
fig.hold(True)
|
||||
ax = [None, None]
|
||||
plots = 2 if hasval else 1
|
||||
ax[0] = fig.add_subplot(plots, 1, 1)
|
||||
if hasval:
|
||||
ax[1] = fig.add_subplot(plots, 1, 2, sharex=ax[0])
|
||||
legends = [[], []]
|
||||
for e in G.sevents:
|
||||
cur = ax[1 if e.type == "value" else 0]
|
||||
pl, = cur.plot([x for x,y in e.vals], [y for x,y in e.vals], label=e.name)
|
||||
if e.type == "event-signal":
|
||||
plot.setp(pl, marker = e.marker, linestyle = "None")
|
||||
for cur in ax:
|
||||
if cur is not None:
|
||||
cur.legend()
|
||||
plot.show()
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo >&2 "Usage: $0 input.svg output.ico"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For smooth rendering on high-DPI displays, the standard three app icon sizes
|
||||
# (16x16, 32x32 and 48x48) have to be scaled to the four Windows DPI settings
|
||||
# as in the table below:
|
||||
|
||||
# Small Regular Tiles
|
||||
# 96 DPI (100%) 16x16 32x32 48x48
|
||||
# 120 DPI (125%) 20x20 40x40 60x60
|
||||
# 144 DPI (150%) 24x24 48x48 72x72
|
||||
# 196 DPI (200%) 32x32 64x64 96x96
|
||||
|
||||
# Also, there should also be an extra large 256x256 icon and some low colour
|
||||
# 8-bit and 4-bit variants, which are still used in Remote Desktop.
|
||||
|
||||
# Note: Windows Vista has a bug in its icon scaling that makes no sense.
|
||||
# Instead of following the DPI setting, small icons are always a bit larger
|
||||
# than they should be at 22x22, 26x26 and 36x36 for 120, 144 and 196 DPI. This
|
||||
# script doesn't generate icons with those sizes, since computers with Vista
|
||||
# and a high-DPI display are probably fairly rare these days.
|
||||
|
||||
temppng=".$(basename "$1" .svg)-temp.png"
|
||||
|
||||
inkscape --without-gui --export-png="$temppng" --export-dpi=72 \
|
||||
--export-background-opacity=0 --export-width=512 --export-height=512 \
|
||||
"$1" >/dev/null 2>&1
|
||||
|
||||
# Old versions of ImageMagick (like the one in Cygwin) use the wrong gamma when
|
||||
# exporting icon files. To fix, add -gamma 2.2 after the input file.
|
||||
|
||||
convert png:"$temppng" -filter lanczos2 \
|
||||
\( -clone 0 -resize 96x96 \) \
|
||||
\( -clone 0 -resize 72x72 \) \
|
||||
\( -clone 0 -resize 64x64 \) \
|
||||
\( -clone 0 -resize 60x60 \) \
|
||||
\( -clone 0 -resize 48x48 \) \
|
||||
\( -clone 0 -resize 40x40 \) \
|
||||
\( -clone 0 -resize 32x32 \) \
|
||||
\( -clone 0 -resize 24x24 \) \
|
||||
\( -clone 0 -resize 20x20 \) \
|
||||
\( -clone 0 -resize 16x16 \) \
|
||||
\( -clone 0 -resize 256x256 \) \
|
||||
\( -clone 0 -resize 32x32 \( -clone 0 -alpha opaque -colors 255 \) \
|
||||
\( -clone 0 -channel A -threshold 50% \) \
|
||||
-delete 0 -compose CopyOpacity -composite -colors 256 \) \
|
||||
\( -clone 0 -resize 16x16 \( -clone 0 -alpha opaque -colors 255 \) \
|
||||
\( -clone 0 -channel A -threshold 50% \) \
|
||||
-delete 0 -compose CopyOpacity -composite -colors 256 \) \
|
||||
\( -clone 0 -resize 32x32 \( -clone 0 -alpha opaque -colors 15 \) \
|
||||
\( -clone 0 -channel A -threshold 50% \) \
|
||||
-delete 0 -compose CopyOpacity -composite -colors 16 \) \
|
||||
\( -clone 0 -resize 16x16 \( -clone 0 -alpha opaque -colors 15 \) \
|
||||
\( -clone 0 -channel A -threshold 50% \) \
|
||||
-delete 0 -compose CopyOpacity -composite -colors 16 \) \
|
||||
-delete 0 \
|
||||
-define png:compression-level=9 -define png:include-chunk=none ico:"$2"
|
||||
|
||||
rm "$temppng"
|
||||
Loaded 100 of 736 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user