Commit Graph

38301 Commits

Author SHA1 Message Date
wm4 09386b173e vo: remove config_ok check from vo_check_events()
This should be ok now after the x11 code was adjusted.
2014-05-22 09:28:28 +02:00
wm4 85c3459bf8 vo_vaapi: don't redraw twice
After VOCTRL_REDRAW_FRAME, flip_page is called, which renders the frame.
The current code rendered the frame twice; drop the redundant call.
2014-05-22 09:28:17 +02:00
Juan Francisco Cantero Hurtado 38c8f5ea57 Fix the build on OpenBSD and FreeBSD
Without this change, the compiler uses by default the "talloc.h" file
installed by the package libtalloc within /usr/local/include. Found and
tested on OpenBSD but FreeBSD has the same patch on its ports tree.
2014-05-21 02:23:23 +02:00
wm4 c0641c63fc osdep: silence a -Wshadow warning 2014-05-21 02:21:18 +02:00
wm4 885b744767 atomics: more correct usage of gcc/clang __atomic builtins
This should be more correct. The builtins were made to directly map to
C11, and the way we use them is now relatively close to how gcc
implements atomics in 4.9. In particular, we make use of the load and
store builtins.

I'm not entirely sure why gcc didn't support stdatomic.h in 4.8 already.
Maybe support for the builtins was incomplete or broken - so there's a
lot of room for doubt about the correctness of this.
2014-05-21 02:21:18 +02:00
wm4 8e7cf4bc99 atomics: switch to C11 stdatomic.h
In my opinion, we shouldn't use atomics at all, but ok.

This switches the mpv code to use C11 stdatomic.h, and for compilers
that don't support stdatomic.h yet, we emulate the subset used by mpv
using the builtins commonly provided by gcc and clang.

This supersedes an earlier similar attempt by Kovensky. That attempt
unfortunately relied on a big copypasted freebsd header (which also
depended on much more highly compiler-specific functionality, defined
reserved symbols, etc.), so it had to be NIH'ed.

Some issues:
- C11 says default initialization of atomics "produces a valid state",
  but it's not sure whether the stored value is really 0. But we rely on
  this.
- I'm pretty sure our use of the __atomic... builtins is/was incorrect.
  We don't use atomic load/store intrinsics, and access stuff directly.
- Our wrapper actually does stricter typechecking than the stdatomic.h
  implementation by gcc 4.9. We make the atomic types incompatible with
  normal types by wrapping them into structs. (The FreeBSD wrapper does
  the same.)
- I couldn't test on MinGW.
2014-05-21 02:21:18 +02:00
wm4 2f65f0e254 input: allow disabling window dragging with --no-window-dragging
Requested in github issue #608.
2014-05-20 02:40:28 +02:00
wm4 15c22fb0eb input: fix compilation on windows
Currently I don't have a crosscompilation toolchain, so I couldn't test
whether this actually compiles (and still can't).
2014-05-20 02:40:28 +02:00
wm4 7dc74bab32 manpage: mention bdnav:// 2014-05-20 02:40:28 +02:00
wm4 094d03fd91 README: describe release cycle 2014-05-20 02:40:28 +02:00
wm4 4664f8b3b7 cache: redo options and default settings
Some options change from percentages to number of kilobytes; there are
no cache options using percentages anymore.

Raise the default values. The cache is now 25000 kilobytes, although if
your connection is slow enough, the maximum is probably never reached.
(Although all the memory will still be used as seekback-cache.)

Remove the separate --audio-file-cache option, and use the cache default
settings for it.
2014-05-20 02:40:22 +02:00
wm4 ac66bcc259 x11: unbreak build without xinerama 2014-05-19 22:09:26 +02:00
wm4 5f6406f450 x11: leaving fullscreen -> reset WM hints only if needed
This works around an issue in OpenBox: OpenBox apparently sizes the
normal window incorrectly if aspect ratio hints are set, and the window
size is off by 1 pixel. Then, when going fullscreen and leaving
fullscreen again, mpv sets the hints based on OpenBox' broken window
size, and as result, OpenBox sizes the window incorrectly and is off by
1 pixel again - so it's 2 pixels off in total. The error gets more
visible, the more often you toggle fullscreen mode.

Work this around by not setting the window hints if we don't need to.
Actually we only need to do this when the video is resized during
fullscreen, which happens rarely. Under normal circumstances, leaving
fullscreen mode requires that the WM restores the old state.

As such, this commit is not only a workaround, but actually a cleanup.

Note that we do need to set the hints when leaving fullscreen if the
window has resized: even though we set the hints in
vo_x11_highlevel_resize (called by vo_x11_config_vo_window), this
doesn't seem to have an effect (at least on IceWM), so we have to do it
after that.

Side note: ot seems commit 625ad57a strangely triggered the OpenBox
issue according to user reports; I'm not sure why.
2014-05-19 21:59:10 +02:00
wm4 ebe798cbc0 demux_subreader: remove support for some subtitle formats
Drop: sami, vplayer, rt, pjs, mpsub, aqt, jacosub. None of these seem
to be actually in use, except sami. Sami is very complex, and the
results subreader produces are not very useful.

For all these formats, there are still parsers in FFmpeg. We remove the
subreader implementation, because it might contain security relevant
bugs and such. (This is old, unmaintained C string parsing code, written
in times where absolutely nobody cared about security. The kind of
awesome code.)

We keep the other formats, because they're (mostly) commonly used and
relatively simple, for UTF16 support (still missing in FFmpeg), and for
the sake of Libav.
2014-05-19 01:40:41 +02:00
wm4 a332a227f4 x11: always check whether a window exists
So any VOCTRL can be called at any time. Working towards removing all
these config_ok checks in vo.c.
2014-05-19 01:07:54 +02:00
wm4 821f37db62 x11: request and handle resize events of parent windows with --wid
Before this commit, this was somehow polled (i.e. not the right way).

Also, selects the correct window when doing --wid=0 (which is another
weird special-case).
2014-05-19 01:07:10 +02:00
wm4 2c012e9eb2 x11: remove a duplicated line 2014-05-18 23:47:28 +02:00
wm4 0a4adce00c etc/input.conf: add example how to change window size by key binding
Also drop a vague hint how to do it in the manpage.
2014-05-18 22:22:33 +02:00
wm4 d9bd5bacc1 x11: never enable DPMS if we didn't disable it
Enabling DPMS even though you disabled it globally is pretty unfriendly,
so don't do it. Instead, we only disable DPMS if it was enabled, and
only enable it if we disabled it ourselves.

The other way should never happen (disabling DPMS permanently), unless
mpv crashes during playback.
2014-05-18 22:16:53 +02:00
wm4 42a51310c1 timer: account for negative time values
It can easily happen that mp_time_us_to_timespec() gets a time in the
past, and then the time difference will be negative. Regression
introduced in commit f47a4fc3.

Also fix an underflow check in mp_add_timeout().
2014-05-18 21:44:45 +02:00
wm4 7fec0c630b compat/libav: remove unneeded things
Currently, it's unused. Still keep the file, because it's not unlikely
we'll need it again, and removing/readding the include statements for
this file is too annoying.
2014-05-18 21:20:40 +02:00
wm4 b3aa5dafa3 vdpau: don't fallback to software decoding on preemption
This was requested by someone. Not sure if it's a good idea; it seems
more can go wrong than right.
2014-05-18 19:21:39 +02:00
wm4 537ac1a15f client API: add mpv_load_config_file()
This is probably a good idea, because it would make it easier for
software embedding mpv to configure the mpv parts, without requiring the
host program to provide explicit mechanisms for this (other than calling
mpv_load_config_file()).
2014-05-18 19:21:39 +02:00
wm4 caa939aa91 options: unify code for setting string and "raw" options
The code paths for setting options by string and by direct "raw" value
were too different, which resulted in some weird code. Make the code
paths closer to each other.

Also, use this to remove the weirdness in the mpv_set_option()
implementation.
2014-05-18 19:21:39 +02:00
wm4 f47a4fc3d9 threads: use mpv time for mpthread_cond_timedwait wrapper
Use the time as returned by mp_time_us() for mpthread_cond_timedwait(),
instead of calculating the struct timespec value based on a timeout.
This (probably) makes it easier to wait for a specific deadline.
2014-05-18 19:20:32 +02:00
wm4 e209e44ca2 manpage: fix a minor aspect of the discnav command
"menu" is in fact understood by stream_bluray.c, so just drop that
sentence.
2014-05-18 14:09:38 +02:00
wm4 dbdf7c39e7 player: increase seek accuracy when refreshing display on filter change
When the player is paused, and video filters are changed, an exact seek
is executed to refresh the display. Increase the exactness of the seek
in this case; this reuses the code used for frame backstepping.

It might help in cases where seeking is very imprecise, such as with
transport streams.
2014-05-18 14:08:45 +02:00
wm4 dc96523536 manpage: document discnav command 2014-05-18 00:03:59 +02:00
wm4 5841685e09 command: add a disc-menu-active property
Returns whether a DVD/BD menu is active. As requested by #788.
2014-05-18 00:03:47 +02:00
wm4 1ef1e8e509 client API: fix "missed" property notifications
If a property is notified as changed, and then again (before the change
notification is returned to the client), and the second change is a
sporadic change (i.e. nothing actually changed) and the change
notification was associated with with a data type, it could happen that
a change was "overlooked", because it would detect no change on the
second notification.

This is actually a pretty annoying corner case, due to the annoying way
we do things, so just store both the previously returned _and_ the newly
obtained property value. then we always compare with the user value to
check for a change, excluding any possibility of a missed change.

Note that we don't (can't/shouldn't) care if a value changes, and then
changes back; it's fine if that doesn't generate a notification. This is
due to how property notifications are supposed to be coalesced.
2014-05-18 00:02:55 +02:00
wm4 c2039572b7 x11: make screensaver code more compact, change DPMS handling
Reduces some code-duplication.

Just call DPMSEnable/DPMSDisable, instead of DPMSForceLevel when
reenabling DPMS. "Force" sounds evil, and messing with DPMS is already
pretty evil. I'm not even sure that we should.
2014-05-17 21:36:34 +02:00
wm4 b4b68ebf5a x11: add wrapper for EWMH XSendEvent calls 2014-05-17 18:03:28 +02:00
wm4 347eaaa93c x11: fix Drag & Drop
Accidentally broken in commit 95462747.
2014-05-17 17:49:47 +02:00
wm4 8304478149 x11: add a wrapper for XGetWindowProperty
XGetWindowProperty is a really bad API, almost as if the NSA designed
it. The wrapper takes care of verifying the return values and handle
corner cases.
2014-05-17 17:49:47 +02:00
wm4 5a1bf25523 x11: comment about gravity
The window "gravity" influences how placement interacts with WM added
borders (i.e. from decorations). This is probably what the code removed
in commit c14721c8 was about.

In theory, we'd probably want to set the gravity depending on the
relative placement requested by the user (so that it's possible to line
up the top/left video pixel with the monitor corner, as well as the
bottom/right pixel - but that would be too complicated, and who cares
after all?).

I'm also not sure whether CenterGravity really uses the top/left corner
as reference point (instead of making coordinates relative to the window
center), but empirically it's correct.
2014-05-17 14:26:49 +02:00
wm4 0e579f8439 x11: replace x/y/w/h with mp_rect 2014-05-17 03:29:36 +02:00
wm4 b4ccf765af x11: remove some unused fields 2014-05-17 03:02:47 +02:00
wm4 625ad57add x11: don't set PBaseSize
There's apparently no reason why we should set a bogus size.
2014-05-17 02:53:57 +02:00
wm4 3afff3fe9b x11: remove vo_hint member
Now it's always recreated in vo_x11_sizehint(). Also, the Xlib manual
says you must use XAllocSizeHints() (for ABI reasons), so do that.
2014-05-17 02:27:46 +02:00
wm4 4807f8bdd2 x11: always raise layer in fullscreen mode without NetWM 2014-05-17 01:53:56 +02:00
wm4 faeaa6c358 x11: implement --fs-screen properly, separate old code path
Try to get the "new" code path (using NetWM/EWMH) free of hacks done for
the sake of old WMs or the no-WM case.

Implement --fs-screen using _NET_WM_FULLSCREEN_MONITORS.
2014-05-17 01:14:59 +02:00
wm4 444e583b6d x11: use CenterGravity by default
Keeps the window centered on resize. Seems nicer. (Although it's worse
if 1. the default placement of the WM puts it into a monitor corner,
and 2. you switch to a larger video.)
2014-05-17 00:53:54 +02:00
wm4 c14721c8b9 x11: remove gravity restore code
It was added with 3813c685 in 2004. I'm not really sure why this gravity
stuff would be needed; apparently it has to do with misplacements with
broken WMs and had to be changed on fullscreen. Just get rid of it; it
works perfectly fine without on modern WMs.

The thread discussing this is here:
http://mplayerhq.hu/pipermail/mplayer-dev-eng/2004-July/027674.html
2014-05-17 00:53:53 +02:00
wm4 9546274710 x11: don't cache X Atoms manually
XInternAtom() already caches lookups. Even if calling XInternAtom would
be always inefficient, it wouldn't matter much during normal playback.
2014-05-16 23:17:09 +02:00
wm4 7c2cf7cdf1 x11: inline a function
Keeping it separate seems less readable.
2014-05-16 23:17:02 +02:00
Rudolf Polzer 4ac4269389 encoding: No error when the output format doesn't support a stream type at all.
When writing a video to foo.mp3, the user's intention is clearly to drop
the video stream, and similarly, when writing to foo-%d.png, the
intention is clearly to drop the audio stream. Now, explicit
specification of --no-audio or --no-video is no longer necessary in
these cases.
2014-05-16 21:41:32 +02:00
wm4 129ab5833d etc/example.conf: add example options for multichannel audio 2014-05-16 01:24:03 +02:00
wm4 014c0fb997 etc/example.conf: minor adjustments 2014-05-16 01:15:11 +02:00
wm4 07fe0412d9 etc/example.conf: remove spaces between key and value
Currently, they are allowed, but only because MPlayer happened to do
that. This might or might not be changed in the future.
2014-05-16 01:13:20 +02:00
wm4 ebd5bbd241 x11: replace--[x11-]fstype option with --x11-netwm
Simplifies the code a lot. You can still use --x11-netwm=no to disable
NetWM for whatever reasons.
2014-05-16 00:47:13 +02:00