1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 21:27:08 +00:00
Commit Graph

40016 Commits

Author SHA1 Message Date
Vítor Galvão
9c83e8483e youtube-dl_mpv.sh: unquote ${video_url} 2015-01-25 17:00:21 +09:00
wm4
e0e58e18c0 input: handle mixing key press and up/down events better 2015-01-25 17:00:21 +09:00
James Ross-Gowan
6f9eb960c7 ao_wasapi: fix try_format logic in shared mode
The MSDN documentation for IsFormatSupported says a return code of
AUDCLNT_E_UNSUPPORTED_FORMAT means the function "succeeded but the
specified format is not supported in exclusive mode." This seems to
imply that the format is supported in shared mode, and that's what the
old code assumed, however try_format would incorrectly return success
with some drivers.

The remarks section of the documentation contradicts that assumption. It
says that in shared mode, if the audio engine does not support the
caller-specified format or any similar format, ppClosestMatch is set to
NULL and the function returns AUDCLNT_E_UNSUPPORTED_FORMAT. This is the
same as in exclusive mode, so treat AUDCLNT_E_UNSUPPORTED_FORMAT the
same regardless of opt_exclusive. In shared mode, the format selection
code will fall back to the mix format, which should always be supported.
2015-01-25 17:00:21 +09:00
xylosper
a4b21b5a13 player: some fixes for property notification
`core-idle` depends on seeking state `mpctx->restart_complete`,
so make `core-idle` notified whenever `seeking` is notified, too.

`paused-for-cache` can be changed on MPV_EVENT_CACHE_UPDATE obviously.

Finally, `MPV_EVENT_PLAYBACK_RESTART` should be notified after
`mpctx->restart_complete` changed.

Conflicts:
	player/command.c
2015-01-25 17:00:21 +09:00
Vítor Galvão
799458a5b1 youtube-dl_mpv.sh: use curly braces and double quotes consistently 2015-01-25 17:00:21 +09:00
wm4
c774f2c3bb vo_opengl: improve terminal messages with lscale suboption errors
Make it more apparent what the hell the user did wrong.
2015-01-25 17:00:21 +09:00
wm4
9e6091a5b1 vo_opengl: guarantee correct reinitialization on setting options
At least the scale_sep_fbo could have been uninitialized or initialized
incorrectly when switching between scalers (e.g. from bilinear to
lanczos). Calling check_resize() should take care of this.
2015-01-25 17:00:21 +09:00
wm4
74c2146092 vo_vdpau: don't render to an output surface if it could be busy
There was a case when we could have rendered to an output surface while
it's still used for display. Not sure why the API doesn't do this
automatically.
2015-01-25 17:00:21 +09:00
wm4
7af2cb08e2 vo_direct3d: disable shaders if unavailable
Apparently, extremely crappy graphics drivers don't allow you to use
shaders. Simply disable use of shaders if this happens, and use the
"old" method instead.

One unexpectedly tricky thing is that you need a d3d_device to create
a shader, which in turn requires a window, so the initialization order
changes.

Conflicts:
	video/out/vo_direct3d.c
2015-01-25 17:00:21 +09:00
wm4
155ecb2c14 vo: never autoselect vo_null
Same deal as with commit d44b4ccb.

Conflicts:
	video/out/vo.c
2015-01-25 17:00:21 +09:00
wm4
2a2dc4d73c ao_alsa: reinitialize if device got broken
Apparently, physically disconnecting the audio device (consider USB
audio) breaks the ALSA device handle forever. It will signal ENODEV.
Fortunately, it's easy for us to handle this, and we can just use
existing mechanisms that will make the playback core close and reopen
the AO. Whether the immediate reopening will actually succeeds really is
ALSA's problem, though.
2015-01-25 17:00:21 +09:00
wm4
d855be5ec1 vf_scale: replace ancient fallback image format selection
If video output and VO don't support the same format, a conversion
filter needs to be insert. Since a VO can support multiple formats, and
the filter chain also can deal with multiple formats, you basically have
to pick from a huge matrix of possible conversions.

The old MPlayer code had a quite naive algorithm: it first checked
whether any conversion from the list of preferred conversions matched,
and if not, it was falling back on checking a hardcoded list of output
formats (more or less sorted by quality). This had some unintended side-
effects, like not using obvious "replacement" formats, selecting the
wrong colorspace, selecting a bit depth that is too high or too low, and
more.

Use avcodec_find_best_pix_fmt_of_list() provided by FFmpeg instead. This
function was made for this purpose, and should select the "best" format.

Libav provides a similar function, but with a different name - there is
a function with the same name in FFmpeg, but it has different semantics
(I'm not sure if Libav or FFmpeg fucked up here).

This also removes handling of VFCAP_CSP_SUPPORTED vs.
VFCAP_CSP_SUPPORTED_BY_HW, which has no meaning anymore, except possibly
for filter chains with multiple scale filters.

Fixes #1494.
2015-01-25 17:00:21 +09:00
wm4
141728832b stream: reject overly long URLs 2015-01-25 17:00:20 +09:00
wm4
a8b364cad3 stream_lavf: escape disallowed characters in http URLs
In my opinion, libavformat should be doing this. But a patch handling a
very safe case rejected, so I suppose we have to do it manually. (This
patch was only escaping spaces, which can never work because they break
the basic syntax of the HTTP protocol.)

This commit attempts to do 2 things:
- Try to guess whether libavformat will use the URL for http. This is
  not always trivial, because some protocols will recursively pass part
  of the user URL to http in some way.
- Try to fix invalid URLs. We fix only the simplest case: only
  characters that are never valid are escaped. This excludes invalid
  escape codes, which happen with freestanding '%' characters.

Fixes #1495.
2015-01-25 17:00:20 +09:00
wm4
c282cd679c vo_opengl: fix typo 2015-01-25 17:00:20 +09:00
wm4
1f815558b8 build: reduce worst case with mismatching FFmpeg pkg-config files
Handles mismatching libavfilter/libavdevice and libavcodec slightly
better.

libavfilter and libavdevice are optional, and thus are checked
separately and at a later point of the build. But if a user system has
at least 2 FFmpeg installations, and one of them lacks libavfilter or
libavdevice, the build script will pick up the libavfilter/libavdevice
package of the "other" FFmpeg installation. The moment waf picks these
up, all include paths will start pointing at the "wrong" FFmpeg, and the
FFmpeg API checks done earlier might be wrong too, leading to obscure
and hard to explain compilation failures.

Just moving the libavfilter/libavdevice checks before the FFmpeg API
checks somewhat deals with this issue. Certainly not a proper solution,
but since the change is harmless, and there is no proper solution, and
the change doesn't actually add anything new, why not.

Conflicts:
	wscript
2015-01-25 17:00:20 +09:00
wm4
a0de98871b README: extend dependecy list, link Windows compilation docs
Also, fix vo.rst, don't want to waste a separate commit on this.

Conflicts:
	DOCS/man/vo.rst
2015-01-25 17:00:20 +09:00
wm4
3711327430 audio: don't force any parameters if spdif is used
The existing code only ignored --audio-channels, but not --audio-rate or
--audio-format if spdif passthrough is used. Setting these makes no
sense.
2015-01-25 17:00:20 +09:00
wm4
7d523cd47a ao_coreaudio: reset possibly random errno value
In general, you need to check errno when using strtol(), but as far as I
know, strtol() won't reset errno on success. This has to be done
manually. The code could have failed sporadically if strtol() succeeded,
and errno was already set to one of the checked values.

(This strtol() still isn't fully error checked, but I don't know if it's
intentional, e.g. for parsing a numeric prefix only.)
2015-01-25 17:00:20 +09:00
wm4
224abe9e23 vo: restore framedrop
Fix inverted condition in commit 234d6329.
2015-01-25 17:00:20 +09:00
wm4
c6d54cccb5 player: mention mpv encoding support for transcoding in desync. warning 2015-01-25 17:00:20 +09:00
wm4
081368dabf video: fix waiting for last frame/format reconfig
We still need to send the VO a duration in these cases. Disabling
framedrop has logically absolutely nothing to do with these cases; it
was overlooked in commit 918b06c4.

So we always send the frame duration (or a guess for it), and check
whether framedropping is actually enabled in the VO code. (It would
be cleaner to send framedrop as a flag, but I don't care about that
right now.)
2015-01-25 17:00:20 +09:00
wm4
3b5b2144c3 demux: return EOF when reading from unselected stream
Normally the player doesn't read from unselected streams, so this should
be a no-op. But unfortunately, some broken files can severely confuse
the player, and assign the same demuxer stream to multiple front-end
tracks. Then selecting one of the tracks would deselect the other track,
with the end result that the demuxer stream for the selected track is
deselected. This could happen with mkv files that use the same track
number (which is of course broken). timeline_set_part() sets the tracks
using demuxer_stream_by_demuxer_id(), using the broken non-unique IDs.

The observable effect was that the player never quit, because
demux_read_packet_async() told the caller to wait some longer for new
packets. Fix by returning EOF instead.

Fixes #1481.
2015-01-25 17:00:20 +09:00
Stefano Pigozzi
a80166f22a cocoa: don't set application icon in libmpv 2015-01-25 17:00:20 +09:00
wm4
126b7c4739 player: respect --untimed on last frame
The last video frame is another case that has a separate code path,
although it's pretty similar to the one in commit 73e5aa87. Fix this
in a different way, which also takes care of the last frame case,
although without context the code becomes slightly more tricky.

As further cleanup, move the decision about framedropping itself to
the same place, so the check in vo.c becomes much simpler. The check
for the vo->driver->encode flag, which is remvoed completely, was
redundant too.

Fixes #1480.
2015-01-25 17:00:20 +09:00
wm4
f8b842cdf3 manpage: fix osd-ass-cc examples
The "\\" escape was rendered as "\" on the website. I'm hoping quoting
this in ``...`` will render it correctly.

Also add an example for show_text, which awkwardly does not require
escaping the "\".
2015-01-25 17:00:19 +09:00
wm4
ad9ea546d3 player: respect --untimed on video format changes
If the video format changes (e.g. different frame size), a special code
path is entered to wait until the currently displayed frame is done.
Otherwise, the frame before the change would be destroyed by the
vo_reconfig() call.

This code path didn't respect --untimed; correct this.

Fixes #1475.
2015-01-25 17:00:19 +09:00
ChrisK2
c63d929261 OSC: Reset all styles for idle message 2015-01-25 17:00:19 +09:00
wm4
595c4cf872 osc: fix disabling OSC
Upon the "DEL" key binding or the "disable-osc" message, the OSC should
stay permanently invisible. This was recently broken (not sure by what),
because other code accidentally reenables it anyway, which resulted in
the OSC appearing again when moving the mouse.
2015-01-25 17:00:19 +09:00
wm4
4ebed102f0 ao_alsa: fix a small memory leak 2015-01-25 17:00:19 +09:00
wm4
371b52e377 player: fallback to seek time for percent-pos property
The percent-pos property normally goes by time, except for file formats
like .ts or .ogg, where you can't trust the timestamps and duration info
to compute the position in the overall files. These use the byte
position and size instead.

When the file position was unavailable (e.g. due to an ongoing seek),
the percent-pos was unknown. Change it to use the time position instead.
In most cases, it's actually accurate enough, and the temporary
unavailability of the property can be annoying, e.g. on the terminal
status line.
2015-01-25 17:00:19 +09:00
wm4
d8152b7003 wayland: implement key modifiers
Includes shift, ctrl, alt, meta.
2015-01-25 17:00:19 +09:00
wm4
6a9cdfa771 wayland: don't compute absurd window size
For some reason, schedule_resize() can be called with everything set to
0. The code couldn't handle wl->window.aspect set to 0, converting NaNs
to integers. Just work this around.

(I have no idea what I'm doing. This is probably a corner case caused
by my broken-ish wayland setup.)
2015-01-25 17:00:19 +09:00
wm4
399e746275 manpage: improve --title description
It might be rather surprising that --title also sets the audio stream
title (for PulseAudio and wasapi), so it certainly should be mentioned.
2015-01-25 17:00:19 +09:00
wm4
929c4a5529 client API: reasonable behavior if window is closed
Closing the video window sends CLOSE_WIN, which is normally mapped to
the "quit" command. The client API normally disables all key bindings,
and closing the window does nothing. It's simply left to the application
to handle this. This is fine - an embedded window can not be destroyed
by user interaction.

But sometimes, the window might be destroyed anyway, for example because
the containing window is destroyed. If this happens, CLOSE_WIN should
better not be ignored. We can't expect client API users to handle this
specially (by providing their own input.conf), so provide some fallback
for this pseudo key binding. The "quit" command might be too intrusive
(not every client necessarily handles "unexpected" MPV_EVENT_SHUTDOWN),
but I think it's still reasonable.
2015-01-25 17:00:19 +09:00
wm4
38903486fb player: enable demuxer thread for external audio files
Enable asynchronous reading for external files. This excludes subtitle
files (so it's effectively enabled for audio files only), because most
subtitle files are fully read on loading, and running a thread for them
would just cause slowdowns and increase resource usage, without having
any advantages.

In theory, an external file could provide multiple tracks from the same
demuxer, but demux_start_thread() is idempotent, so the code can be
kept simple.

Should help with playing DASH with ytdl_hook.
2015-01-25 17:00:19 +09:00
wm4
c56b237b3c ao_alsa: fix dtshd passthrough
We must not try to remap channels with this. Whethever ALSA gives us,
and whatever we do with it, the result will probably be nonsense.

Untested, as I don't have the required hardware.
2015-01-25 17:00:19 +09:00
wm4
63e401ccc9 tl_matroska: check chapter bounds
I have no idea what this does, but it's without doubt a sufficient fix
for the issue at hand.

Fixes #1445.

Conflicts:
	player/timeline/tl_matroska.c
2015-01-25 17:00:18 +09:00
wm4
35cc1830a3 ao_pulse: disable latency calculation hacks by default
This used to be required to workaround PulseAudio bugs. Even later, when
the bugs were (partially?) fixed in PulseAudio, I had the feeling the
hacks gave better behavior. On the other hand, I couldn't actually
reproduce any bad behavior without the hacks lately. On top of this, it
seems our hacks sometimes perform much worse than PulseAudio's native
implementation (see #1430).

So disable the hacks by default, but still leave the code and the option
in case it still helps somewhere. Also, being able to blame PulseAudio's
code by using its native API is much easier than trying to debug our own
(mplayer2-derived) hacks.
2015-01-25 17:00:18 +09:00
wm4
f4a9c9424f win32: request UTF-16 API variants, Vista+ APIs, and COM C macros
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.

Conflicts:
	video/out/w32_common.c
	waftools/checks/custom.py
2015-01-25 17:00:18 +09:00
wm4
d9da0c9ce9 terminal: always print to stderr with --no-input-terminal
The function terminal_in_background() reports whether the player was
backgrounded. In this case, we don't want to annoy the user by still
printing the status to stderr. If no terminal interaction is assumed,
this mechanism is disabled, and stderr is always used. The read_terminal
variable signals this case.

Oddly, just redirecting stderr will disable output to stderr, because
the background check with tcgetpgrp() is done on stderr, but
read_terminal is still true (because that one depends on stdin and
stdout).

Explicitly disable this mechanism if --no-input-terminal is used by
setting read_terminal to true only if terminal input is actually
initialized.
2015-01-25 17:00:18 +09:00
Philip Sequeira
5f3f36a800 TOOLS/zsh.pl: complete options based on types
No more equals signs for options that don't take values.

Complete values for options with preset choices.

Complete --no-whatever where applicable.

Fixes #997.
2015-01-25 17:00:18 +09:00
wm4
12c316d95e player: use libavutil API to get number of CPUs
Our own code was introduced when FFmpeg didn't provide this API (or
maybe didn't even have a way to determine the CPU count). But now,
av_cpu_count() is available for all FFmpeg/Libav versions we support,
and there's no reason to have our own code.

libavutil's code seems to be slightly more sophisticated than our's, and
it's possible that the detected CPU count is different on some platforms
after this change.
2015-01-25 17:00:18 +09:00
wm4
cf997ff691 player: print used number of threads in verbose mode
Also, don't use av_log() for mpv output.
2015-01-25 17:00:18 +09:00
wm4
1560f74dde demux_mkv: avoid PTS warning with image attachments
Removes an annoying "No video PTS! Making something up." warning.

Mark it as keyframe, which is needed to prevent strange behavior with
PNG. Also, don't leak the picture data.
2015-01-25 17:00:18 +09:00
wm4
9b9d453748 manpage: clarify syntax for color options
Options which take colors accept two variants. The first is "r/g/b/a",
the second is "#AARRGGBB". Since they put alpha at different places,
it's probably better to document the second variant explicitly. (It's a
bit strange that they put alpha in different places, but on the other
hand, it's kind of natural. The second variant should probably be
considered deprecated.)
2015-01-25 17:00:18 +09:00
wm4
cb9b59858d TOOLS/lua/observe-all: add a warning
This is just natural, but it's also not that obvious.
2015-01-25 17:00:18 +09:00
wm4
3f85092ffe TOOLS/lua/autoload: fix behavior with network URLs
readdir() fails if the directory is an URL, so just exit instead of
letting the Lua script fail.
2015-01-25 17:00:18 +09:00
wm4
f4634e404f vf_vapoursynth: fix Lua backend
It couldn't handle the newly added float variable.
2015-01-25 17:00:18 +09:00
wm4
dbc00297cc vf_vapoursynth: pass through container FPS value
This is basically a hack; but apparently a needed one, since many
vapoursynth filters insist on having a FPS set.

We need to apply the FPS override before creating the filters. Also
change some terminal output related to the FPS value.
2015-01-25 17:00:18 +09:00