Commit Graph

371 Commits

Author SHA1 Message Date
Stefano Pigozzi 4ffaf4868e cocoa_common: fix ontop switching when fullscreen
`enterFullScreenMode:withOptions:` creates another window so set the level on
both the windowed window and current window.

Also remove NSFullScreenModeWindowLevel as it seems to be superfluous.
2013-06-11 21:20:46 +02:00
Stefano Pigozzi fbca1b179a cocoa_common: fix window level when going fullscreen
This is a regression introduced by 0057aa4769. Fix it so that the fullscreen
window uses the correct window level.

[ci skip]

Fixes #106
2013-06-10 20:42:39 +02:00
Rudolf Polzer fc438061e8 encoding: fix -oneverdrop logic when -omaxfps is used
Not that anyone should ever do this...
2013-06-09 16:37:13 +02:00
Rudolf Polzer 3600bf348f encoding -omaxfps: rewrite logic
Now it properly hits the "0 times displayed" case when frames get
skipped; this means the candidate frame for the case the next frame is
"long" is set properly.
2013-06-09 16:31:09 +02:00
Rudolf Polzer 19d80e28e1 encoding -omaxfps: do not shift pts when pts are repeated entirely
This is just to make sure. I have no test case for this, but the logic
seems saner that way.
2013-06-09 15:50:53 +02:00
Rudolf Polzer 0cbc75c083 Option -omaxfps: limit fps when encoding
Lower-fps content is left alone (NOT aligned to this fps); higher fps
content is decimated to this frame rate.
2013-06-09 15:37:28 +02:00
wm4 92ae48db0f Merge branch 'sub_mess'
This branch heavily refactors the subtitle code (both loading and
rendering), and adds support for a few new formats through FFmpeg.

We don't remove any of the old code yet. There are still some subtleties
related to subreader.c to be resolved: code page detection & conversion,
timing post-processing, UTF-16 subtitle support, support for the -subfps
option. Also, SRT reading and loading ASS via libass should be turned
into proper demuxers. (SRT is needed because Libav's is gravely broken,
and we want ASS loading via libass to cover full libass format support.
Both should be demuxers which are probed _before_ libavformat, so that
all subtitles can be loaded through the demuxer infrastructure, and
libavformat subtitles don't need to be treated in a special way.)
2013-06-04 00:29:44 +02:00
wm4 9f4261de65 core: add common function to initialize AVPacket
Audio and video had their own (very similar) functions to initialize an
AVPacket (ffmpeg's packet struct) from a demux_packet (mplayer's packet
struct). Add a common function for these.

Also use this function for sd_lavc_conv. This is actually a functional
change, as some libavfilter subtitle demuxers add weird out-of-band
stuff as side-data.
2013-06-03 22:40:07 +02:00
Stefano Pigozzi f0d2120347 osx: cocoa_common: use default wakeup period
Now that Cocoa's input handling is done on a separate thread from the playloop
it is ridicolously simple to have longer asynchronous sleeps when paused.
2013-06-03 22:31:13 +02:00
Stefano Pigozzi f13f0db33a osx: create macosx_events to deal with keyDown events
On OSX with Cocoa enabled keyDown events are now handled with
addLocalMonitorForEventsMatchingMask:handler:. This allows to respond to
events even when there is no VO initialized but the GUI is focused.
2013-06-03 22:31:13 +02:00
Stefano Pigozzi 63e2a21c64 osx_common: remove outdated ifdeffery
It was definining keycodes not defined in OS X < 10.5.
2013-06-03 22:31:13 +02:00
wm4 66be276f69 gl_video: reduce output with -v, skip useless header parts
Originally, the header wasn't supposed to contain random compatibility
stuff, but now all that is printed with -v. Add a hack to skip it and
to reduce the noise.
2013-06-03 00:05:07 +02:00
wm4 87c549ffae gl_video: explicitly clamp colormatrix output
This could lead to quite visible artifacts when using an appropriate ICC
and float FBOs. The float FBOs allow storing out of range values, and my
guess is that the rest of the precessing chain elevated these out of
range values, resulting in artifacts.
2013-06-03 00:00:14 +02:00
Stefano Pigozzi 57571b5da3 cocoa_common: autohide dock/menubar on fs only if on same screen
Autohide the menubar and/or dock only if they are present in the screen the
player is going to go fullscreen into. I thought the GUI would handle this for
me when I switched 0057aa476 but lack of hardware to test made me embarass
myself yet again.

I reimplemented this feature with nicer code and behaviour. The code checks
separately wether to hide menubar and dock separatly, while the old code used
a single check possibly hiding stuff without need.

Added the key checks as a some category additions to NSScreen for readability.
2013-06-01 22:52:21 +02:00
Stefano Pigozzi f4dcb93be1 cocoa_common: don't autohide mouse on mousedown
Previews code allowed to click the same spot for a long time and the cursor
would autohide. No more!
2013-06-01 17:58:08 +02:00
Stefano Pigozzi db7835f5d7 cocoa_common: avoid window creation with VOFLAG_HIDDEN
This takes an approach similar to the wayland OpenGL backend. VOFLAG_HIDDEN
flag semantics doesn't mean "hide the window" but is simply ever used only to
do detection of available OpenGL extensions. On OSX it's possibile to
accomplish this task just by creating the OpenGL context without attaching
it to a drawable.
2013-06-01 12:12:17 +02:00
Stefano Pigozzi 109158603d cocoa_common: dehack mouse autohide by clipping view bounds to visible screen
This prevents the mouse to autohide when hovering the dock/menubar without any
particular hack and seems to finally cover all edge cases.
2013-06-01 02:10:41 +02:00
Stefano Pigozzi 25ae58fbbe cocoa_common: fix mouse autohide on MenuBar/Dock interaction
This is needed after last commit. A bug within a bug (yo dawg)! Serious
explaination in the source code comment so that it's not forgotten.
2013-05-31 14:16:27 +02:00
Stefano Pigozzi 2c4f5b75c0 cocoa_common: fix empty window when going fs on different screen
Using `enterFullScreenMode:withOptions:` with a screen handle than the current
screen doesn't hide the current window in the current screen. This is a bug in
Cocoa (preparing an isolated test case and sending the rdar later).

To work around this, manually hide/show the window that the toolkit should
hide/show for us.
2013-05-31 12:58:54 +02:00
Stefano Pigozzi bf21ed0102 cocoa_common: fix mouse hiding outside of player view
This bug was the result of crappy position detection in the previous code
combined with the commits moving autohide delay out of the cocoa backend and
into the core.

The hit detection was improved and now takes also account of interactions with
the Dock and Menubar. Moreover VOCTRL_SET_CURSOR_VISIBILITY now has an effect
only if the mouse position matches with this improved hit detection. This means
that both interaction with the Dock and Menubar are considered as well as
moving the mouse inside another screen.
2013-05-30 23:03:21 +02:00
Stefano Pigozzi 68c3e2aabb cocoa_common: refactor fullscreen code for readability
Break up the code into several methods and reduce code duplication. Also add
comments to make the intention of all this clearer.
2013-05-30 23:03:20 +02:00
Stefano Pigozzi 0aac8bc5ad cocoa_common: fix native-fs state saving
`opts->fs = VO_FALSE` was forgotten
2013-05-30 23:03:20 +02:00
Stefano Pigozzi 3789e1bebf cocoa_common: fix a bug in window initialization error
We didn't bail out soon enough. Bug was introduced by 134f3e97.
2013-05-30 23:02:56 +02:00
Stefano Pigozzi 0057aa4769 cocoa_common: use cocoa APIs to go fullscreen
This removes a bit of ugly code and bookeeping which is never bad. `drawRect`
needs to guard against different window instances since in fullscreen the view
is wrapped in a fullscreen window provided by the toolkit (a instance of
NSFullScreenWindow to be precise).

The event handling was moved to the view so that it can still get all the
events when in the fullscreen window. Ideally these should be moved to
some NSResponder subclass within macosx_application and made available even
when no window is present. I refrained from this because "small steps".
2013-05-30 23:01:12 +02:00
Stefano Pigozzi 3396e0565b macosx_application: move escape_loadfile_name in this file
This allows to move back osx_common to raw C.
2013-05-30 23:01:12 +02:00
Stefano Pigozzi 14ff6bbf7c cocoa_common: use better power management activity description
Now one might actually undestand why this power management assertion is used
in the first place.
2013-05-30 23:01:12 +02:00
Stefano Pigozzi ae1fa639e0 osx: remove compatibility conditionals for 10.6
At this point 10.6 is pretty old and we don't want to supporting old platforms.
I'm killing all the 10.6 compatibility code before doing more refactorings.

Next commits will also use newer Objective-C syntax such as literals and
@autoreleasepool.
2013-05-30 22:57:35 +02:00
wm4 59892dd4cc gl_common: fix invalid alignment
0 is invalid. The intention of the code turning off any additional
alignment, so we need 1.

Change a comment: obviously we don't try to set alignment parameters
etc.to handle stride correctly, and instead do everything by row.
2013-05-30 15:56:51 +02:00
wm4 bbc865a4da gl_video: add some debug code for testing texture depth
This probes and prints the depth of some texture formats with the help
of a FBO. By default it tests the format used for scaling, as well as
the format used for dithering and the 3D LUT (if any of these are
enabled).

The output is visible only with -v. Some representative values are
probed, and the difference of input and output value is printed as hex-
float. Hex-floats are used because they make the implied precision more
obvious. Originally I wanted to do some more sophisticated guessing of
the implied depth/precision for more user-friendly reporting, but then
I decided that printing raw data is better for debugging, especially if
things go wrong.

This does not try to disable any functionality and does not print any
warnings if the depth is lower than what it should be.
2013-05-30 15:55:41 +02:00
wm4 5d0c4b6ac3 gl_video: change a GLSL statement
This might be better with dumb shader compilers, which won't vectorize
this to a single vector-division, assuming the hardware does have such
an instruction. Affects "bicubic_fast" scale mode only.
2013-05-30 15:40:55 +02:00
wm4 e08bf272ee gl_video: fix some dithering bugs
The internal texture format GL_RED is typically 8 bit, which is clearly
not good enough for the new dither matrix. The idea was to use a float
texture format, but this was somehow "forgotten". Use GL_R16, since
16 bit textures are more robust, and provide more precision for the
same memory usage.

Change how the offset for centering the dither matrix is applied. This
is needed for making it possible to round up values to the target depth.
Before this commit, this changed the output even if the input was exact
and input and output depth were the same, which is not really what you
want. Now it doesn't do that anymore.
2013-05-30 15:38:07 +02:00
wm4 a21cfddaab options: remove some questionable -lavdopts suboptions
Most of these are rather questionable, the rest you rarely need to set
manually. You still can set all of them with -lavdopts-o (because
libavcodec has AVOptions for them).
2013-05-29 14:57:05 +02:00
wm4 f3f77c6e31 vo_opengl: remove most of the "inline" documentation
There's no point duplicating all the text that is already in the man
pages, and synchronizing them is a pain. Place a link to the github
generated pages instead.

Unfortunately, the anchor '#vo-opengl' does not work. Maybe github's
rst converter just sucks, as the actually generated HTML contains
links using that anchor too, but does not generate the anchor itself.
Too bad.
2013-05-26 17:20:01 +02:00
wm4 3edb8fb71c vf_delogo: copy in non-direct case, fix double-free
If the image is not writeable, the image actually has to be copied
beforehand. This was overlooked when converting the video chain to
reference counted images.

Fix a double free issue. This was overlooked when vf.c was changed to
free filter priv data automatically.
2013-05-26 17:13:09 +02:00
wm4 58a7d81dc5 gl_video: improve dithering
Use a different algorithm to generate the dithering matrix. This
looks much better than the previous ordered dither matrix with its
cross-hatch artifacts.

The matrix generation algorithm as well as its implementation was
contributed by Wessel Dankers aka Fruit. The code in dither.c is
his implementation, reformatted and with static global variables
removed by me.

The new matrix is uploaded as float texture - before this commit, it
was a normal integer fixed point matrix. This means dithering will
be disabled on systems without float textures.

The size of the dithering matrix can be configured, as the matrix is
generated at runtime. The generation of the matrix can take rather
long, and is already unacceptable with size 8. The default is at 6,
which takes about 100 ms on a Core2 Duo system with dither.c compiled
at -O2, which I consider just about acceptable.

The old ordered dithering is still available and can be selected by
putting the dither=ordered sub-option. The ordered dither matrix
generation code was moved to dither.c. This function was originally
written by Uoti Urpala.
2013-05-26 16:44:20 +02:00
wm4 39225ed196 gl_video: add scaler-resizes-only sub-option
This option disables the scaler set with lscale if the video image is
not resized.
2013-05-26 16:44:20 +02:00
wm4 f44a242258 Replace calls to usec_sleep()
This is just dumb sed replacement to mp_sleep_us().

Also remove the now unused usec_sleep() wrapper.
2013-05-26 16:44:20 +02:00
wm4 e56d8a200d Replace all calls to GetTimer()/GetTimerMS()
GetTimer() is generally replaced with mp_time_us(). Both calls return
microseconds, but the latter uses int64_t, us defined to never wrap,
and never returns 0 or negative values.

GetTimerMS() has no direct replacement. Instead the other functions are
used.

For some code, switch to mp_time_sec(), which returns the time as double
float value in seconds. The returned time is offset to program start
time, so there is enough precision left to deliver microsecond
resolution for at least 100 years. Unless it's casted to a float
(or the CPU reduces precision), which is why we still use mp_time_us()
out of paranoia in places where precision is clearly needed.

Always switch to the correct time. The whole point of the new timer
calls is that they don't wrap, and storing microseconds in unsigned int
variables would negate this.

In some cases, remove wrap-around handling for time values.
2013-05-26 16:44:20 +02:00
wm4 51254a678c vo: rip out VO timer wakeup mechanism again
This was used by some VOs to do timing of cursor autohiding, but we
recently moved that out of the VOs. Even though this mechanism might
be a good idea and could be needed again in future (but for what?),
it's unused now. So better just get rid of it.
2013-05-26 16:44:20 +02:00
Stefano Pigozzi 25d66f526e cocoa_common: send mouse moved events to core when dragging
This change fixes mouse autohide when dragging mouse.
2013-05-26 16:44:20 +02:00
Alexander Preisinger 405182af46 wayland: use VOCTRL_SET_CURSOR_VISIBILITY 2013-05-26 16:44:19 +02:00
Alexander Preisinger bb9b6501fd wayland: introduce vo_wayland_config
This removes the need for exposing vo_wayland_fullscreen and other functions
also this will be usefull for other vos in the future.
2013-05-26 16:44:19 +02:00
Stefano Pigozzi e6a225d57a cocoa_common: implement VOCTRL_SET_CURSOR_VISIBILITY
Pass along cursor visibility hints to be more consistent with OSX's behaviour.
2013-05-26 16:44:19 +02:00
Stefano Pigozzi ea8a8af3ec cocoa_common: implement mouse movement notifications
Notify the core of mouse movement events. The coordinates are converted to a
coordinate system with the origin in upper left corner, since Cocoa has it in
the lower left corner.
2013-05-26 16:44:19 +02:00
wm4 8fe357380e w32: use VOCTRL_SET_CURSOR_VISIBILITY
This didn't even implement --cursor-autohide. Now it does, and the
behavior of the VOs under Windows change accordingly.
2013-05-26 16:44:19 +02:00
wm4 6ab719f698 vo_sdl: use VOCTRL_SET_CURSOR_VISIBILITY 2013-05-26 16:44:19 +02:00
wm4 c76c65441a x11: remove cursor hiding logic, use VOCTRL_SET_CURSOR_VISIBILITY 2013-05-26 16:44:19 +02:00
wm4 3c8f8b7714 core: do mouse cursor hiding business in frontend
Do this so that not every VO backend has to setup a timer for cursor
hiding and interpret the --cursor-autohide option.
2013-05-26 16:44:19 +02:00
wm4 8df780cb50 vo: remove vo.check_events callback
Use VOCTRL_CHECK_EVENTS instead. Change the remaining VOs to use it.
Only vo_sdl and vo_caca actually need this, and vo_null, vo_lavc, and
vo_image had stubs only.
2013-05-26 16:44:19 +02:00
wm4 526e969419 w32: use vo_w32_control() for all VOs 2013-05-26 16:44:19 +02:00