Commit Graph

40620 Commits

Author SHA1 Message Date
wm4 102946ee03 player: enable cache and demuxer thread for subtitles too
Includes some logic for not starting the demuxer thread for fully read
subtitles. (Well, the cache will still waste _lots_ of resources, and
the cache always has to be created, because we don't know whether it'll
be needed _before_ opening the file.)

See #1597.
2015-02-18 21:12:57 +01:00
wm4 37a0c9140a demux_lavf: reorganize hacks
An attempt to make format-specifics more declarative. (In my opinion,
all of this should be either provided by libavformat, or should not be
needed.)

I'm still leaving many checks with matches_avinputformat_name(), because
they're so specific.

Also useful for the following commit.
2015-02-18 21:12:57 +01:00
wm4 c7f450723f player: allow unsetting --term/osd-playing-msg
Treat an empty string as unset. The fact that the option values can be
NULL is merely weirdness due to how the option parser works (it
unfortunately doesn't initialize string fields to non-NULL).
2015-02-18 21:12:57 +01:00
wm4 ff992e093b demux_lavf: set interrupt_callback
Helps with terminating the stream if e.g. HLS streams are stuck. (For
other demuxers, the stream's interrupt callback already takes care of
this.)
2015-02-18 21:12:57 +01:00
wm4 69e6e7b17c input: minor cleanup
Add MP_KEY_MOUSE_ENTER to the ignored input if the user has disabled
mouse input. Remove one instance of code duplication, and add a
MP_KEY_IS_MOUSE_MOVE macro to summarize events that are caused by moving
the mouse.
2015-02-18 21:12:57 +01:00
Jaime Marquínez Ferrándiz aa98049877 find_subfiles: Add 'vtt' to subtitle extensions 2015-02-18 21:12:55 +01:00
torque 3b269ac0a0 input: add MOUSE_ENTER keybinding.
Signed-off-by: wm4 <wm4@nowhere>
2015-02-18 00:03:16 +01:00
wm4 fa9b587426 demux, matroska: remove demuxer type field
The Matroska timeline code was the only thing which still used the
demuxer.type field. This field explicitly identifies a demuxer
implementation. The purpose of the Matroska timeline code was to reject
files that are not Matroska. But it already forces the Matroska format,
meaning loading will explicitly only use the Matroska demuxer. If the
demuxer can't open the file, no other demuxer will be tried, and thus
checking the field is redundant.

The change in demux_mkv_timeline.c removes the if condition, and
unindents the if body.
2015-02-17 23:58:18 +01:00
wm4 082371a160 demux: remove file_contents field
Only demux_cue and demux_edl used it. It's a weird field and doesn't
help with anything anymore - by now, it only saves a priv context in the
mentioned demuxers. Reducing the number of confusing things the demuxer
struct has is more important than minimizing the code.
2015-02-17 23:49:38 +01:00
wm4 d7a4cb14ff demux_edl: make independent from MPContext 2015-02-17 23:48:47 +01:00
wm4 1e44c811f3 demux_edl: move implementation
Same deal as with demux_cue, and a separate commit for the same reasons.
2015-02-17 23:48:39 +01:00
wm4 10781c2a9c demux_cue: make independent from MPContext
Also see previous commit(s).
2015-02-17 23:48:07 +01:00
wm4 7f03f46882 demux_cue: move implementation
Move the implementation, of which most was in tl_cue.c, to demux_cue.c.
Currently, this is illogical, because tl_cue.c still accesses MPContext.
This is going to change, and then it will be better if everything is in
demux_cue.c. This is only a separate commit to distinguish code movement
and actual work; the next commit will do the actual work.
2015-02-17 23:48:03 +01:00
wm4 f9872ab26f demux: copy priv pointer too
Weird, but helps with the case a demuxer gets handed its own instance
from outside.
2015-02-17 23:47:54 +01:00
wm4 edc0007e74 matroska: move timeline code to demux/
Separate from previous commit, because git is bad at tracking file
renames when the file contents are also changed.
2015-02-17 23:47:37 +01:00
wm4 5a186d5942 matroska: make timeline code independent of MPContext 2015-02-17 23:46:50 +01:00
wm4 a0a089f6a4 player: use a separate context for timeline loader stuff
Instead of accessing MPContext in player/timeline/*, create a separate
context struct, which the timeline loaders fill out. It turns out that
there's not much in the way too big MPContext that these need to access.

One major PITA is managing (and closing) the set of open demuxers. The
problem is that we need a list of all demuxers to make sure no unneeded
streams are enabled.

This adds a callback to the demuxer_desc struct, with the intention of
leaving to to the demuxer to call the right loader, instead of
explicitly checking the demuxer type and dispatching manually in common
code. I also considered making the timeline part of the demuxer state,
but decided against: it's too much of a mess wrt. memory management and
threading, and also doesn't make it clear who owns the child demuxers.
With the struct timeline decoupled from the demuxer state, it's at least
somewhat clear that the child demuxers are independent from the "main"
demuxer.

The actual changes to player/timeline/* are separated in the following
commits, because they're quite verbose. Some artifacts will be removed
later as soon as there's only 1 timeline loading mechanism.
2015-02-17 23:46:12 +01:00
wm4 3efeee446e demux: chapters without metadata are allowed
Makes some of the following commits slightly simpler. Also fix a typo.
2015-02-17 23:44:31 +01:00
wm4 969edb9e0b player: use a macro to remove an element from an array
Should be equivalent.
2015-02-17 23:43:43 +01:00
wm4 f54220d951 player: actually close files when using sub_remove
Also effects some other cases.

The real reason for this is for keeping track of which demuxers can be
closed (see following commit). Since I don't want to use reference
counting for this, some sort of simplistic mark-and-sweep is done to
determine whether a demuxer is still needed.
2015-02-17 23:43:13 +01:00
wm4 0283815ee1 DOCS/client-api-changes: mark 0.8.0 release
(There was a missing version bump for the msg-level change; just move it
under 1.14.)
2015-02-17 23:42:25 +01:00
wm4 a64b1deaa6 demux_lavf: hack against hls showing "100%" position
The HLs protocol consists of a "playlist" main file, which mpv downloads
and passes to the HLS demuxer. The HLS demuxer actually requests segment
files containing media data on its own. The packets read from the
demuxer have a source file position set, but it's not from the main
file. This leads to a strange effect: as a last fallback, the player
will calculate the approximate playback position from the file
position/size ratio, and since the main file is tiny, this will always
show 100%. Fix this by resetting the packet file position.

This doesn't affect the case when HLS actually reports a duration.
2015-02-17 23:42:04 +01:00
wm4 d26ba961d0 command: add rescan_external_files
Requested.

Hopefully will be useful for things that download and add external
subtitles on demand. Or something.

Closes #1586.
2015-02-16 22:08:16 +01:00
wm4 37183532ae command: nicer OSD message when setting audio-device
Requested.
2015-02-16 21:35:13 +01:00
wm4 8b784fb1ca etc/input.conf: remove a leftover
This is already mapped by default.
2015-02-16 21:16:14 +01:00
wm4 0063d94927 vo_opengl: glsl: remove trailing \
This should be no problem... but it _might_ help with #1536, so it's
worth a try.
2015-02-16 21:00:03 +01:00
wm4 6e50e59386 vf_vapoursynth: replace a hack with a newer VS API function
The new function does exactly what we need. Replaces the old hack, which
created the vscore by running an empty script.
2015-02-16 20:56:00 +01:00
wm4 d34eabe286 m_config: log options set by the client API too 2015-02-16 20:04:31 +01:00
wm4 2308b3a2a6 sub: mess with styling defaults, change --ass-use-margins behavior
Now --ass-use-margins doesn't apply to normal subtitles anymore. This is
probably the inverse from the mpv behavior users expected so far, and
thus a breaking change, so rename the option, that the user at least has
a chance to lookup the option and decide whether the new behavior is
wanted or not.

The basic idea here is:
- plain text subtitles should have a certain useful defalt behavior,
  like actually using margins
- ASS subtitles should never be broken by default
- ASS subtitles should look and behave like plaintext subtitles if
  the --ass-style-override=force option is used

This also subtly changes --sub-scale-with-window and adds the --ass-
scale-with-window option. Since this one isn't so important, don't
bother with compatibility.
2015-02-16 20:04:29 +01:00
wm4 b63503db04 options: mark some more options as runtime-settable
Most of these are in the category of options which can be changed
without issues, but which will not take effect immediately.
2015-02-16 20:04:05 +01:00
wm4 14a24f35bf osd: customizable subtitle and OSD position
You can set in which "corner" the OSD and subtitles are shown. I'd
prefer it a bit more general (so you could set the alignment using
a factor), but the libass API does not provide this.
2015-02-16 20:04:02 +01:00
wm4 4c283d5f8d osd: make it possible to have different subtitle vs. OSD defaults
Until now, they used exactly the same defaults for the styling options.
The defaults were shared, so it was impossible to have different
defaults. Change this. This requires duplicating the full default
struct, even for settings that are the same. The list of options is
still shared, though.
2015-02-16 20:03:56 +01:00
Skyrainfit 31ac0574ad mpv.desktop: Add zh-TW and zh-CN translations 2015-02-16 10:27:22 +01:00
wm4 816d7bba1f osxbundle: config file special case isn't needed anymore
The previous commit effectively fixes the mess caused by 'config' vs.
'mpv.conf', and the hack introduced by commit e01a6dac and extended by
commit db167cd4 isn't needed anymore.
2015-02-15 17:29:06 +01:00
wm4 a27aa68dd3 player: undeprecate 'config' files
Actually, it's pretty simple to look for multiple filenames at once,
since mp_find_all_config_files() is already a bit "special" anyway.

See #1569. Reverts most of commit db167cd4 (keeps osx-bundle.conf).
2015-02-15 14:28:49 +01:00
wm4 cf073138b2 vd_lavc: uninit the hwdec backend after closing the decoder
A recent behavior change in libavcodec's h264 decoder keeps at least 1
surface even after avcodec_flush_buffers() has been called. We used to
flush the decoder in order to make sure all surfaces are free'd, so that
the hw decoder can be safely uninitialized. This doesn't work anymore.

Fix it by closing the AVCodecContext before the hw decoder is
uninitialized. This is actually simpler and more robust. It seems to be
well-supported too.

Fixes invalid read accesses with vaapi-copy and dxva2-copy. These
destroyed the hwdec API fully on uninit, and could not deal with
surfaces surviving the decoder.

Probably fixes #1587.
2015-02-14 16:45:38 +01:00
wm4 f247294d73 x11: fix uninitialized variable reads
This line of code ended up in the wrong block in commit cd6dfcbe.
2015-02-14 16:45:38 +01:00
Stefano Pigozzi ecab0d6bb0 ao: fix null dereference 2015-02-14 16:41:08 +01:00
wm4 04472352ae player: fix audio-device-list updates
The way the AO wakes up the playloop has nothing to do with events;
instead we must query the events on the AO once the playloop was woken
up. Querying the events in every playloop iteration is thus the correct
way to do this.
2015-02-14 15:13:58 +01:00
wm4 a799a4c57f client API: clarify filename string encoding
Admittedly, the behavior on Windows is not quite straightforward. The
behavior on the other platforms is equivalent to fopen().

Fixes #1585.
2015-02-14 14:36:48 +01:00
wm4 de0f3747ee demux: fix dropped subtitle packets with the new stream switching
If the previous subtitle packet is too far back, and the refresh seek
won't pick it up, and the packet never comes again. As a consequence,
the refresh mode was never stopped on the subtitle stream, which caused
all packets to be discarded.

Fix by assuming the file position is monotonically increasing; then it
will resume even if a packet _after_ the intended resume point is
returned. This introduces a new requirement on how the demuxer behaves.
(I'm not sure if mp4 actually satisfies this requirement in all cases.)

Fixes a regression introduced by commit f9f2e1cc.
2015-02-14 14:29:21 +01:00
Stefano Pigozzi bf46f4c997 cocoa: remove unused function 2015-02-14 12:52:09 +01:00
Stefano Pigozzi 70802d519f ao_coreaudio: add support for hotplug notifications
This commit adds notifications for hot plugging of devices. It also extends
the old behaviour of the `audio-out-detected-device` property which is now
backed by the hotplugging code. This allows clients to be notified when the
actual audio output device changes.

Maybe hotplugging should be supported for ao_coreaudio_exclusive too, but it's
device selection code is a bit fragile.
2015-02-14 12:51:15 +01:00
Martin Herkt 9aaec7cffb x11: add XK_Cancel to the list of special keys
Some IR receivers emit this key by default for remote control
buttons. Make it mappable.
2015-02-14 03:50:26 +01:00
wm4 5247416735 Fix build on OSX broken by previous commit
Hopefully.
2015-02-13 22:51:38 +01:00
Julian 349067a6ab vf_vapoursynth: add display refresh rate property
This value is not necessarily trustworthy (it might change) and can be
0.
2015-02-13 22:35:47 +01:00
wm4 cd6dfcbef4 x11: return a framerate even if no window is mapped
Falls back to the first display in the list returned by xrandr. Not
entirely correct, but makes some people happy (see #1575).
2015-02-13 22:34:26 +01:00
wm4 db167cd438 player: deprecate 'config' files (use mpv.conf), warn against clashes
Apparently there's at least one distro which ships a /etc/mpv/mpv.conf
file (mpv doesn't install such a file). This breaks config files named
'config' located in the user's mpv config directory, because mpv first
loads files named 'config' and then 'mpv.conf'. There is no mechanism
for putting files with different names into the same config path order.
(Even worse, that mpv.conf file only set an option to the default value.
Why do distros always do very stupid things?)

Print a warning on collisions.

Although using 'config' was well-supported, supporting both names is
starting to become messy, so deprecate 'config' and print a warning if
one is found.

At least we will be able to remove the whole mess once 'config' files
are ignored...

This also affects the osx-bundle, which intentionally used these not-so-
optimal semantics. Solve it in a different way. (Unfortunately with an
ifdef - it's not required, but having to explain everyone why mpv tries
to load a osx-bundle.mpv file on Linux and Windows would consume
energy.)

Closes #1569.
2015-02-13 22:28:44 +01:00
wm4 fd5403cb40 command: mark get_property as deprecated
Using it just makes no sense. But we're really being nice about this and
don't remove it immediately.
2015-02-13 21:48:11 +01:00
wm4 417869f845 x11: make all XF86 special keys mappable
Makes all keys documented in XF86keysym.h mappable. This requires the
user to deal with numeric keycodes; no names are queried or exported.

This is an easy way to avoid adding all the hundreds of XF86 keys to
our X11 lookup table and mpv's keycode/name list.
2015-02-13 21:47:22 +01:00