Commit Graph

1034 Commits

Author SHA1 Message Date
wm4 3ec7f528c4 vd_lavc: remove compatibility crap
All this code was needed for compatibility with very old libavcodec
versions only (such as Libav 9).

Includes some now-possible simplifications too.
2014-03-16 13:19:19 +01:00
wm4 ba160f5c84 vd_lavc: ridiculous workaround for Libav 9 compatibility
This "sometimes" crashed when seeking. The fault apparently lies in
libavcodec: the decoder returns an unreferenced frame! This is
completely insane, but somehow I'm apparently still expected to
work this around. As a reaction, I will drop Libav 9 support in the
next commit. (While this commit will go into release/0.3.)
2014-03-16 01:38:13 +01:00
James Ross-Gowan 3bcb4b8a9e w32_common: prevent MOUSE_BTN0 sticking after drag
The window doesn't recieve a WM_LBUTTONUP message after it's dragged,
probably because it's swallowed by the modal loop. To stop the button
from sticking, release it manually when the drag is complete.
2014-03-12 14:51:25 +01:00
James Ross-Gowan 6402b9dc38 w32_common: capture mouse input
Mouse buttons can get stuck down if the button is pressed inside the
video window and released outside. Avoid this by capturing mouse input
when a button is pressed.
2014-03-12 14:51:07 +01:00
wm4 ccce58d6d6 video: initialize hw decoder in get_format
Apparently the "right" place to initialize the hardware decoder is in
the libavcodec get_format callback.

This doesn't change vda.c and vdpau_old.c, because I don't have OSX, and
vdpau_old.c is probably going to be removed soon (if Libav ever manages
to release Libav 10). So for now the init_decoder callback added with
this commit is optional.

This also means vdpau.c and vaapi.c don't have to manage and check the
image parameters anymore.

This change is probably needed for when libavcodec VDA supports gets a
new iteration of its API.
2014-03-10 22:56:26 +01:00
Niklas Haas fbddbce01d vo_opengl: Correct and clarify gl_check_features
This updates the logic for the new, somewhat unified behavior of SRGB
and 3DLUT since 34bf9be (not that it was particularly correct even that
change) and checks for the presence of corresponding extensions only in
the cases in which they're needed.
2014-03-10 22:56:26 +01:00
Niklas Haas 6a833797db vo_opengl: Simplify and clarify color correction code
This commit:

- Changes some of the #define and variable names for clarification and
  adds comments where appropriate.
- Unifies :srgb and :icc-profile, making them fit into the same step of
  the decoding process and removing the weird interactions between both
  of them.
- Makes :icc-profile take precedence over :srgb (to significantly reduce
  the number of confusing and useless special cases)
- Moves BT709 decompanding (approximate or actual) to the shader in all
  cases, making it happen before upscaling (instead of the old 0.45
  gamma function). This is the simpler and more proper way to do it.
- Enables the approx gamma function to work with :srgb as well due to
  this (since they now share the gamma expansion code).
- Renames :icc-approx-gamma to :approx-gamma since it is no longer tied
  to the ICC options or LittleCMS.
- Uses gamma 2.4 as input space for the actual 3DLUT, this is now a
  pretty arbitrary factor but I picked 2.4 mainly because a higher pure
  power value here seems to produce visually better results with wide
  gamut profiles, rather then the previous 1.95 or BT.709.
- Adds the input gamma space to the 3dlut cache header in case we change
  it more in the future, or even make it user customizable (though I
  don't see why the latter would really be necessary).
- Fixes the OSD's gamma when using :srgb, which was previously still
  using the old (0.45) approximation in all cases.
- Updates documentation on :srgb, it was still mentioning the old
  behavior from circa a year ago.

This commit should serve to both open up and make the CMS/shader code much
more accessible and less confusing/error-prone and simultaneously also
improve the performance of 3DLUTs with wide gamut color spaces.

I would liked to have made it more modular but almost all of these
changes are interdependent, save for the documentation updates.

Note: Right now, the "3DLUT takes precedence over SRGB" logic is just
coded into gl_lcms.c's compile_shaders function. Ideally, this should be
done earlier, when parsing the options (by overriding the actual
opts.srgb flag) and output a warning to the user.

Note: I'm not sure how well this works together with real-world
subtitles that may need to be color corrected as well. I'm not sure
whether :approx-gamma needs to apply to subtitles as well. I'll need to
test this on proper files later.

Note: As of now, linear light scaling is still intrinsically tied to
either :srgb or :icc-profile. It would be thinkable to have this as an
extra option, :linear-scaling or similar, that could be used with or
without the two color management options.
2014-03-10 22:56:25 +01:00
Niklas Haas 76554ca62a vo_opengl: Use bt709_expand on OSD for :srgb
This affects the OSD only when :srgb is enabled, this still used the old
gamma approximation of 2.22 previously.
2014-03-10 22:56:25 +01:00
wm4 5ffd6a9e9b encode: add locking
Since the AO will run in a thread, and there's lots of shared state with
encoding, we have to add locking.

One case this doesn't handle correctly are the encode_lavc_available()
calls in ao_lavc.c and vo_lavc.c. They don't do much (and usually only
to protect against doing --ao=lavc with normal playback), and changing
it would be a bit messy. So just leave them.
2014-03-09 00:19:35 +01:00
Alexander Preisinger a9eae4276d wayland/shm: fix leak in buffer pool
Rename it to reinit and check if parts of the pool are already allocated.
2014-03-06 14:43:20 +01:00
wm4 b684ea55a5 vo_opengl: minor simplification
I think this is easier to follow.
2014-03-01 15:40:46 +01:00
Niklas Haas d5b5ed0b46 vo_opengl: Include :icc-approx-gamma option in the 3DLUT cache header
This makes sure the ICC cache is recomputed when the :icc-approx-gamma
option is changed, since it affects the output quite a lot.
2014-03-01 02:28:46 +01:00
wm4 8a51a6b79c vo_opengl: change gamma suboption to take a value
The previous version of the gamma suboption was pretty useless. It could
be used to disable delayed gamma enabling, which is a mechanism to avoid
having to adjust gamma in the shader by default.

Repurpose the suboption and allow setting an exact gamma value with it.
You can already override gamma with the --gamma option as well as the
gamma input property, but these use a weird curve to create the
impression of a linear perceived brightness change when changing the
value. This suboption now allows setting an exact gamma value.
2014-02-27 00:53:41 +01:00
Niklas Haas 6119cf13be vo_opengl: Change the default icc-intent to relative colorimetric
This used to be absolute colorimetric, but relative colorimetric is a
saner default due to the arguments presented in issue #595.

A short summary: In general it doesn't affect much because our eyes
adapt to the white point either way, but if running in windowed mode it
would make the whites seem inconsistent/tinted. For fullscreen
projection it's also undesirable since it reduces the dynamic range
without much benefit (again, since our eyes adapt either way) and it
also breaks calibration against ambient lighting.

This shouldn't change much, since most profile types that aren't 3DLUTs
aren't capable of either of those transforms, and most displays are
calibrated against D65 (same as BT.709 source) either way.
2014-02-26 23:05:20 +01:00
Andrey Morozov d0e64dcc9b vdpau: change the error message when video too large 2014-02-24 17:59:52 +01:00
Niklas Haas 701c8c8254
vo_opengl: Add :icc-approx-gamma suboption to approximate BT.709 gamma
This uses the value of 1.95 as an approximation for the exact gamma
curve, which replicates the behavior of popular video software including
anything in the Apple ecosystem, as per issue #534.
2014-02-24 14:34:12 +01:00
wm4 5d7cf6e508 video: add rounding to aspect ratio calculations
Small errors are unavoidable, but truncation can cause anamorphic video
to be off by 1 or 2 pixels.
2014-02-19 15:37:47 +01:00
Grigori Goronzy 472bb04e9d vo_opengl: use GL_RGBA16 FBO format for HQ
GL_RGB16 is definitely not a required format, after review of the
OpenGL 3.3 spec. Most HW doesn't have native support for RGB16 anyway.
2014-02-17 20:31:14 +01:00
Stefano Pigozzi b1328418ee vo_corevideo: remove unused variable 2014-02-17 19:39:49 +01:00
James Ross-Gowan b3b59b9a2d w32_common: don't set small icon
Windows will automatically choose the correct icon size if this field is
unset.
2014-02-17 02:52:58 +01:00
Alexander Preisinger 891268955e wayland/shm: remove unused define 2014-02-16 18:14:17 +01:00
wm4 ccfbe43455 csputils: provide string descriptions of chroma locations 2014-02-16 03:51:02 +01:00
nand 55f4b592d1 vo_opengl: make :srgb decompand the BT.709 values correctly
This is the same issue as addressed by 257d9f1, except this time for
the :srgb option as well. (257d9f1 only addressed :icc-profile)

The conditions of the srgb_compand mix() call are also flipped to
prevent an off-by-one error.
2014-02-12 22:00:42 +01:00
wm4 958455ac39 vo_wayland: silence shadowing warning 2014-02-12 22:00:23 +01:00
Alexander Preisinger 0920dc1e26 wayland/shm: rewrite buffer handling
I was unhappy with the old way of handling buffers, especially resizing. But my
original plan to use wl_shm_pool_resize wasn't as good as I initially thought.
I might get back to it.

With the new buffer pools it now possible to select triple buffering. Also the
buffer pools are also needed for the upcoming subsurfaces for osd and subtitles.

I hope this change was worth it.
2014-02-11 18:44:53 +01:00
Alexander Preisinger 0670c541a5 wayland/shm: prevent the window from flying away
With the new xdg_shell the problem will be no gone by itself.
2014-02-11 18:11:14 +01:00
wm4 7448d1958d video: fix --no-aspect
This also affects the --aspect option and the "aspect" property.
2014-02-11 17:36:25 +01:00
nand 7d9fff9c6b vo_opengl: fix typo in gamma function's parameter
The correct value is 0.081, not 0.18. The scale factor also needed
slight adjustment due to the order of operations.
2014-02-10 22:11:13 +01:00
Jonas Zetterberg 1fcdf2d849 vo_vdpau: Discard zero timestamps
Some drivers do not supply timestamps, use old timestamp in these conditions.
2014-02-10 22:10:56 +01:00
Jonas Zetterberg c60c784a6a vo_vdpau: Ensure presentation time is within bounds
When a time sync happens the last sync time is the minimum time that can be
used for presentation.
2014-02-10 22:10:54 +01:00
nand 257d9f1610 vo_opengl: use exactly the values defined by BT.709 for CMS
I could not see any difference whatsoever, but for usage with a 3DLUT
there's zero performance difference so we might as well follow the spec to
the letter.
2014-02-09 14:42:39 +01:00
wm4 67769db1a4 gl_x11: don't require a X visual for modern GL context creation
Legacy GL context creation (glXCreateContext) explicitly requires a X
visual, while the modern one (glXCreateContextAttribsARB) does not for
some reason. So fail only on the legacy code path if we don't find a
visual. Note that vo_x11_config_vo_window() will select a default visual
if a NULL visual is passed to it.
2014-02-06 14:33:30 +01:00
wm4 7134574f53 gl_x11: always request true color visual
This fixes issue #504. For some reason, glXChooseFBConfig() will return
a fbconfig with no associated visual. (I'm not sure if this allowed.
They don't always have a visual, but since GLX_X_RENDERABLE is set
and GLX_DRAWABLE_TYPE is (implicitly) set to GLX_WINDOW_BIT, why would
there be no visual?)

Even worse, a test program seems to show that a 16 bit fbconfig is
selected (instead of 24/32 bit), which doesn't sound nice at all. Since
there _are_ better fbconfigs available, glXChooseFBConfig() should
normally sort them by quality, and return the better ones first. It's
worth noting that this function should also prefer GLX_TRUE_COLOR
over anything else, although this comes last in the sort order.

Whatever is going on, requesting GLX_X_VISUAL_TYPE with GLX_TRUE_COLOR
seems to fix it.
2014-02-06 14:12:04 +01:00
wm4 d03111c5be csputils: correct constness of csp name constants 2014-02-03 22:01:09 +01:00
Alexander Preisinger 44bfe3b14a wayland: change minimum version
Change minimum version to 1.3 and remove the version checking in the source
code.
2014-02-02 08:46:13 +01:00
wm4 c8b754e38f x11: fix initial VO size
This was done incorrectly in the previous commit: the fallback size used
the window size as requested with the first config call, which is the
size of the hidden window in the vo_opengl case. (That damn hidden
window again...)
2014-02-02 03:19:36 +01:00
wm4 b57a0a0bc6 x11: remove apparently useless code
This code essentially does nothing. As far as I could find out, this
actually used to do something. Then it was removed with commit efe7c39f,
leaving some leftover code that didn't do anything useful. This happened
12 years ago!

Also remove a commented debug printf.
2014-02-02 01:50:25 +01:00
wm4 fc04be708c x11: fix race condition when setting aspect when leaving fullscreen
vo_opengl creates a hidden X11 window to probe the OpenGL context. It
must do that before creating a visible window, because VO creation and
VO config are separate phases.

There's a race condition involving the hidden window: when starting with
--fs, and then leaving fullscreen, the unfullscreened window is
sometimes set to the aspect ratio of the hidden window. I'm not sure why
the window size itself uses the correct size (but corrupted by the wrong
aspect), but that's perhaps because the window manager is free to ignore
the size hint while honoring the aspect, or something equally messed up.

It turns out this happens because x11_common.c thinks the size of the
hidden window is the size of the unfullscreened window. This in turn
happens because vo_x11_update_geometry() reads the size of the hidden
window when called in vo_x11_fullscreen() (called from
vo_x11_config_vo_window()) when mapping the fullscreen window. At that
point, the window could be mapped, but not necessarily. If it's not
mapped, it will get the size of the unfullscreened window... I think.

One could fix this by actively waiting until the window is mapped. Try
to pick a less hacky approach instead, and never read the window size
until MapNotify is received.

vo_x11_create_window() needs a hack, because we'd possibly set the VO's
size to 0, resulting e.g. in vdpau to fail initialization. (It'll print
error messages until a proper resize is received.)
2014-02-02 01:35:46 +01:00
wm4 5c8ec31ba3 vo_wayland: silence shadowing warning
No real problem.
2014-01-29 17:16:36 +01:00
wm4 8e61e9ed6e mp_image: reject too large image sizes
Larger sizes can introduce overflows, depending on the image format. In
the worst case, something larger than 16000x16000 with 8 bytes per pixel
will overflow 31 bits.

Maybe there should be a proper failure path instead of a hard crash, but
not yet. I imagine anything that sets a higher image size than a known
working size should be forced to call a function to check the size (much
like in ffmpeg/libavutil).
2014-01-29 17:01:42 +01:00
Alexander Preisinger cd2cfc8056 wayland/shm: RGB888 as default, change options
RGB565 is one of the fastest and most supported formats on low end consumer
devices, but ffmpeg spams warning when using it. Make it opt-in instead of
opt-out.
2014-01-28 13:52:12 +01:00
Alexander Preisinger 0f90288bf6 wayland/shm: fix memory leak 2014-01-28 13:30:58 +01:00
Alexander Preisinger 3114390c5b wayland/shm: remove resize boilerplate
The problem seems to have solved itself. I guess the previous changes to
resizing and commit ba101ab made this possible. Consider me happy for removing
that crap.
2014-01-28 13:15:36 +01:00
wm4 bb54cf9559 vo_sdl: fix compilation
Still untested, because now it crashes inside of libSDL for unknown
reasons. (This also happens with mpv git from yesterday - probably an
installation problem, or SDL doing weird things it shouldn't be doing.)
2014-01-25 00:26:35 +01:00
wm4 f46e188ec5 vo_wayland: fix confusion of video and window sizes 2014-01-24 21:23:07 +01:00
wm4 2e66f4b89b video/out: do remaining config to reconfig replacements
The main difference between the old and new callbacks is that the old
callbacks required passing the window size, which is and always was very
inconvenient and confusing, since the window size is already in
vo->dwidth and vo->dheight.
2014-01-24 21:22:25 +01:00
wm4 0931cff1e9 aspect: remove a small ffmpeg dependency
Not strictly needed, but probably saves us pain the next time
ffmpeg mess up their headers.
2014-01-22 00:35:52 +01:00
wm4 38d29c487c vo: merge get rid of vo.aspdat field
Rename vo_get_src_dst_rects() to mp_get_src_dst_rects() and make it
independent from the VO (it takes a comical amount of parameters now to
pass all required state). Add a convenience wrapper with the name
vo_get_src_dst_rects() to vo.c. Replace all aspdat and vo usages with
immediate parameters.

Functionally, nothing should change, except that the window size is
clamped to a minimum of size 1 much earlier, and some log messages
change the prefix (don't bother with vo.vo_log stuff).
2014-01-22 00:35:52 +01:00
wm4 0f2acd4a80 vo: move vo_get_src_dst_rects to aspect.c
The plan is to make all the code in aspect.c independent from vo.c,
which should make the code easier to understand, will allow removal of
vo->aspdat, and reduces the amount of code that accesses weird mutable
struct vo fields.
2014-01-22 00:35:52 +01:00
wm4 4de73fd5c1 video/out: don't access aspdat in VOs
vo->aspdat is basically an outdated version of vo->params, plus some
weirdness. Get rid of it, which will allow further cleanups and which
will make multithreading easier (less state to care about).

Also, simplify some VO code by using mp_image_set_attributes() instead
of caring about display size, colorspace, etc. manually. Add the
function osd_res_from_image_params(), which is often needed in the case
OSD renders into an image.
2014-01-22 00:35:52 +01:00
wm4 302e8ff464 vo_opengl: don't assume there'a always 1 fbconfig on success
Seems to be a reasonable assumption, but it's probably not guaranteed.
2014-01-21 23:34:02 +01:00
Stefano Pigozzi 369e88c99b cocoa: remove dead code
This became dead code in commit 3f594c2e.
2014-01-21 23:32:07 +01:00
James Ross-Gowan 63a76b3d1c w32_common: Fix extended keys
The KF_* flags work on the HIWORD of lParam. Whoops
2014-01-21 00:41:56 +01:00
James Ross-Gowan 32c0df1b53 w32: use the w32_common keymap in terminal-win too 2014-01-19 14:42:15 +01:00
wm4 7f4a09bb85 sub: uglify OSD code path with locking
Do two things:
1. add locking to struct osd_state
2. make struct osd_state opaque

While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses
lots of osd_state (and osd_object) members. To make sure everything is
accessed synchronously, I prefer making osd_state opaque, even if it
means adding pretty dumb accessors.

All of this is meant to allow running VO in their own threads.
Eventually, VOs will request OSD on their own, which means osd_state
will be accessed from foreign threads.
2014-01-18 01:27:43 +01:00
James Ross-Gowan 80c11eba66 w32_common: add extended keys
Also VK_APPS/MP_KEY_MENU was missing.
2014-01-15 16:15:30 +01:00
James Ross-Gowan 4276e9443d w32_common: prevent decoding certain keys twice
This is a bit of a hack, but in order to prevent TranslateMessage from
seeing WM_KEYDOWN messages that we already know how to decode, move the
decoding logic to the event loop. This should fix #476, since it stops
the generation of extraneous WM_CHAR messages that were triggering more
than one action on keydown.
2014-01-15 13:32:25 +01:00
wm4 ad654f3803 options: remove --screenw and --screenh
Doesn't make any sense anymore. X11 (which was mentioned in the manpage)
autodetects it, and everything else ignored the option values.

Since for incomprehensible reasons the backends and vo.c still need to
exchange information about the screensize using the option fields,
they're not removed yet.
2014-01-11 18:58:07 +01:00
wm4 905029ec0c video/out: remove pointless x/y parameter from vo_x11_config_vo_window
This never made any real sense; the "backend" has to access vo->dx/dy
anyway.
2014-01-11 18:58:07 +01:00
wm4 d956bbc065 video/out: simplify monitor aspect handling
For some reason, this made all VO backends both set the screen
resolution in opts->screenwidth/height, and call
aspect_save_screenres(). Remove the latter. Move the code to calculate
the PAR-corrected window size from aspect.c to vo.c, and make it so that
the monitor PAR is recalculated when it makes sense.
2014-01-11 18:58:06 +01:00
wm4 3b8e457379 video/out: remove fallback handling for screensize/monitor pixel aspect
When using --monitoraspect, but either the screen width or height or
both are unknown, a fallback is applied. This is a completely useless
obscure corner case that's going to help nobody, so get it out of the
way.
2014-01-11 18:58:06 +01:00
Stefano Pigozzi 6a3ab66427 cocoa: fix window placement on secondary screens
For a long time the cocoa backend set the xinerama_x/y and used dx/dy from the
VO instance. This somewhat worked with some workarounds but wasn't really
what was supposed to be happening. Moreover 27e4360, which touched this
workaround introduced a regression.

New code doesn't set the xinerama_x/y values so that dx/dy are offsets in the
current screen (not a virtual screen composed of all the screens). The screen
reference detected during VOCTRL_UPDATE_SCREENINFO is also passed down to the
window initialization code.

Fixes #472
2014-01-11 14:06:40 +01:00
wm4 3433f25697 vd_lavc: matroska: remove weird code setting extra_huff for mjpeg
Like with the previous commit, this is probably not needed, but it's
unclear whether that really is the case. Most likely, it used to be
needed by some demuxer, and now the only demuxer left that could
_possibly_ trigger this is demux_mkv.c.

Note that mjpeg is the only decoder that reads the extra_huff option,
and nothing in libavformat actually sets the option. So maybe it's
fundamentally not needed anymore.
2014-01-11 01:49:20 +01:00
wm4 589f4871ea vd_lavc: matroska: remove weird realvideo special handling
This case can't happen with the normal realvideo codepath in
demux_mkv.c, because the code would errors out if the extradata is too
small, and everything would be broken anyway in the case the vd_lavc.c
condition is actually triggered.

It still might happen with VfW-muxed realvideo in Matroska, though.
Basically, I'm hoping this doesn't matter anyway, and that the vd_lavc.c
code was for other old demuxers, like demux_avi or demux_rm. Following
the commit history, it's not really clear for what demuxer this code
was added.
2014-01-11 01:47:14 +01:00
wm4 85e90668ae vd_lavc: minor simplification 2014-01-11 01:33:07 +01:00
wm4 4b4926bbb3 Factor out setting AVCodecContext extradata 2014-01-11 01:25:49 +01:00
Stefano Pigozzi 27e4360b0b cocoa: refactor init window positioning code 2014-01-10 20:39:25 +01:00
Nyx0uf 0f8558a723 cocoa: allow to drag and drop URLs
This commit also improves the visual feedback to the user by showing a plus
icon in the mouse cursor when dragging supported types.

Fixes #469
2014-01-10 10:48:54 +01:00
Alexander Preisinger c555b2ae55 wayland: properly empty output list 2014-01-08 22:16:41 +01:00
Alexander Preisinger 525c7f1add wayland/shm: don't crash if initialization failed 2014-01-08 22:15:40 +01:00
wm4 34abe7e255 wayland: fix crash when initialization fails
On X11, if no wayland compositor is running, wl_list_init() will never
be called. This will cause destroy_display() to segfault when trying to
iterate over the list.
2014-01-08 21:49:18 +01:00
Alexander Preisinger 3e6fdc94d6 wayland/shm: tone down warnings
Those warnings are printed far too often and actually aren't usefull at all.
2014-01-08 21:03:57 +01:00
Alexander Preisinger 4b10255008 wayland: fix memory leaks
There are still some leaks from wayland-cursor stuff, but there is no way to
free the memory as user of the cursor library.
2014-01-08 20:59:40 +01:00
Alexander Preisinger 61e5670684 wayland: cleanup registry_handle_global
The wl_registry object is already passed as a parameter. No need to create
a temporary variable.
2014-01-08 16:23:19 +01:00
Alexander Preisinger 74d9504b65 wayland: remove set_user_data from seat_listener
The user_data is passed on add_listener and can later be changed with
set_user_data. But because we don't want to change it later and because it is
the same object remove the set_user_data call.

This might be a copy&paste leftover from the initial draft for the wayland
backend.
2014-01-08 16:23:19 +01:00
Alexander Preisinger fa5f1e7800 wayland: use static consistently
Declare everything that is only needed inside wayland_common.c as static.
2014-01-08 16:23:11 +01:00
Alexander Preisinger 374f40de30 wayland: fix fullscreen & resizing for good
I added enough logic to never set ontop or fullscreen twitce.
This commit keeps also the size of the video if multiple videos are played.
If the ratio differs the width will be kept at the same size and only the
height changes.
2014-01-07 21:12:24 +01:00
wm4 2c4c912c15 wayland: silence annoying libwayland-client message
libwayland-client contains the following code [1]:

	runtime_dir = getenv("XDG_RUNTIME_DIR");
	if (!runtime_dir) {
		fprintf(stderr,
			"error: XDG_RUNTIME_DIR not set in the environment.\n");

This means this message will unconditionally and unavoidably be printed
if XDG_RUNTIME_DIR is not set. Since mpv is a terminal program, and we
want to avoid unnecessary output, work it around by not attempting to
use wayland if this environment variable is not set.

[1] http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-client.c#n636
    (cd0dccd01e16fa404e03974d30ded3aebdb1c4bc)
2014-01-07 01:07:52 +01:00
wm4 326d887a41 wayland: fix some memory leaks on initialization failure
This commonly happens when initializing vo_opengl on a X11-only system.

Unfortunately, most wl_*_destroy() functions appear not to accept NULL
pointers, making partial deinitialization a pain: you have to add your
own NULL checks everywhere to avoid crashes.

xkb.context is uninitialized separately, because you can initialize it
just fine, even if the rest of input initialization fails.
2014-01-07 01:07:50 +01:00
Martin Herkt df116958df w32_common: reformat yet again
I've been told mpv prefers switch/case on the same indent level.
Sorry about the noise :P
2014-01-06 15:37:21 +01:00
Stefano Pigozzi 48e3344f84 cocoa: don't reset window size when the video size doesn't change
Fixes #459
2014-01-06 14:19:04 +01:00
Martin Herkt 1fdc7e6c37 w32_common: don't force topmost on fullscreen
Fixes #457, #444.
2014-01-06 14:12:08 +01:00
Martin Herkt 8bfb20acdc w32_common: reformat slightly
This really needs more whitespace.
2014-01-06 12:26:42 +01:00
xnoreq 43aafc61b0 w32_common: use OLE DnD for text/uri-list support
Signed-off-by: Martin Herkt <lachs0r@srsfckn.biz>
2014-01-06 12:26:28 +01:00
Alexander Preisinger 8a130e08e2 Revert "wayland/egl: use redraw callback"
Because of this commit there were problems displaying the frmase in their right
order.

This reverts commit 96e75d234a.

Conflicts:
	video/out/gl_wayland.c
	video/out/wayland_common.h
2014-01-04 21:18:46 +01:00
Alexander Preisinger 68e179bcf0 wayland: remove workaround
The changes in the vo_wayland_ontop function have no effect on the workaround.

Somehow the problem just disappeared. I guess it is because of the new control
function in gl_wayland.c where the resize happens immediatly after the event
dispatch/flush.
2014-01-04 20:54:51 +01:00
Alexander Preisinger 148918dd53 wayland: fix obvious bug in dnd code
I still don't think this is the right approach.
2014-01-04 20:28:52 +01:00
wm4 7c6bb321eb video/out: remove some code duplication between X11 and wayland
Both X11 and Wayland support the same format for drag & drop operations
(text/uri-list), and the code for that was copied from x11_common.c to
wayland_common.c. Factor it out.
2014-01-04 19:33:40 +01:00
Stefano Pigozzi 1e988c595b cocoa: handle files drag and drop on the player video view 2014-01-04 17:29:53 +01:00
Stefano Pigozzi 082c5c19a1 input: move files drag and drop to a new event.c file
event.c will be used to feed the input queue with 'global' events that don't
mesh well with the usual check_events path in mpv.
2014-01-04 17:28:55 +01:00
Alexander Preisinger bb3ea1580e wayland/egl: misc fixes and cleanups 2014-01-04 17:26:55 +01:00
Alexander Preisinger 96e75d234a wayland/egl: use redraw callback
This solves the issue where we would not receive any frame events. The
difference to my earlier tests is that now it looks like eglSwapBuffers uses
it's own event queue or something similiar along the lines. Becaues the
performance is the same as without any redraw callback.
2014-01-04 17:23:35 +01:00
Alexander Preisinger 17b52cc4a9 wayland/egl: add egl_context to the wayland state
At the moment there are visual glitches when we resize the window. This happens
because in wayland there a special function for resizing EGL windows.

To prevent the glitches move the egl_context to the wayland state in
wayland_common.h and add a new control function to gl_wayland.c to wrap the
vo_wayland_control function to check for resize events.

With the new control wrapper the glitches are gone and the resizing is fluid.
2014-01-04 16:43:58 +01:00
Alexander Preisinger f5565f33c7 wayland: Remove nonsense comment and add warning
The reason a segmentation happend here was because we couldn't get the
requested minor version. The major version is enough for differentiating
between OpenGL 3 and OpenGL 2. If it fails there is still a fallback to any
version available.

Also add a warning if we use the fallback.
2014-01-04 15:37:45 +01:00
Alexander Preisinger 340ab6cd72 wayland: move workaround to fullscreen code
Because of this workaround there was a bug in the wayland vo.
Now it works on both vos (opengl and shm) as it should.
2014-01-04 13:57:47 +01:00
Alexander Preisinger 8f241998c0 wayland: implement dropping files on the VO window
Needs some proper testing.
2014-01-04 13:48:50 +01:00
wm4 7041d8cd37 vo: dropping subtitle files on the VO window adds them as subtitle files
Note that we don't try to be clever about detecting the files as
subtitles: we just check the file extension. We could go all the way and
check the files by opening them with a demuxer, but that would probably
do more bad than good.
2014-01-04 01:27:29 +01:00
wm4 6a1b12158d x11: implement dropping files on the VO window
Drag and drop is pretty complicated (just note how the number of Atoms
in use almost doubles), so I'm not sure whether this works everywhere.

This has been written by looking at the specification [1] or what looks
like the specification, and some external example code [2]. (The latter
one has no code license, but we didn't copy any code.)

We completely ignore the "requirement" of the spec. that the filename
"must" include username and hostname, e.g. "file://user@host/path/file".
In theory, this is required because X is network transparent, but at
this point the so called network transparency is a complete joke, and
Konqueror for one didn't include hostnames in "file://" URIs.

Tested with konqueror as drop source.

[1] http://www.newplanetsoftware.com/xdnd/
[2] http://www.edwardrosten.com/code/dist/x_clipboard-1.1/paste.cc
2014-01-04 01:27:28 +01:00
wm4 0702f642d5 vo: add vo_drop_files()
Intended to be used for GUI drag & drop.
2014-01-04 01:27:28 +01:00
Stefano Pigozzi d4f37174a1 vda: fix build on OS X 10.7
Looks like on 10.8 OpenGL.h recursively includes CGLIOSurface.h. That is not
the case for 10.7 so the build was broken on that version of OS X.
2014-01-02 22:45:39 +01:00