Commit Graph

35591 Commits

Author SHA1 Message Date
wm4 9e1331f7af mplayer: simplify AO creation
The AO creation part was split into two separate parts (one calling
ao_create and one calling ao_init). This didn't really have good
reasons, and obfuscates how AO creation works. Put them together.
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
wm4 999dad454f options: add some features to video filter parser
This is in preparation of making VOs and AOs use the parser which
originally was for video filters only.

The --vo and --ao options have several very annoying features, which are
added here:
- They can skip unknown video outputs (might be useful if a config file
  is supposed to work on several systems, where not all VOs/AOs are
  available everywhere)
- The trailing "," in "-vo a,b," was significant, and meant that if "a"
  and "b" don't work, try the normal autoprobe order as fallback
- There were deprecated VO names (like "gl3" and "gl"), which have to be
  handled with the option parser
- Separating VO/VF names and options is different
  ("-vf foo=opts" vs. "-vo foo:opts")
- vo_opengl.c provides opengl-hq as opengl + preset options
2013-07-21 23:27:31 +02:00
wm4 f2e3a49810 m_option: fix memory leak on error path 2013-07-21 23:27:31 +02:00
wm4 560738ddef m_config: improve option list output a bit
This is printed with --list-options or e.g. --vf=lavfi=help.

Note that in theory, the options should be able to print their own help,
and we shouldn't special case certain types (like m_option_type_choice
in the commit). But that is too hairy for now, so we don't do it.
2013-07-21 23:27:31 +02:00
wm4 6629a95b92 options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)

This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.

This commit will allow using the -vf option parser for other things,
like VOs and AOs.
2013-07-21 23:27:31 +02:00
wm4 111a455ec6 manpage: fix typo 2013-07-21 23:27:31 +02:00
wm4 c50d5376f2 vf: remove unnecessary indirection 2013-07-21 23:27:30 +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
wm4 4fa6975a76 command: fix switching tracks backwards if there's only one track
This remained stuck at no selection.
2013-07-21 18:06:52 +02:00
wm4 ba1dc085bc input.rst: update example
Option was renamed.
2013-07-21 18:06:27 +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
Diogo Franco (Kovensky) 03fd2fe61c input: Ignore spurious mouse moves
Windows generates WM_MOUSEMOVE messages internally whenever the window
manager wants to know where the mouse is[1] and broadcasts that to
everyone; w32_common doesn't check whether the position is different
and just (indirectly) calls this.

Do the check on input.c since it's possible some other VO or frontend
also do the same thing.

[1]: http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx
2013-07-21 01:14:18 +02:00
Diogo Franco (Kovensky) b9944e2dc1 configure: Add some -Wno-error= flags to ERRORFLAGS
-Wno-error=deprecated-declarations and -Wno-error=unused-function.
Lets mpv compile with --extra-cflags=-Werror with gcc 4.8.1.
2013-07-21 01:14:18 +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 cd219e2c5d sd_ass: remove unused variable warning
The `track` variable is used only if `LIBASS_VERSION >= 0x01020000`.
2013-07-20 11:47:41 +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) d0b129971a ao_wasapi0: Don't starve the WASAPI thread on seeks
Seeking calls thread_reset, but doesn't call thread_play. thread_reset
would disable WASAPI events, but they would never get re-enabled unless
the user paused and then unpaused.

Keep track of whether the stream is paused or not (there already was a
field for that, but it was apparently unused), and if it's not paused,
call thread_play after thread_reset. Fixes mpv freezing after seeks.
2013-07-20 02:21:04 +02:00
Diogo Franco (Kovensky) 20c2947cbb ao_wasapi0: Don't release WASAPI buffer twice
Would cause bogus AUDCLNT_E_OUT_OF_ORDER errors.
2013-07-20 02:21:00 +02:00
Diogo Franco (Kovensky) 9ab73b6373 ao_wasapi0: Make it compile on cygwin64
Fixes format specifies that assume windows TYPEDEFS are as long as they look
like they are.

Remove calls to _beginthreadex and _endthreadex, these are only present on
microsoft's C runtimes. Replace by the otherwise identical CreateThread and
ExitThread calls.

This actually requires fixes to devicetopology.h, but the problem has been
(kinda) reported to mingw-w64:

<Kovensky> I see that those KSJACK* structs are supposedly declared in
  devicetopology.h itself, but for some reason (some of?) the decls that use
  them aren't seeing them?
<Kovensky> ok, it seems that it expects ks.h and ksmedia.h to declare those
  structs, but it doesn't
<Kovensky> the included files declare KDATAFORMAT, KSIDENTIFIER and LUID (and
  the associated pointer typedefs)
<Kovensky> but everything else is essentially inside #if 0
<Kovensky> changing the #ifndef _KS_ to only include KDATAFORMAT, KSIDENTIFIER
  and LUID (and putting the KSJACK stuff outside that #ifndef) makes the
  header compile
<Kovensky> it solves my immediate problem, but if that happened to begin with
  there's probably something more wrong with the ks headers :S
2013-07-20 02:20:46 +02:00
Diogo Franco (Kovensky) 6ab2eebe5f direct3d: Fixes format string that assumed sizeof(LONG) == sizeof(long) 2013-07-20 02:20:26 +02:00
Diogo Franco (Kovensky) 1652d3689c mp_msg: fixes windows code that assumes sizeof(DWORD) == sizeof(long) 2013-07-20 02:20:19 +02:00
wm4 bb5bad5ab7 m_option: remove unused definitions 2013-07-20 02:17:04 +02:00
wm4 cb1ee41cec cache: fix time check for printing warning
This actually waited 2 seconds, because CACHE_WAIT_TIME happened to
be 0.5.
2013-07-20 02:16:54 +02:00
wm4 67bad55414 demux_mkv: fix realaudio timestamps
This fixes the sample RA_missing_timestamps.mkv. Pretty funny how this
code got it almost right, but not quite, so it was broken all these
years. And then, after everyone stopped caring, someone comes and fixes
it. (By the way, I know absolutely nothing about realaudio.)
2013-07-20 02:16:46 +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 a1fd8c6953 img_format: comment on some pixel formats 2013-07-18 13:49:33 +02:00
wm4 fcdb681822 img_format: add a mask for color class
Using the term "color class" to avoid confusion with the other
colorspace related concepts.

Also get rid of MP_IMGFLAG_FMT_MASK, since it was unused.
2013-07-18 13:49:28 +02:00
wm4 b606a6ce1a sws_utils: make hq swscale flags available with mp_sws_hq_flags
No need to duplicate this on the call-site.
2013-07-18 13:48:57 +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 4fd06a78ae sws_utils: remove some old code 2013-07-18 13:45:48 +02:00
wm4 de61561deb vo_x11: use new swscale wrapper 2013-07-18 13:44:56 +02:00
wm4 dc73b200db mp_image: one utility function to set image parameters 2013-07-18 13:44:17 +02:00
wm4 b81f5e2757 vf_scale: use new swscale wrapper 2013-07-18 13:41:38 +02:00
wm4 2134fa4e6b vf: make sure less important image params are set before/after filters
Image parameters like colorspace, color levels, and chroma location are
generally less important, and many filters don't set them correctly.
Force them instead in the generic VF code, which is probably better and
more convenient over all. So we designate this is a proper solution,
instead of a dirty hack.
2013-07-18 13:37:24 +02:00
wm4 d8659c9aa0 sws_utils: refactor swscale wrapper code
This splits the monolithic mp_image_swscale() function into a bunch of
functions and a context struct. This means it's possible to set
arbitrary parameters (e.g. even obscure ones without getting in the
way), and you don't have to create the context on every call.

This code is preparation for removing duplicated libswscale API usage
from other parts of the code.
2013-07-18 13:31:01 +02:00
wm4 48789b3546 vf_scale: remove rounding of sizes to 2 with 4:2:0
libswscale doesn't seem to require this (anymore?), and libavfiltert's
vf_scale doesn't do it either. Moreover, this wasn't done for most other
subsampled formats, not even very old ones. So just remove it.

(It'd be quite easy to align on chroma boundaries with all pixel
formats, though.)
2013-07-18 13:16:59 +02:00