Commit Graph

876 Commits

Author SHA1 Message Date
wm4 b30e85508a Remove classic Linux analog TV support, and DVB runtime controls
Linux analog TV support (via tv://) was excessively complex, and
whenever I attempted to use it (cameras or loopback devices), it didn't
work well, or would have required some major work to update it. It's
very much stuck in the analog past (my favorite are the frequency tables
in frequencies.c for analog TV channels which don't exist anymore).

Especially cameras and such work fine with libavdevice and better than
tv://, for example:

  mpv av://v4l2:/dev/video0

(adding --profile=low-latency --untimed even makes it mostly realtime)

Adding a new input layer that targets such "modern" uses would be
acceptable, if anyone is interested in it. The old TV code is just too
focused on actual analog TV.

DVB is rather obscure, but has an active maintainer, so don't remove it.
However, the demux/stream ctrl layer must go, so remove controls for
channel switching. Most of these could be reimplemented by using the
normal method for option runtime changes.
2019-09-13 17:32:19 +02:00
wm4 a9d83eac40 Remove optical disc fancification layers
This removes anything related to DVD/BD/CD that negatively affected the
core code. It includes trying to rewrite timestamps (since DVDs and
Blurays do not set packet stream timestamps to playback time, and can
even have resets mid-stream), export of chapters, stream languages,
export of title/track lists, and all that.

Only basic seeking is supported. It is very much possible that seeking
completely fails on some discs (on some parts of the timeline), because
timestamp rewriting was removed.

Note that I don't give a shit about optical media. If you want to watch
them, rip them. Keeping some bare support for DVD/BD is the most I'm
going to do to appease the type of lazy, obnoxious users who will care.
There are other players which are better at optical discs.
2019-09-13 17:31:59 +02:00
wm4 6229404985 Remove libdvdread support in favor of libdvdnav
stream_dvd.c contained large amounts of ancient, unmaintained code,
which has been historically moved to libdvdnav. Basically, it's full of
low level parsing of DVD on-disc structures.

Kill it for good. Users can use the remaining dvdnav support (which
basically operates in non-menu mode). Users have reported that
libdvdread  sometimes works better, but this is just libdvdnav's problem
and not ours.
2019-09-13 15:29:27 +02:00
john e9fae413fd options/path: fix url detection per RFC3986 2019-04-05 20:48:24 +03:00
Anton Kindestam 8b83c89966 Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into wm4-commits--merge-edition
This bumps libmpv version to 1.103
2018-12-05 19:19:24 +01:00
wm4 559a400ac3 demux, stream: rip out the classic stream cache
The demuxer cache is the only cache now. Might need another change to
combat seeking failures in mp4 etc. The only bad thing is the loss of
cache-speed, which was sort of nice to have.
2018-08-31 12:55:22 +02:00
Tom Yan d48786f682 wscript: split egl-android from android 2018-08-20 17:16:22 +02:00
Stephen Hutchinson f66ee85fdf options.c: display additional metadata tags during video playback
The currently-displayed tags make sense for music files, but similar
information for video is more commonly - or at least should be - put
under other tags, while the audio-related tags are often used for
other information on video files (particularly with youtube-dl's
output).
2018-06-11 20:33:12 +03:00
wm4 45f8d767b9 m_config: remove outdated comment 2018-05-31 01:24:51 +03:00
wm4 b13bb9fbdd m_config: check for int16_t offset overflow
For some reason shadow_offset is a int16_t variable (to save some space
or something), which means the static part of the entire option list
must be below 32KB. This is fine, but still add a check against
overflows. (Currently it's 3.6KB. This does not include dynamic
allocations like strings.)
2018-05-31 01:24:51 +03:00
wm4 7d5133b713 m_config: remove an unused function 2018-05-31 01:24:51 +03:00
wm4 f022bf61a9 m_option: remove an unused field 2018-05-31 01:24:51 +03:00
wm4 b50d54ed40 m_config: cosmetics: fix 2 typos 2018-05-31 01:24:51 +03:00
wm4 8527102121 m_config: remove a redundant condition
Always true, because a few lines above it checks for the same thing.
2018-05-24 19:56:39 +02:00
wm4 0317d7350e m_config: fix build with emulated stdatomic
C11 can access atomic variables normally (in which case they use the
strictest memory access semantics). But the mpv stdatomic wrapper for
C99 compilers does not allow it, because it couldn't give any
guarantees. This means we always need to access them with atomic macros.

While we're at, use relaxed semantics for the m_config_cache field,
since because it's accessed from a single thread only (essentially
used in a non-atomic way). Switch the comparison arguments to make the
formatting look slightly less weird.
2018-05-24 19:56:35 +02:00
wm4 1a86bb59df m_config: make m_config_cache_update() return more fine grained
Although the new code actually fires update notifications only when
needed, m_config_cache_update() itself returned a rather coarse change
value, which could indicate change even if none of the cached options
were changed. On top of that, some code (like vo_gpu) calls the update
function on every frame, which would reconfigure the renderer even on
unrelated option changes.
2018-05-24 19:56:35 +02:00
wm4 f8ab59eacd player: get rid of mpv_global.opts
This was always a legacy thing. Remove it by applying an orgy of
mp_get_config_group() calls, and sometimes m_config_cache_alloc() or
mp_read_option_raw().

win32 changes untested.
2018-05-24 19:56:35 +02:00
wm4 a770006c6e vd_lavc: move hwdec opts to local config, don't use global MPOpts
The --hwdec* options are a good fit for the vd_lavc local option
struct. This annoyingly requires manual prefixing of most of these
options with --vd-lavc (could be avoided by using more sub-struct
craziness, but let's not).
2018-05-24 19:56:35 +02:00
wm4 3569857b75 path: don't access global option struct
The path functions need to access the option that forces non-default
config directories. Just add it as a field to mpv_global - it seems
justified. The accessed options were always enforced as immutable after
init, so there's not much of a change.
2018-05-24 19:56:35 +02:00
wm4 fe6b2f9103 m_config: add a special define to access main config
Passing NULL to mp_get_config_group() returns the main option struct.
This is just a dumb hack to deal with inconsistencies caused by legacy
things (as I'll claim), and will probably be changed in the future. So
before littering the whole code base with hard to find NULL parameters,
require using callers an easy to find separate define.
2018-05-24 19:56:35 +02:00
wm4 fb22bf2317 ao: use a local option struct
Instead of accessing MPOpts.
2018-05-24 19:56:35 +02:00
wm4 455af6aa68 m_config: optimize initialization of each option
Options with dynamic memory allocations (such as strings) require some
care. They need to be fully copied on initialization, and if a static
default value was declared, we must not free that value either.

Instead of going through the entire thing even for simple types like
integers, really run it only for options with dynamic allocations. To
distinguish types which use dynamic allocations, we can use the fact
that they require a free callback (otherwise they would leak). As a
result initialization of simple types becomes chaper, and the init
function does nothing at all if src==dst for a simple type.

(It's funny how mplayer had M_OPT_TYPE_DYNAMIC since 2002, until we
replaced it by the same heuristic as used here in commit 3bb134969e.
It's also funny how the new check was used only for some asserts, and
finally removed in commit 7539928c1c. I guess at this time I felt like
having uniform code was more important than pointless
micro-optimizations.)

The src==NULL case is removed because it can't happen.
2018-05-24 19:56:35 +02:00
wm4 816ad03519 m_config: remove extra default_data field
Just wastes memory (a few KB, because there are so many options).
2018-05-24 19:56:35 +02:00
wm4 3f061dd629 m_config: remove unused fields 2018-05-24 19:56:35 +02:00
wm4 1ebc72d05c m_config: reduce redundant option change notifications 2018-05-24 19:56:35 +02:00
wm4 4cb264a3ff m_config: remove an old temporary hack
Actually rewrite most of the option management code. This affects how
options are allocated, and how thread-safe access to them is done.

One thing that is nicer is that creating m_config_cache does not need to
ridiculously recreate and store the entire option list again. Instead,
option metadata and option storage are now separated. m_config contains
the metadata, and m_config_data all or parts of the actual option
values. (m_config_cache simply uses the metadata part of m_config, which
is immutable after creation.)

The mentioned hack was introduced in commit 1a2319f3e4, and is the
global state around g_group_mutex. Although it was "benign" global
state, it's good that it's finally removed.
2018-05-24 19:56:35 +02:00
wm4 af4fe28af7 m_config: remove outdated comment 2018-05-24 19:56:35 +02:00
wm4 246a828c26 m_config: check for int16_t offset overflow
For some reason shadow_offset is a int16_t variable (to save some space
or something), which means the static part of the entire option list
must be below 32KB. This is fine, but still add a check against
overflows. (Currently it's 3.6KB. This does not include dynamic
allocations like strings.)
2018-05-24 19:56:35 +02:00
wm4 4e9166f22d m_config: remove an unused function 2018-05-24 19:56:35 +02:00
wm4 a7c853fc64 m_option: remove an unused field 2018-05-24 19:56:35 +02:00
wm4 3ed173643e m_config: cosmetics: fix 2 typos 2018-05-24 19:56:35 +02:00
wm4 dbcd654e61 player: make playback termination asynchronous
Until now, stopping playback aborted the demuxer and I/O layer violently
by signaling mp_cancel (bound to libavformat's AVIOInterruptCB
mechanism). Change it to try closing them gracefully.

The main purpose is to silence those libavformat errors that happen when
you request termination. Most of libavformat barely cares about the
termination mechanism (AVIOInterruptCB), and essentially it's like the
network connection is abruptly severed, or file I/O suddenly returns I/O
errors. There were issues with dumb TLS warnings, parsers complaining
about incomplete data, and some special protocols that require server
communication to gracefully disconnect.

We still want to abort it forcefully if it refuses to terminate on its
own, so a timeout is required. Users can set the timeout to 0, which
should give them the old behavior.

This also removes the old mechanism that treats certain commands (like
"quit") specially, and tries to terminate the demuxers even if the core
is currently frozen. This is for situations where the core synchronized
to the demuxer or stream layer while network is unresponsive. This in
turn can only happen due to the "program" or "cache-size" properties in
the current code (see one of the previous commits). Also, the old
mechanism doesn't fit particularly well with the new one. We wouldn't
want to abort playback immediately on a "quit" command - the new code is
all about giving it a chance to end it gracefully. We'd need some sort
of watchdog thread or something equally complicated to handle this. So
just remove it.

The change in osd.c is to prevent that it clears the status line while
waiting for termination. The normal status line code doesn't output
anything useful at this point, and the code path taken clears it, both
of which is an annoying behavior change, so just let it show the old
one.
2018-05-24 19:56:35 +02:00
wm4 76dc5d9aa9 command: make loadlist command async and abortable
Don't allow it to freeze everything when loading a playlist from network
(although you definitely shouldn't do that, but whatever).

This also affects the really obscure --ordered-chapters-files option.
The --playlist option on the other hand has no choice but to freeze the
shit, because there's no concept of aborting the player during command
line parsing.
2018-05-24 19:56:35 +02:00
wm4 d9bc97bda6 command: add a subprocess command
This supports named arguments. It benefits from the infrastructure of
async commands.

The plan is to reimplement Lua's utils.subprocess() on top of it.
2018-05-24 19:56:34 +02:00
Philip Sequeira e5b2af0a80 m_option: fix duplicate flag value 2018-05-13 14:04:00 +02:00
wm4 e02c9b9902 build: make encoding mode non-optional
Makes it easier to not break the build by confusing the ifdeffery.
2018-05-03 01:08:44 +03:00
wm4 bfc33da250 encode: get rid of AVDictionary setter helper
Removes a good hunk of weird code.

This loses qscale "emulation", some logging, and the fact that duplicate
keys for values starting with +/- were added with AV_DICT_APPEND. I
don't assign those any importance, even if they are user-visible
changes.

The new M_OPT_ flag is just so that nothing weird happens for other
key-value options, which do not interpret a "help" key specially.
2018-04-29 02:21:32 +03:00
wm4 a5610b2a0d options: remove broken --video-stereo-mode option
See changelog for minor explanation. Basically, 3D is unused crap and
nobody cares.
2018-04-29 02:21:32 +03:00
Rostislav Pehlivanov e3e2c794ef vaapi: add option to select a non-default device path
On machines with multiple GPUs, /dev/dri/renderD128 isn't guaranteed
to point to a valid vaapi device. This just adds the option to specify
what path to use.

The old fallback /dev/dri/card0 is gone but that's not a loss as its
a legacy interface no longer accepted as valid by libva.

Fixes #4320
2018-03-30 14:16:07 -07:00
wm4 8ed76d2561 command: move property multiply code to m_property.c
I think this will help with reducing code duplication (see following
commit). The error messages loses the multiplication factor, but the
error message will be replaced by a generic one in the following commit
anyway.
2018-03-26 19:47:08 +02:00
wm4 e42a194062 vo: move display-fps internal option value to VO opts
Removes the awkward notification through VO_EVENT_WIN_STATE.
Unfortunately, some awkwardness remains in mp_property_display_fps(),
because the property has conflicting semantics with the option.
2018-03-15 23:13:53 -07:00
wm4 2c572e2bb1 video: add an option to tune waiting for video timing
Probably mostly useful for the libmpv render API.
2018-03-15 23:13:53 -07:00
wm4 775b86212d video: add option to reduce latency by 1 or 2 frames
The playback start logic explicitly waits until the first frame has been
displayed. Usually this will introduce a wait of 1 vsync. For normal
playback this doesn't matter, but with respect to low latency needs,
this only leads to additional data getting queued up in the demuxer or
network buffers.

Another thing is that the timing logic decodes 1 frame ahead (= 1 frame
extra latency) to determine the exact duration of a frame.

To be fair, there doesn't really seem to be a hard reason why this is
needed. With the current code, enabling the option does lead to A/V
desync sometimes (if the demuxer FPS is too inaccurate), and also frame
drops at playback start in some situations. But this all seems to be
avoidable, if the timing logic were to be rewritten completely, which
should probably happen in the future. Thus the new option comes with the
warning that it can be removed any time. This is also why the option has
"hack" in the name.
2018-03-03 02:38:01 +02:00
wm4 e76fda8594 m_option: remove unneded compatibility features
Aliases that set old options are not needed anymore. Also extend the
total size of the aliases array for one of the following commits.
2018-02-28 00:55:06 -08:00
Akemi 938ad6ebc0 cocoa-cb: change border and borderless window styling
the title bar is now within the window bounds instead of outside. same
as QuickTime Player. it supports several standard styles, two dark and
two light ones. additionally we have properly rounded corners now and
the borderless window also has the proper window shadow.

Also make the earliest supported macOS version 10.10.

Fixes #4789, #3944
2018-02-28 00:48:44 -08:00
wm4 223821d91c options: minor cleanup to --no-... handling
Most options starting with --no-<name> are automatically translated to
--<name>=no. Make the code slightly nicer by using a flag instead of
explicitly comparing option types. Also fix an issue that made the
option parser print nonsense error messages for if --no-... was used for
options which don't support it.
2018-02-13 17:45:29 -08:00
wm4 d7c38a0b23 options: prefix option with "--" in one case in help output 2018-02-13 17:45:29 -08:00
wm4 afb167cfd2
options: slightly improve filter help output for lavfi bridge
--vf=help will now list libavfilter filters, and e.g. --vf=yadif=help
will list libavfilter filter options.

The latter is rather bare, because the AVOption API is really awful
(holy shit how is it so bad), and would require us to handle _every_
option type manually.

Alternatively we could call av_opt_show2(), which ffmpeg uses for help
output in its CLI tools and which is much more detailed. But it's rather
foreign and forces output through av_log(), so I don't really want to
use it.
2018-02-03 05:00:52 -08:00
wm4 1742614505 options: pretty print default values with --list-options 2018-02-01 10:21:55 +01:00
wm4 76e7e78ce9 audio: move to decoder wrapper
Use the decoder wrapper that was introduced for video. This removes all
code duplication the old audio decoder wrapper had with the video code.

(The audio wrapper was copy pasted from the video one over a decade ago,
and has been kept in sync ever since by the power of copy&paste. Since
the original copy&paste was possibly done by someone who did not answer
to the LGPL relicensing, this should also remove all doubts about
whether any of this code is left, since we now completely remove any
code that could possibly have been based on it.)

There is some complication with spdif handling, and a minor behavior
change (it will restrict the list of codecs to spdif if spdif is to be
used), but there should not be any difference in practice.
2018-01-30 03:10:27 -08:00
wm4 b9f804b566 audio: rewrite filtering glue code
Use the new filtering code for audio too.
2018-01-30 03:10:27 -08:00
wm4 76276c9210 video: rewrite filtering glue code
Get rid of the old vf.c code. Replace it with a generic filtering
framework, which can potentially handle more than just --vf. At least
reimplementing --af with this code is planned.

This changes some --vf semantics (including runtime behavior and the
"vf" command). The most important ones are listed in interface-changes.

vf_convert.c is renamed to f_swscale.c. It is now an internal filter
that can not be inserted by the user manually.

f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed
once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is
conceptually easy, but a big mess due to the data flow changes).

The existing filters are all changed heavily. The data flow of the new
filter framework is different. Especially EOF handling changes - EOF is
now a "frame" rather than a state, and must be passed through exactly
once.

Another major thing is that all filters must support dynamic format
changes. The filter reconfig() function goes away. (This sounds complex,
but since all filters need to handle EOF draining anyway, they can use
the same code, and it removes the mess with reconfig() having to predict
the output format, which completely breaks with libavfilter anyway.)

In addition, there is no automatic format negotiation or conversion.
libavfilter's primitive and insufficient API simply doesn't allow us to
do this in a reasonable way. Instead, filters can use f_autoconvert as
sub-filter, and tell it which formats they support. This filter will in
turn add actual conversion filters, such as f_swscale, to perform
necessary format changes.

vf_vapoursynth.c uses the same basic principle of operation as before,
but with worryingly different details in data flow. Still appears to
work.

The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are
heavily changed. Fortunately, they all used refqueue.c, which is for
sharing the data flow logic (especially for managing future/past
surfaces and such). It turns out it can be used to factor out most of
the data flow. Some of these filters accepted software input. Instead of
having ad-hoc upload code in each filter, surface upload is now
delegated to f_autoconvert, which can use f_hwupload to perform this.

Exporting VO capabilities is still a big mess (mp_stream_info stuff).

The D3D11 code drops the redundant image formats, and all code uses the
hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a
big mess for now.

f_async_queue is unused.
2018-01-30 03:10:27 -08:00
Kevin Mitchell 3766024dcd command: add --osd-on-seek option defaulting to bar
Restores behaviour prior to aef2ed5dc1.

That change was apparently unpopular. However, given the amount of
complaining over how hard it is to change the defaults by rebinding every
key, I think the extra option introduced by this commit is justified.

Technically not all behaviour is restored, because now --no-osd-bar will
not instead display the msg text on seek. I think that feature was a
little weird and is now easy enough to remedy with the --osd-on-seek
option.
2018-01-26 21:50:38 -08:00
wm4 3deef308c8 options: add string list -toggle action 2018-01-25 20:18:32 -08:00
wm4 415fc6e327 m_option: remove string list -append action code duplication
Instead of duplicating the append code, reimplement it using the
existing code. The difference between -add and -append is that -append
does not take multiple items (thus removing the need for escaping), but
-append can reuse all code for -add by pretending the separator is never
found.
2018-01-25 20:18:32 -08:00
wm4 11f5713e3b options: add an option type for byte sizes
And use it for 2 demuxer options. It could be used for more options
later. (Though the --cache options can not use this, because they use KB
as base unit.)
2018-01-25 20:18:32 -08:00
wm4 cabfbc34b5 m_option: add missing print callbacks
Add the print callback to all option types (except pseudo option types
which don't represent values). This makes it less confusing for client
API users (no strange properties that can't be read), and also lists the
default properly with --list-options.

Fix the option type for audio formats - they use int, not uint32_t.

Fix some identation cosmetic issues.
2018-01-25 20:18:32 -08:00
Olivier Perret 70b2be3cf7 m_option: add print callback to color type
This lets scripts query the value of 'background' and similar properties
2018-01-22 23:17:26 -08:00
wm4 1d3b680427 options: simplify mp_get_config_group() memory management
There is some craziness here: the function allocates m_config_cache,
which in turn allocates the actual option struct, which is what the
function returns. The user would expect to be able to use talloc_free()
to deallocate everything. Of course this didn't work, because the
returned pointer is not the root parent in the talloc tree.

But with some additional talloc craziness, this can be fixed. We
rearrange the parent pointers such that freeing the option struct will
free m_config_cache first, which uninits the contents in the option
struct, but fortunately not the option struct itself.

This change should simplify API use on the caller side, and reduce
surprises.
2018-01-18 00:59:07 -08:00
wm4 cc3cdcb0f0 options: don't warn when reading deprecated option as raw value
mp_read_option_raw() should not print the deprecation warning if the
option is deprecated. This change also means you can't pass an alias
to the function, but all existing uses should be fine.
2018-01-18 00:59:07 -08:00
wm4 cbfc001918 options: deprecate --vf-defaults and --af-defaults 2018-01-13 03:26:45 -08:00
wm4 6d4b4c0de3 audio: add global options for resampler defaults
This is part of trying to get rid of --af-defaults, and the af
resample filter.

It requires a complicated mechanism to set the defaults on the resample
filter for backwards compatibility.
2018-01-13 03:26:45 -08:00
wm4 e894f75bb5 player: cosmetics: rename internal variable for consistency
This was so annoying.
2018-01-03 15:43:51 -08:00
wm4 f798bc3c25 player: add --cache-pause-initial option to start in buffering state
Reasons why you'd want this see manpage additions. Disabled by default,
because it would increase latency of live streams by default. (Or well,
at least it would be another problem when trying getting lower latency.)
2018-01-03 15:43:51 -08:00
wm4 9c22108fec player: use fixed timeout for cache pausing (buffering) duration
This tried to be clever by waiting for a longer time each time the
buffer was underrunning, or shorter if it was getting better. I think
this was pretty weird behavior and makes no sense. If the user really
wants the stream to buffer longer, he/she/it can just pause the player
(the network caches will continue to be filled until they're full).
Every time I actually noticed this code triggering in my own use, I
didn't find it helpful. Apart from that it was pretty hard to test.

Some waiting is needed to avoid that the player just plays the available
data as fast as possible (to compensate for late frames and underrunning
audio). Just use a fixed wait time, which can now be controlled by the
new --cache-pause-wait option.
2018-01-03 15:43:51 -08:00
Ricardo Constantino 877775f84e m_option: add print callback to start/end/length 2018-01-03 15:10:25 -08:00
sfan5 48943a73f6 vo_gpu/context_android: replace both options with android-surface-size
This allows us to automatically trigger a VOCTRL_RESIZE (also contained).
2018-01-02 15:04:31 -08:00
wm4 6aad532aa3 options: move most subtitle and OSD rendering options to sub structs
Remove them from the big MPOpts struct and move them to their sub
structs. In the places where their fields are used, create a private
copy of the structs, instead of accessing the semi-deprecated global
option struct instance (mpv_global.opts) directly.

This actually makes accessing these options finally thread-safe. They
weren't even if they should have for years. (Including some potential
for undefined behavior when e.g. the OSD font was changed at runtime.)

This is mostly transparent. All options get moved around, but most users
of the options just need to access a different struct (changing sd.opts
to a different type changes a lot of uses, for example).

One thing which has to be considered and could cause potential
regressions is that the new option copies must be explicitly updated.
sub_update_opts() takes care of this for example.

Another thing is that writing to the option structs manually won't work,
because the changes won't be propagated to other copies. Apparently the
only affected case is the implementation of the sub-step command, which
tries to change sub_delay. Handle this one explicitly (osd_changed()
doesn't need to be called anymore, because changing the option triggers
UPDATE_OSD, and updates the OSD as a consequence). The way the option
value is propagated is rather hacky, but for now this will do.
2018-01-02 14:27:37 -08:00
sfan5 451fc931b0 vo_gpu/context: Let embedding application handle surface resizes
The callbacks for this are Java-only and EGL does not reliably
return the correct values.
2017-12-27 14:29:15 -07:00
TheAMM c8d955571d encode: rename option --ometadata to --ocopy-metadata
--copy-metadata describes the result of the option better, (copying metadata
from the source file to the output file). Marks the old --no-ometadata
OPT_REMOVED with a suggestion for the new --no-ocopy-metadata.
2017-12-26 03:33:19 -07:00
wm4 e530783cdb options: add -add/-append actions to key/value lists
Requested.
2017-12-26 00:54:05 -07:00
wm4 69ae23fdd1 options: drop some previously deprecated options
A release has been made, so drop options deprecated for that release.
Also drop some options which have been deprecated a much longer time
before.

Also fix a typo in client-api-changes.rst.
2017-12-25 04:06:17 -07:00
wm4 2964788055
options: deprecate --ff- options and properties
Some old crap which nobody needs and which probably nobody uses.

This relies on a GCC extension: using "## __VA_ARGS__" to remove the
comma from the argument list if the va args are empty. It's supported
by clang, and there's some chance newer standards will introduce a
proper way to do this. (Even if it breaks somewhere, it will be a
problem only for 1 release, since I want to drop the deprecated
properties immediately.)
2017-12-21 19:51:30 +01:00
Niklas Haas ba1943ac00 msg: reinterpret a bunch of message levels
I've decided that MP_TRACE means “noisy spam per frame”, whereas
MP_DBG just means “more verbose debugging messages than MSGL_V”.
Basically, MSGL_DBG shouldn't create spam per frame like it currently
does, and MSGL_V should make sense to the end-user and provide mostly
additional informational output.

MP_DBG is basically what I want to make the new default for --log-file,
so the cut-off point for MP_DBG is if we probably want to know if for
debugging purposes but the user most likely doesn't care about on the
terminal.

Also, the debug callbacks for libass and ffmpeg got bumped in their
verbosity levels slightly, because being external components they're a
bit less relevant to mpv debugging, and a bit too over-eager in what
they consider to be relevant information.

I exclusively used the "try it on my machine and remove messages from
MSGL_* until it does what I want it to" approach of refactoring, so
YMMV.
2017-12-15 22:28:47 -08:00
pavelxdd e1ac0c1eb6 options: rename 'error' labels to 'exit' where appropriate 2017-12-16 02:20:44 +03:00
pavelxdd 7fc9ff54d3 options: don't report errors on help value for OPT_SIZE_BOX
The same idea as in 3723e61 but for OPT_SIZE_BOX now.

Affects options `autofit`, `autofit-larger` and `autofit-smaller`.
2017-12-16 01:29:05 +03:00
pavelxdd 6c8e7daebb options: don't report errors on help value for OPT_GEOMETRY
The same idea as in 3723e61 but for OPT_GEOMETRY now.
2017-12-11 21:56:20 +02:00
pavelxdd cdb6cb55e0 options: don't report errors on help value for OPT_COLOR
The same idea as in 3723e61 but for OPT_COLOR now.
Added missing closing bracket in the help message.
2017-12-11 21:56:20 +02:00
pavelxdd 3f127448e8 options: don't report errors on help value for OPT_FLAG
The same idea as in 3723e61 but for OPT_FLAG now.
2017-12-11 21:56:20 +02:00
pavelxdd 3723e611fc options: don't report errors on help value for OPT_CHOICE
'help' is a valid value for a lot of mpv options, such as `hwdec`
or `vo` for printing available values, so this change makes the
output of OPT_CHOICE options like `--video-sync=help` more
consistent by not reporting an error about invalid value 'help'.
2017-12-08 20:47:14 +02:00
Aman Gupta 0c6a488ef9 options: add --start=none to reset previously set start time
Previously when using a libmpv instance to play multiple videos,
once --start was set there was no clear way to unset it. You could
use --start=0, but 0 does not always mean the beginning of the file
(especially when using --rebase-start-time=no). Looking up the start
timestamp and passing that in also does not always work, particularly
when the first timestamp is negative (since negative values to --start
have a special meaning).

This commit adds a new "none" value which maps to the internal
REL_TIME_NONE, matching the default value of the play_start option.
2017-12-06 20:50:31 +02:00
wm4 eb8957cea1 vd_lavc: rewrite how --hwdec is handled
Change it from explicit metadata about every hwaccel method to trying to
get it from libavcodec. As shown by add_all_hwdec_methods(), this is a
quite bumpy road, and a bit worse than expected.

This will probably cause a bunch of regressions. In particular I didn't
check all the strange decoder wrappers, which all cause some sort of
special cases each. You're volunteering for beta testing by using this
commit.

One interesting thing is that we completely get rid of mp_hwdec_ctx in
vd_lavc.c, and that HWDEC_* mostly goes away (some filters still use it,
and the VO hwdec interops still have a lot of code to set it up, so it's
not going away completely for now).
2017-12-01 21:11:43 +01:00
wm4 43af055a70 options: rename empty string special case for option values
"--bla" behaved differently from "--bla=". Change this, in line with how
options have been changed in general over the last few years.
2017-12-01 21:01:40 +01:00
wm4 91586c3592 vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec
APIs at once. The main gain is that this simplifies autoprobing a lot.
Before this change, it could happen that the VO loaded the "wrong" hwdec
API, and the decoder was stuck with the choice (breaking hw decoding).
With the change applied, the VO simply loads all available APIs, so
autoprobing trickery is left entirely to the decoder.

In the past, we were quite careful about not accidentally loading the
wrong interop drivers. This was in part to make sure autoprobing works,
but also because libva had this obnoxious bug of dumping garbage to
stderr when using the API. libva was fixed, so this is not a problem
anymore.

The --opengl-hwdec-interop option is changed in various ways (again...),
and renamed to --gpu-hwdec-interop. It does not have much use anymore,
other than debugging. It's notable that the order in the hwdec interop
array ra_hwdec_drivers[] still matters if multiple drivers support the
same image formats, so the option can explicitly force one, if that
should ever be necessary, or more likely, for debugging. One example are
the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both
support d3d11 input.

vo_gpu now always loads the interop lazily by default, but when it does,
it loads them all. vo_opengl_cb now always loads them when the GL
context handle is initialized. I don't expect that this causes any
problems.

It's now possible to do things like changing between vdpau and nvdec
decoding at runtime.

This is also preparation for cleaning up vd_lavc.c hwdec autoprobing.
It's another reason why hwdec_devices_request_all() does not take a
hwdec type anymore.
2017-12-01 05:57:01 +01:00
wm4 3d27a0792b af: remove deprecated audio filters
These couldn't be relicensed, and won't survive the LGPL transition. The
other existing filters are mostly LGPL (except libaf glue code).

This remove the deprecated pan option. I guess it could be restored by
inserting a libavfilter filter (if there's one), but for now let it be
gone.

This temporarily breaks volume control (and things related to it, like
replaygain).
2017-11-29 21:30:51 +01:00
wm4 23d9dc5457 video: remove automatic stereo3d filter insertion
The internal stereo3d filter was removed due to being GPL only, and due
to being a mess that somehow used libavfilter's filter. Without this
filter, it's hard to remove our internal stereo3d image attribute, so
even using libavfilter's stereo3d filter would not work too well (unless
someone fixes it and makes it able to use AVFrame metadata, which we
then could mirror in mp_image).

This was never well thought-through anyway, so just drop it. I think
some "downsampling" support would still make sense, maybe that can be
readded later.
2017-11-29 21:30:51 +01:00
James Ross-Gowan e7bf5576e5 vo_gpu: hwdec_d3d11va: allow zero-copy video decoding
Like the manual says, this is technically undefined behaviour. See:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085.aspx

In particular, MSDN says texture arrays created with the BIND_DECODER
flag cannot be used with CreateShaderResourceView, which means they
can't be sampled through SRVs like normal Direct3D textures. However,
some programs (Google Chrome included) do this anyway for performance
and power-usage reasons, and it appears to work with most drivers.

Older AMD drivers had a "bug" with zero-copy decoding, but this appears
to have been fixed. See #3255, #3464 and http://crbug.com/623029.
2017-11-07 20:27:13 +11:00
James Ross-Gowan 68eac1a1e7 vo_gpu: d3d11: initial implementation
This is a new RA/vo_gpu backend that uses Direct3D 11. The GLSL
generated by vo_gpu is cross-compiled to HLSL with SPIRV-Cross.

What works:

- All of mpv's internal shaders should work, including compute shaders.

- Some external shaders have been tested and work, including RAVU and
  adaptive-sharpen.

- Non-dumb mode works, even on very old hardware. Most features work at
  feature level 9_3 and all features work at feature level 10_0. Some
  features also work at feature level 9_1 and 9_2, but without high-bit-
  depth FBOs, it's not very useful. (Hardware this old is probably not
  fast enough for advanced features anyway.)

  Note: This is more compatible than ANGLE, which requires 9_3 to work
  at all (GLES 2.0,) and 10_1 for non-dumb-mode (GLES 3.0.)

- Hardware decoding with D3D11VA, including decoding of 10-bit formats
  without truncation to 8-bit.

What doesn't work / can be improved:

- PBO upload and direct rendering does not work yet. Direct rendering
  requires persistent-mapped PBOs because the decoder needs to be able
  to read data from images that have already been decoded and uploaded.
  Unfortunately, it seems like persistent-mapped PBOs are fundamentally
  incompatible with D3D11, which requires all resources to use driver-
  managed memory and requires memory to be unmapped (and hence pointers
  to be invalidated) when a resource is used in a draw or copy
  operation.

  However it might be possible to use D3D11's limited multithreading
  capabilities to emulate some features of PBOs, like asynchronous
  texture uploading.

- The blit() and clear() operations don't have equivalents in the D3D11
  API that handle all cases, so in most cases, they have to be emulated
  with a shader. This is currently done inside ra_d3d11, but ideally it
  would be done in generic code, so it can take advantage of mpv's
  shader generation utilities.

- SPIRV-Cross is used through a NIH C-compatible wrapper library, since
  it does not expose a C interface itself.

  The library is available here: https://github.com/rossy/crossc

- The D3D11 context could be made to support more modern DXGI features
  in future. For example, it should be possible to add support for
  high-bit-depth and HDR output with DXGI 1.5/1.6.
2017-11-07 20:27:13 +11:00
wm4 a2a623ebb9 player: change license of some code surrounding --frames to LGPL
The original author of the patch has agreed now.
2017-11-06 20:53:27 +01:00
wm4 694157e024 m_option: pretty print mpv_node for OSD
Somewhat useful for debugging. Unfortunately libass (or something else)
strips leading whitespace, making it look slightly more ugly than
necessary. Still an improvement.
2017-10-30 15:32:24 +01:00
wm4 6b745769b1 vd_lavc: add support for nvdec hwaccel
See manpage additions.

(In ffmpeg-mpv and Libav, this is still called "cuvid". Libav won't work
yet, because it has no frame params support yet, but this could get
fixed soon.)
2017-10-28 19:59:08 +02:00
Lionel CHAZALLON 1992bb5151 video : Move drm options to substruct.
This allows to group them and most of all query the group config when
needed and when we don't have the access to vo.
2017-10-23 21:08:20 +02:00
Lionel CHAZALLON cfcee4cfe7 Add DRM_PRIME Format Handling and Display for RockChip MPP decoders
This commit allows to use the AV_PIX_FMT_DRM_PRIME newly introduced
format in ffmpeg that allows decoders to provide an AVDRMFrameDescriptor
struct.

That struct holds dmabuf fds and information allowing zerocopy rendering
using KMS / DRM Atomic.

This has been tested on RockChip ROCK64 device.
2017-10-23 21:07:24 +02:00
wm4 60df01512c command: read the diff if you want to know 2017-10-21 21:13:53 +02:00
wm4 ac295960b8 video: make it possible to always override hardware decoding format
Mostly an obscure option for testing. But --videotoolbox-format can be
deprecated, as it becomes redundant.

We rely on the libavutil hwcontext implementation to reject invalid
pixfmts, or not to blow up if they are incompatible.
2017-10-16 15:02:12 +02:00
wm4 902ae9ae41 options: add --vlang switch
For symmetry with --alang and --slang. 100% useless, but why not?
2017-10-13 00:31:43 +02:00
Julian 92a9150cc2 lua: integrate stats.lua script
Signed-off-by: wm4 <wm4@nowhere>

Rename --stats to --load-stats-overlay and add an entry to options.rst
over the original commit.

Signed-off-by: wm4 <wm4@nowhere>
2017-10-09 20:47:33 +02:00
Aman Gupta 61a1612de9 hwdec: add mediacodec hardware decoder for IMGFMT_MEDIACODEC frames 2017-10-09 18:36:54 +02:00
Aman Gupta d08e407c9e hwdec: rename mediacodec to mediacodec-copy 2017-10-09 18:36:54 +02:00
Niklas Haas 258487370f vo_gpu: vulkan: generalize SPIR-V compiler
In addition to the built-in nvidia compiler, we now also support a
backend based on libshaderc. shaderc is sort of like glslang except it
has a C API and is available as a dynamic library.

The generated SPIR-V is now cached alongside the VkPipeline in the
cached_program. We use a special cache header to ensure validity of this
cache before passing it blindly to the vulkan implementation, since
passing invalid SPIR-V can cause all sorts of nasty things. It's also
designed to self-invalidate if the compiler gets better, by offering a
catch-all `int compiler_version` that implementations can use as a cache
invalidation marker.
2017-09-26 17:25:35 +02:00
Niklas Haas 91f23c7067 vo_gpu: vulkan: initial implementation
This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop!

Current problems / limitations / improvement opportunities:

1. The swapchain/flipping code violates the vulkan spec, by assuming
   that the presentation queue will be bounded (in cases where rendering
   is significantly faster than vsync). But apparently, there's simply
   no better way to do this right now, to the point where even the
   stupid cube.c examples from LunarG etc. do it wrong.
   (cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370)

2. The memory allocator could be improved. (This is a universal
   constant)

3. Could explore using push descriptors instead of descriptor sets,
   especially since we expect to switch descriptors semi-often for some
   passes (like interpolation). Probably won't make a difference, but
   the synchronization overhead might be a factor. Who knows.

4. Parallelism across frames / async transfer is not well-defined, we
   either need to use a better semaphore / command buffer strategy or a
   resource pooling layer to safely handle cross-frame parallelism.
   (That said, I gave resource pooling a try and was not happy with the
   result at all - so I'm still exploring the semaphore strategy)

5. We aggressively use pipeline barriers where events would offer a much
   more fine-grained synchronization mechanism. As a result of this, we
   might be suffering from GPU bubbles due to too-short dependencies on
   objects. (That said, I'm also exploring the use of semaphores as a an
   ordering tactic which would allow cross-frame time slicing in theory)

Some minor changes to the vo_gpu and infrastructure, but nothing
consequential.

NOTE: For safety, all use of asynchronous commands / multiple command
pools is currently disabled completely. There are some left-over relics
of this in the code (e.g. the distinction between dev_poll and
pool_poll), but that is kept in place mostly because this will be
re-extended in the future (vulkan rev 2).

The queue count is also currently capped to 1, because of the lack of
cross-frame semaphores means we need the implicit synchronization from
the same-queue semantics to guarantee a correct result.
2017-09-26 17:25:35 +02:00
wm4 0b5c1d2912 m_config: better variable name 2017-09-22 11:31:23 +02:00
wm4 fba927de41 options: properly handle deprecated options with CLI actions
We want e.g. --opengl-shaders-append=foo to resolve to the new option,
all while printing an option name. --opengl-shader is a similar case.
These options are special, because they apply "actions" on actual
options by specifying a suffix. So the alias/deprecation handling has to
be part of resolving the actual option from prefix and suffix.
2017-09-22 11:31:03 +02:00
wm4 2b5da4804c build: make vo_gpu + infrastructure non-optional
Also readd the the error message for when no GL backends are found (why
was this removed?).
2017-09-22 05:35:26 +02:00
Niklas Haas 65979986a9 vo_opengl: refactor into vo_gpu
This is done in several steps:

1. refactor MPGLContext -> struct ra_ctx
2. move GL-specific stuff in vo_opengl into opengl/context.c
3. generalize context creation to support other APIs, and add --gpu-api
4. rename all of the --opengl- options that are no longer opengl-specific
5. move all of the stuff from opengl/* that isn't GL-specific into gpu/
   (note: opengl/gl_utils.h became opengl/utils.h)
6. rename vo_opengl to vo_gpu
7. to handle window screenshots, the short-term approach was to just add
   it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to
   ra itself (and vo_gpu altered to compensate), but this was a stop-gap
   measure to prevent this commit from getting too big
8. move ra->fns->flush to ra_gl_ctx instead
9. some other minor changes that I've probably already forgotten

Note: This is one half of a major refactor, the other half of which is
provided by rossy's following commit. This commit enables support for
all linux platforms, while his version enables support for all non-linux
platforms.

Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the
--opengl- options like --opengl-early-flush, --opengl-finish etc. Should
be a strict superset of the old functionality.

Disclaimer: Since I have no way of compiling mpv on all platforms, some
of these ports were done blindly. Specifically, the blind ports included
context_mali_fbdev.c and context_rpi.c. Since they're both based on
egl_helpers, the port should have gone smoothly without any major
changes required. But if somebody complains about a compile error on
those platforms (assuming anybody actually uses them), you know where to
complain.
2017-09-21 15:00:55 +02:00
wm4 bfa9b62858 build: add preliminary LGPL mode
See "Copyright" file for caveats.

This changes the remaining "almost LGPL" files to LGPL, because we think
that the conditions the author set for these was finally fulfilled.
2017-09-21 13:56:27 +02:00
wm4 fdb300b983 audio: make libaf derived code optional
This code could not be relicensed. The intention was to write new filter
code (which could handle both audio and video), but that's a bit of
work. Write some code that can do audio conversion (resampling,
downmixing, etc.) without the old audio filter chain code in order to
speed up the LGPL relicensing.

If you build with --disable-libaf, nothing in audio/filter/* is compiled
in. It breaks a few features, such as --volume, --af, pitch correction
on speed changes, replaygain.

Most likely this adds some bugs, even if --disable-libaf is not used.
(How the fuck does EOF notification work again anyway?)
2017-09-21 12:48:30 +02:00
wm4 80e3173aa1 options: remove --heartbeat-cmd and --heartbeat--interval
This mechanism uses system() and shouldn't even exist. x11_common.c has
its own solution for the original problem (disabling Linux DE
screensavers without MPlayer/mpv having to link a dbus lib). If that is
not sufficient, you can create a simple Lua script.

Incidentally fixes #4888.
2017-09-18 22:54:03 +02:00
James Ross-Gowan 9aa091615e video: increase --monitorpixelaspect range
Some people use very wide display modes such as 3840x240 with their CRT
televisions because it lessens scaling artifacts in video game
emulators. When using a 3840x240 display mode on a 4:3 CRT television,
the pixel aspect ratio is 1:12, so in order to watch a video with mpv on
the same television without changing the display mode, the user should
use --monitorpixelaspect=1:12.

Unfortunately, 1:12 (or 0.083) was out of range for the
--monitorpixelaspect option. There was no good reason for this, so
extend the range of the option to 1:32-32:1 (0.03125-32,) which should
be more than enough to support "super-wide" display modes like these.

This is related to #4483, but it doesn't fix the issue (which was to do
with subtitle rendering.)
2017-08-26 00:40:11 +10:00
wm4 b62150bd6b command: restore OSD marker for video equalizer properties
Commit 03cf150ff3 accidentally dropped these. Readd them in a simpler
way (so only a property_osd_display[] entry is enough). This commit
doesn't actually touch the video equalizer properties, because the
default value of 0 for the marker is what they require anyway.
2017-08-23 14:23:37 +02:00
wm4 8f2ccba71b video: change --deinterlace behavior
This removes all GPL only code from it, and that's the whole purpose.
Also happens to be much simpler.

The "deinterlace" option still sort of exists, but only as runtime
changeable option. The main change in behavior is that the property will
not report back the actual deint state. Or in other words, if inserting
or initializing the filter fails, the deinterlace property will still
return "yes". This is in line with most recent behavior changes to
properties and options.
2017-08-22 19:08:07 +02:00
wm4 03cf150ff3 video: redo video equalizer option handling
I really wouldn't care much about this, but some parts of the core code
are under HAVE_GPL, so there's some need to get rid of it. Simply turn
the video equalizer from its current fine-grained handling with vf/vo
fallbacks into global options. This makes updating them much simpler.

This removes any possibility of applying video equalizers in filters,
which affects vf_scale, and the previously removed vf_eq. Not a big
loss, since the preferred VOs have this builtin.

Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and
vo_xv. I'm not going to waste my time on these legacy VOs.

vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which
exists _only_ to trigger a redraw. This seems silly, but for now I feel
like this is less of a pain. The rest of the equalizer using code is
self-updating.

See commit 96b906a51d for how some video equalizer code was GPL only.
Some command line option names and ranges can probably be traced back to
a GPL only committer, but we don't consider these copyrightable.
2017-08-22 17:01:35 +02:00
wm4 d2bdb72b69 options: add a thread-safe way to notify option updates
So far, we had a thread-safe way to read options, but no option update
notification mechanism. Everything was funneled though the main thread's
central mp_option_change_callback() function. For example, if the
panscan options were changed, the function called vo_control() with
VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This
worked, but's pretty inconvenient. Most of these problems come from the
fact that MPlayer was written as a single-threaded program.

This commit works towards a more flexible mechanism. It adds an update
callback to m_config_cache (the thing that is already used for
thread-safe access of global options).

This alone would still be rather inconvenient, at least in context of
VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and
takes care of some annoying synchronization issues. We extend
mp_dispatch_queue itself to make this easier and slightly more
efficient.

As a first application, use this to reimplement certain VO scaling and
renderer options. The update_opts() function translates these to the
"old" VOCTRLs, though.

An annoyingly subtle issue is that m_config_cache's destructor now
releases pending notifications, and must be released before the
associated dispatch queue. Otherwise, it could happen that option
updates during e.g. VO destruction queue or run stale entries, which is
not expected.

Rather untested. The singly-linked list code in dispatch.c is probably
buggy, and I bet some aspects about synchronization are not entirely
sane.
2017-08-22 15:50:33 +02:00
wm4 817bb2bbbe options: change --loop semantics
As announced by the previous deprecation.
2017-08-14 20:01:08 +02:00
wm4 c6628a5fb6 player: add --track-auto-selection option
I imagine this is useful. Or maybe it isn't.
2017-08-12 23:44:47 +02:00
wm4 f1d161d55f player: make --lavfi-complex changeable at runtime
Tends to be somewhat glitchy if subtitles are enabled, and you enable
and disable tracks.

On error, this will disable --lavfi-complex, which will result in
whatever behavior.
2017-08-12 23:10:40 +02:00
wm4 c6fafbffac vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:

 1. Make the hwdec context (which does initialization, provides the
    device to the decoder, and other basic state) and frame mapping
    (getting textures from a mp_image) separate. This is more
    flexible, and you could map multiple images at once. It will
    help removing some hwdec special-casing from video.c.
 2. Switch all hwdec API use to ra. Of course all code is still
    GL specific, but in theory it would be possible to support other
    backends. The most important change is that the hwdec interop
    returns ra objects, instead of anything GL specific. This removes
    the last dependency on GL-specific header files from video.c.

I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.

hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.

hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 21:24:31 +02:00
wm4 f7fb6e186a options: fix --include
This is really obnoxious. --include parses into the default profile, but
when used on the command line, it did never get applied. So we have to
apply it when the exact conditions for this are met.

Fixes #4673.
2017-08-08 15:54:51 +02:00
Akemi f550fdaa91 cocoa: add an option to disable the native macOS fullscreen
Fixes #4014
2017-08-06 22:48:26 +02:00
wm4 955cc50e1b options: --priority can be LGPL
Original author has agreed now.

Also fix the notice in dec_video.c - all GPL-only code is gone
(unrelated to --priority/its author).
2017-08-03 09:44:36 +02:00
Martin Herkt 67cda60da0
options: fix --external-file alias typo 2017-07-29 16:40:08 +02:00
wm4 2378acc3b3 options: drop --video-aspect-method=hybrid
Remove this code because it could be argued that it contains GPL-only
code (see commit 642e963c86 for details).

The remaining aspect methods appear to work just as well, are
potentially more compatible to other players, and the code becomes much
simpler.
2017-07-21 20:19:39 +02:00
wm4 533ff28574 client API: drop some compatibility handling
See commit e4bc563fd2 for more information.
2017-07-21 20:09:22 +02:00
wm4 4bc29c1730 options: kill --field-dominance
GPL-only author, no chance of relicensing.
2017-07-21 20:00:09 +02:00
Ricardo Constantino 0922678fc4
options/path: fallback to USERPROFILE if HOME isn't set
HOME isn't set by default on Windows. But if the user does set it,
prefer it by default.

Enables stuff like --log-file=~/mpv.log to work, even if HOME isn't set.
2017-07-06 15:45:08 +01:00
wm4 4a084c0df8 m_option: deprecate multiple items for -add etc.
This is more confusing than it helps, and forces escaping more stuff.
For example, for string lists we could remove all need for escaling with
-add and -pre.

The user can simply use multiple of those options.
2017-07-02 16:47:27 +02:00
wm4 e4bc563fd2 options: change everything again
Fucking bullshit.
2017-07-02 16:29:45 +02:00
wm4 d24f4587a7 m_option: remove unused error code
The situation in the str_list_* functions can never happen, and they
were the only users of this error code.
2017-07-02 13:52:36 +02:00
wm4 3d31807198 m_option: remove redundant indirections
Remove the various redundant m_config_set_option* calls, rename the
remaining one to m_config_set_option_cli(), and merge the
m_config_parse_option() function.
2017-07-02 13:07:36 +02:00
wm4 dd408e68ed d3d: make DXVA2 support optional
This partially reverts the change from a longer time ago to always build
DXVA2 and D3D11VA together.

To make it simpler, we change the following:
- building with ANGLE headers is now required to build D3D hwaccels
- if DXVA2 is enabled, D3D11VA is still forcibly built
- the CLI vo_opengl ANGLE backend is now under --egl-angle-win32

This is done to reduce the dependency mess slightly.
2017-06-30 18:57:37 +02:00
wm4 91583fccac options: change path list options, and document list options
The changes to path list options is basically getting rid of the need to
pass multiple paths to a single option. Instead, you can use the option
multiple times. The old behavior can be used by using the -set suffix
with the option.

Change some options to path lists. For example --script is now append by
default, and if you use --script-set, you need to use ":"/";" as
separator instead of ",".

--sub-paths/--audio-file-paths is a deprecated alias now, and will break
if the user tries to pass multiple paths to it. I'm assuming that if
these are used, most users will pass only 1 path anyway.

--opengl-shaders has more compatibility handling, since it's probably
rather common that users pass multiple options to it.

Also document all that in the manpage.

I'll probably regret this later, as it somewhat increases the complexity
of the option parser, rather than increasing it.
2017-06-30 16:39:36 +02:00
wm4 b266a334c1 video: change --video-aspect-method default value again
I noticed that the previous default, bitstream, actually breaks with
some shitty anamorphic DVD rips that signal square pixel aspect in the
bitstream. So I think the "container" method is a better default.
2017-06-29 22:34:57 +02:00
Pedro Pombeiro 4637b029cd Universal Windows Plaform (UWP) support
libmpv only. Some things are still missing.

Heavily reworked.

Signed-off-by: wm4 <wm4@nowhere>
2017-06-29 10:36:16 +02:00
wm4 7eca787571 build: change how some OS specific source files are selected
In a bunch of cases, we emulate highly platform specific APIs on a
higher level across all OSes, such as IPC, terminal, subprocess
handling, and more. We have source files for each OS, and they implement
all the same mpv internal API.

Selecting which source file to use on an OS can be tricky, because there
is partially overlapping and emulated APIs (consider Cygwin on Windows).
Add a pick_first_matching_dep() function to make this slightly easier
and more structured.

Also add dummy backends in some cases, to deal with APIs not being
available.

Clarify the Windows dependency identifiers, as these are the most
confusing.
2017-06-29 10:30:16 +02:00
wm4 70a70b9da3 build: replace glob() check and assume it's always in POSIX
POSIX requires glob(), so no need to check for it. Together with the
fact that we can emulate glob() on Windows, glob() is always available.
2017-06-29 10:30:13 +02:00
wm4 45bd739796 options: sort action list alphabetically
There is no technical need for this, but it's nicer if --list-options
appears to output them sorted (it only actually sorts the actual option
list, while actions are output in the order they are defined).
2017-06-27 11:27:19 +02:00
wm4 1328005937 options: expose string list actions for --sub-file option
This means you can use --sub-file-set=a,b,c to set a string list
separated by ',', while --sub-file=filename,with,commas.srt still works
(the original motivation for changing the --sub-file option this way).

You can also use it to append strings to string list options without the
need for escale, e.g.: --opengl-shaders-add-str=unescapesdfilename.glsl

(The normal -add for some reason expects a ',' separated list as
argument.)
2017-06-27 11:25:02 +02:00
wm4 c8930d0be2 options: list suffix actions as options too
These are not "really" separate actions, but on the command line they're
obserable as such. So it would be a good idea to list them too.

Adds about 117 options (holy fuck).
2017-06-27 11:14:06 +02:00
wm4 50008adf4a options: handle suffixes like -add in a more generic way
This affects options like --vf or --display-tags. These used a "*"
suffix to match all options starting with a specific name, and handled
the rest in the option parser. Change this to remove the "*" special
case, and require every option parser to declare a list of allowed
suffixes via m_option_type.actions.

The new way is conceptually simpler, because we don't have to account
for the "*" in a bunch of places anymore, and instead everything is
centrally handled in the CLI part of the option parser, where it's
actually needed.

It automatically enables suffixes like -add for a bunch of other
stringlist options.
2017-06-26 21:07:00 +02:00
wm4 6f80a694d3 client API: drop old "no-" option emulation
You could do mpv_set_option(h, "no-fs", ""), which would behave like
"--no-fs" on the command line. At one point, this had to be emulated for
compatibility, and printed a deprecation warning. This was almost a year
ago, so remove it.
2017-06-26 20:07:20 +02:00
wm4 7293d9cf85 options: suggest a replacement for --field-dominance 2017-06-25 18:54:33 +02:00
wm4 933db1b95f Revert "parse_commandline: fail gracefully on bad args"
This reverts commit 38b05daf7d.

There was actually no LGPL relicensing agreement with wd0.
2017-06-24 11:32:40 +02:00
wm4 0729bee415 options: simplify and rename m_option_type_store
This was an annoying option type. And still is. But at least it's on the
same level as m_option_type_print_fn now, and can probably cleaned up
further like it. Both types are for options that are only on the command
line, always have special handling (i.e. do something with them in
parse_commandline.c before passing them to the generic
m_config.c/m_option.c layers), and are m_options only for --list-options
and (oddly) the split_opt_silent() function.
2017-06-23 20:51:12 +02:00
wm4 633152e55a options: remove weird --really-quiet special behavior
This was especially grating because it causes problems with the
option/property unification, uses as only thing OPT_FLAG_STORE, and
behaves weird with the client API or scripts.

It can be reimplemented in a much simpler way, although it needs
slightly more code. (Simpler because less special cases.)
2017-06-23 20:42:20 +02:00
wm4 48970cd485 options: unbreak -h
Sure is a simple thing to break.
2017-06-23 20:23:51 +02:00
wm4 6dde9ab27a player: change license of most core files to LGPL
These files have all in common that they were fully or mostly taken from
mplayer.c. (mplayer.c was a huge file that contains almost all of the
playback core, until it was split into multiple parts.) This was
probably the hardest part to relicense, because so much code was moved
around all the time.

player/audio.c still does not compile. We'll have to redo audio
filtering. Once that is done, we can probably actually provide an
actual LGPL configure switch.

Here is a relatively detailed list of potential issues:

8d190244: author did not reply, parts were made GPL-only in a previous
commit.
7882ea9b: author could not be reached, but the code is gone. wscript
still has --datadir switch, but I don't think this is relevant to
copyright.
f197efd5: unclear origin, but I consider the code gone anyway (replaced
with generic OSD mechanisms).
8337d9c2: author did not reply, but only the option still exists (under
a different name), other code was removed.
d8fd7131: did not reply. Disabled in a previous commit.
05258251: same author as above. Both fields actually seem to have
vanished (even when tracking renames), so no action taken.
d459e644, 268b2c1a: author did not reply, but we reuse only the options
(with different names and slightly or fully different semantics, and
completely different implementations), so I don't think this is relevant
for copyright.
09e742fe, 17c39c4e: same as above.
e8a173de, bff4b3ee: author could not be reached. The commands were
reworked to properties, and the code outside of the TV code were moved
back to the TV code. So I don't think copyright applies to the current
command.c parts (mp_property_tv_color, mp_property_tv_freq,
mp_property_tv_scan). The TV parts remain GPL.
0810e427: could not be reached. Disabled in a previous commit.
43744a2d: unknown author, but this was replaced by dynamic alloc (if the
change is even copyrightable).
116ca0c7: unknown author; reasoning see input.c relicensing commit.
e7e4d1d8: these semantics still exist, but as generic code, and this
code was fully removed.
f1175cd9: the author of the cited patch is unknown, and upon inspection
it turns out that I was only using the idea to pause the player on EOF,
so I claim it's not copyright relevant.
25affdcc: author could not be reached (yet) - but it's only a function
rename, not copyrightable.

5728504c was committed by Arpi (who agreed), but hints that it might be
by a different author. In fact it seems to be mostly this patch:
http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2001-November/002041.html
The author did not respond, but it all seems to have been removed later.
It's a terrible mess though. Arpi reverted the A-V sync code at first,
but left the RTC code for a while. The following commits remove these
changes 100%: 14b35442, 7181a091, 31482783, 614f8475, df58e822.

cehoyos did explicitly not agree to LGPL, but was involved in the
following changes:
c99d8fc8: applied a patch and didn't modify it, the original author
agreed.
40ac0d31: author could not be reached, but all code is gone anyway. The
"af" command has a similar function, but works completely different and
actually reuses a mechanism older than this patch.
54350436: applied a patch, but didn't modify it, except for adding a
German translation, which was removed later.
a2dda036: same situation as above
240b743e: this was made GPL-only in a previous commit
7b25afd7: same as above (for now)

kirijua could not be reached, but was a regular patch contributor:
c2c997fd: video equalizer code move; probably not copyrightable. Is GPL
due to Nick anyway.
be54f481: technically, this became the audio track property later. But
all what is left is the fact that you pass a track ID to it, so consider
the original coypright non-relevant.
2f376d1b: this was rewritten in b7052b43, but for now we can afford to
be careful, so this was marked as GPL only in a previous commit.
43844d09: remaining parts in main.c were reverted in a previous commit.

anders has mostly disagreed with the LGPL relicensing. Does not want
libaf to become LGPL, but made some concessions. In particular, he
granted us permission to relicense 4943e9c52c and 242aa6ebd4. We also
consider some of his changes remaining in mpv not relevant for copyright
(such as 735de602 - we won't remove the this option completely). We will
completely remove his other contributions, including the entire audio
filter chain. For now, this stuff is marked as GPL only. The remaining
question is how much code in player/audio.c (based on the former
mplayer.c and dec_audio.c) is under his copyright. I made claims about
this in a previous commit.

Nick(ols) Kurshev, svn username "nick" and "nickols_k", could not be
reached. He had a lot of changes in early MPlayer. It seems all of that
was removed, at least in mpv. His main work, like VIDIX or libswscale
work, does not exist in mpv anymore, but the changes to mplayer.c and
other core parts still deserve attention:
a4119f6b, fb927549, ad3529b8, e11b23dc, 5f2178be, 93c371d5: removed in
b43d67e0, d1628d12, 24ed01fe, df58e822.
0a83c6ec, 104c125e, 4e067f62, aec5dcc8, b587a3d6, f3de6e6b: DR, VAA, and
"tune" stuff was fully removed later on or replaced with other
mechanisms.
340183b0: screenshots were redone later (the VOCTRL was even removed,
with an independent implementation using the same VOCTRL a few years
later), so not relevant anymore. Basically only the 's' shortcut remains
(but not its implementation).
92c5c274, bffd4007, 555c6766: for now marked as GPL only in a previous
commit.

Might contain some trace amounts of "michael"'s copyright, who agreed to
LGPL only once the core is relicensed. This will still be respected, but
I don't think it matters at this in this case. (Some code touched by him
was merged into mplayer.c, and then disappeared after heavy
refactoring.)

I tried to be as careful and as complete as possible. It can't be
excluded that amends to this will be made later.

This does not make the player LGPL yet.
2017-06-23 16:55:02 +02:00
wm4 d81576c9a6 player: disable --frames in WIP LGPL mode
Commit d8fd7131 changes this. "tibcu" did not reply. While I'm not sure
whether copyrightable code remains, I'd tend towards saying yes (the
basic idea is still intact after years of refactoring), so make it
GPL-only for now.
2017-06-23 16:54:09 +02:00
wm4 96b906a51d player: disable video equalizer frontend code for WIP LGPL mode
Nick and kiriuja could not be reached, and created/changed this in
92c5c274, 6441a5ad, bffd4007, 555c6766, c2c997fd. The video equalizer
stuff was redone fully later, but there are still parts that look too
similar and basically use the same approach. I'm more comfortable with
declaring it GPL only for now.

I plan to redo them later in a way that will remove copyright.
2017-06-23 16:54:09 +02:00
wm4 690a312f42 options: disable --field-dominance for WIP LGPL mode, also deprecate
cehoyos, who did not agree to the LGPL relicensing, added this in commit
240b743e. The actual implementation of it is already guarded with
HAVE_GPL. The field_dominance field in the option struct won't be
guarded.

We won't keep GPL-only core code forever, so deprecate it as well. To
apply forced deinterlacing, a libavfilter filter can probably be
removed, or we merge this functionality into the --deinterlace option
(without using copyrighted stuff).
2017-06-23 16:52:52 +02:00
wm4 54e2b1e9f3 player: disable --priority for WIP LGPL mode
Due to commit 14ecebe9: author could not be reached. I don't think
anything copyrightable is left, but to be sure make it GPL-only.
2017-06-23 15:05:07 +02:00
wm4 ee21bd1baa stream: move cache option declarations to cache.c
If they are copyrightable, iive's changes (commits listed in cache.c)
would make them LGPL 3+. To avoid that options.c becoming LGPL 3, move
the option declarations to cache.c. struct mp_cache_opts is still in
options.h, but we consider that irrelevant, and options.h will become
LGPL 2.1+ later.
2017-06-23 13:03:50 +02:00
wm4 f001b47cb8 Revert "m_option: make geometry code GPL-only"
This reverts commit e30fe38a21.

The original author as well as the author from d568eaa2 agreed to LGPL
now. The only one missing is 0842caf6 (Henk could not be reached, and
that will probably stay this way).

When I discussed this with someone else who knows a lot about copyright
(j-b), the conclusion was that the rewrite was actually enough to
remove all past copyright. Only the syntax and the option name remained
the same, but code, code structure, and architecture all changed
radically. So I'm content with dropping the GPL part.

(m_option.c is still formally GPL due to the special agreement with
michael, but once this is fullfilled, we will change the license to
LGPL without further checks.)
2017-06-22 17:49:17 +02:00
wm4 e30fe38a21 m_option: make geometry code GPL-only
In commit eb22569ff0, I claimed that the geometry parsing code was
rewritten. But I'm not sure if it's rewritten enough, or if copyright
claims could still be made. Given that the original code was
self-contained, and could be considered a separate work, it's probably
safer (and more up to the standards applied to this relicensing) to
leave this as GPL code.

The rewrite/code move can be seen with: git diff f2dcdca...ccaed5e
2017-06-21 18:13:53 +02:00
wm4 642e963c86 dec_video: change license to LGPL (almost)
"Almost" because this might contain copyright by michael, who agreed
with LGPL, but only once the core is LGPL. This is preparation for that
to happen.

Apart from that, the usual remarks apply. In particular, dec_video.c
started out quite chaotic with no modularization, but was later
basically gutted, and in general rewritten a bunch of times. Not going
to give a history lesson.

Special attention needs to be given to 3 patches by cehosos, who did not
agree to the relicensing:

240b743ebdf: --field-dominance
e32cbbf7dc3: reinit VO if aspect ratio changes
306f6243fdf: use container aspect if codec aspect unset (?)

The first patch is pretty clearly still in the current code, and needs
to be disabled for LGPL.

The functionality of the second patch is still active, but implemented
completely different, and as part of general frame parameter changes (at
the time of the patch, MPlayer already reinitialized the VO on frame
size and pixel format changes - all this was merged into a single check
for changing image parameters).

The third patch makes me a bit more uncomfortable. It appears the code
was moved to dec_video.c in de68b8f23c, and further changed in
82f0d373, 0a0bb905, and bf13bd0d. You could claim that cehoyos'
copyright still sticks. Fortunately, we implement alternative aspect
detection, which is simpler and probably preferable, and which arguably
contains none of the original code and logic, and thus should be fully
safe.

While I don't know if cehoyos' copyright actually still applies, I'm
more comfortable with making the code GPL-only for now. Also change the
default to use the (in future) plain LGPL code, and deprecate the one
associated with the GPL code, so we can eventually remove the GPL code.

But it's also possible we decide that the copyright doesn't apply, and
undo the deprecation and GPL guards.

I expect that users won't notice anything. If you ask me, the old aspect
method was probably an accidental bug instead of intentional behavior.

Although, the new aspect method was broken too, so I had to fix it.
2017-06-18 18:58:36 +02:00
wm4 32833fa3d1 img_format: minor simplification 2017-06-18 13:58:42 +02:00
wm4 986e10901d command: avoid going through prop->opt bridge from opt->prop bridge
The option->property bridge can't (and shouldn't) preserve option flags.
This is a problem if the flags are actually used by the option
implementation, beyond calling m_config_mark_co_flags().

This was true so far, but b8193e4071 changed this. Now setting the
--profile option (usually from a config file or as recursive profile)
can have side-effects that depend on the flags contents. Solve this by
avoiding going through the "double bridge" altogether.

This fixes a regression if an auto-profile is active, and the user
specifies an option on the command line that is supposed to override an
item in a profile recursively referenced by the auto-profile. The
command line option will not override it, because the auto-profile is
set later, and during application of the auto-profile, the
M_SETOPT_PRESERVE_CMDLINE flag gets lost.

Having to add something to m_property is not nice, and I'll probbaly
regret later. On the other hand, there is a chance that this helps
towards true option/property unification.
2017-06-16 21:31:24 +02:00
wm4 b8193e4071 command: add all options to property->option bridge
Before this, options with co->data==NULL (i.e. no storage) were not
added to the bridge (except alias options). There are a few options
which might make sense to allow via the bridge ("profile" and
"include"). So allow them.

In command_init(), we merely remove the co->data check, the rest of the
diff is due to switching the if/else branches for convenience.

We also must explicitly error on M_PROPERTY_GET if co->data==NULL. All
other cases check it in some way.

Explicitly exclude options from the property bridge, which would be
added due this, and the result would be pointless.
2017-06-15 15:29:54 +02:00
wm4 fd7de84833 options: make mess to allow setting profile option with libmpv
Certain options, such as --profile, --help, and many others require
special-handling, because they don't fit conceptually into the option
and property model. They don't store data, but perform actions.

This caused the situation that profiles could not be set when using
libmpv in encoding mode (although you should probably not used libmpv in
encoding mode). Using libmpv always ends up in calling
m_config_set_option_raw_direct(), while --profile was handled in
m_config_parse_option().

Solve this by moving the handling of this from m_config_parse_option()
to m_config_set_option_raw_direct(). Actually we just stuff most of this
into m_config_handle_special_options(), which is only called by the
aforementioned function.

Strangely this also means that the --h/--help option declarations need
to be changed, because they used OPT_PRINT, and now the option "parser"
is always invoked before the special code. Thus, make them a string.
Them being OPT_PRINT was apparently always redundant. (The other option
declarations are moved for cosmetic purposes only.)

The most weird change is how co->data==NULL is handled. We now allow
passing down involved options to m_config_set_option_raw_direct(). The
thing is that we don't want them to error if the command line parser is
using them (with special handling done there), while all other code
paths should raise an error. We try using M_SETOPT_FROM_CMDLINE to
distinguish these cases.

Note that normal libmpv users are supposed to use the "apply-profile"
command instead.

This probably contains a bunch of bugs, which you should report.
2017-06-15 15:23:25 +02:00
Avi Halachmi (:avih) d223a63bc5 js: add javascript scripting support using MuJS
Implements JS with almost identical API to the Lua support.

Key differences from Lua:
- The global mp, mp.msg and mp.utils are always available.
- Instead of returning x, error, return x and expose mp.last_error().
- Timers are JS standard set/clear Timeout/Interval.
- Supports CommonJS modules/require.
- Added at mp.utils: getenv, read_file, write_file and few more.
- Global print and dump (expand objects) functions.
- mp.options currently not supported.

See DOCS/man/javascript.rst for more details.
2017-06-14 12:29:32 +02:00
wm4 eb22569ff0 options: change license of most files to LGPL (except options.c/.h)
All authors of the current code have agreed (as far as this commit
requires).

options.c/options.h will take more effort, because it contains all the
option declarations, and thus is touched extremely often.

m_option.c is technically still GPL, because of commit 2c82d5a1d8
(michael has agreed to LGPL, but only once the core of mpv is LGPL).

The geometry parsing code in m_option.c was originally by someone who
could not be reached. However, it was heavily rewritten anyway, and only
the syntax remains (i.e. not copyright-relevant).

parse_commandline.c contains a change by "adland" (commit 1d0ac71ae8),
who could not be reached - this this specific part is GPL only.
Fortunately, it matters only for DVD (and even then is more like a hack,
but whatever).

There are some other relevant changes, but they have all been reverted,
moved somewhere else, deleted, or replaced.
2017-06-12 20:55:17 +02:00
wm4 26a173f40c m_option: revert commit 2793a70e0f 2017-06-12 20:13:18 +02:00
wm4 2cded0ea9f m_property: change license to LGPL
All involved authors have agreed.
2017-06-12 17:00:20 +02:00
wm4 5c42c70bfd path: change license to LGPL
The history goes back to 2001 or so, but everyone involved with still
existing code has agreed.

One person who could not be reached yet (elevengu) has changes in this,
which as far as I can tell were overwritten anyway at a later point.
2017-06-12 16:41:21 +02:00
wm4 79dc1834f5 m_option: fix leaks with OPT_KEYVALUELIST options
For example, specifying --script-opts multiple times could leak some
data.
2017-06-08 21:51:25 +02:00
Niklas Haas 4d1ffecabc options: slight cleanup of --sub-ass-style-override
List of changes:

1. Rename `signfs` to `scale`, to better match what it actually does
   (force --sub-scale to apply to ASS subtitles), and fix the blatantly
   wrong documentation (it actually specifically does *not* apply to
   signs)

2. Rename `--sub-ass-style-override` to `--sub-ass-override` to help
   reduce confusion between it and `--sub-ass-force-style`, as well as
   pointing out that it doesn't necessarily actually override styles.
   (The new `scale` option, for example, only sets
   ASS_OVERRIDE_BIT_FONT_SIZE, but not ASS_OVERRIDE_BIT_STYLE)

3. Mention that `--sub-ass-override` is generally sort of smart about
   only overriding dialog, not signs.
2017-06-07 15:55:03 +02:00
wm4 c075b48ee0 options: change --sub-fix-timing default
Why? Better than wasting time by arguing with idiots.

Fixes #4484.
2017-06-06 18:58:20 +02:00
Philip Langdale 7424651b96 vo_opengl: hwdec_cuda: Support separate decode and display devices
In a multi GPU scenario, it may be desirable to use different GPUs
for decode and display responsibilities. For example, if a secondary
GPU has better video decoding capabilities.

In such a scenario, we need to initialise a separate context for each
GPU, and use the display context in hwdec_cuda, while passing the
decode context to avcodec.

Once that's done, the actually hand-off between the two GPUs is
transparent to us (It happens during the cuMemcpy2D operation which
copies the decoded frame from a cuda buffer to the OpenGL texture).

In the end, the bulk of the work is around introducing a new
configuration option to specify the decode device.
2017-06-03 16:41:03 +02:00
wm4 afead7a356 audio: merge --replaygain-track and --replaygain-album into one option
This is probably better than separate options. For example, the user
does not have to guess which one is applied if both options are enabled.
2017-04-27 00:21:17 +02:00
wm4 f1c4d20e65 audio: move replaygain control to top-level options
af_volume is deprecated, and so are its replaygain sub-options. To make
it possible to use replaygain without deprecated options (and of course
to make it available at all after af_volume is dropped), reintroduce
them as top-level options.

This also means that they are easily changeable at runtime by using them
as properties. Change the "volume" property to use the new update
mechanism as well.

We don't actually bother sharing the implementation between new and
deprecated mechanisms, as the deprecated one will simply be deleted.

For the from_dB() functions, we mention anders' copyright, although I'm
not sure if a mere formula is copyrightable. This will have to be
determined later.

This whole change is mostly untested. Our distributed human CI will take
care of it.
2017-04-26 21:45:55 +02:00
wm4 f41e50530f options: change --audio-file-auto default to not to load any files
There have been user complaints, and I'm annoyed by this behavior
myself.
2017-04-20 05:29:04 +02:00
Dan Oscarsson ae0a40259f player: add --keep-open-pause=no option
Instead of pausing if --keep-open is active, stop
at end but continue playing if seeking backwards.
And then stop again when end is reached.

Signed-off-by: wm4 <wm4@nowhere>

Over the PR, the option was renamed, and the manpage additions were
slightly changed/enhanced.
2017-04-14 17:43:34 +02:00
wm4 6dea8fceda options: deprecate --loop
Also "announce" the plans to undeprecate it with changed semantics
later. The deprecation period is needed to warn script authors and
client API users (etc.) of the change.

This is done because everyone seems to expect --loop to loop the current
file, not the playlist. Even in cases when only 1 file is on the
playlist, the --loop-file semantics seem to be preferred.
2017-04-10 21:19:13 +02:00
wm4 93bd1a7d4a options: assing proper default value for --audio-channels
This will make --list-options (and some other code paths) actually
return the proper default. Shouldn't change behavior.
2017-04-05 11:07:08 +02:00
wm4 6063cd569d parse_commandline: guard glob() use
Might make porting to batshit environments simpler.
2017-04-04 10:47:57 +02:00
wm4 31611fc46b video: support positional arguments for automatic lavfi option bridge
Now e.g. --vf=pad=1000:1000 works.

All in all pretty ugly and hacky. Just look away.
2017-04-03 18:12:42 +02:00
wm4 a94013f585 command: change and simplify filter toggle syntax
"@name:!" becomes simply "@name". This is actually slightly more complex
to parse, but makes for a much simpler syntax and will be less weird to
the user. Suggested by haasn.

The old syntax is now rejected with an error.

Also add some more explicit error checks, instead of e.g. allowing empty
filter names and erroring only when it's not found.
2017-03-26 13:13:34 +02:00
wm4 b0086d6243 m_option: consistent af/vf filter entry "enabled" flag default value
It should default to true, but setting the filter list via mpv_node
(relevant for client API and Lua scripting) left it to false.

Also "document" the flag.
2017-03-25 18:13:04 +01:00
wm4 7d424b4ce4 command: add better runtime filter toggling method
Basically, see the example in input.rst.

This is better than the "old" vf-toggle method, because it doesn't
require the user to duplicate the filter string in mpv.conf and
input.conf.

Some aspects of this changes are untested, so enjoy your alpha testing.
2017-03-25 17:07:40 +01:00
Dan Oscarsson 5b75142a1d sub: add SDH subtitle filter
Add subtitle filter to remove additions for deaf or hard-of-hearing
(SDH). This is for English, but may in part work for others too.
This is an ASS filter and the intention is that it can always be
enabled as it by default do not remove parts that may be normal text.
Harder filtering can be enabled with an additional option.

Signed-off-by: wm4 <wm4@nowhere>
2017-03-25 15:04:05 +01:00
Philip Sequeira a2a5fa4545 options: add M_OPT_FILE to some more file options
(Helps shell completion.)
2017-03-06 15:41:06 +01:00
wm4 85c8556eef hw_videotoolbox: allow using native decoder output format
Depends on FFmpeg commit ade7c1a2326e2bb9b.

It has yet to show whether it actually does what it should. Probably
doesn't.
2017-03-02 11:49:12 +01:00
wm4 0aa01ca743 m_option: optionally allow passing "no" to imgfmt option types
Needed for the following commit.

Also, fix that uint32_t type - we always assumed int.
2017-03-02 11:32:07 +01:00
Akemi 2292501533 cocoa: add option to force dedicated GPU
Fixes #3242
2017-02-27 23:53:53 +01:00
Akemi 64b0d81c32 cocoa: add --ontop-level option for modifying ontop window level
since there are different views on what ontop is, we make the ontop
window level modifiable. at the moment only support for macOS was added.
the default for macOS was changed from 'system' to 'window' since this
fixes an unwanted behaviour in fullscreen and in general causes less
issues with expected behaviour.

Fixes #2376 #3974
2017-02-13 22:49:11 +01:00
Michael Forney 212f6c8206 Fix build with HAVE_GL==0
video/out/opengl/hwdec.h includes video/out/opengl/common.h, which tries
to include opengl headers.
2017-02-13 11:16:20 +01:00
wm4 96a45a16af player: add experimental stream recording feature
This is basically a WIP, but it can't remain in a branch forever. A
warning is print when using it as it's still a bit "shaky".
2017-02-07 17:05:17 +01:00
Dan Oscarsson f1c9032ddf sub: add justify of subtitles
To make it easier for the eyes, multi line subtitles should
be left justified (for most languages).
This adds an option to define how subtitles are to be justified
inpendently of how they are aligned.
Also add option to enable --sub-justify to be applied on ASS subtitles.
2017-02-01 16:42:58 +01:00
pavelxdd 9c90c902c1 win32: snap to screen edges
Disabled by default. The snap sensitivity value depends on
the screen DPI. The default value is 16px on a 96 DPI screen.

Fixes #2248
2017-01-27 12:00:32 +01:00
wm4 00eadcec8d sub: add option to force using video resolution for image subtitles
Basically for debugging and dealing with broken files.
2017-01-23 15:55:09 +01:00
wm4 73858bb0cc player: remove --stream-capture option/property
This was excessively useless, and I want my time back that was needed to
explain users why they don't want to use it.

It captured the byte stream only, and even for types of streams it was
designed for (like transport streams), it was rather questionable.

As part of the removal, un-inline demux_run_on_thread() (which has only
1 call-site now), and sort of reimplement --stream-dump to write the
data directly instead of using the removed capture code.

(--stream-dump is also very useless, and I struggled coming up with an
explanation for it in the manpage.)
2017-01-21 17:19:01 +01:00
wm4 fd203ff16a options: refacactor how --opengl-dwmflush is declared
Same deal as previous commit, except this time we just readd it as lone
global option, and read it directly.
2017-01-20 14:03:34 +01:00
wm4 d890e0731c options: refactor how --opengl-dcomposition is declared
vo_opengl used to have it as sub-option, which made it very hard to pass
down option values to backends in a generic way (even if these options
were completely backend-specific). For --opengl-dcomposition we used a
VOFLAG to deal with this. Fortunately, sub-options are gone, and we can
just add it as global option.

Move the option to context_angle.c and add it as global option. I
thought about adding a mechanism to let backends declare options, which
would get magically picked up my m_config instead of having to add them
to the global option list manually (similar to VO vo_driver.options),
but decided against this complexity just for 1 or 2 backends. Likewise,
it could have been added as a single option to avoid the boilerplate of
an option struct, but then again there are probably going to be more
angle suboptions, and it's cleaner.
2017-01-20 13:40:59 +01:00
wm4 e277fadd60 player: add prefetching of the next playlist entry
Since for mpv CLI, the player state is a singleton, full prefetching is
a bit tricky. We do it only on the demuxer layer.

The implementation reuses the old "open thread". This means there is
significant potential for regressions even if the new option is not
used. This is made worse by the fact that I barely tested this code.

The generic mpctx_run_reentrant() wrapper is also removed - this was its
only user, and its remains become part of the new implementation.
2017-01-18 19:02:50 +01:00
wm4 9d68d8fb0f vo_opengl, vo_opengl_cb: better hwdec interop backend selection
Introduce the --opengl-hwdec-interop option, which replaces
--hwdec-preload. The new option allows explicit selection of the interop
backend.

This is relatively complex, and I would have preferred not to add this,
but it's probably useful to debug certain problems. In exchange, the
"new" option documents that pretty much any but the simplest use of it
will not be forward compatible.
2017-01-17 15:48:56 +01:00
wm4 b26ab4d08c config: do not resolve default profile during "include" processing
Application of options in the default section is "delayed" until the
whole config file is read in order to allow profile forward references.
This was run at the end of parsing a config file - but because of
"include" options, this means it's not always called at the end of the
main config file.

Use the recursion counter to prevent it from being processed after each
"include" option. This also gets rid of the resulting unintended
infinite recursion (which eventually stopped and failed loading the
config file) due to m_config_finish_default_profile() processing the
"include" option again.

Fixes #4024.
2017-01-13 12:02:46 +01:00
wm4 1d5e95783e options: explicitly deprecate --ad-spdif-dtshd
Has been less formally deprecated for a longer time.
2016-12-23 18:12:54 +01:00
wm4 c560f6ff0a audio: change how spdif codecs are selected
Remove ad_spdif from the normal codec list, and select it explicitly.

One goal was to decouple this from the normal codec selection, so
they're less entangled and the decoder selection code can be simplified
in the far future. This means spdif codec selection is now done
explicitly via select_spdif_codec(). We can also remove the weird
requirements on "dts" and "dts-hd" for the --audio-spdif option, and it
can just do the right thing.

Now both video and audio codecs consist of a single codec family each,
vd_lavc and ad_lavc.
2016-12-23 18:10:07 +01:00
wm4 aab98776f6 options: change --h=... behavior
Does not match a shell pattern anymore. Instead, a simple sub-string
search is done.
2016-12-16 16:09:10 +01:00
Akemi a8347eb9ba cocoa: fullscreen refactoring
this replaces the old fullscreen with the native
macOS fullscreen. additional the
--fs-black-out-screens was removed since the new
API doesn't support it in a way the old one did.
it can possibly be re-added if done manually.

Fixes #2857 #3272 #1352 #2062 #3864
2016-12-15 20:55:16 +01:00
wm4 a8b8295f8d options: remove weird RPI-only fullscreen default
As announced by interface-changes.rst.
2016-12-08 12:39:49 +01:00