Commit Graph

495 Commits

Author SHA1 Message Date
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
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
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
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 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
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
wm4 1a2319f3e4 options: remove deprecated sub-option handling for --vo and --ao
Long planned. Leads to some sanity.

There still are some rather gross things. Especially g_groups is ugly,
and a hack that can hopefully be removed. (There is a plan for it, but
whether it's implemented depends on how much energy is left.)
2016-11-25 21:17:25 +01:00
wm4 bb48f09532 options: clarify --softvol deprecation message and manpage entry
People seem to think that the softvol behavior is deprecated, but what
is deprecated is actually disabling softvol.
2016-11-19 01:19:14 +01:00
Akemi aceeeaf9bb cocoa: option to scale window by HiDPI scale factor
Deactivating this options makes it possible to
circumvent the default OS X behavior of using
points. Windows on HiDPI resolutions won't open
in double the size anymore and videos are display
in their native resolution when windowed.

Fixes #3716
2016-11-11 21:37:04 +01:00
wm4 1bf474e19a options: make --load-scripts runtime changeable
Just that actually changing it at runtime won't do anything.

This deals with a nasty initialization order issue with encoding.
Encoding is initialized after options have initialized, but before
--load-scripts is checked and executed. Encoding initialization accesses
FFmpeg API, thus it has to run after FFmpeg is initialized (which also
implies it's initialized after options/logging init). On the other hand,
it sets the encoding builtin profile, which possibly sets --load-scripts
to "no". That failed at this point because --load-scripts was marked as
fixed.

Just marking it as not fixed gets rid of the headache, even if it's not
perfectly orthodox.
2016-10-22 16:39:24 +02:00
wm4 6b18d4dba5 video: add --hwdec=vdpau-copy mode
At this point, all other hwaccels provide -copy modes, and vdpau is the
exception with not having one. Although there is vf_vdpaurb, it's less
convenient in certain situations, and exposes some issues with the
filter chain code as well.
2016-10-20 16:43:02 +02:00
Philip Langdale 0a81fe1cf9 vd_lavc: Add hwdec wrapper for crystalhd
This hardware decodes to system memory so it only requires a wrapper.
2016-10-15 17:44:23 +02:00
rr- 403f489f6c vo_drm: change CLI options + refactors
- Change connector selection to accept human readable names (such as
  eDP-1, HDMI-A-2) rather than arbitrary numbers.
- Change GPU selection to accept GPU number rather than device paths.
- Merge connector and GPU selection into one --drm-connector.
- Add support for --drm-connector=help.
- Add support for --drm-* in EGL backend.
- Refactor KMS; reduce state sharing across drm_common.
2016-10-07 00:22:23 +02:00
wm4 d7e587acc9 options: handle --audio-device changes like the other options
Don't require special property code for handling updates, and simply use
the UPDATE_AUDIO flag instead. Also make runtime changes to
--audio-client-name take effect.
2016-10-05 16:45:04 +02:00
Kevin Mitchell 387f501278 audio: make setting audio-exclusive update the audio chain
This is required since exclusive mode requires entirely different
initializaiton.
2016-10-04 12:48:26 -07:00
Dan Oscarsson 7debdde9b9 options: rename subtitle options
Rename the text subtitle options from --sub-text- to --sub-
and --ass- options to --sub-ass-.
The intention is to common sub options to prefixed --sub-
and special ASS option be seen as a special version of sub options.
The OSD options that work like the --sub- options are still named
--osd-.
Man page updated including a short note about renamed --sub-text-*
and --ass-* options to --sub-* and --sub-ass-*.
2016-10-03 16:57:04 +02:00
wm4 39fc5e1deb player: make --stop-screensaver runtime-changeable
Move the screensaver enable/disable determination to a central place,
and call it if the stop-screensaver property is changed.

Also, do not stop the screensaver when in idle mode (i.e. no file is
loaded).

Fixes #3615.
2016-10-02 12:33:34 +02:00
wm4 7e6456f43a rpi: add --hwdec=rpi-copy
This means it can be used with normal video filters.

Might help out with #3604.
2016-09-30 13:05:30 +02:00
James Ross-Gowan b712095d89 win32: make --priority runtime-settable
I'm not sure if this option affects anything or if it's a placebo,
especially since the VO thread is now registered with MMCSS. Still, I
think --priority=high may have helped back when I used mplayer2 on a
netbook. It's also possible that encoding-mode users would want to set
--priority=idle.

Anyway, it was one of the last M_OPT_FIXED options, so fix that.
2016-09-28 21:47:30 +10:00
wm4 733218b233 options: do not mark --profile/--include as M_OPT_FIXED
The intention of M_OPT_FIXED is to make options not runtime-changeable,
so trying to set them at runtime will always error. This is not wanted
for --profile and --include, for which there is no reason to block them
at runtime.

Fixes #3581.
2016-09-24 20:41:07 +02:00
wm4 9eef41dec1 player: do not let pseudo-gui override user config settings
Seems like this confused users quite often.

Instead of --profile=pseudo-gui, --player-operation-mode=pseudo-gui now
has to be used to invoke pseudo GUI mode. The old way still works, and
still behaves in the old way.
2016-09-23 21:24:50 +02:00
wm4 075edc6fee player: make audio-channels etc. runtime settable
If one of the audio output format options is set, brually reinit the
audio chain.

Since the audio-channels property is still mapped to the deprecated
read-only property, "options/audio-channels" currently has to be used,
e.g. "cycle-values options/audio-channels 2 7.1".
2016-09-22 20:57:06 +02:00
David Logie 78b3852f7e player: add --watch-later-directory option
This option allows the user to set the directory where "watch later"
files are stored.

Signed-off-by: wm4 <wm4@nowhere>
2016-09-22 13:46:19 +02:00
wm4 7783f0b7d7 client API: more or less deprecate mpv_set_option()
With the merging of options and properties, the mpv_set_option()
function is close to being useless, and mpv_set_property() can be used
for everything instead. There are certain conflicts remaining, which are
explained in depth in the docs. For now, none of this should affect
existing code using the client API.

Make mpv_set_property() redirect to mpv_set_option() before
initialization.

Remove some options marked as M_OPT_FIXED. The "pause" and "speed"
options cannot be written anymore without the playloop being notified by
it, so the M_OPT_FIXED does nothing. For "vo-mmcss-profile", the problem
was lack of synchronization, which has been added. I'm not sure what the
problem was with "frames" - I think it was only marked as M_OPT_FIXED
because changing it during playback will have no effect. Except for
pause/speed, these changes are needed to make them writable as
properties after mpv_initialize().

Also replace all remaining uses of CONF_GLOBAL with M_OPT_FIXED.
2016-09-21 17:35:00 +02:00
wm4 75d12c174f options: make input options generally runtime-settable 2016-09-21 17:35:00 +02:00
wm4 e13eb3fede command: change update handling of some video-related properties
Use the new mechanism, instead of wrapped properties. As usual, extend
the update handling to some options that were forgotten/neglected
before. Rename video_reset_aspect() to video_reset_params() to make it
more "general" (and we can amazingly include write access to
video-aspect as well in this).
2016-09-20 15:44:16 +02:00
wm4 995962291a options: fix window-scale property
A recent change merged the window-scaler option and property, but forgot
that the option is float for some reason, while the property uses
double. This led to undefined behavior. Fix it by changing the option
to double too.
2016-09-20 01:25:50 +02:00
wm4 fb67db8b72 player: make --osc/--ytdl settable during playback
Setting the osc or ytdl properties will now load/unload the associated
scripts. (For ytdl this does not mean the currently played URL will be
reloaded.)

Also add a changelog entry for this, which also covers the preceding
work for --terminal.
2016-09-20 01:24:27 +02:00
wm4 bf5c97a6c3 options, command: simplify some option updates
Remove wrapper properties for OSD and video position updates, use the
new mechanism for them. We can mark the options directly. Update
behavior will work for more options (since I've casually marked more
affected options than the old less direct mechanism covered).
2016-09-19 20:16:44 +02:00
wm4 b62634c051 player: make --terminal freetly settable at runtime
So client API users don't have to care about whether to set this before
or after mpv_initialize().

We still don't enable terminal at any point before mpv_initialize(),
because reasons.

This also subtly changes some behavior how terminal options are applied
while parsing. This essentially reverts the behavior as it was reported
in issue #2588. Originally, I was hoping to get rid of the pre-parse
option pass, but it seems this is absolutely not possible due to the way
config and command line parsing are entangled. Command line options take
priority over configfile options, so they have to be applied later - but
we also want to apply logging and terminal options as specified on the
command-line, but _before_ parsing the config files. It has to be this
way to see config file error messages on the terminal, or to hide them
if --no-terminal is used. libmpv considerations also factor into this.
2016-09-19 19:54:54 +02:00
wm4 fe7db61035 options: slightly better option update mechanism
Extend the flag-based notification mechanism that was used via
M_OPT_TERM. Make the vo_opengl update mechanism use this (which, btw.,
also fixes compilation with OpenGL renderers forcibly disabled).

While this adds a 3rd mechanism and just seems to further the chaos, I'd
rather have a very simple mechanism now, than actually furthering the
mess by mixing old and new update mechanisms. In particular, we'll be
able to remove quite some property implementations, and replace them
with much simpler update handling. The new update mechanism can also
more easily refactored once we have a final mechanism that handles
everything in an uniform way.
2016-09-19 19:51:26 +02:00
wm4 32f235bcef options: remove some M_OPT_FIXED flags
--quiet can be always set - the playloop checks it whenever rendering
the status line. Nothing special about it.

The ytdl- options are simply refetched by the Lua script every time a
stream is opened, so it makes sense to be able to change them at runtime
as well.

The VO options don't have a real reason to be marked with it anymore.
2016-09-19 19:50:41 +02:00
wm4 2415b69572 player: more option/property consistency fixes
Some properties had a different type from their equivalent options (such
as mute, volume, deinterlace, edition). This wasn't really sane, as raw
option values should be always within their bounds. On the other hand,
these properties use a different type to reflect runtime limits (such as
range of available editions), or simply to improve the "UI" (you don't
want to cycle throuhg the completely useless "auto" value when cycling
the "mute" property).

Handle this by making them always return the option type, but also
allowing them to provide a "constricted" type, which is used for UI
purposes. All M_PROPERTY_GET_CONSTRICTED_TYPE changes are related to
this.

One consequence is that you can set the volume property to arbitrary
high values just like with the --volume option, but using the "add"
command it still restricts it to the --volume-max range.

Also deprecate --chapter, as it is grossly incompatible to the chapter
property. We pondered renaming it to --chapters, or introducing a more
powerful --range option, but concluded that --start --end is actually
enough.

These changes appear to take care of the last gross property/option
incompatibilities, although there might still be a few lurking.
2016-09-18 16:08:21 +02:00
wm4 9e972ed7d2 options: rename/deprecate --playlist-pos
Conflicts with the "playlist-pos" property. They're really a bit too
different, and since the --playlist-pos option is relatively new and
obscure, just rename it to get this out of the way.
2016-09-18 16:08:21 +02:00
wm4 79e20ff485 options: actually deprecate --mute=auto
Also, make it internally actually an alias to "no".
2016-09-18 16:08:21 +02:00
wm4 7fa26bfd9c options: kill M_OPT_GLOBAL flag
This meant "cannot be used as per-file option" (wrt. playlist items).
Doesn't make too much sense anymore, especially given how obscure
per-file options are.
2016-09-17 17:04:13 +02:00
wm4 5968a307d5 options: add --hwdec=yes as alias for --hwdec=auto
This also lets you just do "mpv --hwdec file.mkv", with the minor caveat
that the legacy syntax "--hwdec val" or "-hwdec val" (without "=") does
not work as expected anymore.
2016-09-15 14:50:38 +02:00
wm4 2b0c620b22 player: move builtin profiles to a separate file
Move the embedded string with the builtin profiles to a separate
builtin.conf file. This makes it easier to read and edit, and you can
also check it for errors with --include=etc/builtin.conf. (Normally
errors are hidden intentionally, because there's no way to output error
messages this early, and because some options might not be present on
all platforms or with all configurations.)
2016-09-15 14:50:38 +02:00
Philip Langdale 3f7e43c2e2 hwdec_cuda: Add trivial cuda-copy wrapper
The cuvid decoder already knows how to copy back to system memory
if NV12 frames are requested, and this will happen if the decoder
is used without the hwdec.

For convenience, let's add a wrapper hwdec so people don't have
to explicitly pick the cuvid decoder if they want this behaviour.
2016-09-11 10:46:22 +02:00
wm4 5e30e7a041 stream_dvd, stream_dvdnav: remove weird option parsing stuff
Same deal as with stream_bluray.

Untested because I don't give a fuck about your shitty DVDs.
2016-09-08 21:46:48 +02:00
wm4 35e8b6c1e6 options: drop unreferenced --bluray-angle option
Uh, what? It wasn't used at all. It was probably accidentally dropped at
one point, or it was never used at all. Whatever, who cares.
2016-09-08 21:02:31 +02:00
Philip Langdale 2048ad2b8a hwdec/opengl: Add support for CUDA and cuvid/NvDecode
Nvidia's "NvDecode" API (up until recently called "cuvid" is a cross
platform, but nvidia proprietary API that exposes their hardware
video decoding capabilities. It is analogous to their DXVA or VDPAU
support on Windows or Linux but without using platform specific API
calls.

As a rule, you'd rather use DXVA or VDPAU as these are more mature
and well supported APIs, but on Linux, VDPAU is falling behind the
hardware capabilities, and there's no sign that nvidia are making
the investments to update it.

Most concretely, this means that there is no VP8/9 or HEVC Main10
support in VDPAU. On the other hand, NvDecode does export vp8/9 and
partial support for HEVC Main10 (more on that below).

ffmpeg already has support in the form of the "cuvid" family of
decoders. Due to the design of the API, it is best exposed as a full
decoder rather than an hwaccel. As such, there are decoders like
h264_cuvid, hevc_cuvid, etc.

These decoders support two output paths today - in both cases, NV12
frames are returned, either in CUDA device memory or regular system
memory.

In the case of the system memory path, the decoders can be used
as-is in mpv today with a command line like:

mpv --vd=lavc:h264_cuvid foobar.mp4

Doing this will take advantage of hardware decoding, but the cost
of the memcpy to system memory adds up, especially for high
resolution video (4K etc).

To avoid that, we need an hwdec that takes advantage of CUDA's
OpenGL interop to copy from device memory into OpenGL textures.

That is what this change implements.

The process is relatively simple as only basic device context
aquisition needs to be done by us - the CUDA buffer pool is managed
by the decoder - thankfully.

The hwdec looks a bit like the vdpau interop one - the hwdec
maintains a single set of plane textures and each output frame
is repeatedly mapped into these textures to pass on.

The frames are always in NV12 format, at least until 10bit output
supports emerges.

The only slightly interesting part of the copying process is that
CUDA works by associating PBOs, so we need to define these for
each of the textures.

TODO Items:
* I need to add a download_image function for screenshots. This
  would do the same copy to system memory that the decoder's
  system memory output does.
* There are items to investigate on the ffmpeg side. There appears
  to be a problem with timestamps for some content.

Final note: I mentioned HEVC Main10. While there is no 10bit output
support, NvDecode can return dithered 8bit NV12 so you can take
advantage of the hardware acceleration.

This particular mode requires compiling ffmpeg with a modified
header (or possibly the CUDA 8 RC) and is not upstream in ffmpeg
yet.

Usage:

You will need to specify vo=opengl and hwdec=cuda.

Note that hwdec=auto will probably not work as it will try to use
vdpau first.

mpv --hwdec=cuda --vo=opengl foobar.mp4

If you want to use filters that require frames in system memory,
just use the decoder directly without the hwdec, as documented
above.
2016-09-08 16:06:12 +02:00
wm4 d4d8b3a4fc demux: do not access global options
Don't access MPOpts directly, and always use the new m_config.h
functions for accessing them in a thread-safe way.

The goal is eventually removing the mpv_global.opts field, and the
demuxer/stream-layer specific hack that copies MPOpts to deal with
thread-safety issues.

This moves around a lot of options. For one, we often change the
physical storage location of options to make them more localized,
but these changes are not user-visible (or should not be). For
shared options on the other hand it's better to do messy direct
access, which is worrying as in that somehow renaming an option
or changing its type would break code reading them manually,
without causing a compilation error.
2016-09-06 20:09:56 +02:00
wm4 1d9032f011 audio/out: deprecate "exclusive" sub-options
And introduce a global option which does this. Or more precisely, this
deprecates the global wasapi and coreaudio options, and adds a new one
that merges their functionality. (Due to the way the sub-option
deprecation mechanism works, this is simpler.)
2016-09-05 21:26:39 +02:00
wm4 9e6b9d8a98 vo_image: move to global options
This is a bit "special", because the config tree wants unique
m_sub_options pointers in the whole thing.
2016-09-05 21:04:55 +02:00
wm4 4ab860cddc options: add a mechanism to make sub-option replacement slightly easier
Instead of requiring each VO or AO to manually add members to MPOpts and
the global option table, make it possible to register them automatically
via vo_driver/ao_driver.global_opts members. This avoids modifying
options.c/options.h every time, including having to duplicate the exact
ifdeffery used to enable a driver.
2016-09-05 21:04:17 +02:00
wm4 4f263dce34 sd_lavc: enable teletext
Whitelisting supported codecs is (probably) still better than just
allowing everything, given the weird FFmpeg API. I'm also assuming
Libav doesn't even have the codec ID, but I didn't check.

Also add a --teletext-page option, since otherwise it decodes every
teletext page and shows them in succession.

And yes, we can't use av_opt_set_int() - instead we have to set it as
string. Because FFmpeg's option system is terrible.
2016-09-03 17:12:53 +02:00
wm4 a85eecfe40 ao_alsa: change sub-options to global options
Same deal as with vo_opengl.

Also edit the outdated information about multichannel output a little.
2016-09-02 21:21:47 +02:00
wm4 b2c84a91b6 options: deprecate --vo-defaults
With the conversion from sub-options to global options, this becomes
useless. This change also comes slightly too soon, because not all VOs
have been changed yet.
2016-09-02 21:21:47 +02:00
wm4 849480d0c9 vo_opengl: deprecate sub-options, add them as global options
vo_opengl sub-option were always rather annoying to handle. It seems
better to make them global options instead. This is simpler and easier
to use. The only disadvantage we are aware of is that it's not clear
that many/all of these new global options work with vo_opengl only.

--vo=opengl-hq is also deprecated.

There is extensive compatibility with the old behavior. One exception is
that --vo-defaults will not apply to opengl-hq (though with opengl it
still works). vo-cmdline is also dysfunctional and will be removed in a
following commit.

These changes also affect opengl-cb.

The update mechanism is still rather inefficient: it requires syncing
with the VO after each option change, rather than batching updates.
There's also no granularity (video.c just updates "everything", and if
auto-ICC profiles are enabled, vo_opengl.c will fetch them on each
update).

Most of the manpage changes were done by Niklas Haas <git@haasn.xyz>.
2016-09-02 21:21:47 +02:00
wm4 2c917219cf vo: use new option update mechanism
This is still rather basic.

run_reconfig() and run_control() update the options because it's needed
for panscan (and other video scaling options), and fullscreen, border,
ontop updates. In the old model, these options could be accessed only
while both playback thread and VO threads were locked  (i.e. during
synchronous calls like vo_control()), so this should be sufficient in
order not to miss any updates. In the future, a more fine-grained update
mechanism could be added to handle these updates "exactly".

x11_common.c contains an evil hack, as I see no reasonable way to handle
this properly. The VO thread can't "lock" the main thread, so this is
not simple.
2016-09-02 15:50:54 +02:00
wm4 1393d79417 command: fix or document some property/option consistency issues
Make some existing properties behave more like options. This mostly
means they don't deny access if the associated component is not active,
but redirects to the option.

One kind of fishy change is that we apply --brightness etc. only if
they're not set to the default value. This won't necessarily work with
--vo=xv, but affects only cases where 1. the Xv adapter has been changed
to non-defaults, and 2. the user tries to reset them with mpv by passing
e.g. --brightness=0. We don't care about Xv, and the noted use-case is
dumb, so this change is acceptable.
2016-09-01 20:57:33 +02:00
wm4 d32bee5f01 command: add options to property list
Now options are accessible through the property list as well, which
unifies them to a degree.

Not all options support runtime changes (meaning affected components
need to be restarted for the options to take effects). Remove from the
manpage those properties which are cleanly mapped to options anyway.
From the user-perspective they're just options available through the
property interface.
2016-09-01 20:00:43 +02:00
wm4 c55d859920 m_option: replace --no-video-aspect alias
Instead, add a hacky OPT_ASPECT option type, which only exists to accept
a "no" parameter, which in combination with the "--no-..." handling code
makes --no-video-aspect work again.

We can also remove the code in m_config.c, which only existed to make
"--no-aspect" (a deprecated alias) to work.
2016-08-31 22:17:21 +02:00
wm4 7dde096d8a m_config: introduce and use OPT_ALIAS for some options
OPT_ALIAS redirects the options at a higher level, instead of
introducing "duplicate" options with different name but same backing
storage. This uses the OPT_REPLACED mechanisms - only the deprecation
warning had to be made conditional. Note that e.g. --no-video still
works, because the "--no-..." redirection and OPT_ALIAS are orthogonal.

The deprecated --sub -> --sub-file alias had to be dropped, because it
essentially conflicts with --no-sub. If anyone complains, this could
probably still be undone by letting m_config_find_negation_opt do a
special mapping for --no-sub. (Which would be dumb, but simple and
effective.)
2016-08-31 22:16:19 +02:00
wm4 af1379c43d options: make mp_vo_opts options an actual sub-option group
Just a minor refactor along the planned option change. This commit will
make it easier to update (i.e. copy) the VO options without copying
_all_ options. For now, behavior should be equivalent, though.

(The VO options were put into a separate struct quite early - when all
global variables were removed from the source code. It wasn't clear
whether the separate struct would have any actual purpose, but it seems
it will now. Awesome, huh.)
2016-08-30 23:50:57 +02:00
wm4 5086b2d456 player: add option to disable video OSD
Normally, OSD can be disabled with --osd-level=0. But this also disables
terminal OSD, and some users want _only_ the terminal OSD. Add
--video-osd=no, which essentially disables the video OSD.

Ideally, it should probably be possible to control terminal and video
OSD levels independently, but that would require separate OSD timers
(and other state) for both components, so don't do it. But because the
current situation isn't too ideal, add a threat to the manpage that
might be changed in the future.

Fixes #3387.
2016-08-28 18:26:59 +02:00
rr- ed644b0d33 aspect: add --video-unscaled=downscale-big 2016-08-19 22:51:46 +02:00
wm4 f5bbb5aed2 player: add option to control duration of image display
The --image-display-duration option controls how long an image is
displayed. It's also possible to display the image forever (until manual
user interaction stops playback).

With this, the core drops the old method to "drain" video (i.e. waiting
for the last frame duration on end of playback). Instead, we reuse
MPContext.time_frame. The old mechanism was disabled for non-images
anyway.

Fixes #3425.
2016-08-17 22:46:48 +02:00
wm4 87190969a7 player: add --no-autoload-files option
Allt his auto-loading is getting annoying especially for testing.
2016-08-10 22:22:50 +02:00
wm4 062349ff5b player: add --audio-wait-open options
Complements the option added in the previous commit.
2016-08-09 17:09:29 +02:00
wm4 eab92cec60 player: add --audio-stream-silence
Completely insane that this has to be done. Crap for compensating HDMI
crap.
2016-08-09 17:09:29 +02:00
wm4 0b144eac39 audio: use --audio-channels=auto behavior, except on ALSA
This commit adds an --audio-channel=auto-safe mode, and makes it the
default. This mode behaves like "auto" with most AOs, except with
ao_alsa. The intention is to allow multichannel output by default on
sane APIs. ALSA is not sane as in it's so low level that it will e.g.
configure any layout over HDMI, even if the connected A/V receiver does
not support it. The HDMI fuckup is of course not ALSA's fault, but other
audio APIs normally isolate applications from dealing with this and
require the user to globally configure the correct output layout.

This will help with other AOs too. ao_lavc (encoding) is changed to the
new semantics as well, because it used to force stereo (perhaps because
encoding mode is supposed to produce safe files for crap devices?).
Exclusive mode output on Windows might need to be adjusted accordingly,
as it grants the same kind of low level access as ALSA (requires more
research).

In addition to the things mentioned above, the --audio-channels option
is extended to accept a set of channel layouts. This is supposed to be
the correct way to configure mpv ALSA multichannel output. You need to
put a list of channel layouts that your A/V receiver supports.
2016-08-04 20:49:20 +02:00
wm4 efa9fe8edf options: un-restrict --audio-delay
Not a real reason to restrict its value range.
2016-08-04 11:27:15 +02:00
wm4 546f7472fb options: add vp9 to --hwdec-codecs 2016-07-30 15:47:51 +02:00
wm4 77e1e8e38e audio: refactor mixer code and delete mixer.c
mixer.c didn't really deserve to be separate anymore, as half of its
contents were unnecessary glue code after recent changes. It also
created a weird split between audio.c and af.c due to the fact that
mixer.c could insert audio filters. With the code being in audio.c
directly, together with other code that unserts filters during runtime,
it will be possible to cleanup this code a bit and make it work like the
video filter code.

As part of this change, make the balance code work like the volume code,
and add an option to back the current balance value. Also, since the
balance semantics are unexpected for most users (panning between the
audio channels, instead of just changing the relative volume), and there
are some other volumes, formally deprecate both the old property and the
new option.
2016-07-17 19:21:28 +02:00
Aman Gupta 588b2f48e5 videotoolbox: add --hwdec=videotoolbox-copy for h/w accelerated decoding with video filters 2016-07-15 01:01:17 +02:00
wm4 995c47da9a audio: drop --softvol=no and --softvol=auto
Drop the code for switching the volume options and properties between
af_volume and AO volume controls. interface-changes.rst mentions the
changes in detail.

Do this because this was exceedingly complex and had other problems as
well. It was also very hard to test. It's just not worth the trouble.

Some leftovers like AOCONTROL_HAS_PER_APP_VOLUME will be removed at a
later point.

Fixes #3322.
2016-07-09 18:31:18 +02:00
wm4 e40851ea22 options: deprecate --heartbeat-cmd
It's useless. --heartbeat-interval is also considered deprecated, but
this is not made explicit.
2016-06-29 18:10:15 +02:00
wm4 70b3561270 video: add --hwdec=auto-copy mode
This uses the normal autoprobing rules like "auto", but rejects anything
that isn't flagged as copying data back to system memory.

The chunk in command.c was dead code, so remove it instead of updating
it.
2016-05-11 16:20:13 +02:00
maniak1349 7d9eab15f0 win32: make taskbar progress indication optional
Add --taskbar-progress command line option and property which controls taskbar
progress indication rendering in Windows 7+. This option is on by default and
can be toggled during playback.

This option does not affect the creation process of ITaskbarList3. When the
option is turned off the progress bar is just hidden with TBPF_NOPROGRESS.

Closes #2535
2016-05-08 17:05:20 +02:00
wm4 062493fa7e x11: rename inappropriate --x11-bypass-compositor=never option
This obviously made no sense.
2016-05-07 12:14:56 +02:00
wm4 55846641ea x11: add --x11-bypass-compositor=always
Also add missing documentation for fs-only, and correct the default.
2016-05-06 19:57:17 +02:00
wm4 8a26e139af x11: extend --x11-bypass-compositor with fs-only option
The "fs-only" choice sets the _NET_WM_BYPASS_COMPOSITOR to 1 if the
window is fullscreened, and 0 otherwise. (0 is specified to be the
implicit default - i.e. no change is requested in windowed mode.)

In particular, change the default to "fs-only".

Fixes #2582.
2016-05-02 21:21:53 +02:00
maniak1349 70f64f3ca9 options: add --fit-border video option
Flag that is set by default. Reseting it will result in mpv trying to fit
client area with video instead of the whole window with border and
decorations on the screen.
Marked as (Windows only) for now until it's implemented on other platforms.
2016-04-30 18:55:09 +02:00
wm4 3a8058658d sd_add: replace --sub-ass=no with --ass-style-override=strip
--sub-ass=no / --ass=no still work, but --ass-style-override=strip is
preferred now. With this change, --ass-style-override can control all
the types of style overriding.
2016-04-30 14:25:23 +02:00
wm4 3706918311 vo_opengl: D3D11VA + ANGLE interop
This uses ID3D11VideoProcessor to convert the video to a RGBA surface,
which is then bound to ANGLE. Currently ANGLE does not provide any way
to bind nv12 surfaces directly, so this will have to do.

ID3D11VideoContext1 would give us slightly more control about the
colorspace conversion, though it's still not good, and not available
in MinGW headers yet.

The video processor is created lazily, because we need to have the coded
frame size, of which AVFrame and mp_image have no concept of. Doing the
creation lazily is less of a pain than somehow hacking the coded frame
size into mp_image.

I'm not really sure how ID3D11VideoProcessorInputView is supposed to
work. We recreate it on every frame, which is simple and hopefully
doesn't affect performance.
2016-04-27 13:49:47 +02:00
wm4 2720e60ad0 x11: do not set _NET_WM_BYPASS_COMPOSITOR by default
It's pretty "unfriendly" and causes too many issues. (Probably. At least
they're more obvious to a user than e.g. broken frame timing.)

Potentially we could apply heuristics like applying this only on
fullscreen, but let's not. It's up to the user to configure this to
get best results.

Fixes #2997.
2016-04-03 19:42:07 +02:00
Kevin Mitchell a7110862c8 vd_lavc: add d3d11va hwdec
This commit adds the d3d11va-copy hwdec mode using the ffmpeg d3d11va
api. Functions in common with dxva2 are handled in a separate decode/d3d.c
file. A future commit will rewrite decode/dxva2.c to share this code.
2016-03-30 09:01:27 -07:00
Jan Ekström 5843392db5 Add a mediacodec decoder hwdec wrapper
Does the same thing as the rpi one - makes fallback possible by
pretending that h264_mediacodec is a hwdec.
2016-03-25 21:35:59 +01:00
James Ross-Gowan cd50ebba36 ipc: rename --input-unix-socket to --input-ipc-server
JSON IPC works on Windows now, and although the transports for each
plaform have similar characteristics, they unfortunately have different
names (Unix domain sockets on Linux/Unix vs. named pipes on Windows.)

Hopefully this change better reflects the purpose of the option too,
since with --input-ipc-server, mpv acts as an IPC server that can
service many simultaneous clients (as opposed to --input-file, which can
only do one-to-one IPC.)
2016-03-23 23:15:26 +11:00
Kevin Mitchell 084162d6fe dxva2: add interop (non-copyback) hwdec_type
This always falls back to software decoding right now. VO support will be added
in future commits.
2016-02-17 06:59:02 -08:00
wm4 3d9e1ad363 player: add --external-file option
Mostly intended for use with --lavfi-complex.
2016-02-08 21:18:35 +01:00
wm4 c0de087ba1 player: add complex filter graph support
See --lavfi-complex option.

This is still quite rough. There's no support for dynamic configuration
of any kind. There are probably corner cases where playback might freeze
or burn 100% CPU (due to dataflow problems when interaction with
libavfilter).

Future possible plans might include:
- freely switch tracks by providing some sort of default track graph
  label
- automatically enabling audio visualization
- automatically mix audio or stack video when multiple tracks are
  selected at once (similar to how multiple sub tracks can be selected)
2016-02-05 23:19:56 +01:00
wm4 1aa2ae5404 options: set fs=yes by default on RPI, and change RPI defaults handling
The main reason for changing the fullscreen default is that not doing it
would change the vo_rpi default behavior with the previous commit.
2016-02-05 18:05:38 +01:00
wm4 d53942dd79 audio: remove default preference for libdcadec
Not needed anymore, because the decoder was merged with FFmpeg.
2016-02-01 20:09:02 +01:00
wm4 ac966ded11 audio: change downmix behavior, add --audio-normalize-downmix
This is probably the 3rd time the user-visible behavior changes. This
time, switch back because not normalizing seems to be the more expected
behavior from users.
2016-01-20 17:14:04 +01:00
wm4 930b0d1cf6 audio: change --audio-channels default back to stereo
Too many problems. Well, actually it's just Linux audio systems which
cause problems, and exclusive audio access on other platforms.

In any case, it seems you have to do some manual configuration if you
want multichannel audio output.
2016-01-20 17:12:08 +01:00
Oliver Freyermuth 8128b7c8e2 options: add "service_name" as display tag.
This is labeled as "name of the service in broadcasting (channel name)"
and exported as a generic tag by avformat-demuxers, notably lavf
when handling mpegts-streams from DVB.
2016-01-14 00:36:53 +01:00
wm4 172ce98433 options: raise maximum value for --audio-samplerate
Helps with testing.
2016-01-05 19:15:21 +01:00
wm4 d5f29a3c36 options: exclude 360 from --video-rotate range
It's indeed completely useless. Pointed out in #2647.
2016-01-02 14:31:46 +01:00
wm4 0710ced079 options: add --audio-file-paths
Requested. It works like --sub-paths. This will also load audio files
from a "audio" sub directory in the config file (because the same code
as for subtitles is used, and it also had such a feature).

Fixes #2632.
2015-12-25 13:17:11 +01:00
wm4 475fe453cc stream: drop PVR support
This is only for specific Hauppage cards. According to the comments in
who is actively using this feature. Get it out of the way.

Anyone who still wants to use this should complain. Keeping this code
would not cause terribly much additional work, and it could be restored
again. (But not if the request comes months later.)
2015-12-10 22:53:02 +01:00
wm4 159eb3f962 win32: add option to set VO MMCSS profile
This was requested.
2015-12-06 19:20:23 +01:00
wm4 516e7d19da x11: request bypassing compositor
Maybe this is a good idea. Also add an option to disable it again, for
the sake of testing.

Fixes #2502.
2015-11-18 21:48:29 +01:00
wm4 0ec35fa111 videotoolbox: make decoder format customizable
Because apparently there's no ideal universally working format.

The weird OpenGL texture format for kCVPixelFormatType_32BGRA is from:

http://stackoverflow.com/questions/22077544/draw-an-iosurface-to-an-opengl-context

(Which apparently got it from the linked Apple example code.)
2015-11-17 21:21:19 +01:00
wm4 70df1608d6 player: handle rebasing start time differently
Most of this is explained in the DOCS additions.

This gives us slightly more sanity, because there is less interaction
between the various parts. The goal is getting rid of the video_offset
entirely.

The simplification extends to the user API. In particular, we don't need
to fix missing parts in the API, such as the lack for a seek command
that seeks relatively to the start time. All these things are now
transparent.

(If someone really wants to know the real timestamps/start time, new
properties would have to be added.)
2015-11-16 22:47:17 +01:00
wm4 017f3d0674 options: enable mpeg2 hw decoding by default if hw decoding is requested
We didn't include this codec in the whitelist because of past problems
with vdpau and interlacing. (I can't reproduce any problems anymore.)
2015-11-05 17:31:07 +01:00
wm4 3ad03f6673 options: handle terminal/logging settings eagerly
Update msg.c state immediately if a terminal or logging setting is set.
Until now, this was delayed until mp[v]_initialize() was called. When
using the client API, you could easily miss logged error messages, even
when logging was initialized early on by calling
mpv_request_log_messages().

(Properties can't be used for this either, because properties do not
work before mpv_initialize().)
2015-11-04 21:49:54 +01:00
wm4 aaec2aba38 player: add audio drop/duplicate mode
Not very robust in the moment.
2015-10-27 20:56:46 +01:00
wm4 d1a46c2c32 options: remove --use-text-osd 2015-10-24 19:09:35 +02:00
Joschka Tillmanns 1ee8ce75f1 options: add support for client certificate authentication
Client certificates are supported by ffmpeg as documented here:

  > https://www.ffmpeg.org/ffmpeg-protocols.html#tls

Signed-off-by: wm4 <wm4@nowhere>
2015-10-20 22:55:27 +02:00
ChrisK2 78caf6ae86 ytdl: Remove DASH hacks, use DASH by default
Thanks to rcombs, ffmpeg now properly supports DASH and we can
remove our hacks for it and use it by default whenever
available. If you don't like this for whatever reason, you
can get the "normal" streams back with --ytdl-format=best .

Closes #579
Closes #1321
Closes #2359
2015-10-11 00:35:35 +02:00
wm4 8e654d3f78 video: remove user-controllable PTS sorting (--pts-association-mode)
Useless. Sometimes it might be useful to make some extremely broken
files work, but on the other hand --no-correct-pts is sufficient for
these cases.

While we still need some of the code for AVI, the "auto" mode in
particular inflated the size of the code.
2015-10-06 18:19:20 +02:00
wm4 54fbda2ba4 audio: add option for falling back to ao_null
The manpage entry explains this.

(Maybe this option could be always enabled and removed. I don't quite
remember what valid use-cases there are for just disabling audio
entirely, other than that this is also needed for audio decoder init
failure.)
2015-10-05 19:12:23 +02:00
wm4 ee63c9c210 video: replace vf_format outputlevels option with global option
The vf_format suboption is replaced with --video-output-levels (a global
option and property). In particular, the parameter is removed from
mp_image_params. The mechanism is moved to the "video equalizer", which
also handles common video output customization like brightness and
contrast controls.

The new code is slightly cleaner, and the top-level option is slightly
more user-friendly than as vf_format sub-option.
2015-09-29 21:12:26 +02:00
wm4 1dd7b7bddc video: remove VDA support
VideoToolbox is preferred. Now that FFmpeg released 2.8, there's no
reason to support VDA anymore. In fact, we had a bug that made VDA not
useable with older FFmpeg versions in some newer mpv releases.

VideoToolbox is supported even on slightly older OSX versions, and if
not, you still can run mpv without hw decoding.
2015-09-28 22:03:14 +02:00
wm4 392ae68e5f options: fix --no-config
This was completely broken. It was checked manually in some config
loading paths, so it appeared to work. But the intention was always to
completely disable reading from the normal config dir. This logic was
broken in commit 2263f37d.

The manual checks are actually redundant, and are not needed if
--no-config is implemented properly - remove them.

Additionally, the change to load the libmpv defaults from an embedded
profile also failed to set "config=no". The option is marked as not
being settable by a config file, and the libmpv default profile is
parsed as a config file, so this option was rejected. Fix it by removing
the CONF_NOCFG flag. (Alternatively, m_config_set_profile() could be
changed not to set the "config file" flag by default, but I'm not
bothering with this.)
2015-09-05 15:33:19 +02:00
wm4 82f0d373fb video: make container vs. bitstream aspect ratio configurable
Utterly idiotic bullshit.

Fixes #2259.
2015-08-30 23:04:17 +02:00
wm4 602105dbda player: add --playlist-pos option
Oddly often requested.
2015-08-22 22:08:17 +02:00
Stian Eikeland 8a9fc9398d options: sub-file replaces subfile, instead of sub 2015-08-21 00:15:24 +02:00
wm4 031555fbe6 player: add display sync mode
If this mode is enabled, the player tries to strictly synchronize video
to display refresh. It will adjust playback speed to match the display,
so if you play 23.976 fps video on a 24 Hz screen, playback speed is
increased by approximately 1/1000. Audio wll be resampled to keep up
with playback.

This is different from the default sync mode, which will sync video to
audio, with the consequence that video might skip or repeat a frame once
in a while to make video keep up with audio.

This is still unpolished. There are some major problems as well; in
particular, mkv VFR files won't work well. The reason is that Matroska
is terrible and rounds timestamps to milliseconds. This makes it rather
hard to guess the framerate of a section of video that is playing. We
could probably fix this by just accepting jittery timestamps (instead
of explicitly disabling the sync code in this case), but I'm not ready
to accept such a solution yet.

Another issue is that we are extremely reliant on OS video and audio
APIs working in an expected manner, which of course is not too often
the case. Consequently, the new sync mode is a bit fragile.
2015-08-10 18:48:45 +02:00
Niklas Haas e9182c5c7c
options: remove the period at the end of "No file."
Since we're on the topic of consistency, I've seen multiple users
complain about the presence of this period, which does not really match
other programs' behavior.
2015-08-09 21:45:37 +02:00
Martin Herkt fbb22039f3
options: move program name to end of window title
Fixes #2188
2015-08-09 20:14:16 +02:00
wm4 beb4f8316a demux: add options to control maximum queue size
Add --demuxer-max-packets and --demuxer-max-bytes, which control the
maximum size of the packet queue. These can be helpful to avoid
excessive memory usage.

Memory usage is the reason why there's a limit in the first place. If a
file is more or less broken, and audio and video don't line up, the
decoders will fill up the packet queue trying to read more audio or
video, and the maximum sizes are required to avoid unbounded memory
allocation. Being able to override the maximum sizes is useful; either
for restricting memory usage further, or enlarging the sizes when
attempting to play various broken files.
2015-08-05 23:41:29 +02:00
wm4 775d816096 demux: remove options to control minimum packet queue size
Remove --demuxer-readahead-packets and --demuxer-readahead-bytes. These
were a bit useless. They could force a minimum packet queue size, but
controlling the queue size with --demuxer-readahead-secs is much nicer.

It's fairly certain nobody ever used these options.
2015-08-05 23:38:23 +02:00
Sebastien Zwickert 31b5a211f4 hwdec: add VideoToolbox support
VDA is being deprecated in OS X 10.11 so this is needed to keep hwdec working.
The code needs libavcodec support which was added recently (to FFmpeg git,
libav doesn't support it).

Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2015-08-05 17:47:30 +02:00
wm4 55879a8c0f cache: make backbuffer size configurable
Allow setting an arbitrary amount, instead of the fixed 50%.

This is nto striclty backwards compatible. The defaults don't change,
but the --cache/--cache-default options now set the readahead portion.
So in practice, users who configured this until now will see the
double amount of cache being used, _plus_ the 75MB default backbuffer
will be in use.
2015-07-22 23:55:10 +02:00
wm4 57043d9269 sub: add option for stretching image subtitles to screen
Probably makes users happy who want bitmap subtitles to show up in the
screen margins, and stops them from doing idiotic crap with vf_expand.

Fixes #2098.
2015-07-18 14:36:17 +02:00
wm4 57efe9089c player: extend --hls-bitrate option
Fixes #2116.
2015-07-13 13:34:58 +02:00
wm4 23220db924 player: disable seeking even if the cache is enabled
Until now, if a stream wasn't seekable, but the stream cache was enabled
(--cache), we've enabled seeking anyway. The idea was that at least
short seeks would typically fall within the cache. And if not, the user
was out of luck and terrible things happened. In other words, it was
unreliable.

Be stricter about it and remove this behavior. Effectively, this will
for example disable seeking in piped data.

Instead of trying to be clever, add an --force-seekable option, which
will always enable seeking if the user really wants it.
2015-07-08 22:04:35 +02:00
wm4 92727e7332 vo_opengl_cb, vo_opengl: add option for preloading hwdec context
See manpage additions. This is mainly useful for vo_opengl_cb, but can
also be applied to vo_opengl.

On a side note, gl_hwdec_load_api() should stop using a name string, and
instead always use the IDs. This should be cleaned up another time.
2015-07-07 15:05:32 +02:00
wm4 1d29177c5c options: cleanup hwdec name mappings
Now there's a "canonical" table for mapping the names, that other code
can use, without having to rely too much on option code magic.

Also, use the central HWDEC constants, instead of magic values. (There
used to be semi-ok reasons to do this, but now it makes no sense
anymore.)
2015-07-07 15:05:32 +02:00
wm4 57048c7393 audio: add --audio-spdif as new method for enabling passthrough
This provides a new method for enabling spdif passthrough. The old
method via --ad (--ad=spdif:ac3 etc.) is deprecated. The deprecated
method will probably stop working at some point.

This also supports PCM fallback. One caveat is that it will lose at
least 1 audio packet in doing so. (I don't care enough to prevent this.)

(This is named after the old S/PDIF connector, because it uses the same
underlying technology as far as the higher level protoco is concerned.
Also, the user should be renamed that passthrough is backwards.)
2015-06-05 22:42:59 +02:00
wm4 e8a1d35e9c options: remove --slave-broken
It has been deprecated for ages.
2015-05-27 18:01:26 +02:00
wm4 ae46833836 player: use an array for stream ID options and such
This makes the code slightly more generic.
2015-05-22 21:00:24 +02:00
wm4 450af05338 options: rename --media-title option
Conflicts with the property.
2015-05-22 20:03:14 +02:00
wm4 a165a61415 audio: make softvol scale cubic
This brings the volume control closer to what is percepted as linear
volume change.

Adjust the --softvol-max default to roughly the old maximum (roughly
doubles the gain).
2015-05-22 19:16:42 +02:00
wm4 68bbab0e42 audio: change range of volume option/property
Now --volume takes an absolute volume, meaning it doesn't depend on
--softvol-max. 0 is still silence, and 100 now always means unchanged
volume. The OSD and the "volume" property are changed accordingly.

Also raise the minimum value of --softvol-max. A value below 100 makes
no sense and breaks the OSD.
2015-05-22 18:35:03 +02:00
wm4 eb296d4fde options: --loop without argument means looping forever
Adding a "yes" choice makes the option parser consider this option as a
multi-state flag option, and without argument "yes" is implicitly
selected. "yes" is made an alias for "inf", so it will loop infinitely.

As a negative side effect, the old syntax "-loop inf" does not work
anymore. Since this is ambiguous, the option parser prefers interpreting
the "inf" as filename.

Fixes #1970.
2015-05-22 14:56:26 +02:00
wm4 24f98d1aaf video: add hevc to whitelist of hwdec codecs
This means if --hwdec is used, and hardware decoding is supported for
HEVC, it's actually used.
2015-05-14 20:17:23 +02:00
wm4 f9e2d5026e player: add --force-window=immediate mode
This creates the window before the first file is loaded. This was
requested a bunch of times, but on the other hand a change to make this
behavior the default was reverted some time ago, because other users
hated it.
2015-05-08 21:47:39 +02:00
wm4 6a03357b71 options: fix typo in variable name 2015-05-03 14:44:42 +02:00
wm4 1982fedca6 options: remove --leak-report
Use the environment variable instead.
2015-05-02 19:03:28 +02:00
wm4 72373bb5ae screenshots: prefix default template with "mpv-"
So that the user realizes where they come from, or can find them at all.
This was a common complaint, and this is the most lazy solution. Better
suggestions for a default template are welcome.
2015-05-01 21:51:10 +02:00
wm4 60958ddf9b screenshots: add --screenshot-directory option
The plan is to use this to change the screenshot default location in
pseudo-gui mode.
2015-05-01 21:51:09 +02:00
wm4 95a0488ac2 ytdl: force "best" format by default
If the --ytdl-format option is not used, force the "best" format. Do
this because youtube-dl is going to change its default format to one
that will trigger the (partially broken) DASH support in our own code.

Fixes #1867.
2015-04-26 19:52:28 +02:00
wm4 72e505a944 player: add --window-scale option
Requested. Works similar to the property with the same name.
2015-04-24 23:27:12 +02:00
wm4 e9ca0b1522 demux_mkv: move global options to the demuxer
The options don't change, but they're now declared and used privately by
demux_mkv.c. This also brings with it a minor refactor of the subpreroll
seek handling - merge the code from playloop.c into demux_mkv.c. The
change in demux.c is pretty much equivalent as well.
2015-04-23 19:21:17 +02:00
wm4 c5654e4005 options: don't restrict --hr-seek-demuxer-offset
This was limited to 99 for unknown reasons.
2015-04-20 20:03:05 +02:00
wm4 e6d7e55012 options: --hr-seek=always is the same as --hr-seek=yes
It seems this choice was never documented. "always" is actually older
than "yes", so just declare it a compatibility value for "yes". (Also
move it before "always" in the C code to make this clear.)
2015-04-15 14:27:40 +02:00
Marcin Kurczewski f43017bfe9 Update license headers
Signed-off-by: wm4 <wm4@nowhere>
2015-04-13 12:10:01 +02:00
wm4 5a2825ec35 video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is
pretty much equivalent.

(On a side note, it seems --video-stereo-mode can't be removed, because
it controls whether to "reduce" stereo video to mono, which is also the
default. In fact I'm not sure how this should be handled at all.)
2015-04-02 23:54:08 +02:00
wm4 00230fab6a options: make --video-rotate use range 0-360
Include 360 in the range and don't stop at 359. This makes cycling
through the range in 90° steps less awkward.
2015-03-31 00:09:03 +02:00
wm4 27715b7dd1 video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format.
They are rather obscure and not needed often, so it's better to get them
out of the way. In particular, this gets rid of the semi-complicated
logic in command.c (most of which was needed for OSD display and the
direct feedback from the VO). It removes the duplicated color-related
name mappings.

This removes the ability to write the colormatrix and related
properties. Since filters can be changed at runtime, there's no loss of
functionality, except that you can't cycle automatically through the
color constants anymore (but who needs to do this).

This also changes the type of the mp_csp_names and related variables, so
they can directly be used with OPT_CHOICE. This probably ended up a bit
awkward, for the sake of not adding a new option type which would have
used the previous format.
2015-03-31 00:09:03 +02:00
wm4 205a2ef169 csputils: unify names for colorspace/etc. names 2015-03-31 00:09:03 +02:00
wm4 8fff125422 RPI support
This requires FFmpeg git master for accelerated hardware decoding.
Keep in mind that FFmpeg must be compiled with --enable-mmal. Libav
will also work.

Most things work. Screenshots don't work with accelerated/opaque
decoding (except using full window screenshot mode). Subtitles are
very slow - even simple but huge overlays can cause frame drops.

This always uses fullscreen mode. It uses dispmanx and mmal directly,
and there are no window managers or anything on this level.

vo_opengl also kind of works, but is pretty useless and slow. It can't
use opaque hardware decoding (copy back can be used by forcing the
option --vd=lavc:h264_mmal). Keep in mind that the dispmanx backend
is preferred over the X11 ones in case you're trying on X11; but X11
is even more useless on RPI.

This doesn't correctly reject extended h264 profiles and thus doesn't
fallback to software decoding. The hw supports only up to the high
profile, and will e.g. return garbage for Hi10P video.

This sets a precedent of enabling hw decoding by default, but only
if RPI support is compiled (which most hopefully it will be disabled
on desktop Linux platforms). While it's more or less required to use
hw decoding on the weak RPI, it causes more problems than it solves
on real platforms (Linux has the Intel GPU problem, OSX still has
some cases with broken decoding.) So I can live with this compromise
of having different defaults depending on the platform.

Raspberry Pi 2 is required. This wasn't tested on the original RPI,
though at least decoding itself seems to work (but full playback was
not tested).
2015-03-29 16:09:56 +02:00
wm4 9b5a7241e8 input: remove Linux joystick support
Why did this exist in the first place? Other than being completely
useless, this even caused some regressions in the past. For example,
there was the case of a laptop exposing its accelerometer as joystick
device, which led to extremely fun things due to the default mappings of
axis movement being mapped to seeking.

I suppose those who really want to use their joystick to control a media
player (???) can configure it as mouse device or so.
2015-03-24 16:04:44 +01:00
wm4 1e659a9f0f input: remove classic LIRC support
It's much easier to configure remotes as X11 input devices.
2015-03-24 16:04:44 +01:00
wm4 53f24ac5ad audio: prefer libdcadec by default if present
If you enable this library in FFmpeg, you probably really want it to be
used.
2015-03-23 18:46:26 +01:00
wm4 9b77666783 options: introduce --cache=yes choice
I think this is what I alwass missed ever since I found the MPlayer
cache options: a way to enable the cache on local files with the default
settings, whatever they are.
2015-03-12 23:51:41 +01:00
wm4 1eeeab2e14 cache: bump default size to 150MB
(Well, almost 150MB.)
2015-03-12 23:43:45 +01:00
Philip Sequeira 6172e843cd options: add M_OPT_FILE to new options that are missing it
Fixes shell completion.
2015-03-07 22:19:38 +01:00
wm4 1eb533afb3 options: handle choice -> flag fallback automatically
In the past it happened quite often that flag options (yes/no) were
changed to choice options (yes/no/some more). The problem with this was
that while flag options don't need a parameter, this wasn't the case
with choice options. A hack was introduced to compensate for this:
setting M_OPT_OPTIONAL_PARAM on the option, and an empty string ("") was
added as choice, so that the choice could be used like a flag. So, for
example, "--mute" would set the choice "".

Fix this by 1. not requiring a parameter if there's a "yes" choice, and
2. redirect an empty parameter to "yes". The effect is that a choice
option with the choices ["yes", "no"] is pretty much equivalent to a
flag option.
2015-02-27 18:31:24 +01:00
wm4 b7bb0de1d9 demux: bump default demuxer queue sizes
Now that we have fast stream switching, we can bump these sizes, as the
queues cause no delay in switching anymore.

Of course, the fast stream switching works for mkv and mp4 only. Other
formats will incur a quite terrible delay especially in network mode,
which this commit changes to 10 seconds. Let's see if someone
complains...
2015-02-27 12:44:40 +01:00
Thiago Kenji Okada 633147c959 ytdl: add "--ytdl-params" option
This option allows the user to pass non-supported options directly to
youtube-dl, such as "--proxy URL", "--username USERNAME" and
'--password PASSWORD".

There is no sanity checking so it's possible to break things (i.e.
if you pass "--version" mpv exits with random JSON error).

Signed-off-by: wm4 <wm4@nowhere>
2015-02-25 22:32:48 +01:00
wm4 2308b3a2a6 sub: mess with styling defaults, change --ass-use-margins behavior
Now --ass-use-margins doesn't apply to normal subtitles anymore. This is
probably the inverse from the mpv behavior users expected so far, and
thus a breaking change, so rename the option, that the user at least has
a chance to lookup the option and decide whether the new behavior is
wanted or not.

The basic idea here is:
- plain text subtitles should have a certain useful defalt behavior,
  like actually using margins
- ASS subtitles should never be broken by default
- ASS subtitles should look and behave like plaintext subtitles if
  the --ass-style-override=force option is used

This also subtly changes --sub-scale-with-window and adds the --ass-
scale-with-window option. Since this one isn't so important, don't
bother with compatibility.
2015-02-16 20:04:29 +01:00
wm4 b63503db04 options: mark some more options as runtime-settable
Most of these are in the category of options which can be changed
without issues, but which will not take effect immediately.
2015-02-16 20:04:05 +01:00
wm4 4c283d5f8d osd: make it possible to have different subtitle vs. OSD defaults
Until now, they used exactly the same defaults for the styling options.
The defaults were shared, so it was impossible to have different
defaults. Change this. This requires duplicating the full default
struct, even for settings that are the same. The list of options is
still shared, though.
2015-02-16 20:03:56 +01:00
wm4 aee0978d50 player: add a --loop=force mode
Requested. See manpage additions.

This also makes the magical loop_times constants slightly saner, but
shouldn't change the semantics of any existing --loop option values.
2015-02-12 22:41:45 +01:00
wm4 f3ae845fd2 options: add --network-timeout
Not quite sure if this actually works as intended.

Fixes #1566.
2015-02-06 17:01:35 +01:00
wm4 ffe894ec0a options: change --msg-level option
Make it accept "," as separator, instead of only ":". Do this by using
the key-value-list parser. Before this, the option was stored as a
string, with the option parser verifying that the option value as
correct. Now it's stored pre-parsed, although the log levels still
require separate verification and parsing-on-use to some degree (which
is why the msg-level option type doesn't go away).

Because the internal type changes, the client API "native" type also
changes. This could be prevented with some more effort, but I don't
think it's worth it - if MPV_FORMAT_STRING is used, it still works the
same, just with a different separator on read accesses.
2015-02-06 16:48:52 +01:00
wm4 cfd3d5b520 player: do not autoload audio with audio files, enable autoloading
Autoload external audio files only if there's at least a video track
(which is not coverart pseudo-video).

Enable external audio file autoloading by default. Now that we actively
avoid doing stupid things like loading an external audio file for an
audio-only file, this should be fine.

Additionally, don't autoload subtitles if a subtitle is played.
Although you currently can't play subtitles without audio or video,
it's disturbing and stupid that the player might load subtitle files
with different extension and then fail.
2015-02-05 22:14:17 +01:00
wm4 c3c714b059 player: remove --fixed-vo
In ancient times, this was needed because it was not default, and many
VOs had problems with it. But it was always default in mpv, and all VOs
are required to deal with it. Also, running --fixed-vo=no is not useful
and just creates weird corner cases. Get rid of it.
2015-02-03 23:11:08 +01:00
wm4 de81cb07f4 options: allow more options to be changed at runtime
This allows setting these options directly (without going through
properties, or with going through the "options/" property). The
documented restrictions apply to all of these: changes do not get
immediately applied, unlike with corresponding properties.

This is in reaction to #1548.
2015-02-03 23:11:08 +01:00
wm4 c07e046bfa player: add external audio file auto-loading
Apparently some people want this. Not enabled by default.

Fixes #967.
2015-02-02 21:23:12 +01:00
wm4 9b8d3acc8b options: list correct default value for --screenshot-template
Make the default value part of the option metadata, instead of doing
this in the screenshot code. Makes more sense with --list-options and
the command.c option metadata properties.
2015-01-26 11:38:23 +01:00
wm4 96f7c96da0 msg: add --log-file option
This allows getting the log at all with --no-terminal and without having
to retrieve log messages manually with the client API. The log level is
hardcoded to -v. A higher log level would lead to too much log output
(huge file sizes and latency issues due to waiting on the disk), and
isn't too useful in general anyway. For debugging, the terminal can be
used instead.
2015-01-26 11:31:02 +01:00
wm4 f033eaff9b options: make --hls-bitrate=max the default
The previous default ("no") seemed to be equivalent to "min" in practice
(though it might depend on the website, which is even worse).

Better just select the best stream by default.
2015-01-26 03:58:13 +01:00
wm4 6b24cb2756 win32: remove check for SetPriorityClass()
This function is always available, which is reflected by the fact that
the configure check doesn't actually bother to check for its existence.
Instead, MinGW and Cygwin imply it. The check was probably "needed" when
the priority code was still in a separate source file.

Remove the check, and use _WIN32 for testing for the win32 API (in a
bunch of other places too).
2015-01-20 15:18:51 +01:00
wm4 eb5a83e1c1 x11: add --on-all-workspaces option and property
Fixes #1469.
2015-01-16 23:38:47 +01:00
wm4 1883b7cc0c player: add --autofit-smaller option
Fixes #1472.

(Maybe these options should have been named --autofit-max and
--autofit-min, but since --autofit-larger already exists, use
--autofit-smaller for symmetry.)
2015-01-16 22:30:41 +01:00
wm4 067bb9605c sub: add option to not scale subtitles with window
--sub-scale-by-window=no attempts to keep subs always at the same pixel
size.

The implementation is a bit all over the place, because it compensates
already done scaling by an inverse scale factor, but it will probably do
its job.

Fixes #1424. (The semantics and name of --sub-scale-with-window are
kept, and this adds a new option - the name is confusingly similar, but
it's actually analogue to --osd-scale-by-window.)
2015-01-05 19:18:08 +01:00
wm4 7297c88998 player: capitalize --display-tags items
Tags keys are case-insensitive. Before commit 8048374a, the casing of
whatever FFmpeg returned was used (it was quite random). But since the
change, the values in --display-tags decides. Consider this an
accidental feature, and make the output nicer by capitalizing
the tag names.
2014-12-31 21:07:50 +01:00
wm4 8048374a5c player: filter tags, add --display-tags option
This attempts to increase user-friendliness by excluding useless tags.
It should be especially helpful with mp4 files, because the FFmpeg mp4
demuxer adds tons of completely useless information to the metadata.

Fixes #1403.
2014-12-29 22:51:18 +01:00
wm4 af3bbb800d audio: make native channel count the default instead of stereo downmix
This should work well with most audio APIs, except ALSA. A long-winded
explanation is provided how to make ALSA multichannel output work.

All other AOs should have no such problems. Of course it's possible
that previously unknown issues arise, because I assume that enabling
multichannel audio is actually relatively rare.

This also disables codec downmix by default, which could change the
audio output due to different mixing in the codec and libavresample.

Fixes #1313.
2014-12-15 17:14:23 +01:00
Avi Halachmi (:avih) 39e04e9294 options: deprecate 'lua' based options/dirs for 'script'
- --lua and --lua-opts change to --script and --script-opts
- 'lua' default script dirs change to 'scripts'
- DOCS updated

- 'lua-settings' dir was _not_ modified

The old lua-based names/dirs still work, but display a warning.

Signed-off-by: wm4 <wm4@nowhere>
2014-12-15 04:39:56 +01:00