Commit Graph

334 Commits

Author SHA1 Message Date
wm4 1ff35c3a20 vo_opengl_old: use new option API 2013-07-22 01:50:22 +02:00
wm4 5e0ee41617 options: move --colorkey option to vo_xv 2013-07-22 01:50:22 +02:00
wm4 549ef68c62 vo_xv: use new option API 2013-07-22 01:50:16 +02:00
wm4 3fd7794d42 vo_direct3d: fix warning on MinGW
Commit 6ab2eeb attempted to fix it on Cygwin, but now it broke on MinGW
in turn. Don't think too hard about it and just remove the code. (vo.c
already prints the video rectangle anyway.)
2013-07-22 00:14:38 +02:00
wm4 3cdf4cf14d options: hide encoding AO/VO in help output
These can't be used manually. Encoding is enabled with -o instead, and
the encoding AO/VO is selected using internal mechanisms.
2013-07-21 23:27:31 +02:00
wm4 c1afd75142 options: use new code for parsing --vo
Nothing should change from user perspective.

mpv --vo=opengl:help now works.

Remove the vo_opengl inline help text. The new code can list option
names for you, but that's it. Refer to the manpage if you have trouble.
2013-07-21 23:27:31 +02:00
Stefano Pigozzi 644451f4d9 cocoa_common: fix regression in draggable state computation
Regression introduced in 8fb064de5. Prevented the OSC from working correctly.
2013-07-21 21:02:44 +02:00
Stefano Pigozzi 73cd78f8c5 cocoa_common: fix style 2013-07-21 21:02:43 +02:00
Stefano Pigozzi 7c1d707f45 cocoa_common: move tracking area setup to updateTrackingAreas
This makes the tracking area work when going in and out of fullscreen.
2013-07-21 21:02:43 +02:00
wm4 50a84eb32d x11: add key modifiers to mouse button events 2013-07-21 18:07:09 +02:00
James Ross-Gowan d784759bc0 w32_common: show the cursor in the window border
When the cursor was in the window border, it could be hidden but it
wouldn't appear again, since mpv doesn't process mouse input there.

The code used ShowCursor, which is a horrid stateful API designed for
mouseless Win16 systems that incremented or decremented a global counter
to keep track of how many applications needed to display a special
cursor (like a busy cursor.) Replace that with a simple flag, handle
WM_SETCURSOR and use SetCursor(NULL) to hide the mouse cursor, but only
when the mouse is in the client area. DefWindowProc will set the correct
cursor on the border as long as it isn't hidden with ShowCursor.

PowerPoint also uses SetCursor(NULL) to hide the cursor when showing a
presentation, so it's probably safe.

See http://blogs.msdn.com/b/oldnewthing/archive/2009/12/17/9937972.aspx
2013-07-21 18:05:22 +02:00
Stefano Pigozzi 5f265d5930 cocoa_common: handle keyboard modifiers for mouse events 2013-07-21 10:49:27 +02:00
Alexander Preisinger ccc4512e1d Merge remote-tracking branch 'michaelforney/master' 2013-07-20 17:21:51 +02:00
Stefano Pigozzi 7088fe3fec cocoa_common: make the fullscreen transition only when necessary
This makes the cocoa backend follow more closely the new fullscreen semantics
added in c4b08a9a.
2013-07-20 12:08:14 +02:00
Stefano Pigozzi 8fb064de58 cocoa_common: use a tracking area to handle mouse events
This change which also flipse the coordinate system of the view, greatly
simplifies the mouse event handling code.

There are still some uglities mostly related to the cursor visibility
code. For instance the core doesn't show the cursor when it receives a mouse
leave event.
2013-07-20 11:45:32 +02:00
Stefano Pigozzi 2765153214 cocoa_common: fix typo in comment
Surely it's copy pasta's fault.
2013-07-20 11:44:06 +02:00
Stefano Pigozzi 20c0231f02 cocoa_common: implement MP_MOUSE_LEAVE notifications
This is needed for the OSC. At the moment I'm sending a notification for any
mouse movement outside of the video surface. This might be overkill.
2013-07-20 11:44:06 +02:00
Stefano Pigozzi 891e092669 cocoa_common: implement conditional video dragging
This was more roundabout than expected, since it looks like the framework
caches isMovabileByWindowBackground so in mpv's case it's needed to set it
with setMovableByWindowBackground.
2013-07-20 11:44:06 +02:00
Diogo Franco (Kovensky) 6ab2eebe5f direct3d: Fixes format string that assumed sizeof(LONG) == sizeof(long) 2013-07-20 02:20:26 +02:00
Michael Forney 906315f075 wayland: Fallback to any GL version if 3.0 is not supported
This fixes playback on Wayland with older GPUs.
2013-07-19 04:30:23 -07:00
Alexander Preisinger 3dc063a330 wayland: use a unified struct for the state
This commit removes the pointer to the single different structures for input
and window and puts them as anonymous structures inside the wayland_state
structure.

This has the disadvantage of passing the substructure to the listeners, but the
advantage is that we don't have to allocate them and check for NULL pointers.
This makes it more reliable and easier to follow.
2013-07-18 17:52:56 +02:00
Alexander Preisinger c5b76714a0 wayland: don't resize in gl_wayland.c
The vo_wayland_fullscreen handles resizing for the video, because the video
could still be in fullscreen mode and resizing it in gl_wayland could make it
grow or shrink.
2013-07-18 14:17:30 +02:00
wm4 c4b08a9a11 video: remove fullscreen flags chaos
There was a MPOpts fullscreen field, a mp_vo_opts.fs field, and
VOFLAG_FULLSCREEN. Remove all these and introduce a
mp_vo_opts.fullscreen flag instead.

When VOs receive VOCTRL_FULLSCREEN, they are supposed to set the
current fullscreen mode to the state in mp_vo_opts.fullscreen. They
also should do this implicitly on config().

VOs which are capable of doing so can update the mp_vo_opts.fullscreen
if the actual fullscreen mode changes (e.g. if the user uses the
window manager controls). If fullscreen mode switching fails, they
can also set mp_vo_opts.fullscreen to the actual state.

Note that the X11 backend does almost none of this, and it has a
private fs flag to store the fullscreen flag, instead of getting it
from the WM. (Possibly because it has to deal with broken WMs.)

The fullscreen option has to be checked on config() to deal with
the -fs option, especially with something like:

   mpv --fs file1.mkv --{ --no-fs file2.mkv --}

(It should start in fullscreen mode, but go to windowed mode when
playing file2.mkv.)

Wayland changes by: Alexander Preisinger <alexander.preisinger@gmail.com>
Cocoa changes by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2013-07-18 14:07:21 +02:00
wm4 05cf512dc5 vo: remove aspdat.asp member
This was bad, because it was the only aspdat member updated by
vo_get_src_dst_rects() instead of vo_reconfig(). Now it isn't
accessed anymore, so remove it.
2013-07-18 13:57:28 +02:00
wm4 eb7959e43a gl_video: add support for more rgb formats
Until now, only formats directly supported by OpenGL were supported.
This excludes various permutations of 8-bit RGB[A|0]. But we can simply
permutate the color channels in the shader, so do that. This also adds
support for all these weird RGB0 formats.

Note that we could use libavutil's pixfmt list instead of the
mp_packed_formats array, but trying to decrypt the pixfmt info would
probably end in pain, so this array with duplicated information is
actually better and shorter.

Note: I didn't actually test whether the alpha components are reproduced
correctly with alpha formats.
2013-07-18 13:52:38 +02:00
wm4 7f88e36911 sws_utils: don't recursively include libswscale header
Add libswscale includes where they are actually needed instead.
2013-07-18 13:46:05 +02:00
wm4 de61561deb vo_x11: use new swscale wrapper 2013-07-18 13:44:56 +02:00
wm4 81698e7116 vo_x11: remove weird inactive code
I guess this code was supposed to handle cases like drawing RGBA as ARGB
by offsetting it by 1 byte.

The code didn't make any sense, though. It used to make sense before mpv
switched internal pixel formats from FourCCs to a simple enum. With the
FourCCs, "fmt | 128" selected the big endian version of a format. Of
course this doesn't work this way with the new pixel formats. It just so
happens that there are no formats with whose values match
IMGFMT_RGB32|128 or IMGFMT_BGR32|128, so this code was inactive.

All involved pixel formats seem to play fine on my setup (though it's
little endian only), and the code strictly matches the mpv pixel formats
against the format of the X image, so I'm not quite sure why this code
was there in the first place.

The original commit that added this was b333ae1 (svn 21602):
  Support for different endianness on client and server with -vo x11
2013-07-18 13:11:13 +02:00
wm4 18b6c01d92 video: redo how colorspaces are handled
Instead of handling colorspaces with VFCTRLs/VOCTRLs, make them part of
the normal video format negotiation. The colorspace is passed down like
other video params with config/reconfig calls.

Forcing colorspaces (via the --colormatrix options and properties) is
handled differently too: if it's changed, completely reinit the video
chain. This is slower and requires a precise seek to the same position
to perform an update, but it's simpler and less bug-prone. Considering
switching the colorspace at runtime by user-interaction is a rather
obscure feature, this is a good change.

The colorspace VFCTRLs and VOCTRLs are still kept. The VOs rely on it,
and would have to be changed to get rid of them. We'll do that later,
and convert them incrementally instead of in one go.

Note that controlling the output range now always works on VO level.
Basically, this means you can't get vf_scale to output full-range YUV
for whatever reason. If that is really wanted, it should be a vf_scale
option. the previous behavior didn't make too much sense anyway.

This commit fixes a few bugs (such as playing RGB video and converting
that to YUV with vf_scale - a recent commit broke this and forced the
VO to display YUV as RGB if possible), and might introduce some new
ones.
2013-07-16 23:22:55 +02:00
Alexander Preisinger 6230e0b896 wayland: early aspect calculation in vo_config
Calculate the aspect ratio in vo_config, when we get the window size and in the
inside the resize function we calculate the aspect ratio of the output in order
to determine if we have to change the height or the width of the video.

If the ratio of the output is bigger than the ratio of the video then we have
to set the width accordingly and if the ratio is smaller we change the size.
But only if no resize edges are passed, because this indicates that we want to
change the windows state instead of just a simple resize and the video should
not grow bigger than the requested size.
2013-07-16 19:13:29 +02:00
Alexander Preisinger dc142991f1 wayland: use default fullscreen method
I misunderstood how the different methods work and if we set the size
accordingly to the wayland configure event then METHOD_DEFAULT is what we want.
2013-07-16 16:53:42 +02:00
wm4 cde55d4c34 w32_common: don't use aspdat.asp for aspect
aspdat.asp is a problem, because it's updated when the VO calls
vo_get_src_dst_rects(). Nothing guarantees that the value has been
updated when the w32 code accesses it.

Instead, use the aspect vo_w32_config() was called with.
2013-07-16 00:03:51 +02:00
wm4 e18ffd6b99 Merge branch 'remove_old_demuxers'
The merged branch doesn't actually just remove old demuxers, but also
includes a branch of cleanups and some refactoring.

Conflicts:
	stream/stream.c
2013-07-14 17:59:26 +02:00
wm4 52c3eb6976 core: change open_stream and demux_open signature
This removes the dependency on DEMUXER_TYPE_* and the file_format
parameter from the stream open functions.

Remove some of the playlist handling code. It looks like this was
needed only for loading linked mov files with demux_mov (which was
removed long ago).

Delete a minor bit of dead network-related code from stream.c as well.
2013-07-12 21:56:40 +02:00
Stefano Pigozzi b0932ecbb6 cocoa_common: change video size when changing screen DPI
This improves the situation when moving a window from screens with different
DPIs.
2013-07-10 22:22:08 +02:00
Martin Herkt 062b22b7cb Merge remote-tracking branch 'origin/low_quality_intel_crap'
Conflicts:
	video/out/gl_video_shaders.glsl
2013-07-08 18:07:54 +02:00
wm4 1709b65a72 dither: don't use long double
This fixes compilation with broken libcs, like on Cygwin. C99
absolutely requires long double and associated functions like expl,
even if long double is double. But newlib (used by cygwin) omits
declaration for these if long double is equivalent to double.

The extra precision is not needed here, so remove it to make life
easier for the single person using mpv with cygwin.
2013-07-05 20:26:32 +02:00
wm4 d084f72a6c core: remove mp_fifo leftovers 2013-07-04 17:53:30 +02:00
Alexander Preisinger 1789449a0a wayland: remove mp_fifo header 2013-07-03 22:43:05 +02:00
Alexander Preisinger 56b9dcaabb wayland: fix typo 2013-07-03 19:00:33 +02:00
Alexander Preisinger 17e5542574 wayland: remove unused members 2013-07-03 18:59:52 +02:00
Alexander Preisinger 8ea39d548b wayland: remove mp_fifo 2013-07-02 18:56:50 +02:00
Alexander Preisinger 37c5867703 wayland: implement MOUSE_LEAVE 2013-07-02 17:31:43 +02:00
wm4 d603e73c24 core: cleanup more mp_fifo leftovers
Now only the OSX and Wayland parts are using this.
2013-07-02 14:11:31 +02:00
wm4 70a8079c8e core: remove mp_fifo indirection
For some reason mp_fifo specifically handled double clicks, and other
than that was a pointless wrapper around input.c functionality.

Move the double click handling into input.c, and get rid of mp_fifo. Add
some compatibility wrappers, because so much VO code uses these
functions. Where struct mp_fifo is still used it's just a casted
struct input_ctx.
2013-07-02 14:00:24 +02:00
wm4 c4766dc3c6 input: require VOs to send key up events, redo input key lookup
Making key up events implicit was sort-of a nice idea, but it's too
tricky and unreliable and makes the key lookup code (interpret_keys())
hard to reason about. See e.g. previous commit for subtle bugs and
issues this caused.

Make key-up events explicit instead. Add key up events to all VOs.
Any time MP_KEY_STATE_DOWN is used, the matching key up event must
use MP_KEY_STATE_UP.

Rewrite the key lookup code. It should be simpler and more robust now.
(Even though the LOC increases, because the new code is less "compact".)
2013-07-02 12:19:16 +02:00
James Ross-Gowan d3b68a283f w32_common: prevent display power management
Handling SC_MONITORPOWER doesn't seem to prevent the screen from
dimming. The recommended way to do this in Windows XP and Vista is to
call SetThreadExecutionState with ES_DISPLAY_REQUIRED. Windows 7 also
has the PowerCreateRequest/PowerSetRequest/PowerClearRequest APIs but
they're probably too complicated for this task.
2013-06-30 23:41:06 +10:00
wm4 1099e0fc99 w32_common: prevent that window dragging and mouse input interfere 2013-06-29 22:58:14 +02:00
wm4 9ff6b472bd w32_common: refactor mouse button code, handle mouse up events
Instead of sending a single event on click, send both down and up
events.
2013-06-29 22:58:13 +02:00
wm4 831a7cf3ee input: trigger mouse_leave key bindings if mouse leaves mouse area
Also, implement mouse leave events for X11. But evne on other
platforms, these events will be generated if mouse crosses a section's
mouse area boundaries within the mpv window.
2013-06-29 22:58:13 +02:00