Commit Graph

41658 Commits

Author SHA1 Message Date
wm4 c890eeac47 audio: use unknown channel layouts if there is no standard layout
This is just a conceptual issue, since for now every channel count has
an associated standard layout.

But should the max. channel count ever be bumped, some things would stop
function if mp_chmap_from_channels() refused to work for any channel
count within the allowed range.
2015-06-12 17:45:56 +02:00
wm4 11fee81a7a audio: fix messed up channel reordering
Quite a blunder, really.
2015-06-12 17:45:47 +02:00
wm4 627b87b0d8 audio: deal with AVFrame-style buffer assignments
In the AVFrame-style system (which we inreasingly map our internal data
stuctures on), buffers and plane pointers don't necessarily have a 1:1
correspondence. For example, a single buffer could cover 2 or more
planes, all while other planes are covered by a second buffer, and so
on. They don't need to be ordered in the same way.

Change mp_audio_get_allocated_size() to retrieve the maximum size all
planes provide. This also considers the case of planes not pointing to
buffer start.

Change mp_audio_realloc() to reset all planes, even if corresponding
buffers are not reallocated. (The caller has to be careful anyway if it
wants to be sure the contents are preserved on realloc calls.)
2015-06-12 17:44:40 +02:00
wm4 0d2456ae5f lua: support MPV_END_FILE_REASON_REDIRECT
And also add the missing "unknown" entry to the manpage.
2015-06-11 21:42:09 +02:00
wm4 e53cb0890e client API: add MPV_END_FILE_REASON_REDIRECT
Requested. Minor incompatible behavior change, as it was signalling
MPV_END_FILE_REASON_EOF previously.
2015-06-11 21:42:09 +02:00
wm4 87b60ded88 client API: leave mpv_event_end_file.error to 0 on no error
Making sure this is true makes it closer to the libmpv docs, and
possibly less confusing in corner cases.
2015-06-11 21:42:09 +02:00
wm4 ce513dedd8 lua: export end-file event fields 2015-06-11 21:42:09 +02:00
wm4 478ea1d0f3 ao_alsa: change ALSA braindeath heuristic
If you try to play surround with dmix, it will advertise surround and
lets you set more than 2 channels, but will report a stereo channel map,
with the extra channels identified as NA. We could handle this now, but
we don't want to (because it's excessively stupid).

Do it only if the channel map is not what we requested, instead of just
acting if it contains NA entries at all. This avoids that we hurt
ourselves in the unlikely but possible case we actually have to use
channel maps with NA entries.
2015-06-11 21:42:09 +02:00
torque d0fe5e08b9 command: add keypress, keydown, and keyup commands.
These commands are used to simulate keypresses using the key names from
input.conf.
2015-06-11 21:42:09 +02:00
wm4 b655ed5ed0 player: use 4 as process exit code on user quits
So successful playback and user quit can be distinguished, for whatever
reason you may want to do this.

Normally, the "quit" command can be customized, but this does not work
for quit commands sent by the terminal signal handler. One solution
would be introducing something like "ON_SIGNAL" (equivalent to
"CLOSE_WIN"), but considering there are a bunch of possible signals, I'd
rather not get into this. So go with the dumb solution.

Probably fixes #2029.
2015-06-10 23:18:42 +02:00
wm4 a3d561f950 options: make keyvalue list parsing less strict
Affects for example --script-opts. A bunch of characters are now allowed
in them without causing trouble to the user.
2015-06-10 23:06:07 +02:00
wm4 7de2411c47 vo_opengl: fix a small memory leak when loading user shaders
When gl_shader_cache was destroyed, existing user shader entries leaked
the file path string.
2015-06-09 22:42:03 +02:00
wm4 4a90b15f74 vo_opengl: fix dangling pointers with vo_cmdline
gl_video_set_options() does not acquire ownership of the opts parameter
or its contents. In case of vo_cmdline, opts will point to temporary
memory. This memory will be free'd at a later point, and p->opts will
point to free'd memory on the next reinitialization.

The fix is pretty ugly, but it's a quick bug fix. This can probably be
removed once VO sub-options are exposed as properties.

Fixes #2035.
2015-06-09 22:30:32 +02:00
wm4 f51459c077 audio: add some change notifications
We must be sure that every change comes with a notification. Otherwise,
some property changes could possibly be missed.
2015-06-09 18:29:11 +02:00
wm4 b7d833c2a6 ao_coreaudio: change physical stream format synchronously 2015-06-09 18:26:14 +02:00
wm4 211088943c audio/out/pull: avoid dropping some audio when draining
If the audio API takes a while for starting the audio callback, the
current heuristic can be off. In particular, with very short files, it
can happen that the audio callback is not called before playback is
stopped, so no audio is output at all.

Change draining so that it essentially waits for the ringbuffer to
empty. The assumption is that once the audio API has read the data
via the callback, it will always output it, even if the audio API
is stopped right after the callback has returned.
2015-06-09 18:26:14 +02:00
wm4 a2b1c6d3f6 audio/out/pull: correctly pad partial frames with silence
If a frame could only be partially filled with real audio data, the
silence wasn't written at the correct offset. It could have happened
that the remainder of the frame contained garbage.

(This didn't happen in the more common case of playing dummy silence.)
2015-06-09 18:26:14 +02:00
wm4 3399b775b7 command: fix audio-out-detected-device property
Used a wrong condition, and I suppose it could crash in some situations.

Change it to lazily initialize the hotplug stuff, like the
audio-device-list property does.
2015-06-09 18:25:44 +02:00
wm4 bd64763076 command: remove unnecessary event IDs
These were actually not needed for correct function, since individual
property change notifications via mp_notify_property() are used.
2015-06-09 18:21:56 +02:00
wm4 9986593b50 command: make property event mask matching more restrictive
This was matching e.g. both "foo/bar" and "foobar" against "foo", when
only the former should match. This could cause more property
notifications than necessary.
2015-06-09 18:21:56 +02:00
wm4 8653ed2183 ao_alsa: refine channel count mismatch error message
I suspect we need to hand this more gracefully in some cases.
2015-06-09 18:21:56 +02:00
wm4 f72028ddad vaapi: add missing license header
Absence of license header implies LGPL, as mentioned in the "Copyright"
file. But vaapi.h contains some code taken from the mplayer-vaapi
patch, which was under the typical MPlayer license.
2015-06-08 22:14:47 +02:00
wm4 0dfbd29828 gl_osd: fix license header
All vo_gl.c related code has been GPL+LGPL dual-licensed. The OSD code
is no exception and is also derived from vo_gl.c. Thus it should have
the same license (although I think technically speaking sub-licensing
it by removing one of the licenses is ok).
2015-06-08 22:13:00 +02:00
wm4 5dbd22e165 vo: clarify condition
This is (at least currently) redundant, but makes the code more
explicit. (This was discussed on IRC.)
2015-06-08 12:27:40 +02:00
Avi Halachmi (:avih) b694f480fe vo: restore frame-drop logic for high-fps clips
Commits 92b27be and f4ce99d removed high-fps logic to to a bug. That bug was
a missing parenthesis around everything after duration >= 0 && ... at the
removed code.

This patch restores the removed code, fixes the bug and then refactors the
code a bit.
2015-06-07 23:53:37 +02:00
Jaime Marquínez Ferrándiz 69abb48194 ytdl_hook: Support 'multi_video' results
They can be handled by the same codes used for playlists, most of them will use an EDL.
Fixes #2027.
2015-06-07 23:53:13 +02:00
wm4 92b27bec45 Revert "opengl: drop less frames when clip and display have similar fps"
This reverts commit f1746741de.

Together with the other revert, this fixes #2023 (the reason being
broken framedrop handling - it was dropping frames when it shouldn't).
2015-06-07 20:06:42 +02:00
wm4 f4ce99d082 Revert "vo: improve frame drop logic on high playback rate"
This reverts commit ffcad1a72b.
2015-06-07 20:04:49 +02:00
wm4 fb7d0c80cc vo_vdpau: add a NULL check, verify image dimensions
read_output_surface() could fail and return NULL.

Also, make sure we don't set the image to a size larger than the
allocated size. Normally this shouldn't happen, but in theory it could
in corner cases; this is for robustness.
2015-06-06 21:06:54 +02:00
wm4 57048c7393 audio: add --audio-spdif as new method for enabling passthrough
This provides a new method for enabling spdif passthrough. The old
method via --ad (--ad=spdif:ac3 etc.) is deprecated. The deprecated
method will probably stop working at some point.

This also supports PCM fallback. One caveat is that it will lose at
least 1 audio packet in doing so. (I don't care enough to prevent this.)

(This is named after the old S/PDIF connector, because it uses the same
underlying technology as far as the higher level protoco is concerned.
Also, the user should be renamed that passthrough is backwards.)
2015-06-05 22:42:59 +02:00
wm4 14ac4f0bd6 ad_spdif: use a pseudo codec entry to select DTS-HD instead of an option
This deprecates the --ad-spdif-dtshd option, and replaces it with a
pseudo decoder. This means ad_spdif will report two decoders, "dts" and
"dts-hd", of which the second simply enables what the option did.

The --ad-spdif-dtshd option will actually be deprecated in the next
commit.
2015-06-05 22:34:48 +02:00
wm4 68aaffc711 audio: do not allow AO to change passthrough formats
This makes no sense, because the format can't be converted anyway. It
just sets up the filter chain init code, which will vomit a bunch of
useless and confusing messages. So uninit and fail explicitly when this
happens.
2015-06-05 22:34:47 +02:00
wm4 2bf2254248 vo_vdpau: limit output surfaces to allowed maximum dimensions
We can't do much in this case, but at least we can not call the vdpau
API functions with too large sizes. Apparently the API considers this
undefined behavior, and random stuff might happen.
2015-06-05 22:34:16 +02:00
wm4 e0f0f6f3e9 vo_vdpau: directly get surface size from surface for screenshots
The previous code was not wrong, but I'd claim this makes the code more
robust. If a situation could happen in which the passed surface size is
incorrect, we could have passed a too small image, and
VdpOutputSurfaceGetBitsNative could have randomly overwritten memory.
2015-06-05 22:34:16 +02:00
wm4 650469d65b vo_vdpau: shorten 2 variable names
Why should I be required to type so much?
2015-06-05 22:34:16 +02:00
wm4 f30b28de46 video: remove worthless log message
All this information is already output otherwise. Except the FourCC,
which lost most of its importance in mpv.
2015-06-05 18:59:46 +02:00
wm4 54b6389873 vf_sub: minor simplification 2015-06-05 18:59:13 +02:00
Niklas Haas b68627ed2b filter_kernels: distinguish between regular/EWA robidoux
This is because it turns out the regular robidoux is pretty useful for
tscale etc.
2015-06-05 17:08:39 +02:00
wm4 af58bfb62b vo_vdpau: check maximum video size
Check the maximum size of video surfaces, and refuse initialization if
the video is too large for them.

Maybe we could do something more sophisticated, like inserting a
software scaler. On the other hand, this would have a very questionable
benefit, as it would be guaranteed to be too slow.
2015-06-04 22:29:26 +02:00
wm4 c06cd1b993 audio: do not exit when loading small files in paused mode
When starting in paused mode, no audio is written to the device at all,
because writing audio implicitly unpauses the AO. If the file is very
small, and all audio fits within the AO buffer, this accidentally
triggered the EOF condition. (In unpaused mode, it would write all
audio, end playback, and then wait until the AO has everything played.)
2015-06-04 22:05:29 +02:00
wm4 b2d058ef00 ao_alsa: refuse to use spdif if AES flags can't be set
Seems like a good idea to avoid accidentally playing noise by writing
spdif data to pure PCM devices.
2015-06-04 21:54:08 +02:00
wm4 fd96bddca9 af_lavrresample: slightly better computation of total delay
On libavresample, don't ignore the buffered output data.

On libswresample, don't round the total buffer size to the input
samplerate.
2015-06-04 21:23:46 +02:00
wm4 935997d4d6 af_lavrresample: use a new libswresample function if available
It was recently added to libswresample, and it does exactly what we
need.
2015-06-04 19:22:45 +02:00
wm4 2dc46423d6 af_lavrresample: change output samples calculation
This is better, because now we call swr_get_delay() with the output
samplerate, instead of with the input samplerate and then multiplying it
with the ratio and rounding it up.
2015-06-04 19:08:40 +02:00
wm4 c277c17a93 ao_alsa: hack against potential spdif failure 2015-06-04 13:10:33 +02:00
wm4 73401f92ec bootstrap.py: make it work on win32
Apparently, just running ./waf and hoping that it will be run with a
Python interpreter doesn't necessarily work. The workaround is pretty
simple and reliable.
2015-06-04 11:10:02 +02:00
wm4 38c74270c3 inpout.conf: make shift+o toggle between 2 states only
The "osd" command cycles between 4 states (OSD level 0-3), which is
probably confusing and inconvenient. OSD levels 0 and 2 are rarely
needed. I would claim there is normally not much of a need to completely
disable OSD by setting level 0 during playback. Level 2 is just slightly
less information than level 3, and I'm not sure why it exists at all.

Change it so that it toggles between level 3 and 1. Note that this
ignores the default OSD level. If the default is 3, the first use of
this key will set it to 3 again. Just assume 1 is the default. If
someone complains, this could be improved.
2015-06-03 22:02:10 +02:00
wm4 04d5bf4f0b player: print track list when switching tracks 2015-06-03 21:52:32 +02:00
wm4 e14df5c4f4 player: print a message along with track list
Slightly less strange.
2015-06-03 21:50:37 +02:00
wm4 52bd61d698 player: don't print stream list when adding external tracks during load
There's a short time during loading where external commands can add
external streams even before the main file is loaded (like during ytdl
hook execution). The track list is printed every time an external track
is added via commands. This was quite awkward when ytdl was adding
multiple streams, so don't print it in this stage. They are printed
anyway at the end of the loading process.
2015-06-03 21:34:46 +02:00