Commit Graph

1672 Commits

Author SHA1 Message Date
wm4 460ef9c7a4 wayland: implement key modifiers
Includes shift, ctrl, alt, meta.
2015-01-12 16:41:00 +01:00
wm4 10532b99e5 wayland: don't compute absurd window size
For some reason, schedule_resize() can be called with everything set to
0. The code couldn't handle wl->window.aspect set to 0, converting NaNs
to integers. Just work this around.

(I have no idea what I'm doing. This is probably a corner case caused
by my broken-ish wayland setup.)
2015-01-12 15:21:26 +01:00
wm4 a8df0bbf22 x11: explicitly query map status when waiting for map event
For some reason, mpv sometimes does not get a MapNotify event with
GtkSocket embedding. This happens maybe 1 out of 10 times. I'm not sure
how this can happen - it certainly shouldn't. Since I was not able to
find the cause, and causes an apparent "deadlock", here's a lazy hack to
fix the misbehavior.
2015-01-12 12:15:27 +01:00
wm4 fc95678d8d x11: support XEmbed
Seems to work with GtkSocket and passing the gtk_socket_get_id() value
via "wid" option to mpv.

One caveat is that using <tab> to move input focus from mpv to GTK does
not work. It seems we would have to interpret <tab> ourselves in this
case. I'm not sure if we really should do this - it would probably
require emulating some other typical conventions too. I'm not sure if an
embedder could do something about this on the toolkit level, but in
theory it would be possible, so leave it as is for now.
2015-01-12 12:08:48 +01:00
wm4 2e531aaf14 vo: don't synchronize when seeking
Don't use vo_control() for sending VOCTRL_RESET when starting a seek.
This means vo_seek_reset() won't wait until the VO actually processed
VOCTRL_RESET. It happens asynchronously instead.

The impact of this change should be minimal, unless the VO is somehow
too busy (like blocking on vsync).
2015-01-12 05:14:41 +01:00
wm4 e5f2072364 command: change properties added in previous commit
Make their meaning more exact, and don't pretend that there's a
reasonable definition for "bits-per-pixel". Also make unset fields
unavailable.

average_depth still might be inconsistent: for example, 10 bit 4:2:0 is
identified as 24 bits, but RGB 4:4:4 as 12 bits. So YUV formats
seemingly drop the per-component padding, while RGB formats do not.
Internally it's consistent though: 10 bit YUV components are read as
16 bit, and the padding must be 0 (it's basically like an odd fixed-
point representation, rather than a bitfield).
2015-01-10 19:13:16 +01:00
Niklas Haas 286340d7d0 video: Add sigmoidal upscaling to avoid ringing artifacts
This avoids issues when upscaling directly in linear light, and is the
recommended way to upscale images according to imagemagick.

The default slope of 6.5 offers a reasonable compromise between
ringing artifacts eliminated and ringing artifacts introduced by
sigmoid-upscaling. Same goes for the default center of 0.75.
2015-01-09 03:18:21 +01:00
xylosper a4c0e254a3 vo_opengl_cb: make mpv_opengl_cb_render() return left frames
Instead of error code which was not helpful because it's always 0,
mpv_opengl_cb_render() returns the number of left frames in the
frame queue now.
2015-01-08 21:32:22 +01:00
xylosper e66acd52af vo_opengl_cb: use vo's drop_count instead of internal counter
This commit makes it possible to query dropped frames by opengl-cb
through vo-drop-frame-count property.
2015-01-08 21:15:24 +01:00
xylosper 5bb3b1b4cf vo: add functions to increment drop_count
Add two functions which increment drop_count thread-safely.
This is for the commit followed.
2015-01-08 21:15:09 +01:00
xylosper 5b4d587ede vo_opengl_cb: introduce frame queue
The previous implementation of opengl-cb kept only latest flipped frame.
This can cause massive frame drops because rendering is done asynchronously
and only the latest frame can be rendered.

This commit introduces frame queue and releated options to opengl-cb.

frame-queue-size: the maximum size of frame queue (1-100, default: 1)
frame-drop-mode: behavior when frame queue is full (pop, clear, default: pop)

The frame queue holds delayed frames and drops frames if the frame queue is
overflowed with next method:

'pop' mode: drops all the oldest frames overflown.
'clear' mode: drops all frames in queue and clear it.

With default options(frame-queue-size=1:frame-drop-mode=pop),
opengl-cb behaves in the same way as previous implementation effectively.

For frame-queue-size > 1, opengl-cb tries to calls update() without waiting
next flip_page() in order to consume queued frames.

Signed-off-by: wm4 <wm4@nowhere>
2015-01-08 18:50:25 +01:00
wm4 348ea46537 win32: minor simplification
The events parameter is not needed here and won't ever be.
2015-01-08 18:32:23 +01:00
wm4 f6e466585a vo_opengl: don't crash win32 backend with NULL events
vo_opengl was crashing since f811348d because it passed NULL for the
events parameter to vo_control. Normally the parameter should not be
NULL, so add a hack to account for this. In particular, we should
handle the events that are returned. For the call in preinit() we
skip this, but it most likely has no meaning anyway, because in this
stage no window is visible yet.
2015-01-08 18:30:19 +01:00
wm4 88c6f18209 vo_opengl_cb: fix a typo 2015-01-08 16:54:15 +01:00
wm4 41f6c15df5 vo_opengl_cb: allow changing debug option at runtime
This was always supposed to work.

Just add the option declaration. Normally I'm not a fan of duplicating
such things, but in this case it's (still) harmless.
2015-01-08 13:36:09 +01:00
wm4 f52ec079b2 vo_opengl_cb: fix flipped rendering
Oops.
2015-01-08 02:19:12 +01:00
wm4 d6aac7f930 vo_opengl: gl_lcms: implement change detection for memory profiles
This affects OSX, where memory profiles are updated e.g. on fullscreen
switches. The profile most likely doesn't change, but the LUT will
be generated and reloaded anyway.

Somewhat of a regression from commit f811348.

Fixes #1439.
2015-01-08 01:03:09 +01:00
wm4 ae8a91d6b6 vo_opengl: gl_lcms: fix potential dangling pointer issue
If icc-path is set, but the thing is replaced with a memory profile,
then p->icc_path would point to deallocated memory.

Also, the NULL checks are unnecessary.
2015-01-08 00:56:21 +01:00
wm4 02dbd41ae0 vo_direct3d: fix shader colormatrix generation
It was accidentally broken in d42d60bc1.
2015-01-07 22:08:20 +01:00
wm4 f61b8b312d win32: request UTF-16 API variants, Vista+ APIs, and COM C macros
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.
2015-01-07 21:42:44 +01:00
wm4 5f398831d2 x11: always use glXGetProcAddressARB()
glXGetProcAddress() is outdated, and as far as I know doesn't give all
the guarantees the "new" ARB function gives.

Probably doesn't matter too much, because until now it always appeared
to work. On the other hand, since this function is (bogusly) used only
on the gl3 code path, it could have happened that users hit this, and
just reverted to vo_opengl_old instead.
2015-01-07 21:13:26 +01:00
xylosper 21000774bf gl_video.c: invalidate image_params in uninit_video()
When the given mp_image_params does not match with that of gl_video,
gl_video_config() always calls uninit_video() but calls init_video()
only if valid format is given.

Since uninit_video() does not change image_params of gl_video,
when the same params as the previous one is given to gl_video_config()
after gl_video is unitialized with invalid format, gl_video_config()
never calls init_video().

To prevent this, invalidate image_params of gl_video in uninit_video().
2015-01-07 19:22:54 +01:00
Stefano Pigozzi f811348d0c vo_opengl: add support for in memory icc profiles
Previously we just forced loading a profile from file, but that has poor
integration for querying the OS / display server for an ICC profile, and
generating profiles on the fly (which we might use in the future for creating
preset 3dluts).

Also changed the previous icc-profile-auto code to use this mechanism, and
moved gl_lcms to be an opaque type with state instead of just providing pure
functions.
2015-01-07 18:47:27 +01:00
Niklas Haas d66598eeed video: Remove some stale CMS code, minor cosmetics
This removes an old code path that was disabled in 016bb14.
2015-01-07 14:22:17 +01:00
James Ross-Gowan a095958263 dxva2: copy mp_image attributes to sw_img 2015-01-07 23:00:22 +11:00
James Ross-Gowan 9a3ab5c298 mp_image: copy missing attributes
This adds a couple of missing fields to mp_image_copy_attributes so
things like rotation metadata work.
2015-01-07 22:59:21 +11:00
wm4 b5529707f5 vo_opengl_cb: implement equalizer controls
This makes vo_opengl_cb respond to controls like "gamma" and
"brightness". The commit includes an awkward refactor for vo_opengl to
make it easier for vo_opengl_cb.

One problem is a logical race condition. The set of supported controls
depends on the pixelformat, which in turn is set by reconfig(). But the
actual reconfig() call (on the renderer) happens asynchronously on the
renderer thread. At the time it happens, the player most likely already
tried to set some controls for command line options (see init_vo() in
video.c). So setting this command line options will fail most of the
time, though it could randomly succeed. This can't be fixed directly,
because the player can't wait on the renderer thread, because the
renderer thread might already wait on the player.
2015-01-06 17:34:29 +01:00
wm4 941eff85a6 csputils: use M_PI 2015-01-06 16:51:06 +01:00
wm4 d42d60bc1e csputils: replace float[3][4] with a struct
Not being able to use the 3x3 part of the matrix was annoying, so split
it into a float[3][3] matrix and a separate float[3] constant vector.
2015-01-06 16:51:06 +01:00
wm4 5410a5b2c5 csputils: move image_params -> csp_params into a function
Although the line count increases, this is better for making sure
everything is handled consistently for all users of the mp_csp_params
stuff.

This also makes sure mp_csp_params is always initialized with
MP_CSP_PARAMS_DEFAULTS (for consistency).
2015-01-06 16:51:02 +01:00
wm4 a52ca8a2b0 csputils: get rid of mp_csp_details
It used to be central, but now it's just unneeded.
2015-01-06 16:50:58 +01:00
wm4 02362f938f csputils: cosmetics
Fix some coding style issues, remove doxygen formatting.
2015-01-06 13:46:08 +01:00
wm4 31e9630788 vo_opengl_cb: don't resize when redrawing 2015-01-06 11:32:08 +01:00
Soeren D. Schulze 2ab259e683 video/out/win_state.c: fix --monitoraspect 2015-01-05 17:28:26 +01:00
wm4 df595b06e6 vo_opengl_cb: support changing options at runtime
Like vo_opengl, but way messier, because the already messy config
handling meets threading.
2015-01-05 15:25:58 +01:00
wm4 589e70e17d vf_vapoursynth: autodetect CPU count
This adds an "auto" choice to the concurrent-frames suboption, and makes
it the default.

I'm not so sure about making this the default, though. It could lead to
excessive buffering with large CPU counts. But we'll see.
2015-01-05 12:49:13 +01:00
wm4 0f4bf347c5 player: print used number of threads in verbose mode
Also, don't use av_log() for mpv output.
2015-01-05 12:17:55 +01:00
wm4 d5e744d4b8 vo_opengl: remove obsolete comment in shader 2015-01-04 19:04:45 +01:00
wm4 2b0fce56a2 x11: make display-names property stricter
Returning the property before the window is mapped could lead to
confusing behavior, and in particular strange differences between
vo_vdpau and vo_opengl. (vo_opengl creates the window right at the
start, while vdpau waits until the first reconfigure event.) It might
even be possible that for vo_opengl random results were returned,
because the hidden window can have different placement than the actual,
final one on initial video reconfig.

Fix this by returning the property only if the window is considered
mapped. command.c handles this case specifically, and makes the property
unavailable, instead of returning an empty list.
2015-01-04 03:57:50 +01:00
wm4 a7dddbacc6 video: batch query_format calls
There are currently 568 pixel formats (actually fewer, but the namespace
is this big), and for each format elaborate synchronization was done to
call it synchronously on the VO. This is completely unnecessary, and we
can do with just a single call.
2015-01-03 17:23:01 +01:00
wm4 d5f1170679 vf_vapoursynth: fix Lua backend
It couldn't handle the newly added float variable.
2015-01-03 14:44:20 +01:00
wm4 bfac1e81a6 vf_vapoursynth: pass through container FPS value
This is basically a hack; but apparently a needed one, since many
vapoursynth filters insist on having a FPS set.

We need to apply the FPS override before creating the filters. Also
change some terminal output related to the FPS value.
2015-01-03 03:37:05 +01:00
wm4 9300351a30 x11: make display-names property observable
Reuse MP_EVENT_WIN_STATE for this.
2015-01-03 03:06:26 +01:00
wm4 f5ed13bcd4 video: better pipelining with vf_vapoursynth
Most of this is explained in the code comments. This change should
improve performance with vapoursynth, especially if concurrent requests
are used.

This should change nothing if vf_vapoursynth is not in the filter chain,
since non-threaded filters obviously can not asynchronously finish
filtering of frames.
2015-01-03 03:01:58 +01:00
Stefano Pigozzi 9633790ac6 cocoa: fix build on 10.9
Use -isInFullScreenMode instead of the property introduced with the 10.10 SDK.
2015-01-02 20:54:09 +01:00
Stefano Pigozzi 43faae7a1e cocoa: fix NSMapGet error
regression from 64b6b2ea45
2015-01-02 19:19:23 +01:00
wm4 7873301be8 vo_opengl_old: remove ancient ATI-specific YUV conversions
While there's no actual need to get rid of these, I want to make sure
nobody actually needs this stuff, and removing it is the best way to
get to know this. We still can revert this commit if it turns out there
is a significant need for this stuff.

The final goal is removing vo_opengl_old entirely. Add a warning, which
basically announces this intention.
2015-01-02 00:59:27 +01:00
Stefano Pigozzi 64b6b2ea45 cocoa: fix uninitialization while in fullscreen
This is only needed for switching video track with `_`, since Cocoa
automatically handles cleaning up the application's presentation options when
quitting the process.

Fixes #1399
2015-01-01 14:38:08 +01:00
wm4 3e12e79b8f gl_hwdec_vda: refuse to work with old OpenGL versions
The way we use rectangle textures (required by VDA for no reason) works
onl in OpenGL 3.0 or higher. Below that, the shader will fail to
compile. We could add support for older OpenGL versions, but that would
be a major pain.

This normally doesn't matter; mpv itself always creates OpenGL 3.2
contexts on OSX. But it could matter if a client API user uses
vo_opengl_cb, and gives it a 2.1 context (which OSX also allows you to
create).
2014-12-31 21:04:52 +01:00
wm4 a850bf786e vo_opengl_cb: simplify API uninitialization
Until now, calling mpv_opengl_cb_uninit_gl() at a "bad moment" could
make the whole thing to explode. The API user was asked to avoid such
situations by calling it only in "good moments". But this was probably a
bit too subtle and could easily be overlooked.

Integrate the approach the qml example uses directly into the
implementation. If the OpenGL context is to be unitialized, forcefully
disable video, and block until this is done.
2014-12-31 20:31:19 +01:00