Commit Graph

1519 Commits

Author SHA1 Message Date
Sergey Kvachonok 01717dcd2c vo_wayland: Add "multimedia" keyboard key bindings.
libxkbcommon keysyms are the same as X11 keysyms (sans prefix),
so I simply copied the missing subsection from x11_common.c.

Signed-off-by: Sergey Kvachonok <ravenexp@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
2014-11-29 19:13:47 +01:00
wm4 9e10f8ccbb vo_opengl: enable fancy-downscaling by default for opengl-hq 2014-11-29 00:04:01 +01:00
wm4 4ce7a2ede9 vo_opengl: disable fancy-downscaling for anamorphic video
Includes some arbitrary minor refactoring.
2014-11-29 00:04:00 +01:00
wm4 4af24daf2c win32: add screen offset when handling overlarge windows
MS Windows doesn't allow windows larger than the screen, so we include
a hack to make the window smaller. This hack recenters the window (what
else would it do?).

It didn't account for the virtual offset of the current screen, and it
was reported that it forces the window to the first screen.

Should fix #1292.
2014-11-28 22:11:54 +01:00
wm4 5db162231e vo_direct3d: check whether D3DFMT_A8 is available
I suspect this is what is happening in github issue #1265 (at least
partially).

If D3DFMT_A8 is not available, fall back to RGBA. This is less efficient
in general, so we normally want to avoid it.
2014-11-27 20:05:29 +01:00
wm4 4495044947 gl_video: minor simplification
Not needed anymore.
2014-11-27 19:48:15 +01:00
Niklas Haas b584802813 vo_opengl: Linearize non-RGB sRGB files correctly (eg. JPEG)
Signed-off-by: wm4 <wm4@nowhere>
2014-11-26 21:44:36 +01:00
wm4 cc54377463 Do not call strerror()
...because everything is terrible.

strerror() is not documented as having to be thread-safe by POSIX and
C11. (Which is pretty much bullshit, because both mandate threads and
some form of thread-local storage - so there's no excuse why
implementation couldn't implement this in a thread-safe way. Especially
with C11 this is ridiculous, because there is no way to use threads and
convert error numbers to strings at the same time!)

Since we heavily use threads now, we should avoid unsafe functions like
strerror().

strerror_r() is in POSIX, but GNU/glibc deliberately fucks it up and
gives the function different semantics than the POSIX one. It's a bit of
work to convince this piece of shit to expose the POSIX standard
function, and not the messed up GNU one.

strerror_l() is also in POSIX, but only since the 2008 standard, and
thus is not widespread.

The solution is using avlibc (libavutil, by its official name), which
handles the unportable details for us, mostly. We avoid some pain.
2014-11-26 21:21:56 +01:00
wm4 3fe57e3cb6 gl_common: factor context creation
Always create the context in mpgl_init(), instead of doing it when
mpgl_config_window() is called the first time. This is a small step
towards cleaning up the GL backend interface, and adding other things
like perhaps GLES support, or a callback-driven backend for libmpv.
2014-11-26 20:48:18 +01:00
Niklas Haas 7e62f2b052 vo_opengl: Reword comment in shader
I didn't quite understand this comment after looking at the code again
months later, so I reworded it for better clarity.
2014-11-26 20:31:59 +01:00
wm4 fc0ea3a541 vo_opengl: make operator precedence explicit
More readable.
2014-11-26 20:03:20 +01:00
wm4 cebb3ba645 vo_opengl: fix srgb with certain inputs
Sampling from the source texture and scaling must always be done
separately in this mode.

Fix suggested by haasn.

Still looks a bit wrong, though.
2014-11-26 20:02:55 +01:00
wm4 46dc5709c8 vo_opengl: something
Insert explanation here.

Fixes #1023.
2014-11-26 18:22:57 +01:00
Stefano Pigozzi 4590c198e6 cocoa: don’t hand over view memory ownership to libmpv clients 2014-11-25 14:45:13 +01:00
wm4 9d91776d0d x11: fix crash
Broken by previous commit. Oops.
2014-11-23 13:58:03 +01:00
wm4 c9fdf4308c x11: fix crash with --wid=0 and vo_xv/vo_x11
But seriously, don't use --wid=0, don't use vo_xv, and _especially_
don't use vo_x11.

Fixes #1284.
2014-11-23 10:54:34 +01:00
wm4 86b521f7df Silence some Coverity warnings
None of this really matters.
2014-11-21 09:59:58 +01:00
wm4 8a1d5e91ad vd_lavc: flush frames before uninitializing hw decoder
This way, no surfaces are in use when uninitializing the hw decoders,
which might help with -copy hw decoders (normal hw decoding is not
affected).
2014-11-20 16:48:03 +01:00
wm4 b8ac594af0 vo_direct3d: fix texture-memory sub-option, extend it
This sub-option was turned into a flag when the sub-option parser was
changed to the generic one (probably accidentally). Turn it into a
proper choice-option.

Also, adjust what the options do. Though none of this probably makes
much sense; the default should work, and if it doesn't, the GPU/driver
is probably beyond help.
2014-11-18 16:30:32 +01:00
wm4 d484cb3f32 vo_opengl: allow setting different filters for downscaling 2014-11-14 15:22:37 +01:00
wm4 e9792326e3 mp_image: slightly better image params verbose info 2014-11-12 19:30:59 +01:00
wm4 4136531343 video: move formatting of image parameters to separate function 2014-11-12 19:30:59 +01:00
wm4 509997ec12 vf: minor simplification
Remove the extra vf_chain.output field - there's absolutely no need for
it, because there is always a last filter which will buffer the output.

For some reason, vf_chain.last was never set, which we now need to fix
too.
2014-11-12 19:30:59 +01:00
Rudolf Polzer 4f63a812de ao_lavc, vo_lavc: Fix crashes in case of multiple init attempts.
When initialization failed, vo_lavc may cause an irrecoverable state in
the ffmpeg-related structs. Therefore, we reject additional
initialization attempts at least until we know a better way to clean up
the mess.

ao_lavc currently cannot be initialized more than once, yet it's good to
do consistent changes there as well.

Also, clean up uninit-after-failure handling to be less spammy.
2014-11-12 12:16:07 +01:00
wm4 481ab94c4e vf_sub: fix previous commit
The previous fix breaks another obscure case: if the second vf_sub adds
margins, the image is accidentally not extended, which would return in
an assertion failure when returning the bogus image.
2014-11-11 19:26:43 +01:00
wm4 599a4a8769 vf_sub: don't crash if no subtitle context is available
Happens with --vf=sub,sub (only the first one gets the context).
2014-11-11 18:47:21 +01:00
wm4 67e0230905 encode: don't segfault when bailing out due to resolution change
Somehow this code expects lastimg is always set.
2014-11-11 17:59:49 +01:00
wm4 d8cd768ed0 vo_opengl: don't reset user-set gamma when using vo_cmdline 2014-11-11 10:48:54 +01:00
wm4 3d7d1f3f26 video/out: minor simplification to event query function
The "clear" parameter is confusing and useless.
2014-11-09 10:01:16 +01:00
wm4 4235aab897 mp_image: check memory allocation 2014-11-08 16:10:04 +01:00
James Ross-Gowan 68ecbdf920 w32_common: open window menu on Alt+Space
Since mpv doesn't call TranslateMessage, this must be done manually.

Should fix #1254
2014-11-08 12:16:14 +01:00
wm4 249e8f6a54 Revert "w32_common: don't override alt+space"
This reverts commit d859549424.

Going to apply the alternative fix through PR #1256, which came just
some seconds after pushing the reverted commit. The reverted commit
was reported as not actually working.
2014-11-08 12:14:29 +01:00
wm4 d859549424 w32_common: don't override alt+space
Apparently, stealing this from the WM is bad form, just like with F10.

Fixes #1254.
2014-11-08 12:06:44 +01:00
wm4 01141198be vo_opengl: initialize renderer after setting size
This silences the warning:

video/out/gl_video.c:1091:51: runtime error: division by zero

when running with clang -fsanitize=undefined. Division by zero is legal
according to IEEE, but I guess clang doesn't care about standard. While
triggering this warning isn't actually avoided in all cases, it's
avoided in the common case and also makes people shut up about it.
2014-11-07 15:28:12 +01:00
Kevin Mitchell 83aab1d4be vo/x11: implement VOCTRL_GET_DISPLAY_NAMES with xrandr names (e.g., "LVDS1")
XRRGetOutputInfo contains a "name" element which corresponds to to the
display names given to the user by the "xrandr" command line
utility. Copy it into the xrandr_display struct for each display.
On VOCTRL_GET_DISPLAY_NAMES, send a copy of the names
of the displays spanned by the mpv window on.
2014-11-07 01:14:03 -08:00
wm4 97b4b4c8e0 vo_wayland: drop redundant "const" 2014-11-07 09:28:58 +01:00
wm4 68ad0fce1f vo_vaapi: fix broken error checks 2014-11-07 09:28:47 +01:00
wm4 a7686e86ff video: remove swapped-endian image format aliases
Like the previous commit, this removes names only, not actual support
for these formats.
2014-11-05 01:52:20 +01:00
wm4 fce77c05f5 vo_wayland: don't use endian-specific defines
Instead, use the native-endian alias, and switch the wayland format
depending on the target platform's endian.

This drops support for swapped-endian formats, but I think that is ok.
Not only are the affected formats rather ancient and backwards, but
using swapped formats probably does not make any sense for performance
either.

Untested.
2014-11-05 01:52:20 +01:00
wm4 91471deecc video: remove aliases for some rarely referenced image formats
These formats are still supported; you just can't reference them via a
defined constants directly. They are now handled via the generic
passthrough.

(If you want to use such a format, you either have to add the entry
back, or use AV_PIX_FMT_* directly.)
2014-11-05 01:52:19 +01:00
wm4 5fc29e459f video: add image format test program 2014-11-05 01:52:19 +01:00
wm4 7333bc6536 video: passthrough unknown AVPixelFormats
This is a rather radical change: instead of maintaining a whitelist of
FFmpeg formats we support, we automatically support all formats.

In general, a format which doesn't have an explicit IMGFMT_* name will
be converted to a known format through libswscale, or will be handled
by code which can treat pixel formats in a generic way using the pixel
format description, like vo_opengl.

AV_PIX_FMT_UYYVYY411 is a special-case. It's packed YUV with chroma
subsampling by 4 in both directions. Its component order is documented
as "Cb Y0 Y1 Cr Y2 Y3", meaning there's one UV sample for 4 Y samples.
This means each pixel uses 1.5 bytes (4 pixels have 1 UV sample, so
4 bytes + 2 bytes). FFmpeg can actually handle this format with its
generic mechanism in an extremely awkward way, but it doesn't work for
us. Blacklist it, and hope no similar formats will be added in the
future.

Currently, the AV_PIX_FMT_*s allowed are limited to a numeric value of
500. More is not allowed, and there are some fixed size arrays that need
to contain any possible format (look for IMGFMT_END dependencies).

We could have this simpler by replacing IMGFMT_* with AV_PIX_FMT_*
through the whole codebase. But for now, this is better, because we
can compensate for formats missing in Libav or older FFmpeg versions,
like AV_PIX_FMT_RGB0 and others.
2014-11-05 01:52:19 +01:00
wm4 9548f63943 video: handle endian detection in a more generic way
FFmpeg has only a AV_PIX_FMT_FLAG_BE flag, not a LE one, which causes
problems for us: we want to have the LE flag too, so code can actually
detect whether a format is non-native endian. Basically, we want to
reconstruct the LE/BE suffix all AV_PIX_FMT_*s have.

Doing this is hard due to the (messed up) way AVPixFmtDescriptor works.
The worst is AV_PIX_FMT_RGB444: this group of formats describe an
endian-independent access (since no component actually spans 2 bytes,
you only need byte accesses with a fixed offset), so we have to go
through some pain.
2014-11-05 01:41:35 +01:00
wm4 3a50bbf563 video: refuse to allocate image data for hwaccel formats
Makes no sense.
2014-11-05 01:41:35 +01:00
wm4 ffe9c03502 video: get hwaccel flag from pixdesc 2014-11-05 01:41:34 +01:00
wm4 bebfaae666 vo_opengl: minimal EGL on X11 support
Pretty useless and only good for testing.

Does not include any form of GLES support.
2014-11-04 01:41:37 +01:00
wm4 dc1d851c92 x11: rely on the Atom cache
XInternAtom() has a 64 entry hash table to avoid network accesses. Rely
on this cache, instead of caching these manually.
2014-11-03 23:01:27 +01:00
wm4 416c86f3cb command: add window-minimized property (X11 only)
More or less requested by #1237.

Should be simple to extend this to other backends.
2014-11-02 20:55:07 +01:00
wm4 4e2574f025 command: make window-scale property observable
Add a generic mechanism to the VO to relay "extra" events from VO to
player. Use it to notify the core of window resizes, which in turn will
be used to mark all affected properties ("window-scale" in this case) as
changed.

(I refrained from hacking this as internal command into input_ctx, or to
poll the state change, etc. - but in the end, maybe it would be best to
actually pass the client API context directly to the places where events
can happen.)
2014-11-02 20:53:56 +01:00
Stefano Pigozzi 98b1f861cb cocoa: fix fullscreen delay when paused
NSDisableScreenUpdates came to hunt me in the end and when mpv was paused, it
did wait for a frame that never came (because of interaction with the live
resizing code)!
2014-11-01 17:29:10 +01:00