Commit Graph

45285 Commits

Author SHA1 Message Date
Kevin Mitchell 6666b25b73 ao_wasapi: enable packed 24 bit output 2017-07-09 13:46:13 -07:00
Kevin Mitchell a081c8d372 audio/out: correct copy length in ao_read_data_converted
Previously, the entire convert_buffer was being copied to the desination without
regard to the fact that it may be packed and therefore smaller.

The allocated conversion buffer was also way to big

bytes * (channels * samples) ** 2

instead of

bytes * channels * samples
2017-07-09 13:46:13 -07:00
Kevin Mitchell 03abd704ec ao_wasapi: reorder channels and samplerates to speed up search
This shouldn't affect which are chosen, but it should speed up the search by
putting more common configurations earlier so that a working sample format and
sample rates can be found sooner obviating the need to search them for each
iteration of the outer loops.
2017-07-09 13:46:13 -07:00
Kevin Mitchell 7568715563 ao_wasapi: minor cosmetic fixes 2017-07-09 13:44:09 -07:00
Kevin Mitchell 2514e542e5 ao_wasapi: try correct initial format
The loop to select the native wasapi_format for the incoming audio was
not breaking correctly when it found the most desirable format. It
therefore executed completely leaving the least desirable format (u8) as
the choice.

fixes #4582
2017-07-09 13:43:54 -07:00
Niklas Haas f4178b90c7
vo_opengl: describe the remainder passes after user shaders
On optional hook points, we store to a temp FBO and then read from it
again to complete any operations that may still be left (e.g.
sigmoidization after MAIN/LINEAR).

In theory this mechanism should be reworked to avoid the temporary FBO
until the next time we actually need one - and also skip redundant
passes if we the next thing we need *is* a FBO - but both are those are
tricky. Anyway, in the meantime, at least we can label the
(semi-)redundant passes that get generated when using user shaders.
2017-07-09 08:48:29 +02:00
Niklas Haas 45a2e1ce0d
manpage: add a description for --scale
For some reason this wasn't actually documented.
2017-07-09 01:13:52 +02:00
Niklas Haas 8c0162e762
vo_opengl: support tone-mapping-param for `clip`
This just indicates a fixed linear coefficient to multiply into the
signal, similar to the old option --target-brightness (but the inverse
thereof). Good for testing purposes, which is why I added it. (This also
corresponds somewhat to what zimg does)
2017-07-07 21:00:21 +02:00
wm4 03596ac551 audio: drop AF_FORMAT_S24
This is the last sample format that was only in mpv and not in FFmpeg
(except the spdif special formats). It was a huge pain, even if the
removed code in af_lavrresample is pretty small after all.

Note that this drops S24 from the ao_coreaudio AOs too. I'm not sure
about the impact, but I expect it doesn't matter.

af_fmt_change_bytes() was unused as well, so remove that too.
2017-07-07 17:56:22 +02:00
wm4 300097536d ao_pcm: drop AF_FORMAT_S24 usage
I'd actually be somewhat interested in supporting this, as it could help
testing the S24 conversion code. But then again it's only a pain,
there's no immediate need, and it would require new options to make
ao_pcm.c select this output format at all.
2017-07-07 17:56:18 +02:00
wm4 2e1eb8b37c ao_oss: drop AF_FORMAT_S24 usage
Can't test / don't care.
2017-07-07 17:56:18 +02:00
wm4 adbb429296 ao_sndio: drop AF_FORMAT_S24 usage
I can't test it, so I'm dropping it without replacement. If anyone is
interested in readding support, it would be done like the ao_alsa.c
change.
2017-07-07 17:56:18 +02:00
wm4 4e11549593 ao_wasapi_utils: be slightly more clever when converting channel map 2017-07-07 17:56:18 +02:00
wm4 951c1a4907 ao_wasapi: drop use of AF_FORMAT_S24
Do conversion directly, using the infrastructure that was added before.

This also rewrites part of format negotation, I guess.

I couldn't test the format that was used for S24 - my hardware does not
report support for it. So I commented it, as it could be buggy. Testing
this with the wasapi_formats[] entry for 24/24 uncommented would be
appreciated.
2017-07-07 17:56:18 +02:00
wm4 4cb5e53ada ao_alsa: drop use of AF_FORMAT_S24
Instead of the infrastructure added in the previous commit to do the
conversion within the AO.

If this is used, and snd_pcm_status_get_avail() returns more frames than
snd_pcm_write*() actually accepts, you will get some nice audio
corruption.

Also, this mutates the data passed via play(), which is rather fishy,
but sort of doesn't matter for now. Surely this will cause unintended
bugs and WTFs.
2017-07-07 17:56:18 +02:00
wm4 90dd229871 audio/out: add helper code to do 24 bit conversion in AO
I plan to remove the S24 sample formats in mpv. It seems like we should
still support this _somehow_ in AOs though. So the idea is to convert
the data to more obscure representations (that would not be useful for
filtering etc. anyway) within the AO.

This commit adds helper to enable this. ao_convert_fmt is meant to
provide mechanisms for this, rather than a generic audio format
description (as the latter leads only to overly generic misery). The
conversion also supports only cases which we think will be needed at
all.

The main advantage of this approach is that we get S24 out of sight,
and that we could support other crazy formats (like S20). The main
disadvantage is that usually S32 will be selected (if both S32 and S24
are available), and there's no user control to force S24. That doesn't
really matter though, and at worst makes testing harder or will lead
to unpleasant arguments with audiophiles (they'd be wrong anyway).

ao_convert_fmt.pad_lsb is ignored, although if we ever find a case in
which playing S32 with data in the LSBs breaks when playing it as padded
24 bit format. (For example, WAVEFORMATEXTENSIBLE recommends setting the
unused bits to 0 if wValidBitsPerSample implies LSB padding.)
2017-07-07 17:54:05 +02:00
Niklas Haas 7c1db05cbb
vo_opengl: rework --opengl-dumb-mode
It's now possible to request non-dumb mode as a user, even when not
using any non-dumb features. This change is mostly intended for testing,
so I can easily switch between dumb and non-dumb mode on default
settings. The default behavior is unaffected.
2017-07-07 14:46:46 +02:00
Niklas Haas 9a49a35453 vo_opengl: correct off-by-one in scale=oversample
This caused a single pixel shift to the top-left, introduced in e3e03d0f3.
2017-07-07 13:47:47 +02:00
wm4 ae4c0134ed vo_opengl: do not use vaapi-over-GLX
This backend is selected if vaapi is available, but vaapi-over-EGL is
not. This causes various issues around the forced RGB conversion, which
is done with fixed, usually incorrect parameters.

It seems the existing auto probing check is too weak, and doesn't really
prevent it from getting loaded. Fix this by adding a flag to not ever
load this during auto probing.

I'm still not deleting it, because it's useful for testing on nvidia
machines.

See #4555.
2017-07-07 12:29:29 +02:00
Niklas Haas 9c9d3e7b25
vo_opengl: prevent desat from blowing up for negative
The current algorithm blew up when the color was negative, such as the
case when downscaling with dscale=mitchell or other algorithms that
introduce negative ringing. The simplest solution is to just slightly
change the calculation to force both parameters to be in-range.
2017-07-07 11:26:30 +02:00
wm4 6a59d7342f demux_lavf: remove --demuxer-lavf-cryptokey option
Was at least somewhat broken, and is misleading. I don't really have an
idea why FFmpeg has two AVOptions here anyway. We don't need to care,
and I'm only aware of 1 user trying this option ever.

See #4579.
2017-07-06 18:08:04 +02:00
Avi Halachmi (:avih) fa857ac7bc js: utils.getenv(): fix crash on undefined var 2017-07-06 18:11:24 +03: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 01d8aad1e8 demux_lavf: potentially fix --demuxer-lavf-cryptokey
The first time I saw a user try to use this option, and apparently it
didn't work. I'm not exactly sure why, but the code seems to be broken
anyway. Apart from not doing any error checking (neither mallocs nor
warning the user against invalid input), it forgets to add a 0
terminator.

Use the corresponding AVOption instead, which probably works.

See #4579.
2017-07-06 16:25:42 +02:00
wm4 d5702d3b95 ad_lavc, vd_lavc, sd_lavc: consistently use avcodec_free_context()
Instead of various ad-hoc ways to achieve the same thing. (The API was
added only later.)
2017-07-06 16:25:42 +02:00
Niklas Haas aa2bdec26c
vo_opengl: also expose NAME_mul for user shaders
This is exposed so that bjin/mpv-prescalers can use textureGatherOffset
for performance.

Since there are now quite a lot of parameters where it isn't quite clear
why they're all defined, add a paragraph to the man page that explains
them a bit.
2017-07-06 11:30:33 +02:00
Niklas Haas ef43854b34
vo_opengl: prevent division by zero in shader
In theory the max() should clamp it away anyway but I believe division
by zero is UB so just avoid it altogether.
2017-07-06 05:59:08 +02:00
Niklas Haas 9e04018f92
vo_opengl: add --tone-mapping-desaturate
This helps prevent unnaturally, weirdly colorized blown out highlights
for direct images of the sunlit sky and other way-too-bright HDR
content. I was debating whether to set the default at 1.0 or 2.0, but
went with the more conservative option that preserves more detail/color.
2017-07-06 05:43:00 +02:00
Niklas Haas 6f77444f6c
vo_opengl: get rid of weird double-bind in pass_read_fbo
This logic doesn't really make sense. copy_img_tex already binds the
texture, so why would we bind it a second time? Furthermore, nothing
actually uses this return value. Must have been some left-over artifact
of a previous iteration of this function. Anyway, it's harmless, just
nonsensical. So remove it.
2017-07-05 11:22:00 +02:00
Niklas Haas 6e25934a8c vo_opengl: remove redundant left-over line
The pass_read_fbo immediately below replaces it
2017-07-05 11:21:58 +02:00
Niklas Haas ad0d6caac7 vo_opengl: use textureGatherOffset for polar filters
This is more efficient on my machine (nvidia), but only when applied to
groups of exactly 4 texels. So we switch to the more efficient
textureGather for groups of 4. Some notes:

- textureGatherOffset seems to be faster than textureGather by a
  non-negligible amount, but for some reason, textureOffset is still
  slower than a straight-up texture
- textureGather* requires GLSL 400; and at least on nvidia, this
  requires actually allocating a GL 4.0 context.
- the code in opengl/common.c that clamped the GLSL version to 330 is
  deprecated, because the old user shader style has been removed
  completely in the meantime
- To combat the growing complexity of the polar sampling code, we drop
  the antiringing functionality from EWA shaders completely, since it
  never really worked well for EWA to begin with. (Horrific artifacting)
2017-07-05 11:21:58 +02:00
wm4 b387f82aa4 vd_lavc: fix build with old FFmpeg/Libav versions
Seems like AV_HWACCEL_FLAG_IGNORE_LEVEL was introduced much earlier than
AVCodecContext.hwaccel_flags.
2017-07-04 15:24:09 +02:00
James Ross-Gowan 91079c0e2b w32_common: use sent messages to wake up the Win32 thread
Instead of PostMessage, use SendNotifyMessage from the SendMessage
family of functions to wake up the Win32 thread from the VO thread. When
a message is sent rather than posted between threads, it ends up in a
different queue which is processed before posted messages and can be
processed in more places. This prevents a playback glitch when clicking
on the titlebar, but not moving the window. With PostMessage-based
wakeups, VOCTRLs could be delayed for up to 500ms after the user clicks
on the titlebar, but with SendNotifyMessage, they still complete in
under a millisecond.

Also, instead of handling WM_USER, process the dispatch queue before
every message. This ensures the dispatch queue is processed as soon as
possible. WM_NULL is used to wake up the window procedure in case there
are no other messages being processed.
2017-07-04 23:08:40 +10:00
wm4 abe01fd18a vd_lavc: remove unused hwaccel support code
Was used by old hwaccel implementations.
2017-07-04 15:01:03 +02:00
wm4 e76d56d57b vd_lavc: make --vd-lavc-check-hw-profile=no work for generic hwaccels
This sets AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH, which some hwaccels
using the new generic API respect. These do profile selection in
libavcodec, so it can be controlled only with an external flag, instead
of in mpv code like it used to be done.
2017-07-04 14:58:34 +02:00
wm4 bd356333c7 d3d: fix behavior with deprecated FFmpeg J pixel formats
They have been deprecated for a decade, yet you're forced to explicitly
deal with them at every step, or they will break your shit.

FFmpeg insists on keeping them, because libavfilter is too stupid to
deal with color ranges properly. Ridiculous.
2017-07-04 14:06:31 +02:00
wm4 46dc15a220 command: add missing change notification for playlist-shuffle
Fixes #4573.
2017-07-04 13:11:52 +02:00
Niklas Haas 5df3576856
vo_opengl: make the pass info mechanism more robust
- change asserts to silent exits
- check all pointers before use
- move the p->pass initialization code to the right place

This should hopefully cut down on the amount of crashing by making the
code fundamentally more robust, while also fixing a concrete issue where
opengl-cb failed to initialize p->pass.
2017-07-03 17:14:06 +02:00
Ricardo Constantino 4a2f268f67
etc/encoding_profiles: remove deprecated usage of *-add 2017-07-03 13:47:33 +01:00
James Ross-Gowan 8d02983b4d w32_common: use SWP_NOSENDCHANGING when resizing child
This seems to reduce glitches when resizing a --wid program (or it could
be a placebo.) Since we don't need the WM_WINDOWPOSCHANGING handler in
--wid mode, it should be fine.
2017-07-03 21:29:17 +10:00
Niklas Haas 8854a2bef6
filter_kernels: add radius cutoff functionality
This allows filter functions to be prematurely cut off once their
contributions start becoming insignificant. This effectively prevents
wasted GPU time sampling from parts of the function that are essentially
reduced to zero by the window function, providing anywhere from a 10% to
20% speedup. (5700μs -> 4700μs for me)
2017-07-03 11:51:37 +02:00
Ricardo Constantino 41b3b11669
ytdl_hook: add pre-parsed chapters, if available
Available since 2017.05.07 but only on certain extractors.
2017-07-02 21:15:15 +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
Xu Zhao 1097c1416f x11: add 128x128 sized icon support 2017-07-02 13:07: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 66478cff14 bstr: short-circuit bstr_equals() 2017-07-02 12:43:18 +02:00
Raúl Peñacoba d39f3bcd3a
misc/json: avoid redundant condition
Closes #4415
2017-07-01 15:09:21 +01:00
Raúl Peñacoba 71f97d9cf3
demux/demux: avoid redundant condition
Closes #4414
2017-07-01 15:09:12 +01:00