Commit Graph

987 Commits

Author SHA1 Message Date
Stefano Pigozzi fccd08f43b build: remove bundle support from waf
Use TOOLS/osxbundle.py instead. It's just better and less hacky.
2014-11-01 17:29:10 +01:00
wm4 aa6b7fa07b vo_opengl: draw OSD twice in 3D mode case
Apparently this is needed for correct 3D mode subtitles. In general,
it seems you need to duplicate the whole "GUI", so it's done for all
OSD elements.

This doesn't handle the "duplication" of the mouse pointer. Instead,
the mouse can be used for the top/left field only. Also, it's possible
that we should "compress" the OSD in the direction it's duplicated, but
I don't know about that.

Fixes #1124, at least partially.
2014-10-29 23:14:46 +01:00
Stefano Pigozzi 1d7ae5829e cocoa: fix small leak 2014-10-27 19:18:29 +01:00
Stefano Pigozzi 55396ee554 libmpv: cocoa: fix view leak on uninit
The code was lacking a -removeFromSuperview call which resulted in a leak on
our part if the parent view in the client was not released.
2014-10-27 19:14:55 +01:00
wm4 fcc360ccad x11: fix display FPS detection for interlaced modes
In interlaced modes, we output fields, not complete frames, so the
framerate doubles.

The method to calculate this was borrowed from xrandr code.

Hopefully fixes #1224.
2014-10-27 16:17:55 +01:00
wm4 3b34f0078d vo_direct3d: support nv12/nv21 directly 2014-10-26 02:36:15 +02:00
Stefano Pigozzi 7822b97033 cocoa: perform VOCTRL_SET_UNFS_WINDOW_SIZE asyncronously
Apparently if resizing a NSWindow from a secondary thread Cocoa will
automatically protect itself using NSViewHierarchyLock and in our case,
cause a deadlock.

Fixes #1210
2014-10-24 20:30:53 +02:00
wm4 9ba6641879 Set thread name for debugging
Especially with other components (libavcodec, OSX stuff), the thread
list can get quite populated. Setting the thread name helps when
debugging.

Since this is not portable, we check the OS variants in waf configure.
old-configure just gets a special-case for glibc, since doing a full
check here would probably be a waste of effort.
2014-10-19 23:48:40 +02:00
Stefano Pigozzi fa904150bf cocoa: reintroduce async resize
After removing synchronous libdispatch calls, this looks like it doesn't
deadlock anymore. I also experimented with pthread_mutex_trylock liek wm4
suggested, but it leads to some annoying black flickering. I will fallback to
that only if some new deadlocks are discovered.
2014-10-18 18:30:22 +02:00
Stefano Pigozzi 421bce0077 Revert "cocoa: perform init and uninit synchronously"
This reverts commit a0ac8b6331.
2014-10-18 14:28:47 +02:00
wm4 d15df00643 win32: clear window handle on destruction
As I understand, otherwise, the code will try to destroy the same
window again in the cleanup part of the gui_thread(), which makes no
sense and is potentially dangerous.
2014-10-17 22:22:10 +02:00
wm4 201a656350 win32: get rid of mp_stat in the normal source code
mp_stat() instead of stat() was used in the normal code (i.e. even
on Unix), because MinGW-w64 has an unbelievable macro-mess in place,
which prevents solving this elegantly.

Add some dirty workarounds to hide mp_stat() from the normal code
properly. This now requires replacing all functions that use the
struct stat type. This includes fstat, lstat, fstatat, and possibly
others. (mpv currently uses stat and fstat only.)
2014-10-17 22:15:19 +02:00
Stefano Pigozzi eb902efb04 cocoa: allow mouse events to bubble up with no-input-cursor
Previously we didn't report events to the core, but still prevented the events
to travel on the responder chain.
2014-10-17 19:19:45 +02:00
wm4 708ca05cc6 vo_opengl: fix wrong comments
The previous commit was actually incorrect, and the change had
absolutely no effect. The two formats are (fortunately) the same. I'm
probably too tired.
2014-10-16 23:51:36 +02:00
wm4 b52c7273f4 vo_opengl: fix theoretical format mismatch issue
This would have been wrong for hw decoders which pass us NV12 or NV21.
The format the GL shader filter chain gets is stored in p->image_desc,
while p->image_format still contains the "real" input format (which in
case of hw decoding is an opsque hw accel format). Since no hw decoder
did this, this is really just a theoretical fix and doesn't fix any
actual bugs.
2014-10-16 23:44:10 +02:00
Stefano Pigozzi a0ac8b6331 cocoa: perform init and uninit synchronously
This is slightly safer and without the resize redraw, should not cause any
deadlock.
2014-10-16 22:53:08 +02:00
wm4 7266ceeb8e x11: don't wait for asynchronous X resizing with window-scale
Instead of letting the window-scale property return the old value until
X11 actually executed the resize, just set the new assumed internal
window size immediately. This avoids a "lag" between setting and reading
the window-scale property, like OSD controls typically do.

Remove the additional calls from vo_x11_highlevel_resize() - they're
pointless and slightly wrong, and resize events will take care of
updating these things correctly anyway.

Fixes #1176.

("window-scale" works via VOCTRL_[S|G]ET_UNFS_WINDOW_SIZE.)
2014-10-13 09:57:31 +02:00
wm4 9c0389e841 gl_x11: distinguish missing GLX and too old GLX versions
This probably led to confusing output.

CC: @mpv-player/stable
2014-10-12 01:33:10 +02:00
Stefano Pigozzi c2eca2e4b7 libmpv/cocoa: allow clients to use mpv event system
This allows mpv's view to take key and send events to mpv's core.
To set key status correctly, clients must call -[NSWindow selectNextKeyView:]
during reconfig on the main thread. All is 'documented' in the cocoabasic
example.

If someone knows a better way to handle giving key to the embedded view,
let me know!
2014-10-12 00:19:44 +02:00
Stefano Pigozzi 8b6b84f36b cocoa: remove usage of Objective-C categories
Objective-C categories need special linker flags from the user when statically
linking (-ObjC LDFLAG), so make everyone's life simpler and remove them.
2014-10-12 00:19:44 +02:00
wm4 cea7528b39 x11: don't wait until window is destroyed
This can hang if the window was destroyed externally (or that's what I
suspect happens), and we somehow didn't receive the DestroyNotify event.
I'm not sure why we wouldn't receive this event (since it should just be
in the xlib event queue), but on the other hand there's no real need to
wait for window destruction.

This essentially reverts 97fc74e2.
2014-10-11 16:30:58 +02:00
wm4 26bc6b4831 Add some missing "const"s
The one in msg.c was mistakenly removed with commit e99a37f6.

I didn't actually test the change in ao_sndio.c (but obviously "ap"
shouldn't be static).
2014-10-10 13:44:08 +02:00
Stefano Pigozzi 8a25a4af65 cocoa: post keydown and keyup events without event monitor
Our code worked under the assumption that the event monitor is always active
and we did remove the keydown and keyup overrides from our cocoa view.
2014-10-09 22:14:41 +02:00
Stefano Pigozzi 58f62891fa cocoa: fix 'uninitalized' access
I think this doesn't make a difference, since in Objective-C nil responds as
a NullObject, but better not depend on this crappy language feature.
2014-10-09 22:14:41 +02:00
wm4 a13e01cc3e x11: fix inverted condition
Worryingly wrong. Fixes #1162.

Also fix another issue (window title was set anyway), which was why I
didn't notice this and testing it seemed to be fine.
2014-10-09 21:26:03 +02:00
wm4 e294656cb1 client API: rename --input-x11-keyboard to --input-vo-keyboard
Apparently we need this for Cocoa too. (The option was X11 specific in
the hope that only X11 would need this hack.)
2014-10-09 18:28:37 +02:00
Stefano Pigozzi 69fa956f50 cocoa: allow to embed into an arbitrary NSView
Basically add if guards on all the problematic features. I'm still thinking
about a better way to handle this, but for the time being, this will do.
2014-10-08 19:38:35 +02:00
wm4 f47269a074 x11: disable various features when embedding the window 2014-10-07 23:37:47 +02:00
Stefano Pigozzi f440c0626e cocoa: try to fix sizing bugs on retina displays
untested, no hardware.
2014-10-06 09:58:59 +02:00
Stefano Pigozzi ba994bc0dd cocoa: fix mouse autohide
broken in 547b62f
2014-10-05 23:49:09 +02:00
Stefano Pigozzi 69508dc507 cocoa: remove a debug commento
fixup previous commit
2014-10-05 23:41:39 +02:00
Stefano Pigozzi 547b62f45e cocoa: separate video view and events view 2014-10-05 23:38:39 +02:00
Stefano Pigozzi cb0f342ab2 cocoa: fix fullscreen with bundle 2014-10-05 23:38:12 +02:00
Stefano Pigozzi ea83a2b9bc cocoa: readd some function calls 2014-10-05 22:38:26 +02:00
Stefano Pigozzi c655fdc38f cocoa: actually reset the event flags 2014-10-05 22:32:23 +02:00
Stefano Pigozzi 62bc735c1a cocoa: remove some useless flags 2014-10-05 19:31:21 +02:00
Stefano Pigozzi 2cb97454f5 cocoa: disable some features when embedding in another window
ontop, fullscreen and window title change to be precise
2014-10-05 19:16:23 +02:00
Stefano Pigozzi c6b68c28f4 cocoa: remove --fs-missioncontrol
This is the first of a series of commits that will change the Cocoa way in a
way that is easily embeddable inside parent views. To reach that point common
code must avoid referencing the parent NSWindow since that could be the host
application's window.
2014-10-05 18:07:27 +02:00
Stefano Pigozzi 7968814470 cocoa: fix some pointer casts to be 32bit safe
credits: wm4
2014-10-05 15:22:17 +02:00
Stefano Pigozzi c8ed4736ef cocoa/libmpv: allow to embed mpv GL view in another window
This is just temporary code but is a good base for future work (and baby
steps are required for these changes). The 'final destination' is embedding
the video view into any NSView but that requires some more work (the mechanism
will be the same: pass the view's pointer casted to int64_t through -wid).

For instance we will need to remove as much usage of the window instance
as possible, and use nil guards where not possible. For this reason I will
remove stuff like the mission control fullscreen feature (it's a cute feature
but annoying to support and quite limited, go make your GUIs), and a way to
lookup the current screen directly from the NSView absolute coordinates
(this is needed for ICC detection mostly, and reporting back the screen to
mpv's core).

Moreover the current view.m will need to be separated into 2 views: the actual
video view that will be embedded, and a parent view that will not be embedded
and will be responsibile for tracking events.
2014-10-05 14:28:33 +02:00
Stefano Pigozzi 0ec14ec597 cocoa: simplify the config code and run it on the main thread
This could be dangerous because we initialize the window asynchronously and
return immediately from config, but since the OpenGL context is already
created, this seems to work correctly and doesn't cause weird deadlock cases.
2014-10-05 09:33:00 +02:00
wm4 bd169a313c options: add --no-keepaspect-window
Seems silly, but was requested.
2014-10-04 22:17:36 +02:00
Stefano Pigozzi 1651d96583 cocoa: don't reset presentation options on uninit
This doesn't look to be needed anymore. Fullscreening with both the NSView
and the NSWindow API works correctly. I guess this was forgotten in from older
code which changed presentation options directly for going fullscreen.
2014-10-04 19:10:36 +02:00
Stefano Pigozzi e75ce6c869 cocoa: only call resize for view changing frame 2014-10-04 17:39:43 +02:00
Stefano Pigozzi 0541151b40 cocoa: remove pointless drawRect
Apparently it causes deadlocks, and at the moment it does nothing.

Fixes #778
2014-10-04 17:31:18 +02:00
Stefano Pigozzi d980c30851 cocoa: make fullscreening look like an atomic operation
At the moment when you fullscreen mpv there is a very small time interval
where the fullscreen windows is semi-transparent. Apparently whem moving the
view to another parent it's better to make Cocoa not draw anything globally.

An Apple engineer said it, so it must be correct:
http://www.cocoabuilder.com/archive/cocoa/142020-preventing-flicker-on-moving-nsview-to-different-superview.html

I know I will regret this in the future.
2014-10-04 17:31:18 +02:00
Stefano Pigozzi b915852f9f cocoa: make resizing wake the vo thread 2014-10-04 17:31:18 +02:00
Stefano Pigozzi c1d5b182b4 cocoa: remove dead code 2014-10-04 17:31:18 +02:00
wm4 54fd93856a x11: stupid workaround for XMonad
--x11-netwm=yes now forces NetWM fullscreen, while --x11-netwm=auto
(detect whether NetWM fullsctreen support is available) is the old
behavior and still the default.

See #888.
2014-10-04 15:03:02 +02:00
Stefano Pigozzi d1bdf9ea11 cocoa: move to a simpler threading model
Unfortunately using dispatch_sync for synchronization turned out to be really
bad for us. It caused a wide array of race conditions, deadlocks, etc.

Moving to a very simple mutex. It's not clear to me how to do liveresizing
with this, for now it just flickers with is unacceptable (maybe I'll draw
black instead).

This should fix all the threading cocoa bugs. Reopen if it's not the case!

Fixes #751
Fixes #1129
2014-10-04 11:47:17 +02:00