summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* demux_mkv: adjust subtitle preroll again (2)wm42014-11-154-3/+35
| | | | | | | | | | | | | | Make the changes started in commit c827ae5f more eloborate, and provide an option to control the amount of data read before the seek-target. To achieve this, rewrite the loop that finds the lowest still acceptable target cluster. It is now searched by time instead of file position. The behavior (both with and without preroll option) may be different from before this change, although it shouldn't be worse. The change demux_mkv_read_cues() fixes a bug: when seeking after playing normally, the code would erroneously assume that durations are set. This doesn't happen if the first operation after loading was a seek instead of playback.
* vo_opengl: allow setting different filters for downscalingwm42014-11-143-3/+12
|
* command: list filters/VOs/AOs with option-infowm42014-11-141-0/+11
| | | | Another special-case, but pretty simple after all.
* command: export some option metadatawm42014-11-134-3/+60
| | | | | | | This might be interesting for GUIs and such. It's probably still a little bit insufficient. For example, the filter and audio/video output lists are not available through this.
* command: rename "option-flags" property to "option-info"wm42014-11-132-6/+6
|
* command: make sub-properties more flexiblewm42014-11-133-15/+13
| | | | | This makes it work with all kind of types, instead of just some simple ones.
* command: fix weird stuffwm42014-11-131-0/+1
| | | | | Happens to fix some aspects of some properties (especially reading "option-flags/x" as native value).
* command: export mpv configure arguments as propertywm42014-11-132-0/+11
| | | | | It seems strange that a client API user can't get this string, other than analyzing the mpv log output.
* terminal-unix: Add some comments about FD use.Rudolf Polzer2014-11-131-0/+8
|
* terminal-unix: Fix initial terminal state.Rudolf Polzer2014-11-131-1/+1
| | | | | | When mpv is backgrounded initially (via & in the shell), do no longer change terminal settings on startup. This fixes broken local echo after launching a backgrounded mpv.
* demux: update cache state when pausedwm42014-11-121-1/+11
| | | | | | | | | | | | | This was removed in commit 480f82fa. This caused the cache display not to update while paused, because the update_cache() function is never called in the thread (now I remember why the extra call was "needed"). The old implementation intentionally run update_cache() only before waiting on a mutex, with no further checks for the condition variable. In theory, this is strictly not sane, but since it was just for the retrieval of the very fuzzy cache status, it was ok. Now we want to call update_cache() outside of the mutex though - which means that in order to avoid missed wakeups, a proper condition has to be used.
* af: remove redundant functionwm42014-11-121-9/+2
|
* af: check audio params for validitywm42014-11-121-0/+5
| | | | Normally, these should be valid anyway, so this is just being cautious.
* mp_image: slightly better image params verbose infowm42014-11-123-2/+9
|
* video: move formatting of image parameters to separate functionwm42014-11-123-21/+27
|
* vf: minor simplificationwm42014-11-122-16/+9
| | | | | | | | Remove the extra vf_chain.output field - there's absolutely no need for it, because there is always a last filter which will buffer the output. For some reason, vf_chain.last was never set, which we now need to fix too.
* manpage: adjust --hwdec docswm42014-11-121-6/+8
|
* player: simplify audio uninit on segment switcheswm42014-11-121-5/+4
| | | | | | | The purpose of temporarily setting stop_play was to make the audio uninit code to explicitly drain audio if needed. This was the only way to do it before ao_drain() was made a separate function; now we can just do it explicitly instead.
* audio: fix some issues when reloading the AOwm42014-11-121-0/+3
| | | | | | | We absolutely need to clear the AO reference in the mixer. The audio_status must be changed to a state where no code assumes that the AO is available. (It's allowed to do this blindly.)
* ao_lavc, vo_lavc: Fix crashes in case of multiple init attempts.Rudolf Polzer2014-11-122-6/+24
| | | | | | | | | | | | When initialization failed, vo_lavc may cause an irrecoverable state in the ffmpeg-related structs. Therefore, we reject additional initialization attempts at least until we know a better way to clean up the mess. ao_lavc currently cannot be initialized more than once, yet it's good to do consistent changes there as well. Also, clean up uninit-after-failure handling to be less spammy.
* player: make the osd-msg prefix work for playlist_next/prevwm42014-11-114-1/+10
| | | | | If input.conf e.g. contains "n osd-msg playlist_next", then pressing the n key will switch to the next file, and display the filename on OSD.
* audio: make sure AVFrame is actually refcountedwm42014-11-111-0/+12
| | | | | | | | | | | The mp_audio_from_avframe() function requires the AVFrame to be refcounted, and merely increases its refcount while referencing the same data. For non-refcounted frames, it simply did nothing and potentially would make the caller pass around a frame with dangling pointers. (libavcodec should always return refcounted frames, but it's not clear what other code does; and also the function should simply work, instead of having weird requirements on its arguments.)
* audio: refuse to allocate frames in invalid formatwm42014-11-111-1/+1
|
* demux_mkv: adjust subtitle preroll againwm42014-11-111-14/+17
| | | | | | | | | | | | | | | Revert commit 24e52f66; even though the old beheavior doesn't make sense (as the commit message assured), it turns out that this works better: typically, it means preroll will start from the previous video key frame (the video CUE index will contain clusters with video key frames only), which often coincides with subtitle changes. Thus the old behavior is actually better. Change the code that uses CueDuration elements. Instead of merely checking whether preroll should be done, find the first cluster that needs to be read to get all subtitle packets. (The intention is to compensate for the enlarged preroll cluster-range due to reverting commit 24e52f66.)
* vf_sub: fix previous commitwm42014-11-111-3/+3
| | | | | | The previous fix breaks another obscure case: if the second vf_sub adds margins, the image is accidentally not extended, which would return in an assertion failure when returning the bogus image.
* vf_sub: don't crash if no subtitle context is availablewm42014-11-111-0/+3
| | | | Happens with --vf=sub,sub (only the first one gets the context).
* encode: don't segfault when bailing out due to resolution changewm42014-11-111-1/+1
| | | | Somehow this code expects lastimg is always set.
* vo_opengl: don't reset user-set gamma when using vo_cmdlinewm42014-11-111-0/+3
|
* audio: make decoders output refcounted frameswm42014-11-1010-212/+153
| | | | | | | | | | | | | | This rewrites the audio decode loop to some degree. Audio filters don't do refcounted frames yet, so af.c contains a hacky "emulation". Remove some of the weird heuristic-heavy code in dec_audio.c. Instead of estimating how much audio we need to filter, we always filter full frames. Maybe this should be adjusted later: in case filtering increases the volume of the audio data, we should try not to buffer too much filter output by reducing the input that is fed at once. For ad_spdif.c and ad_mpg123.c, we don't avoid extra copying yet - it doesn't seem worth the trouble.
* audio: add mp_audio_make_writeable()wm42014-11-102-0/+28
|
* audio: clear buffer array too with mp_audio_set_null_data()wm42014-11-101-1/+3
|
* audio: change how filters are inserted on playback speed changeswm42014-11-107-43/+122
| | | | | | | | | | Use a pseudo-filter when changing speed with resampling, instead of somehow changing a samplerate somewhere. This uses the same underlying mechanism, but is a bit more structured and cleaner. It also makes some of the following changes easier. Since we now always use filters to change audio speed, move most of the work set_playback_speed() does to recreate_audio_filters().
* af_format: remove redundant message prefixeswm42014-11-101-2/+2
|
* audio: add function to convert AVFrame to mp_audio referenceswm42014-11-102-0/+51
| | | | | This is somewhat duplicated from ad_lavc.c and af_lavfi.c, but will eventually be used by both.
* audio: add mp_audio_poolwm42014-11-102-4/+66
| | | | | | A helper to allocate refcounted audio frames from a pool. This will replace the static buffer many audio filters use (af->data), because such static buffers are incompatible with refcounting.
* player: don't try to use duration 0wm42014-11-101-1/+1
|
* dvd, bluray: reload demuxer on title changeswm42014-11-101-0/+1
| | | | | | | | | Causes the player to reload the demuxer and to relist the found streams. Probably slightly dangerous/broken, because the demuxer thread and possibly even the decoders will keep reading data from the new title before the new demuxer takes over. Fixes #1250.
* audio: use AVBufferRef to allocate audio frameswm42014-11-102-20/+10
| | | | | | | A first step towards refcounted audio frames. Amazingly, the API just does what we want, and the code becomes simpler. We will need to NIH allocation from a pool, though.
* command: send property-change event on playlist changeAlessandro Ghedini2014-11-092-0/+6
|
* audio/out/pull: avoid deadlock if audio callback stopswm42014-11-091-26/+40
| | | | | | | | | | | | | | | | | | | | | | | | If the audio callback suddenly stops, and the AO provides no "reset" callback, then reset() could deadlock by waiting on the audio callback forever. The waiting was needed to enter a consistent state, where the audio callback guarantees it won't access the ringbuffer. This in turn is needed because mp_ring_reset() is not concurrency-safe. This active waiting is unavoidable. But the way it was implemented, the audio callback had to call ao_read_data() at least once when reset() is called. Fix this by making ao_read_data() set a flag upon entering and leaving, which basically turns p->state into some sort of spinlock. The audio callback actually never needs to spin, because there are only 2 states: playing audio, or playing silence. This might be a bit surprising, because usually atomic_compare_exchange_strong() requires a retry-loop idiom for correct operation. This commit is needed because ao_wasapi can (or will in the future) randomly stop the audio callback in certain corner cases. Then the player would hang forever in reset().
* atomics: add atomic_compare_exchange_strong()wm42014-11-092-0/+12
| | | | | | | | | | | | | | | | As usual, we use C11 semantics, and emulate it if <stdatomic.h> is not available. It's a bit messy with __sync_val_compare_and_swap(). We assume it has "strong" semantics (it can't fail sporadically), but I'm not sure if this is really the case. On the other hand, weak semantics don't seem to be possible, since the builtin can't distinguish between the two failure cases that could occur. Also, to match the C11 interface, use of gcc builtins is unavoidable. Add a check to the build system to make sure the compiler supports them (although I don't think there's any compiler which supports __sync_*, but not these extensions). Needed for the following commit.
* audio/out: consistently use double return type for get_delaywm42014-11-0912-27/+25
| | | | | ao_get_delay() returns double, but the get_delay callback still returned float.
* video/out: minor simplification to event query functionwm42014-11-093-7/+6
| | | | The "clear" parameter is confusing and useless.
* audio/out: make ao_request_reload() idempotentwm42014-11-095-15/+31
| | | | | | | | | | This is what you would expect. Before this commit, each ao_request_reload() call would just queue a reload command, and then recreate the AO for the number of times the function was called. Instead of sending a command, introduce some sort of event retrieval mechanism. At least for the reload case, use atomics, because we're too lazy to setup an extra mutex.
* audio: handle reinit after AO reload slightly cleanerwm42014-11-091-8/+8
| | | | Don't print bogus messages about packets read in verbose mode.
* mp_image: check memory allocationwm42014-11-081-0/+4
|
* player: improve audio time displaywm42014-11-081-1/+10
| | | | | | | | | | | | | | | | | | This commit fixes a "cosmetic" user interface issue. Instead of displaying the interpolated seek time on OSD, show the actual audio time. This is rather silly: when seeking in audio-only mode, it takes some iterations until audio is "ready", but on the other hand, the audio state machine is rather fickle, and fixing this cosmetic issue would be intrusive. So just add a hack that paints over the ugly behavior as perceived by the user. Probably the lesser evil. It doesn't happen if video is enabled, because that mode sets the current time immediately to video PTS. (Audio has to be synced to video, so the code is a bit more complex.) Fixes #1233.
* w32_common: open window menu on Alt+SpaceJames Ross-Gowan2014-11-081-0/+10
| | | | | | Since mpv doesn't call TranslateMessage, this must be done manually. Should fix #1254
* Revert "w32_common: don't override alt+space"wm42014-11-081-16/+8
| | | | | | | | This reverts commit d859549424174179768fcd0310c75823a5ff7cb1. Going to apply the alternative fix through PR #1256, which came just some seconds after pushing the reverted commit. The reverted commit was reported as not actually working.
* w32_common: don't override alt+spacewm42014-11-081-8/+16
| | | | | | Apparently, stealing this from the WM is bad form, just like with F10. Fixes #1254.
* win32: silence some warningsJames Ross-Gowan2014-11-082-1/+3
| | | | Signed-off-by: wm4 <wm4@nowhere>
* command: silence a warning on win32wm42014-11-081-0/+2
| | | | | Same goal as a change in the #1255 PR, but IMO slightly less ifdefferish.
* demux_mkv: fix undefined shiftswm42014-11-081-4/+4
| | | | | | | Found by clang sanitizer. Casting unsigned integers to signed integers with same size has implementation defined behavior (it's even allowed to crash), but it seems reasonable to expect that reasonable implementations do a complement of 2 "conversion".
* command: fix option-flags propertywm42014-11-081-1/+3
| | | | The sub-path wasn't adjusted, and it worked only in some situations.
* client API: deprecate some eventswm42014-11-083-22/+35
| | | | | | | | | | | Following the discussion in #1253. The events won't be removed for a while, though. (Or maybe never, unless we run out of bits for the uint64_t event mask.) This is not a real change (the events still work, and the alternative mechanisms were established a few API revisions earlier), but for the sake of notifying API users, update DOCS/client-api-changes.rst.
* command: export the flag whether an option was set on commandlinewm42014-11-072-0/+38
| | | | Can be useful for certain scripts; I think someone requested this.
* client API: additional documentation commentswm42014-11-071-5/+19
| | | | (I guess some of the mpv_event contents turned out relatively awkward.)
* client: remove redundant assignmentwm42014-11-071-1/+0
| | | | This is set by send_reply().
* client API: silence silly clang warningwm42014-11-071-2/+2
| | | | | | | The values compared here happen to be of unsigned enum types - but the test is not supposed to break if we somehow force the enum to signed, or if the compiler happens to use a signed type (as far as I remember, the exact integer type the compiler can use is implementation-defined).
* audio: add --audio-client-name optionwm42014-11-076-5/+15
| | | | | | The main need I see for this is with libmpv - it would be confusing if some application showed up as "mpv" on whateverthehell PulseAudio uses it for (generally it does show up on various PA GUI tools).
* vo_opengl: initialize renderer after setting sizewm42014-11-072-2/+4
| | | | | | | | | | | This silences the warning: video/out/gl_video.c:1091:51: runtime error: division by zero when running with clang -fsanitize=undefined. Division by zero is legal according to IEEE, but I guess clang doesn't care about standard. While triggering this warning isn't actually avoided in all cases, it's avoided in the common case and also makes people shut up about it.
* command: add display-names propertyKevin Mitchell2014-11-072-0/+29
| | | | | | | Call VOCTRL_GET_DISPLAY_NAMES it when the property is requested. The vo should return the names of the displays that the mpv window is covering. For example, with x11 vos, xrandr names LVDS1, HDMI1, etc.
* vo/x11: implement VOCTRL_GET_DISPLAY_NAMES with xrandr names (e.g., "LVDS1")Kevin Mitchell2014-11-073-2/+23
| | | | | | | | XRRGetOutputInfo contains a "name" element which corresponds to to the display names given to the user by the "xrandr" command line utility. Copy it into the xrandr_display struct for each display. On VOCTRL_GET_DISPLAY_NAMES, send a copy of the names of the displays spanned by the mpv window on.
* ipc: make sure --input-file=/dev/stdin always workswm42014-11-071-7/+20
| | | | It's not necessarily available on Unix systems other than Linux (sigh).
* vo_wayland: drop redundant "const"wm42014-11-071-1/+1
|
* vo_vaapi: fix broken error checkswm42014-11-071-2/+2
|
* ao_oss: wait for events with poll()wm42014-11-061-0/+13
| | | | | | | | | | The intention is to avoid using the timeout-based fallback. There's some minor hope that this will help with OpenBSD (see #1239), although it probably won't. Some chance that this will cause trouble with obscure OSS implementations or emulations.
* audio/out/push: when using audio wait fallback, recheck conditionwm42014-11-061-1/+2
| | | | | | | | | | | If calling ao->driver->wait() fails, we need to fallback to timeout- based waiting. But it could be that at this point, the mutex was already released (and then re-acquired). So we need to recheck the condition in order to avoid missed wakeups. This probably wasn't an actually occurring problem, but still could cause a small race-condition window if the dynamic fallback is actually used.
* sub: load .mks files as external subtitleswm42014-11-061-1/+1
|
* demux_mkv: fix indentationwm42014-11-051-3/+3
| | | | Meh.
* demux_mkv: for subtitle preroll, consider all clusterswm42014-11-051-5/+3