Commit Graph

825 Commits

Author SHA1 Message Date
Stefano Pigozzi 3f594c2e84 cocoa: use window-scale to support video scaling functionality
In the cocoa backend you can use cmd+0/1/2 to scale the window. This commit
makes it use the new window-scale functionality.
2013-11-22 08:43:02 +01:00
Stefano Pigozzi ede608ed43 cocoa: implement window-scale 2013-11-22 08:41:34 +01:00
Stefano Pigozzi 7e2edad8ef switch the build system to waf
This commit adds a new build system based on waf. configure and Makefile
are deprecated effective immediately and someday in the future they will be
removed (they are still available by running ./old-configure).

You can find how the choice for waf came to be in `DOCS/waf-buildsystem.rst`.
TL;DR: we couldn't get the same level of abstraction and customization with
other build systems we tried (CMake and autotools).

For guidance on how to build the software now, take a look at README.md
and the cross compilation guide.

CREDITS:
This is a squash of ~250 commits. Some of them are not by me, so here is the
deserved attribution:

 - @wm4 contributed some Windows fixes, renamed configure to old-configure
   and contributed to the bootstrap script. Also, GNU/Linux testing.
 - @lachs0r contributed some Windows fixes and the bootstrap script.
 - @Nikoli contributed a lot of testing and discovered many bugs.
 - @CrimsonVoid contributed changes to the bootstrap script.
2013-11-21 21:22:36 +01:00
wm4 16233bc546 vdpau_old: enable OpenGL interop
OpenGL interop was essentially disabled, because the decoder didn't
request vdpau device creation from vo_opengl.
2013-11-19 22:15:28 +01:00
wm4 82068ec56c demux: rename demux_packet.h to packet.h
This always bothered me.
2013-11-18 18:46:44 +01:00
wm4 b1405f3cff vo_vdpau: don't calculate destination alpha when drawing OSD
Same as MPlayer svn commit r36515 "Chose cheaper alpha blend equation."

No idea if this is actually faster, but can't hurt.
2013-11-18 14:21:01 +01:00
wm4 10bcab6bc1 gl_common: print SW renderer warning only if it was the only reason we rejected it 2013-11-14 19:51:42 +01:00
wm4 467ad4413e vd_lavc: select correct hw decoder profile for constrained baseline h264
The existing code tried to remove the "extra" profile flags for h264.

FF_PROFILE_H264_INTRA doesn't matter for us at all, because it's set
only for profiles the vdpau/vaapi APIs don't support.

The FF_PROFILE_H264_CONSTRAINED flag on the other hand is added to
H264_BASELINE, except that it makes the file a real subset of H264_MAIN
and H264_HIGH. Removing that flag would select the BASELINE profile,
which appears to be rarely supported by hardware decoders. This means we
accidentally rejected perfectly hardware decodable files. Use MAIN for
it instead.

(vaapi has explicit support for CONSTRAINED_BASELINE, but it seems to be
a new thing, and is not reported as supported where I tried. So don't
bother to check it, and do the same as on vdpau.)

See github issue #204.
2013-11-14 19:51:42 +01:00
wm4 597a143ec6 gl_common: remove unneeded callback
We got rid of this some time ago, but apparently not completely.
2013-11-14 19:51:40 +01:00
Alexander Preisinger 95ed81c329 wayland: create xkbcommon keymap from string
Fixes a problem where the passed size doesn't match the actuall string.
2013-11-13 00:18:20 +01:00
Alexander Preisinger e4f2fcc0ec waylad: implement functionality for window-scaling 2013-11-12 21:02:49 +01:00
Rudolf Polzer 8ff577a2f3 vo_lavc: fix -ovoffset.
Previously, using it led to no single frame being output, ever.
2013-11-11 13:02:34 +01:00
wm4 775e08ba65 vo_opengl: fix alpha values written to the framebuffer
When blending OSD and subtitles onto the video, we write bogus alpha
values. This doesn't normally matter, because these values are normally
unused and discarded. But at least on Wayland, the alpha values are used
by the compositor and leads to transparent windows even with opaque
video on places where the OSD happens to use transparency.

(Also see github issue #338.)

Until now, the alpha basically contained garbage. The source factor
GL_SRC_ALPHA meant that alpha was multiplied with itself. Use GL_ONE
instead (which is why we have to use glBlendFuncSeparate()). This should
give correct results, even with video that has alpha. (Or at least it's
something close to correct, I haven't thought too hard how the
compositor will blend it, and in fact I couldn't manage to test it.)

If glBlendFuncSeparate() is not available, fall back to glBlendFunc(),
which does the same as the code did before this commit. Technically, we
support GL 1.1, but glBlendFuncSeparate is 1.4, and I guess we should
try not to crash if vo_opengl_old runs on a system with GL 1.1 drivers
only.
2013-11-10 03:14:38 +01:00
wm4 87ab30669c gl_hwdec_vdpau: silence warning caused by buggy GL_NV_vdpau_interop spec
VDPAU handles are integers, but for some reasons the VDPAU GL extension
expects them as void*.
2013-11-09 23:32:58 +01:00
wm4 782c8e72ff vdpau: unbreak
Obviously I didn't test commit 1b8cd01, and it just crashed. Oops.
2013-11-09 01:27:03 +01:00
wm4 1b8cd01b1a vdpau: drop dummy render function
This was supposed to handle preemption better. I still think the current
state isn't very nice, since the decoder can "accidentally" call the
previous render function after preemption (instead of calling the
reloaded function), so there might be issues. But all in all, this
dummy_render function is a bit confusing, and still not entirely
correct, so it's not worth it.
2013-11-07 22:17:35 +01:00
wm4 ce8bc1320d memcpy_pic: reformat
Besides cosmetic changes, also change memcpy_pic return type and remove
config.h include.
2013-11-06 20:27:13 +01:00
wm4 6d2c5fc99a vd_lavc: remove explicit crystalhd support
This removes "--hwdec=crystalhd".

I doubt anyone even tried to use this. But even if someone wants to
use it, the decoders can still be explicitly invoked with e.g.:

    --vd=lavc:h264_crystalhd

The only advantage our special code provided was fallback to
software decoding. (But I'm not sure how the ffmpeg crystalhd
pseudo-decoder actually behaves.)

Removing this will allow some simplifications as soon as we don't need
vdpau_old.c anymore.
2013-11-06 00:47:53 +01:00
wm4 01d12a51f1 gl_header_fixes: fix inverted condition
Could possibly leading to failing compilation on systems with headers
that miss the vdpau extension.
2013-11-05 22:39:19 +01:00
wm4 db6a4eec0a vo_opengl: support for vdpau hardware decoding
This uses vdpau OpenGL interop to convert a vdpau surface to a texture.

Note that this is a bit weak and primitive. Deinterlacing (or any other
form of vdpau postprocessing) is not supported. vo_opengl chroma scaling
and chroma sample position are not supported. Internally, the vdpau
video surfaces are converted to a RGBA surface first, because using the
video surfaces directly is too complicated. (These surfaces are always
split into separate fields, and the vo_opengl core expects progressive
frames or frames with weaved fields.)
2013-11-05 22:28:15 +01:00
wm4 5cca9143ab vdpau: move device and video surface management from vo_vdpau.c to vdpau.c
The goal is being able to use vdpau decoding independently from
vo_vdpau.c.
2013-11-05 22:13:05 +01:00
wm4 ff5a908328 vo_opengl: redo aspects of initialization, change hwdec API
Instead of checking for resolution and image format changes, always
fully reinit on any parameter change. Let init_video do all required
initializations, which simplifies things a little bit.

Change the gl_video/hardware decoding interop API slightly, so that
hwdec initialization gets the full image parameters.

Also make some cosmetic changes.
2013-11-05 22:05:23 +01:00
wm4 91472b84c2 vo_opengl/vaapi: use IMGFMT_RGB0
More correct, might make things slightly faster (probably
insignificant).
2013-11-05 22:05:23 +01:00
wm4 d6de87d1d3 video: make IMGFMT_RGB0 etc. exist even if libavutil doesn't support it
These formats are helpful for distinguishing surfaces with and without
alpha. Unfortunately, Libav and older version of FFmpeg don't support
them, so code will break. Fix this by treating these formats specially
on the mpv side, mapping them to RGBA on Libav, and unseting the alpha
bit in the mp_imgfmt_desc struct.
2013-11-05 22:05:23 +01:00
wm4 7df03a1c9e vo_xv: fix compilation of SHM not available 2013-11-05 22:05:22 +01:00
Paweł Forysiuk f330884b0a Adjust wayland defines 2013-11-04 21:28:34 +01:00
wm4 2826dcff8f vdpau: drop required/deprecated access to a libavcodec struct field
Before the bitstream_buffers field was deprecated, you had to free it,
otherwise you would leak memory.

(Although vdpau.c uses a new API, they managed to introduce a new
deprecation this quickly. This is a complaint.)

This introduces a memory leak of 12 bytes per file on every file on some
_older_ libavcodec versions. This is minor enough that I don't care.
2013-11-04 19:59:03 +01:00
wm4 bb22bee315 vo_opengl: cosmetics/fix typos 2013-11-04 19:46:28 +01:00
wm4 383d8a8b60 vo_opengl: reserve 4 texture units for video instead of 3
Video has up to 4 textures, if you include obscure formats with alpha.
This means alpha formats could always overwrite the first scaler
texture, leading to corrupted video display. This problem was recently
brought to light, when commit 571e697 started to explicitly unbind all 4
video textures, which broke rendering for non-alpha formats as well.

Fix this by reserving the correct number of texture units.
2013-11-04 19:46:15 +01:00
Stefano Pigozzi 9087500179 Merge remote-tracking branch 'origin/have_configure' 2013-11-04 08:31:58 +01:00
wm4 5b6eab01af vo_opengl: fix use of uninitialized memory
Pretty bad, although it should actually not cause any misbehavior. Comes
from the hardware decoding interop commit.
2013-11-04 01:20:11 +01:00
wm4 3813b13796 fix weird DPMS->EXT replacement 2013-11-04 00:43:27 +01:00
wm4 f7b2d644ef Merge branch 'master' into have_configure
Conflicts:
	configure
2013-11-04 00:43:06 +01:00
wm4 2d58fb3b8e vo_opengl: add support for VA-API OpenGL interop
VA-API's OpenGL/GLX interop is pretty bad and perhaps slow (renders a
X11 pixmap into a FBO, and has to go over X11, probably involves one or
more copies), and this code serves more as an example, rather than for
serious use. On the other hand, this might be work much better than
vo_vaapi, even if slightly slower.
2013-11-04 00:11:43 +01:00
wm4 571e697a7c vo_opengl: add infrastructure for hardware decoding OpenGL interop
Most hardware decoding APIs provide some OpenGL interop. This allows
using vo_opengl, without having to read the video data back from GPU.

This requires adding a backend for each hardware decoding API. (Each
backend is an entry in gl_hwdec_vaglx[].) The backends expose video data
as a set of OpenGL textures.

Add infrastructure to support this. The next commit will add support for
VA-API.
2013-11-04 00:11:07 +01:00
wm4 6f17410f88 mp_image: add helper for copying image attributes
This enw function is similar to mp_image_set_params(), but doesn't force
setting "hard" parameters like image size and format.
2013-11-03 23:55:16 +01:00
Stefano Pigozzi 37388ebb0e configure: uniform the defines to #define HAVE_xxx (0|1)
The configure followed 5 different convetions of defines because the next guy
always wanted to introduce a new better way to uniform it[1]. For an
hypothetic feature 'hurr' you could have had:

  * #define HAVE_HURR 1   / #undef HAVE_DURR
  * #define HAVE_HURR     / #undef HAVE_DURR
  * #define CONFIG_HURR 1 / #undef CONFIG_DURR
  * #define HAVE_HURR 1   / #define HAVE_DURR 0
  * #define CONFIG_HURR 1 / #define CONFIG_DURR 0

All is now uniform and uses:
  * #define HAVE_HURR 1
  * #define HAVE_DURR 0

We like definining to 0 as opposed to `undef` bcause it can help spot typos
and is very helpful when doing big reorganizations in the code.

[1]: http://xkcd.com/927/ related
2013-11-03 21:59:54 +01:00
wm4 891a2a1f47 w32: implement functionality required for window-scale
Same semantics with respect to fullscreen as x11.
2013-11-02 17:54:46 +01:00
wm4 9423a7e23e x11: make window-scale use windowed size in fullscreen mode
This is a bit more intuitive, since before, the window size was just set
to something random when setting the window-scale property during
fullscreen.
2013-11-02 17:32:03 +01:00
wm4 4d903127ad demux: rename Windows symbols
There are some Microsoft Windows symbols which are traditionally used by
the mplayer core, because it used to be convenient (avi was the big
format, using binary windows decoders made sense...). So these symbols
have the exact same definition as the Windows one, and if mplayer is
compiled on Windows, the symbols from windows.h are used.

This broke recently just because some files were shuffled around, and
the symbols defined in ms_hdr.h collided with windows.h ones. Since we
don't have windows binary decoders anymore, there's not the slightest
reason our symbols should have the same names. Rename them to reduce the
risk for collision, and to fix the recent regression.

Drop WAVEFORMATEXTENSIBLE, because it's mostly unused. ao_dsound defines
its own version if the windows headers don't define it, and ao_wasapi is
not available on systems where this symbol is missing.

Also reindent ms_hdr.h.
2013-11-02 15:14:12 +01:00
wm4 e0b6fdeb8d Fix some more -Wshadow warnings
These aren't printed with newer gcc or clang versions for some reason.

All of them seem to be about local variables shadowing global functions.
2013-11-01 17:35:38 +01:00
wm4 24897eb94c video: check profiles with hardware decoding
We had some code for checking profiles earlier, which was removed in
commits 2508f38 and adfb71b. These commits mentioned that (working) hw
decoding was sometimes prevented due to profile checking, but I can't
find the samples anymore that showed this behavior. Also, I changed my
opinion, and I think checking the profiles is something that should be
done for better fallback to software decoding behavior.

The checks roughly follow VLC's vdpau profile checks, although we do
not check codec levels. (VLC's profile checks aren't necessarily
completely correct, but they're a welcome help anyway.)

Add a --vd-lavc-check-hw-profile option, which skips the profile check.
2013-11-01 17:33:33 +01:00
wm4 dd344b43e8 Enable -Wshadow
This one really did bite me hard (see previous commit), so enable it by
default.

Fix some cases of shadowing throughout the codebase. None of these
change behavior, and all of these were correct code, and just tripped up
the warning.
2013-11-01 13:00:15 +01:00
wm4 94542abf2e command: add property to scale window size 2013-10-31 23:30:14 +01:00
wm4 b55d557822 x11: factor out normal window resize code
As preparation for resizing the window with input commands in the
following commit.

Since there are already so many functions which somehow resize the
window, add the word "highlevel" to the name of this new function.
2013-10-31 19:51:46 +01:00
wm4 7100a10127 vd_lavc: add more ifdeffery and ffmpeg cargo culting for correctness
We mixed the "old" AVFrame management functions (avcodec_alloc_frame,
avcodec_free_frame) with reference counting. This doesn't work
correctly; you must use av_frame_alloc and av_frame_free. Of course
ffmpeg doesn't warn us about the bad usage, but will just mess up
things silently. (Thanks a lot...)

While the alloc function seems to be 100% compatible, the free function
will do bad things, such as freeing memory that might still be
referenced by another frame. I didn't experience any actual bugs, but
maybe that was pure luck.
2013-10-31 18:17:14 +01:00
wm4 ee2ba635f2 dec_video: remove unused declaration of a former global variable 2013-10-31 18:17:13 +01:00
Stefano Pigozzi 55dca5b6a3 gl_common: osx: fix compilation with latest XQuartz RC
Looks the gl.h header in XQuartz is incompatible with the one in OS X 10.9.
2013-10-30 23:59:43 +01:00
wm4 50e57c346f x11: restore support for --wid=0
This stopped working when the code was changed to create a window even
if --wid is used.

It appears we can't create our own window in this case, because in X11
there is no difference between a window with the root window as parent,
and a window that is managed by the WM. So make this (kind of worthless)
special case use the root window itself.
2013-10-30 22:19:32 +01:00
wm4 7743ed2dc6 x11: remove ancient metacity hack
Tested with recent metacity; this code is not triggered anymore. The
code was added in 2003 and probably has been unused for years.
2013-10-30 22:19:31 +01:00
wm4 4b2d93f103 x11: minor cosmetics 2013-10-30 22:19:31 +01:00
wm4 884b4600a4 gl_x11: change error message when GL3 context creation fails
On systems that provide legacy OpenGL (up to 2.1), but not GL3 and
later, creating a GL3 context will fail. We then revert to legacy GL.

Apparently the error message printed when the GL3 context creation
fails is confusing. We could just silence it, but there's still a X
error ("X11 error: GLXBadFBConfig"), which would be quite hard to
filter out. For one, it would require messing with the X11 error
handler, which doesn't even carry a context pointer (for application
private data), so we don't even want to touch it. Instead, change
the error message to inform the user what's actually happening: a
fallback to an older version of OpenGL.
2013-10-28 23:54:02 +01:00
wm4 96a60e15ce x11_common: refactor of fstype code
This is completely pointless, but it still somehow bugged me.
2013-10-28 22:42:47 +01:00
Stefano Pigozzi e4d23dd01d cocoa: apply the more invasive constraining only with cmd+1/2/3
Regression from bc49957
Fixes #321
2013-10-28 09:08:08 +01:00
wm4 f2d438a1fd x11: fix border toggling
Trying to toggle the border during fullscreen (with "cycle border")
would leave the window stuck without border, and it couldn't be
restored. This was because vo_x11_decoration() always excepted to be
called when toggling the state, and thus confusing the contents of the
olddecor variable. Add got_motif_hints to hopefully prevent this.

Also, when changing the border, don't take fs in account. May break on
older/broken WMs, but all in all is in fact more robust and simpler,
because you do not need to update the border state manually when
returning from fullscreen.
2013-10-27 23:22:46 +01:00
wm4 6e1eb8add9 vo_xv: check whether image allocation succeeds 2013-10-27 17:58:06 +01:00
wm4 74e7043cc7 gl_common: suggest --vo=opengl-old if OpenGL 2.1 missing
If the caller requests at least OpenGL 2.1 (which --vo=opengl does),
but we get OpenGL 1.x, suggest using opengl-old.

Based on a patch by pfor on IRC.
2013-10-26 14:17:53 +02:00
wm4 de303d8ba4 x11_common: reduce screensaver heartbeat from 30 to 10 seconds
Apparently this fixes issues with Gnome, which has a smaller timeout.
See github issue #315.
2013-10-25 20:30:01 +02:00
Stefano Pigozzi bc49957458 cocoa: constraint the window position a little more
The intention of this is to not make the window go outside the screen when
changing dimensions from 2x to .5x.
2013-10-25 20:01:32 +02:00
Alexander Preisinger cb3327fe48 wayland: better name for mouse coordinates
I had to look up what the surf_x and surf_y members do.
That means the name is not very good. Also a comment.
2013-10-25 10:30:12 +02:00
Alexander Preisinger bef2135a44 wayland: fix fullscreen transparent border regions
The default behavior of weston changed some time ago to not fill the surface
black for fullscreen windows.

Now let mpv draw the whole screen in fullscreen mode.
2013-10-25 10:30:11 +02:00
wm4 60aea74f44 m_config: refactor option defaults handling
Keep track of the default values directly, instead of creating a new
instance of the option struct just to get the defaults.

Also get rid of the special handling of m_obj_desc.init_options.
Instead, handle it purely by the option parser. Originally, I wanted to
handle --vo=opengl-hq and --vo=direct3d_shaders with this (by making
them aliases to the real VOs with a different preset), but since --vo
=opengl-hq=help prints the wrong values (as consequence of the
simplification), I'm not doing that, and instead use something
different.
2013-10-24 22:50:13 +02:00
wm4 6d44a4dfd1 video/filter: remove useless vf_info fields
This time I didn't bother to move the contents of the author field to
the file headers. "git log" is your friend.
2013-10-23 19:30:01 +02:00
wm4 c8930e80a8 video/out: remove useless info struct and redundant fields
The author and comment fields were printed only in -v mode.
2013-10-23 19:30:01 +02:00
wm4 a37c810173 vo_opengl: don't enable PBOs with opengl-hq
The speed advantages are marginal (at least with the way it's currently
used), and it might actually be slower on some drivers, like Mesa.
2013-10-23 17:50:49 +02:00
wm4 68531e23a1 gl_video: add RGB10_A2 FBO format
Maybe this can be the default in the future, but I'm not sure yet.
2013-10-23 17:46:57 +02:00
Stefano Pigozzi 3b156caf78 cocoa: set and clear gl context inside of sync sections
The code did not set and unset the current context inside sync sections. I am
not sure if this was an actual problem but this is better since the context is
linked to a single thread. In my brief tests this seems to avoid garbage to
show up in fullscreen.
2013-10-20 21:25:55 +02:00
Alexander Preisinger 6a4e59677e wayland: use mp_input_test_dragging
Instead of removing dragging we now test if it we should drag the window or
not. Because if the OSC shows up we can not drag the window because that would
cause mouse events that makes the OSC disappear.
2013-10-20 09:25:28 +02:00
Alexander Preisinger bbb1057d06 Revert "wayland: remove moving window by grabbing"
This reverts commit 3308bc2bc9.
2013-10-20 09:24:37 +02:00
Alexander Preisinger 38ef925ab7 Revert "wayland: remove outdated comment"
This reverts commit d75cfef49c.
2013-10-20 09:24:37 +02:00
wm4 d7287d60dd vdpau_old: restore hardware decoding with old API
--hwdec=vdpau did nothing with older ffmpeg/libav versions. Oops.
2013-10-19 20:57:43 +02:00
wm4 e046fa584a mp_msg: remove gettext() support
Was disabled by default, was never used, internal support was
inconsistent and poor, and there has been virtually no interest in
creating translations.

And I don't even think that a terminal program should be translated.
This is something for (hypothetical) GUIs.
2013-10-18 22:38:10 +02:00
wm4 1eda9554d4 sws_utils: work around libswscale crash with --contrast=-100 2013-10-16 21:39:51 +02:00
wm4 20e1c5f7d9 vf_scale: fix get/set confusion
This caused the equalizer controls to appear stuck.
2013-10-16 21:35:27 +02:00
wm4 a0485221c7 x11_common: don't handle mouse enter events
This could cause the OSC to be displayed without mouse interaction: for
example, starting mpv with --fs, and putting the mouse to where the OSC
area is beforehand, would cause the OSC to appear and stay visible. We
don't want that. The simplest solution is not generating artificial
mouse move events from mouse enter events, because they make the OSC
think the mouse was actually moved.

Also see commit 0c7978c, where handling of mouse enter events was added.
This was supposed to fix certain corner cases, but they're not relevant
anymore due to changes in OSC behavior.

Commit 9777047 fixed this as well (by resetting the mouse state on
MOUSE_LEAVE), but all the behavior reverted with this commit as perhaps
a bad idea. It wasn't very robust, made it hard to distinguish real
events from artificial ones, and finally made the mouse cursor more
often visible than needed. (Now switching between workspaces doesn't
make the cursor visible again when switching to a fullscreened mpv.)
2013-10-15 21:53:33 +02:00
wm4 94e71b7cc0 mplayer, vo_image: simplify OSD redrawing, fix vo_image crash
vo_image didn't handle OSD redrawing correctly anymore after OSD
redrawing behavior was changed in commit ed9295c (or maybe it has been a
problem for a longer time, and only showed up now). Basically, flip_page
was called unexpectedly and when no image was stored, which made it
crash trying to access the image. This could happen when for example
provoking OSD redrawing by pausing while using --vo=image, or by using
this command line: mpv --vo=image '-vf=lavfi="select=not(mod(n\,3))"'

Fix by removing the code that pretends vo_image can redraw OSD, and by
removing the framestepping fallback, which could make bad things happen
if the VO didn't support OSD redrawing. By now, there aren't any real
VOs that can't redraw the OSD properly, so this code is not needed and
just complicates things like vo_image.

This change likely will also be useful for vo_lavc (encoding).
2013-10-13 23:40:23 +02:00
wm4 c613d802bc talloc: change talloc destructor signature
Change talloc destructor so that they can never signal failure, and
don't return a status code. This makes our talloc copy even more
incompatible to upstream talloc, but on the other hand this is
preparation for getting rid of talloc entirely.

(The talloc replacement in the next commit won't allow the talloc_free
equivalent to fail, and the destructor return value would be useless.
But I don't want to change any mpv code either; the idea is that the
talloc replacement commit can be reverted for some time in order to
test whether the talloc replacement introduced a regression.)
2013-10-13 01:16:30 +02:00
Stefano Pigozzi 8d5f800567 cocoa: make --ontop also cover dock+menubar
This only shows any differences when mpv isn't frontmost and is in fullscreen.
Cmd+Tab overlay is still at a higher level as to avoid complete usability fail.
2013-10-12 21:02:46 +02:00
Stefano Pigozzi 57c3fca7a8 cocoa: refactor precise scrolling to a separate method 2013-10-12 16:26:53 +02:00
Mad Fish 42189ada97 cocoa: fix mouse wheel scrolling 2013-10-12 16:26:24 +02:00
Stefano Pigozzi 177c89d948 cocoa_common: check if the screen has a menubar in a more generic way
Fixes #274
2013-10-09 09:27:41 +02:00
wm4 8304046180 vo_x11, vo_xv: fix OSD redrawing with --force-window
The window wasn't cleared in this mode before doing the redrawing.
2013-10-06 23:03:30 +02:00
Stefano Pigozzi 89fced63b8 cocoa_common: add OS X 10.7 compatibility hacks includes
I forgot these when I split the code. They will hopefully fix compilation on
10.7.
2013-10-05 14:40:48 +02:00
wm4 76f32e3881 gl_x11: fail gracefully if selected FBconfig has no X visual
glXGetVisualFromFBConfig() specifies specifies that it can return NULL
if there is no associated X visual. Instead of crashing, let
initialization fail. I'm not sure if this is actually supposed to work
with a fallback visual (passing a NULL visual to vo_x11_config_vo_window
would just do this), but let's play safe for now.

Apparently this can happen when trying to use vo_opengl over a remote
X display.
2013-10-03 23:50:48 +02:00
wm4 bdc56771eb vo_opengl_old: mp_msg conversion
This was the only thing in video/out/ left with major mp_msg() use.
2013-10-02 21:41:46 +02:00
wm4 ef9c5300ef cosmetics: replace "CTRL" defines by enums
Because why not.
2013-10-02 21:19:16 +02:00
wm4 a8240c1b58 vo: mark frame lost after seek reset
Reverts a small change made in commit ed9295c. This is needed, because
otherwise mplayer.c/update_video_attached_pic() thinks it never has to
update the picture after initialization. (Maybe there would be more
elegant ways to handle this, but not without adding extra state.)
2013-10-02 20:41:11 +02:00
wm4 f01744ac4e core: add --force-window
This commit adds the --force-window option, which will cause mpv always
to create a window when started. This can be useful when pretending that
mpv is a GUI application (which it isn't, but users pretend anyway), and
playing audio files would run mpv in the background without giving a
window to control it.

This doesn't actually create the window immediately: it only does so
only after initializing playback and when it is clear that there won't
be any actual video. This could be a problem when starting slow or
completely stuck network streams (mpv would remain frozen in the
background), or if video initialization somehow is stuck forever in
an in-between state (like when the decoder doesn't output a video
frame, but doesn't return an error either). Well, we can pretend only
so much that mpv is a GUI application.
2013-10-02 01:39:28 +02:00
wm4 7be13b4690 vo_vdpau: don't blank screen on VOCTRL_RESET
vo_vdpau is the only VO which implements VOCTRL_RESET. Redrawing the
last output frame is hard, because the output could consist of several
source video frames with certain types of post-processing
(deinterlacing). Implement redrawing as special case by keeping the
previous video frames aside until at least one new frame is decoded.

This improves the previous commit, but is separate, because it's rather
complicated.
2013-10-02 00:38:23 +02:00
wm4 ed9295c250 video/out: always support redrawing VO window at any point
Before, a VO could easily refuse to respond to VOCTRL_REDRAW_FRAME,
which means the VO wouldn't redraw OSD and window contents, and the
player would appear frozen to the user. This was a bit stupid, and makes
dealing with some corner cases much harder (think of --keep-open, which
was hard to implement, because the VO gets into this state if there are
no new video frames after a seek reset).

Change this, and require VOs to always react to VOCTRL_REDRAW_FRAME.
There are two aspects of this: First, behavior after a (successful)
vo_reconfig() call, but before any video frame has been displayed.
Second, behavior after a vo_seek_reset().

For the first issue, we define that sending VOCTRL_REDRAW_FRAME after
vo_reconfig() should clear the window with black. This requires minor
changes to some VOs. In particular vaapi makes this horribly
complicated, because OSD rendering is bound to a video surface. We
create a black dummy surface for this purpose.

The second issue is much simpler and works already with most VOs: they
simply redraw whatever has been uploaded previously. The exception is
vdpau, which has a complicated mechanism to track and filter video
frames. The state associated with this mechanism is completely cleared
with vo_seek_reset(), so implementing this to work as expected is not
trivial. For now, we just clear the window with black.
2013-10-02 00:36:26 +02:00
wm4 c000a08de2 x11: remove colormap code, always request TrueColor visuals
vo_x11 had a clever trick to implement a video equalizer: it requested a
DirectColor visual. This is a X11 mechanism which allows you to specify
a lookup table for each color channel. Effectively, this is a safe
override for the graphic card's gamma ramp. If X thinks the window
deserves priority over other windows in the system, X would temporarily
switch the gamma ramp so that DirectColor visuals can be displayed as
the application intends. (I'm not sure what the exact policy is, but in
practice, this meant the equalizer worked when the mouse button was
inside the window.)

But all in all, this is just lots of useless code for a feature that is
rarely ever useful. Remove it and use the libswscale equalizer instead.
(This comes without a cost, since vo_x11 already uses libswscale.)

One worry was that using DirectColor could have made it work better in
8-bit paletted mode. But this is not the case: there's no difference,
and in both cases, the video looks equally bad.
2013-09-30 00:47:24 +02:00
wm4 00d41cc5b0 vf_scale: factor out libswscale equalizer control
Will be used by vo_x11.
2013-09-30 00:45:58 +02:00
wm4 5b3ae5aaac vaapi: remove non-VLD entrypoints
These probably don't work. libavcodec doesn't seem to support them,
and neither did the original mplayer-vaapi patch.
2013-09-29 13:52:09 +02:00
wm4 60e7926248 vaapi: fix non-sense condition
Attempting signed comparison on unsigned value.
2013-09-29 13:45:49 +02:00
wm4 4e1d65983a vaapi: fix inverted condition
How embarrassing. This could make --hwdec=vaapi-copy as well as
screenshots with vo_vaapi randomly fail. Regression since
commit b8382aa.
2013-09-29 13:45:15 +02:00
Stefano Pigozzi 9d3943840c cocoa_common: call gl_clear indirectly
glClear needs GL headers and we don't want those in `cocoa_common`. Create
a callback in `gl_cocoa` and register it `cocoa_common`.

Fixes #264
2013-09-28 15:08:40 +02:00
Stefano Pigozzi 73808cd8f0 cocoa_common: fix deadlock
After rebasing my dev branch it turned out that  the code deadlocked on
recursive calls of `vo_control`. Make the locking code a little bit smarter
by making always skip locking/unlocking if we are executing a chunck of
code that is already synchronized with `dispatch_sync`.
2013-09-28 15:08:26 +02:00
Stefano Pigozzi 67d87d36d5 cocoa_common: report pixels instead of points during mouse movement
This fixes the position reporting on retina displays. Doesn't make any
difference on normal displays where 1px = 1pt.

Fixes: #260
2013-09-28 11:20:00 +02:00
Stefano Pigozzi 0ab9634eb3 cocoa_common: split the code, refactoring and cleanups
Split the code to several files. The GUI elements now each have they own files
and private state. The original code was a mess to respect the retarded mplayer
convention of having everything in a single file.

This commit also seems to fix the long running bug of artifacts showing
randomly when going fullscreen using nVidia GPUs.
2013-09-28 11:20:00 +02:00
wm4 b8382aabb3 vaapi: make vaDeriveImage() less verbose
This can just be not supported, so making it look like a real error
doesn't make much sense.
2013-09-27 18:00:03 +02:00
wm4 0901fc8e0e vaapi: check image format in va_surface_upload()
Just for robustness. Also print a warning in vo_vaapi if this happens.
2013-09-27 18:00:03 +02:00
wm4 4d2f354da6 vaapi: potentially make reading surfaces back to system RAM faster
Don't allocate a VAImage and a mp_image every time. VAImage are cached
in the surfaces themselves, and for mp_image an explicit pool is
created. The retry loop runs only once for each surface now.

This also makes use of vaDeriveImage() if possible.
2013-09-27 17:59:44 +02:00
wm4 ede652774e input: translate mouse position to OSD space early
Until now, mouse positions were just passed to the core as-is, even if
the mouse coordinates didn't map to any useful coordinate space, like
OSD coordinates. Lua scripting (used by the OSC, the only current user
of mouse input) had to translate mouse coordinates manually to OSD space
using mp_get_osd_mouse_pos(). This actually didn't work correctly in
cases mouse coordinates didn't map to OSD (like vo_xv): the mouse
coordinates the OSC got were correct, but input.c was still expecting
"real" mosue coordinates for mouse areas.

Fix this by converting to OSD coordinates before passing the mouse
position to the core.
2013-09-27 15:39:28 +02:00
wm4 5a837ced0b video: let sh_video->disp_w/h always be container size
Nothing really accesses it. Subtitle initialization actually does in a
somewhat meaningful way, but there container size is probably fine, as
subtitles were always initialized before the first video frame was
decoded.
2013-09-26 17:33:57 +02:00
wm4 9a55c4e70c video: let sh_video->aspect always be container aspect ratio
Now writing -1 to the 'aspect' property resets the video to the auto
aspect ratio. Returning the aspect from the property becomes a bit more
complicated, because we still try to return the container aspect ratio
if no frame has been decoded yet.
2013-09-26 17:29:14 +02:00
wm4 f5bf6c0fb3 vd: move aspect calculation to a function
This function would probably be useful in other places too.

I'm not sure why vd.c doesn't apply the aspect if it changes size by
less than 4 pixels. Maybe it's supposed to avoid ugly results with bad
scalers if the difference is too small to be noticed normally.
2013-09-26 16:09:08 +02:00
wm4 7eb13c4028 vd: remove some dead code
As of now, this function is called only after decoding a full, valid
video frame, so the image parameters should be reliable.
2013-09-26 15:54:58 +02:00
wm4 b0cc3c2cf4 Fix previous commit
This time it broke because I didn't actually test compiling vo_vaapi.c,
and it was using a macro from mp_image.h, which implicitly assumed
FFALIGN was available. Screw that too, and copy the definition of
ffmpeg's FFALIGN to MP_ALIGN_UP, and move these macros to mp_comnon.h.
2013-09-25 22:44:12 +02:00
wm4 200fb7eceb vaapi: fix compilation with Libav
The code using FFSWAP was moved from vo_vaapi.c to vaapi.c, which didn't
include libavutil/common.h anymore, just libavutil/avutil.h. The header
avutil.h doesn't include common.h recursively in Libav, so it broke
there.

Add FFSWAP as MPSWAP in mp_common.h (copy pasted from ffmpeg) to make
sure this doesn't happen again. (This kind of stuff happens all too
often, so screw libavutil.)
2013-09-25 22:22:02 +02:00
wm4 641e94cd27 vaapi: allow GPU read-back with --hwdec=vaapi-copy
This code is actually quite inefficient: it reuses the (slow, simple)
screenshot code. It uses an inefficient method to read the image
(vaGetImage() instead of vaDeriveImage()), allocates new memory for
each frame that is read, and it tries all image formats again each
time.

Also, in my tests it always picked NV12 as image format, which is not
ideal if you actually want to filter the video, and vo_xv can't handle
this format without conversion either.

However, a user confirmed that it worked for him, so everything is fine.
2013-09-25 13:53:42 +02:00
wm4 7c3f1ffc44 vd_lavc: allow process_image to change image format
This will allow GPU read-back with process_image.

We have to restructure how init_vo() works. Instead of initializing the
VO before process_image is called, rename init_vo() to
update_image_params(), and let it update the params only. Then we really
initialize the VO after process_image.

As a consequence of these changes, already decoded hw frames are
correctly unreferenced if creation of the filter chain fails. This
could trigger assertions on VO uninitialization, because it's not
allowed to reference hw frames past VO lifetime.
2013-09-25 13:53:42 +02:00
xylosper 39d1ab82e5 vaapi: add vf_vavpp and use it for deinterlacing
Merged from pull request #246 by xylosper. Minor cosmetic changes, some
adjustments (compatibility with older libva versions), and manpage
additions by wm4.

Signed-off-by: wm4 <wm4@nowhere>
2013-09-25 13:53:42 +02:00
Alexander Preisinger d75cfef49c wayland: remove outdated comment 2013-09-24 18:34:50 +02:00
Alexander Preisinger 3308bc2bc9 wayland: remove moving window by grabbing
Moving the window was convenient but generates a MOUSE_LEAVE event
which it shouldn't. Now we remove it, because it is still possible
to move the window in weston with MOD+BTN0.
2013-09-24 18:30:44 +02:00
wm4 d5a3739105 vo_lavc: mp_msg conversion
Also restores consistent log message prefixes with ao_lavc.
2013-09-20 16:32:36 +02:00
wm4 2694b5f378 vo/x11_common: don't require a working input method
Normally, we need this for Xutf8LookupString(). But we can just fall
back to XLookupString(). In fact, the code for this was already there,
the code was just never tested and was actually crashing when active
(see commit 2115c4a).
2013-09-20 14:45:49 +02:00
wm4 6c28524e0f vf: fix filter initialization error check
vf_open returns 0 on error, 1 on success. Oops. Accidentally broken
with 6629a95.
2013-09-20 14:01:00 +02:00
Martin Herkt ed2d67b6d7 vo/x11_common: remove superfluous msg prefixes 2013-09-20 00:04:39 +02:00
Martin Herkt 2115c4a3ad vo/x11_common: Fail init with no valid XIM
XOpenIM can fail to find a valid input method, in which case it
returns NULL. Passing a NULL pointer to XCreateIC would cause a
crash, so fail VO init before that happens.
2013-09-19 20:08:34 +02:00
Alexander Preisinger 858dcee5f1 wayland/common: exit properly on fd errors
Before this commit there was just an error message, but the file descriptor was
still open. Now we close the file descriptor and prevent it from calling
endlessly. Also a CLOSE_WIN event is sent which closes the window eventually if
the action of CLOSE_WIN is set to quit or quit_watch_later.
2013-09-19 17:45:49 +02:00
wm4 93feffad15 vo_opengl: blend alpha components by default
Improves display of images and video with alpha channel, especially if
the transparent regions contain (supposed to be invisible) garbage
color values.
2013-09-19 17:03:03 +02:00
Stefano Pigozzi bb4ea8bb3e cocoa_common: signal a mouse movement when changing window size
This is mainly to avoid spurious cursor states due to the mouse moving inside
or outside the window as a result of the window resize (with cmd-0/1/2).

This avoids complex logic and triggers a mouse move so that the player
recomputes the correct cursor state based on the autohide configuration of
the user.
2013-09-18 19:05:00 +02:00
Stefano Pigozzi a08802016d cocoa_common: override core's cursor visibility state
This keeps the state in sync with the current state in cocoa_common. Infact the
cocoa code in mpv can decide wether it really wants to hide the cursor based on
the result of the `canHideCursor` method (this is so that the cursor is only
hidden when hovering on the video window).
2013-09-18 19:05:00 +02:00
Andreas Sinz 44b6696279 gl_common: add wayland backend before x11 backend 2013-09-16 13:45:47 +02:00
wm4 2f165ee12b gl_common: signal to GL backend whether we are probing
This is supposed to reduce the amount of useless error messages shown
during initialization of vo_opengl. If multiple backends are compiled,
usually only one of them will work. For example, on Linux both X and
Wayland backends can be compiled, but usually either Wayland or X is
running. Then, if Wayland is not running, but X is, trying to initialize
the Wayland backend should not spam the terminal with error messages.

Signed-off-by: Andreas Sinz <andreas.sinz@aon.at>
2013-09-16 13:45:33 +02:00
xylosper 1a1504914a vd_lavc: reset last_sample_aspect_ratio in uninit_avctx()
In init_vo(), if sh->aspect is 0 or last_sample_aspect_ratio is set,
sh->aspect is overwritten. With software decoding fallback behaviour,
this makes the aspect ratio from container ignored since
last_sample_aspect_ratio is already set in first try with hardware
decoding.
2013-09-13 21:32:29 +02:00
wm4 6cec60a454 core: add --deinterlace option, restore it with resume functionality
The --deinterlace option does on playback start what the "deinterlace"
property normally does at runtime. You could do this before by using the
--vf option or by messing with the vo_vdpau default options, but this
new option is supposed to be a "foolproof" way.

The main motivation for adding this is so that the deinterlace property
can be restored when using the video resume functionality
(quit_watch_later command).

Implementation-wise, this is a bit messy. The video chain is rebuilt in
mpcodecs_reconfig_vo(), where we don't have access to MPContext, so the
usual mechanism for enabling deinterlacing can't be used. Further,
mpcodecs_reconfig_vo() is called by the video decoder, which doesn't
have access to MPContext either. Moving this call to mplayer.c isn't
currently possible either (see below). So we just do this before frames
are filtered, which potentially means setting the deinterlacing every
frame. Fortunately, setting deinterlacing is stable and idempotent, so
this is hopefully not a problem. We also add a counter that is
incremented on each reconfig to reduce the amount of additional work per
frame to nearly zero.

The reason we can't move mpcodecs_reconfig_vo() to mplayer.c is because
of hardware decoding: we need to check whether the video chain works
before we decide that we can use hardware decoding. Changing it so that
this can be decided in advance without building a filter chain sounds
like a good idea and should be done, but we aren't there yet.
2013-09-13 21:32:28 +02:00
Alexander Preisinger 71f287c9c0 wayland/shm: fix resizing for good (finally)
Problem: I own the buffer and I destroyed while still being displayed.
Solution: Add a temporary buffer and destroy it when the next buffer is
attached.
2013-09-12 18:15:35 +02:00
Alexander Preisinger 195b8bfe93 wayland: change fs messages to dbg
These messages are only helpful when debugging.
2013-09-12 16:38:44 +02:00
Alexander Preisinger 6bd911d7db wayland/egl: use wayland log 2013-09-12 16:36:52 +02:00
Alexander Preisinger cb3d200f58 wayland/shm: use wayland log 2013-09-12 16:31:48 +02:00
Alexander Preisinger aa5f8ba542 Revert "wayland: don't create our own log context"
This reverts commit beab54506e.

Conflicts:
	video/out/wayland_common.c
2013-09-12 16:29:13 +02:00
wm4 1061f43a2f gl_osd: mp_msg conversion 2013-09-12 01:34:42 +02:00
wm4 3a9c5ef687 aspect: mp_msg conversion 2013-09-12 01:34:42 +02:00
wm4 75e63ebb24 gl_lcms: mp_msg conversion
Have to deal with some dumb stuff in LittleCMS2's API: its error handler
is global.
2013-09-12 01:34:42 +02:00
wm4 beb1aa5988 gl_common: complete mp_msg conversion
Hopefully this works on Wayland and Cocoa, which I didn't test.
2013-09-12 01:34:42 +02:00
wm4 057407a39f x11_common: mp_msg conversion
Doesn't touch some parts, like the X11 error handler (which doesn't
allow setting a context pointer).
2013-09-12 01:34:41 +02:00
Alexander Preisinger a84fd1c44a gl_32: mp_msg conversion 2013-09-11 22:41:14 +02:00
Alexander Preisinger b789ef5e8e w32_common: mp_msg conversion 2013-09-11 22:41:14 +02:00
Alexander Preisinger df5606afe0 gl_x11: mp_msg conversion 2013-09-11 22:41:13 +02:00
Stefano Pigozzi 49849190dd cocoa_common: remove most of the special handling for cursor autohide
This is mostly related to the fullscreen behaviour. cecbd8864 introduces an
option to make mpv behave like a OSX user would expect. This commit changes
the Cocoa parts of the code to be consistent with the behaviour on X11. Old
behaviour is still available through the option mentioned in cecbd8864.

There is still custom logic in the cocoa backend and it can probably be moved
to core:

  * Don't perform autohide if the mouse is down
  * Don't perform autohide outside of the video window

Fixes #218 (by accident)
2013-09-10 21:24:37 +02:00
Alexander Preisinger 6de1cb2d59 wayland/common: improved error messages
The previous error message were not very usefull.
Also include a hint where to look for solutions.
2013-09-10 17:53:43 +02:00
Alexander Preisinger 683e58066e wayland: update license headers 2013-09-09 18:37:33 +02:00
Alexander Preisinger b30ad057a5 wayland/shm: version detection that also works
The previous method would break on the next release. Because I am stupid.
2013-09-09 18:21:48 +02:00
wm4 68e331851a options: remove --(no-)mouseinput option
I have no idea why it exists, as it's redundant to --(no-)mouse-movements.
2013-09-08 03:03:58 +02:00
wm4 dbff29c81d x11_common: don't allocate more than needed for icon
icon_size is the number of array items of type long, not bytes. Change
the type of icon_size to int, because size_t makes you think of byte
quantities too quickly.

As an unrelated change, change the (char *) cast to (unsigned char *),
because it matches the common XChangeProperty idiom better.
2013-09-04 13:37:38 +02:00
Alexander Preisinger 353686e636 configure: build with wayland 1.2.0
For the time being there will be a check if someone uses wayland from git,
because I really really like to have the others formats too.
2013-09-03 20:12:44 +02:00
Stefano Pigozzi 39a69aeb89 cocoa_common: remove unlocking from fullscreen function
This was added in the past to prevent a deadlock, but is not needed
anymore.
2013-09-02 08:35:21 +02:00
Stefano Pigozzi 694654e383 cocoa_common: avoid the opengl view to leak it's state
Just because everything is in a single file it doesn't excuse us to have high
coupling between C and ObjC code.
2013-09-02 08:21:03 +02:00
wm4 a5183a761c x11: add window icon
The png file added to etc/ are taken from the link mentioned in commit
303096b, except that they have been converted to 16 bit, sRGB (with
color profile info dropped, if there was one), and transparent pixels
reset for better compression.

The file x11_icon.bin is generated by gen-x11-icon.sh. I'm adding it to
the git repo directly, because the script requires ImageMagick, and we
don't want to make building even more complicated.

The way how this is done is basically a compromise between effort
required in x11_common.c and in gen-x11-icon.sh. Ideally, x11_icon.bin
would be directly in the format as required by _NET_WM_ICON, but trying
to write the binary width/height values from shell would probably be a
nightmare, so here we go.

The zlib code in x11_common.c is lifted from demux_mkv.c, with some
modifications (like accepting a gzip header, because I don't know how to
make gzip write raw compressed data).
2013-09-01 23:27:33 +02:00