1
mirror of https://github.com/mpv-player/mpv synced 2024-08-04 14:59:58 +02:00
Commit Graph

36287 Commits

Author SHA1 Message Date
Johan Kiviniemi
e5710ccc5d ao_pulse: set the property media.role=video 2013-09-20 13:50:13 +02:00
wm4
3e5b632559 Merge branch 'volume_restore' 2013-09-20 13:48:36 +02:00
wm4
542086dd45 af: merge af_reinit() and fix_output_format()
Calling them separately doesn't really make sense, and all existing
calls to them usually combined them. One subtitle difference was that
af_init() didn't wipe the filter chain if initialization of the chain
itself failed, but that didn't really make sense anyway.

Also remove af_init() from the code for setting balance in mixer.c. The
mixer should be in the initialized state only if audio is fully
initialized, so the af_init() call made no sense.

Note that the filter "editing" code in command.c doesn't really do a
nice job of handling errors in case recreating an _old_ (known to work)
filter chain unexpectedly fails, and this obscure/rare case might be
differently handled after this change.
2013-09-20 13:43:00 +02:00
wm4
0162271725 mixer: make struct opaque
Also remove stray include statements from ao_alsa and ao_oss.
2013-09-20 13:23:25 +02:00
wm4
327a779a81 mixer: allow accessing volume and mute property on disabled audio
The volume is set as soon as the audio chain is created again. This
works only in softvol mode. For system wide volume or otherwise
externally user controllable volume, this code is intentionally
disabled. It would be extremely weird if changing volume (while audio is
not initialized) would do nothing, and then suddenly change it when the
audio chain is created.

There's another odd corner case: the user-set volume will be thrown away
if it's set before the _first_ audio chain initialization. This is
because the volume restore logic recognizes a change from nothing to
softvol or an AO, and circumventing that would require additional code.
Also, we don't even know the start volume before that point.

Forcing the volume with --volume will can override the volume set during
no-audio mode, depending on the situation.
2013-09-20 13:23:25 +02:00
wm4
7623c94ddc manpage: af_volnorm was renamed 2013-09-20 13:23:25 +02:00
wm4
b8e42ae13c mixer: restore volume with playback resume
Note that this is intentionally never done if the AO or softvolume is
different, or if the current volume control method is thought to control
system wide volume (such as ALSA) or otherwise user controllable (such
as PulseAudio). The intention is to keep things robust and to avoid
messing with the user's audio settings as far as possible, while still
providing the ability to resume volume if it makes sense.
2013-09-20 13:23:25 +02:00
Martin Herkt
ed2d67b6d7 vo/x11_common: remove superfluous msg prefixes 2013-09-20 00:04:39 +02:00
Stefano Pigozzi
061b6ab3aa macosx_application: fix regression causing crash
95a2151d1 introduced a crash on systems lower than 10.9 when opening files
with a single argument.
2013-09-19 22:03:49 +02:00
Stefano Pigozzi
00d8e85373 Revert "osxbundle: fonts.conf: only look for fonts in ~/.mpv/fonts"
Commit broke text subtitles without embedded fonts. Will look for a better
solution later. Revert it for now, since I'm starting to get bug reports.

This reverts commit 4a9f618d9f.
2013-09-19 21:39:16 +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
6599677b98 mplayer: rename a somewhat misnamed function 2013-09-19 17:28:27 +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
wm4
234d967bed mixer: don't unmute audio when raising volume
This is rather strange behavior, away with it.
2013-09-19 14:32:25 +02:00
wm4
38b2c97fd6 mixer: refactor, fix some aspects of --volume handling
Refactor how mixer.c does volume/mute restoration and initialization.
Move to handling of --volume and --mute to mixer.c. Simplify the
implementation of these and hopefully fix bugs/strange behavior related
to using them as file-local options (this uses a somewhat dirty trick:
the option values are reverted to "auto" after initialization). Put most
code related to initialization and volume restoring in probe_softvol()
and restore_volume(). Having this code all in one place is less
confusing.

Instead of trying to detect whether to use softvol at runtime, detect it
at initialization time using AOCONTROL_GET_VOLUME (same with mute,
AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work
if the GET variants work. Hopefully this is always the case.

This is also preparation for being able to change volume/mute settings
if audio is disabled, and for allowing restoring value with playback
resume.
2013-09-19 14:32:09 +02:00
wm4
4ba52a9e82 mixer, af_volume: use linear values instead of dB
Softvol always used a linear multiplier for volume control. This was
converted to dB, and then back to linear in af_volume. Remove this non-
sense. We still try to keep the command line argument to af_volume in
dB, though.
2013-09-19 14:31:55 +02:00
wm4
296531ad00 mixer: minor refactoring
Let struct mixer access access MPOpts to simplify some things. Rename
some variables and functions. There should be no functional changes.
2013-09-19 14:31:43 +02:00
wm4
69e272dad7 af_export: fix compilation warning
Blargh.
2013-09-19 14:30:53 +02:00
Stefano Pigozzi
4a9f618d9f osxbundle: fonts.conf: only look for fonts in ~/.mpv/fonts
This is to avoid the 30s hang while mpv caches fonts. In practice all the
fonts an average user is going to use are embedded in mkv files so there is
no reason to build fontconfig's cache on all of OS X system directories.

I might add something similar for terminal usage, but I am highly undecided.
2013-09-18 22:18:33 +02:00
wm4
5249cccfcf Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can
return NULL, e.g. if $HOME is unset.

Fix all the code that didn't check for this correctly yet.
2013-09-18 19:56:15 +02:00
wm4
1298dbdf01 osdep/path: remove ifdefs
They're not really needed, so kill them.
2013-09-18 19:42:19 +02:00
Stefano Pigozzi
af018f7e4f macosx: move bundle path stuff to path-macosx.m
This makes the code uniform to how stuff was handled for Windows in 1cb55ceb.
2013-09-18 19:30:11 +02:00
wm4
1cb55cebf9 path, win32: redo user configfile path handling
Remove the ifdef hell from mp_find_user_config_file(). Move the win32
specific code (for MinGW and Cygwin) to path-win.c. The behavior should
be about the same, but I can't be sure due to lack of testing and
because the old path.c code was hard to follow. (I expect those who care
about windows will fix things, should issues pop up - sorry.)

One difference is that the new code will always force MPV_HOME. It looks
like the old code preferred the mpv config dir in the exe dir if it
exists.

Also, make sure MP_PATH_MAX has enough space, even if the equivalent
wchar_t string is not 0-terminated with PATH_MAX (because apparently the
winapi doesn't require this). (Actually, maybe we should just kill all
uses of PATH_MAX/MP_PATH_MAX.)
2013-09-18 19:08:51 +02:00
wm4
12372298a2 win32: add getenv() UTF-8 variant
This is a bit "hard", because getenv() returns a static string, and we
can't just return an allocated string. We also want getenv() to be
thread-safe if possible. (If the mpv core is going to be more threaded,
we sure do want the lower layers to be thread-safe as well.)
2013-09-18 19:08:51 +02:00
wm4
b97d10a839 path: fix undefined behavior
The homepath variable was static, and its value was set to a stack
buffer. This means a second invocation of the function would trigger
undefined behavior. Moreover the stack buffer always went out of scope
before homepath was used.
2013-09-18 19:08:51 +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
Stefano Pigozzi
fc74574df0 HIDRemote: remove OS X version checks
Turns out that these checks were for versions of OS X that mpv doesn't even
support anymore. So just remove the checks since they cause a deprecation
warning.
2013-09-17 20:44:54 +02:00
wm4
82de39b7d5 find_subfiles: fix really dumb bug causing segfaults
NULL pointer deref when a .sub file with the same filename as the video
file was present.

I was probably half asleep when writing this code.
2013-09-17 15:41:23 +02:00
Nyx0uf
95a2151d19 macosx_application: remove deprecation warning on OS X 10.9
GetCurrentProcess() is deprecated on 10.9. Make a universal solution by
checking OS version number.

get_system_version() function is the recommended Apple way of getting the
OS version, since Gestalt is also deprecated (and does pretty much the same
thing anyway)

Updating HIDRemote.m to use a similar function would allow to get rid of the
2 other warnings.
2013-09-16 21:51:08 +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
wm4
6da11789ae mplayer: read subtitle packets as soon as possible
Call update_subtitles() on every iteration of the playloop, so that
subtitle packets are read as soon as possible, instead of every time a
video frame is displayed. This helps in case the packet queue is swamped
with subtitle packets, which can happen with certain insane mkv files.
The change will simply cause the subtitle queue to be emptied on each
playloop iteration.

The timestamps update_subtitles() uses for display are the same before
and after this commit. (Important for files which have subtitle packets
with timestamps or duration not set.)
2013-09-16 00:46:14 +02:00
wm4
4a3ceac2b5 demux_mkv: don't add too many subtitle packets during seeking
In insane files with a very huge number of subtitle events, and if the
--demuxer-mkv-subtitle-preroll option is given, seeking can still
overflow the packet queue. Normally, the subtitle_preroll variable
specifies the maximum number of packets that can be added. But once this
number is reached, the normal seeking behavior is enabled, which will
add all subtitle packets with the right timestamps to the packet queue.
At this point the next video keyframe can still be quite far away, with
enough subtitle packets on the way to overflow the packet queue.

Fix this by always setting an upper limit of subtitle packets read
during seeking. This should provide additional robustness even if the
preroll option is not used.

This means that even with normal seeking, at most 500 subtitle packets
are demuxed. Packets after that are discarded.

One slightly questionable aspect of this commit is that subtitle_preroll
is never reset in audio-only mode, but that is probably ok.
2013-09-16 00:46:14 +02:00
wm4
4f400d2b85 command: force video refresh when changing aspect
Pausing the player and changing the aspect would leave the VO without a
frame to display.
2013-09-15 22:03:29 +02:00
wm4
471d6f0013 manpage: remove bogus space in example usage 2013-09-15 21:32:26 +02:00
wm4
d6884defa7 Add mpv.desktop, let Makefile install the desktop file and the icons
The mpv.desktop file is taken from the Arch package [1]. It appears to
be based on the mplayer2 git mplayer.desktop file (e.g. very similar
MimeType field), with minor modifications applied by Arch package
maintainers.

Note that for now, this doesn't show a terminal (Terminal=false), which
might not always be ideal. For example, if the file is audio only, or
if VO initialization fails for some reason, mpv will run in the
background and play audio without showing a window. But users prefer
running it without terminal, and don't want to play audio files with
it.

Maybe a --force-window option will be added in the future, which would
always create a VO window, and compensate for these issues.

[1] https://aur.archlinux.org/packages/mpv-git/
2013-09-15 21:22:30 +02:00
wm4
132c7f1cf5 manpage: remove version and date fields
These would have to be updated manually all the time. Replacing them
automatically would be possible, but additional work, and would force
regeneration of the manpage way too often.

We decided that we don't need these fields.
2013-09-15 20:44:07 +02:00
wm4
9aa206a90e screenshot: change %w format to be more like %t
Instead of containing a format string within %w{...}, simply allow %w
to specify one item of a time format string. This is simpler, more like
other format specifiers (%t),  and probably easier to use too.
2013-09-15 19:07:35 +02:00
wm4
884c179177 mplayer: attempt to skip playlist entries which can't be played
This is for situations when repeated attempts at playing a playlist
entry failed, and playlist navigation becomes impossible due to that.
For example, it wasn't possible to skip backwards past an unplayable
playlist entry:

    mpv file1.mkv doesntexist.mkv file3.mkv

You couldn't skip back to file1.mkv from file3.mkv. When running a
single "playlist_prev" command, doesntexist.mkv would be played, which
would fail to load. As reaction to the failure to load it, the next file
would be played, which is file3.mkv.

To make this even worse, the file could successfully load, but run only
for a split second. So just loading successfully isn't good enough.

Attempt to solve this by marking problematic playlist entries as failed,
and by having playlist_prev skip past such playlist entries. We define
failure as not being able to play more than 3 seconds (or failing to
initialize to begin with). (The 3 seconds are in real time, not file
duration.)

"playlist_prev force" still exhibits the old behavior.

Additionally, use the same mechanism to prevent pointless infinite
reloading if none of the files on the playlist exist. (See github issue

All in all, this is a heuristic, and later adjustments might be
necessary.

Note: forward skips (playlist_next) are not affected at all. (Except for
the interaction with --loop.)
2013-09-15 05:03:55 +02:00
wm4
aa43405020 screenshot: make it possible to format playback time in various ways 2013-09-15 02:51:19 +02:00
wm4
58cff195e7 mp_common: add function which accepts a format string to format playback time 2013-09-15 02:51:17 +02:00
wm4
a87298e501 mplayer: don't run heartbeat command while paused
This is commonly used to disable the screensaver with broken/non-
standard X screensavers. During pause, the screensaver should not be
disabled, so not calling this command while paused seems sensible.

See github issue #236.
2013-09-15 02:13:54 +02:00
wm4
534842b694 av_log: show ffmpeg "info" messages with -v only
They are rarely useful in my opinion.

This commit was mainly motivated by this message:

    Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using a tool like VirtualDub or avidemux to fix it.

It's what's left over from the "Invalid and inefficient vfw-avi..."
warning that used to be printed when playing avi/divx files. Although
the new message is much better, it's still rather useless and poses
more questions than it answers. Besides, nobody wants to remux a file
when playing it, especially not if playback appears to be completely
fine. (There are some claims that these files raise CPU usage, but even
my old crappy CPU can decode low res avi/divx files at real time at
about x35 playback speed.)
2013-09-15 00:43:43 +02:00
Stefano Pigozzi
47715fd1f7 mplayer: m_option: fix clang -Wformat compiler warning
Code was using %d format instead %zd to print size_t data.
2013-09-14 20:49:55 +02:00
Stefano Pigozzi
855b705980 stream_dvd: prevent segmentation fault with some broken files
I have a sample where some final chapters are missing. This was causing a
segmentation fault when trying to fetch chapter times for them.

This makes the code ignore those chapters.
2013-09-14 20:49:55 +02:00
Bilal Syed Hussain
29edc86721 macosx: add webm the filetypes handled by the bundle 2013-09-14 20:49:55 +02:00
Benjamin Franzke
15dccc3746 demux_playlist: add mov RTSPtext tag parser
The quicktime html scripting guide suggests to wrap urls not
necesarly associated with quicktime in a .mov file.
(so that when <embed>ing videos quicktime would be forced.)
These mov files may contain several "Text Hacks".
One of these is RTSPtext.

The suggested/allowed format (as regex) is like:
  RTSPtext[ \r]RTSP://url
See also p.51 of:
https://developer.apple.com/library/mac/documentation/QuickTime/Conceptual/QTScripting_HTML/QTScripting_HTML.pdf
In reality there are also files like (e.g. zdfmediathek.de):
RTSPtext\nrtsp://url\n\n

Lets handle these files as a playlist with one element.
2013-09-14 15:58:10 +02:00
Stefano Pigozzi
61790c98e8 README: add clarification about --enable 2013-09-14 10:00:59 +02:00