1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00
Commit Graph

36202 Commits

Author SHA1 Message Date
wm4
eeac26410f mplayer: print a warning if libass is not compiled
Libass is technically an optional dependency, but in practice users
tend to disable libass accidentally or for the hell of it to get
something "minimal", without being aware of the consequences.
2013-10-13 22:25:33 +02:00
ChrisK2
1560d6ce60 osc: fix mouse hiding 2013-10-13 05:38:13 +02:00
ChrisK2
9b20c681fd osc: Once again new Show/Hide handling
The deadzone-size is now by default zero, so movement on the entire window will make the OSC show up. To avoid it showing up by randomly moving mice, the option 'minmousemove' controls how many pixels movement (default: 1) between ticks (frames) are necessary to make the OSC show up.
The deadzone can be reenabeled by setting the option 'deadzonesize' (default: 0 = no deadzone, 1 = entire area between OSC and opposite window border), to restore the old behavior, set it to ~0.92.

The OSC will hide immediately when leaving the window or entering the deadzone (if existing) or after the time specified with 'hidetimeout' (default: 500ms) passed without any new movement. Set to negative value to disabling auto-hide (thus restoring old behavior). The OSC will never hide if hovered by the mouse.
2013-10-13 03:51:25 +02:00
wm4
a550731209 Copyright, LICENSE: switch to GPL version 2 or later
Now that talloc has been removed, the license can be switched back to
GPLv2+. Actually, there never was a GPLv2+ licensed MPlayer (fork or
not) until now, but removal of some GPLv2-only code makes this possible
now. Rewrite the Copyright file to explain the reasons for the licenses
MPlayer and forks use. The old Copyright file didn't contain anything
interesting anymore, and all information it contained is available at
other places in the source tree.

The reason for the license change itself is that it should improve
interoperability with differently licensed code in general.

This essentially reverts commit 1752808.
2013-10-13 01:36:10 +02:00
wm4
0933f12d28 Replace talloc
There are multiple reasons to do this. One big reason is the license:
talloc is LGPLv3+, which forces mpv to be licensed as GPLv3+.

Another one is that our talloc copy contains modifications, which makes
it essentially incompatible with upstream talloc (in particular, our
version aborts on out of memory conditions - well, it wasn't my idea).
Updating from upstream is also a bit involved - the talloc source is
not really organized in a way to allow copying it into projects (and
this isn't an intended use-case).

Finally, talloc is kind of big and bloated. The replacement halves the
amount of code - mainly because we didn't use all talloc features. It's
even more extreme if you compare upstream talloc (~4700 lines) and the
new allocator without talloc compat (~900 lines).

The replacement provides all features we need. It also doesn't clash
with talloc. (The talloc compatibility wrapper uses macros to avoid
introducing linker-level symbols which could clash with libtalloc.)

It also tries to lower the overhead (only 4 words opposed to 10 words
in talloc for leaf nodes in release mode). Debugging features like leak
reporting can be enabled at compile time and add somewhat more overhead.
Though I'm not sure whether the overhead reduction was actually
successful: allocations with children need an "extra" header, which adds
plenty of overhead, and it turns out that almost half of all allocations
have children. Maybe the implementation could be simplified and the
extra header removed - even then, overhead would be lower than talloc's.

Currently, debugging features can be entirely deactivated by defining
NDEBUG - I'm not sure if anything defines this directly yet, though.

Unlike in talloc, the leak reporting stuff is thread-safe. (That's also
why it's far less elegant, and requires extra list pointers.)

Comes with a compatibility layer, so no changes to mpv source code
are needed. The idea is that we will pretend to be using talloc for
a while, so that we can revert to our old talloc implementation at
any time for debugging purposes.

Some inspiration was taken from Mesa's ralloc:

    http://cgit.freedesktop.org/mesa/mesa/tree/src/glsl/ralloc.h

This is another talloc replacement, but lacks some features we need
(getting size of an allocation, debugging features, being able to
access children in the dtor).

There's some information in ta/README what will happen next and how the
transition is expected to progress.
2013-10-13 01:36:09 +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
wm4
f312528ebc command: preferably show "add"/"cycle"/"set" command errors on OSD
Before this, they were shown on terminal only. Now they use the OSD
mechanism, which shows them on the video window or the terminal,
depending on settings and what's available.
2013-10-12 18:57:02 +02:00
wm4
20988ee607 command: don't allow changing volume if no audio initialized
Changing volume when audio is disabled was a feature request (github
issue #215), and was introduced with commit 327a779.

But trying to fix github issue #280 (volume is not correct in no-audio
mode, and if audio is re-enabled, the volume set in no-audio mode isn't
set), I concluded that it's not worth the trouble and the current
implementation is questionable all around. (For example, you can't
change the real volume in no-audio mode, even if the AO is open - this
could happen with gapless audio.) It's hard to get right, and the
current mixer code is already hilariously overcomplicated. (Virtually
all of mixer.c is an amalgamation of various obscure corner cases.)

So just remove this feature again.

Note that "options/volume" and "options/mute" still can be used in
idle mode to adjust the volume used next time, though these properties
can't be used during playback and thus not in audio-only mode.

Querying the volume still "works" in audio-only mode, though it can
return bogus values.
2013-10-12 18:57:02 +02:00
wm4
38874b2f2e playlist: check for NULL on caller site
Letting some playlist functions randomly accept NULL, while others do
not isn't such a good idea.
2013-10-12 18:57:02 +02:00
Philip Sequeira
7ce464bef9 options: --loop=N means playback N times, not N+1 times
The argument or this change is that --loop should set how often the
file is played, not the number of additional repeats.

Based on pull request 277, with additions to the manpage and removal
of "--loop=0".

Signed-off-by: wm4 <wm4@nowhere>
2013-10-12 18:57:02 +02:00
wm4
d1c473bc25 libquvi9: work around insane interaction between libquvi and libkdecore
The primary effect of this commit is that it fixes playback resume if
libquvi 0.9 and German locale are used, and libkdecore is on the system.
(See github issue #279.)

libquvi uses libproxy to determine system-wide proxy settings. libproxy
in turn loads libkdecore (if present) to determine KDE proxy settings.
libkdecore has a global constructor, which calls setlocale(LC_ALL, ""),
switching the current locale from "C" to what the user's settings. This
breaks some basic C string processing functions. Note that the locale
won't be set on program start, but only when libproxy calls dlopen() on
its config_kde module, which actually causes libkdecore to be loaded and
initialized.

In particular, with German locale, snprintf() would use "," instead of
"." when formatting float values, which in combination with playback
resume, would lead to parse errors the next time mpv was started, which
is how this issue was found.

I'd consider this a bug with libkdecore or at least libproxy. No library
should ever even touch locale: it might break basic expectations on C
string handling functions, might override program settings, and it's not
thread-safe. But this is so nasty and severe, that a quick hack to fix
it hurts less.

See github issue #279 and KDE bug #325902.
2013-10-12 18:56:03 +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
Mohammad Alsaleh
65a3977282 mpvcore/playlist.c: Avoid NULL reference in playlist_add_base_path()
Before this patch, those will cause a crash:

  mpv -playlist /dev/null
  mpv -playlist <(bla) # if the result of bla is empty

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2013-10-11 18:01:47 +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
William Light
16450fab3f mp_ring: fix mp_ring_read_cb() when read wraps around
previously, mp_ring_read_cb() would allow reading past the end of the
ringbuffer when buffered > available. mp_ring_read() had logic for
splitting the read into two, which I duplicated into mp_ring_read_cb().
2013-10-08 20:03:57 +02:00
wm4
5c3abb9082 demux_raw: set a default video size 2013-10-07 17:21:53 +02:00
wm4
de6eace6e9 command: sub_seek: avoid getting stuck
First, don't try to seek if the result is 0 (i.e. nothing found, or
subtitle event happens to be exactly on spot).

Second, since we never can make sure that we actually seek to the exact
subtitle PTS (seeking "snaps" to video PTS), offset the seek by 10ms.
Since most subtitle events are longer than 10ms, this should work fine.
2013-10-07 17:21:53 +02:00
ChrisK2
ccdaecfc5c osc: Okay, don't multiply the cache value
As expected, this is not liked.
2013-10-07 00:56:11 +02:00
ChrisK2
f3556356b7 osc: Display cache fill status
The OSC will now display cache fill status between the timecodes, but only if it's below 48% to not clutter the interface with erratically changing values.

By default, the displayed value is multiplied by 2 to not confuse users who are unfamillar with the inner workings of the caching system. This can be disabled using the iAmAProgrammer=true setting.
2013-10-07 00:04:35 +02:00
ChrisK2
99adbe1e7c osc: Add another scale option for forced windows.
If the OSC is rendered on a forced window (by --force-window), the scale can be configured with scaleForcedWindow.
2013-10-06 23:44:46 +02:00
Thomas Orgis
55883943c5 ad_mpeg123: support in-stream format changes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36461 b3059339-0415-0410-9bf9-f77b7e298cf2

Fixes playback of http://mpg123.org/test/44and22.mp3

Cherry-picked from MPlayer SVN rev. #36461, a patch by
Thomas Orgis, committed by by Reimar Döffinger.
2013-10-06 23:41:18 +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
wm4
2d638347c1 mplayer: don't resume playlist if --no-resume-playback is used 2013-10-06 21:54:00 +02:00
Christian Neukirchen
2119bcbeac ao_sndio: add documentation 2013-10-05 22:47:20 +02:00
wm4
ae9a3e33aa command: add commands for displaying overlays
Requested by github issue #255.

Does not work where mmap is not available (i.e. Windows).
2013-10-05 22:46:55 +02:00
wm4
fd49edccf8 command: add properties for retrieving OSD dimensions 2013-10-05 22:46:55 +02:00
wm4
1be863afdb mplayer: fix some issues with playlist_prev command
You couldn't jump to the first entry in the playlist, if that entry was
marked as "too short". But this is usually fine, because it doesn't get
into the way of the user. (This feature is meant to allow being able to
jump backwards through the playlist even if a file immediately stops
playback right after initialization, not to prevent playing these files
at all.)

Also, apply the skip logic when wrapping around the playlist when going
backwards. This happens with --loop, because looping pretends the
playlist is infinitely repeated forwards and backwards (as long as the
playlist_prev/next commands are concerned).

Also add some comments.
2013-10-05 22:46:55 +02:00
wm4
c3ea08a2d7 mplayer: fix cleanup if VO initialization fails
Just specifying a VO that doesn't exist would make it crash.
Regression caused by commit 6a0408b.
2013-10-05 22:46:14 +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
6a0408be68 mplayer: don't keep previous video frame with --force-window
When for example switching off the video stream, and --force-window is
used, forcefully reconfigure the VO. This will reset the size, and will
clear the window with black.

Needed some effort, because you don't always want to clear the window
on "discontinuity" points like going to a next file: this would
introduce some flicker.
2013-10-04 00:27:54 +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
Stefano Pigozzi
683e212a77 ao_coreaudio: clear output buffer on buffer underrun
Output silence to the output buffer during underruns. This removes small
occasional glitches that happen before the AUHAL is actually paused from the
`audio_pause` call.

Fixes #269
2013-10-03 23:43:07 +02:00
Christian Neukirchen
3289473678 audio/out: add sndio support
Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
2013-10-03 23:14:03 +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
93b712fa8a command: add sub_seek input command
Essentially reuses the sub_step command, and is subject to the same
restrictions.

Seems to behave a bit strange sometimes, but generally works.
2013-10-02 21:05:04 +02:00
wm4
df5706f156 input: remove strange offset from commands enum
A leftover from 10 years of refactoring.
2013-10-02 20:48:50 +02:00
wm4
a4998e08ef command: don't let "avsync" property print NOPTS value
Can happen when seeking in audio files with attached picture.
MP_NOPTS_VALUE doesn't really make sense outside of mpv internals, so
don't return it.
2013-10-02 20:43:13 +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
4da7630824 mplayer: osd bar depends on VO, not video decoding
The OSD bar wasn't displayed, and instead a fallback message was shown.
2013-10-02 20:39:26 +02:00
wm4
d24bf6e349 mplayer: make VO interaction work in --idle mode
Didn't handle VO events, didn't handle OSD message management.

There is probably still some strangeness left. --idle mode was never
made for direct interaction.
2013-10-02 20:38:10 +02:00
wm4
ca2b05c0fb mplayer: change default window size for --force-window
Closer to the ubiquitous 16:9 screen aspect ratio. Requested by ChrisK3.
2013-10-02 20:34:41 +02:00
wm4
fde99da5c6 mpv.desktop: add --force-window
Seems appropriate.
2013-10-02 01:40:06 +02:00
wm4
886c3ef999 command: subtitle support depends on VO, not video decoding
We can render subtitles if a VO is open. Whether we're decoding video
(i.e. if mpctx->sh_video is set) doesn't really matter.

Subtitle display with --force-window still doesn't quite work yet,
because there's nothing to actually force redrawing of subtitles in this
mode.
2013-10-02 01:39:28 +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
3c0333978e core: don't require "refresh" seek for --keep-open
Seeking normally resets the VO and throws away the currently displayed
frame, so if you seek outside the video with --keep-open enabled, the
window would normally be "stuck" and not redraw properly, because there
is no source video frame that could be redrawn. To deal with this, a
precise seek to the position of the last displayed video frame was
issued.

This usually worked, but it can fail for formats where seeking is broken
or not possible (consider reading from a pipe).

Fix this by changing the semantics for vo_seek_reset(): now the video
frame is remembered even after seeking.

Note that this changes behavior a little when trying to seek outside of
a file with --keep-open enabled. Since no actual seek is done anymore,
the video will remain "frozen" on the previous position, and you can't
unpause or framestep to see the video between current position and
actual end of the video. If users complain, I might revert this commit.
2013-10-02 00:42:18 +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