summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* sub: remove assertionwm42014-12-071-2/+1
| | | | | | | | | | | This should clearly be impossible, but it seems to happen with ordered chapters for a user. Since I can't tell what the actual bug is and it seems impossible to know the details without downloading possibly huge files, this is probably the best we can do. Should at least partially fix #1319.
* player: when seeking past EOF with --keep-open, seek to last framewm42014-12-073-7/+47
| | | | | | | | | | | | | | | | | | | | | It feels strange that seeking past EOF with --keep-open actually leaves the player at a random position. You can't even unpause, because the demuxer is in the EOF state, and what you see on screen is just what was around before the seek. Improve this by attempting to seek to the last video frame if EOF happens. We explicitly don't do this if EOF was reached normally to increase robustness (if the VO got a frame since the last seek, it obviously means we had normal playback before EOF). If an error happens when trying to find the last frame (such as not actually finding a last frame because e.g. the demuxer misbehaves), this will probably turn your CPU into a heater. There is no logic to prevent reinitiating the last-frame search if the last-frame search reached EOF. (Pausing usually prevents that EOF is reached again after a successful last-frame search.) Fixes #819.
* osc: improve slimbox layout and minor code cleanupsChrisK22014-12-051-82/+92
|
* assdraw: Properly approximate circle for rounded boxChrisK22014-12-051-4/+5
| | | | source: http://spencermortensen.com/articles/bezier-circle/
* osc, dvd, bd: fix mouse state when changing menu modeswm42014-12-052-4/+9
| | | | | | | | | The flags weren't correctly set, and the mouse cursor remained visible after leaving menu mode. This was apparently broken in 0.7.0 too. Fixes #1316.
* discnav: remove redundant callwm42014-12-041-2/+0
| | | | This was made the default a while ago.
* dvd, bd: don't unnecessarily block on demuxer/stream all the timewm42014-12-041-1/+4
| | | | | | | | | | | | | | | | | | This was completely breaking any low-level caching. Change it so that at least demuxer caching will work. Do this by using the metadata cache mechanism to funnel through the menu commands. For some incomprehensible reason, I had to reorder the events (which affects their delivery priority), or they would be ignored. Probably some crap about the event state being cleared before it could be delivered. I don't give a shit. All this code sucks. It would probably be better to let discnav.c access the menu event "queue" directly, and to synchronize access with a mutex, instead of going through all the caching layers, making things complicated and slow.
* dvd, bd, osc: disable OSC while a menu is activewm42014-12-041-0/+9
| | | | | | | They interfere. It turns out that commit b6ca4a48 actually broke this in weird ways, but this solution is better anyway.
* lua: fully cleanup removed key bindingswm42014-12-031-0/+1
| | | | This is basically cosmetic; it was leaking the old handler functions.
* client API: allow multiple mpv instances with terminal=yeswm42014-12-022-16/+21
| | | | | | | | | | | | | | | This is simply not allowed, and doing it triggered an assertion. It's still not allowed, because the terminal and related functionality is a global resource, and there doesn't seem to be a sane way to manage the signal handlers. But be a bit nicer, and just the terminal if it's already in use. Note that terminal _output_ happens anyway. This becomes usable with this commit. To facilitate logging-only usage further, also explicitly disable terminal input, so that "terminal=yes" can be used for logging without much interference with other things. (It'll still overwrite some signal handlers, though.)
* osc: always force mouse_move bindingwm42014-12-021-1/+1
| | | | | | So the OSC will still appear when using --no-input-default-bindings. It also means it may override a user's mouse_move binding, but I guess users who don't want the OSC should just use the --no-osc option.
* lua: fix broken error messagewm42014-12-021-1/+1
| | | | | luaL_error() doesn't support %.*s, because it uses Lua's own format string mechanism that just looks like the C one. Just drop this part.
* player: don't signal an error if --stream-dump is usedwm42014-12-021-0/+1
| | | | | | | The player thinks an error happened because no audio or video was played after finishing the file, but this obviously makes no sense with stream dumping. (error_playing follows the client API convention that negative values are errors.)
* client API: print version on initializationwm42014-12-021-0/+2
| | | | | A rather big oversight, because a log produced with the client API will not contain the mpv version at all otherwise.
* player: don't ignore relative seeks by 0 secondswm42014-11-291-4/+0
| | | | | | | I don't know why this done; most likely it had no real reason. Remove it because it breaks "refresh seeks" to the same position. (Although the refresh seeks mpv sometimes does were fine.)
* command: avoid returning invalid FPS valueswm42014-11-291-3/+5
| | | | It's possible that fps is sometimes 0 in case it's unset.
* player: reset frame step counter on seekswm42014-11-292-1/+1
| | | | | I suppose this wasn't done in order to keep the frame step counter active even in the next file, but actually it was reset anyway.
* lua: add a function that formats Lua values as stringswm42014-11-291-16/+21
| | | | | | | | Yep, Lua is so crappy that the stdlib doesn't provide anything like this. Repurposes the undocumented mp.format_table() function and moves it to mp.utils.
* player: simplify and fix ordered chapter EOF handlingwm42014-11-282-17/+11
| | | | | | | | | | | | | | Ordered chapter EOF was handled as special-case of ending the last segment. This broke --kee-open, because it set AT_END_OF_FILE in an "inconvenient" place (after checking for --keep-open, and before the code that exits playback if EOF is reached). We don't actually need to handle the last segment specially. Instead, we remain in the same segment if it ends. The normal playback logic will recognize EOF, because the end of the segment "cuts off" the file. Now timeline_set_from_time() never "fails", and we can remove the old segment EOF handling code in mp_seek().
* command: sub_add with "auto" should not always select a subtitle trackwm42014-11-271-1/+3
| | | | | | | | | | | Running "sub_add file.srt auto" during hook execution automatically selected the first added track. This happened because all tracks added with sub_add are marked as "external", and external subtitles are always selected by default. Fix this by negating the "external" flag when autoselecting subtitles during loading. The no_default flag exists for this purpose; it was probably added for libquvi originally, where we had the same issue.
* audio: alternative fix for previous commitwm42014-11-271-4/+1
| | | | | | | This is a somewhat obscure situation, and happens only if audio starts again after it has ended (in particular can happens with files where audio starts later). It doesn't matter much whether audio starts immediately or some milliseconds later, so simplify it.
* audio: fix busy loop when seeking while pausedwm42014-11-271-2/+4
| | | | | | | | | | | | | | | | | | | | When playing paused, the amount of decoded audio is limited to a small amount (1 sample), because we don't write any audio to the AO when paused. The small amount could trigger the case of the wanted audio being too far in the future in the PTS sync code, which set the audio status to STATUS_DRAINING, which in turn triggered the EOF code in the next iteration. This was ok, but unfortunately, this triggered another retry in order to check resuming from EOF by setting the status to STATUS_SYNCING, which in turn lead to the busy loop by alternating between the 2 states. So don't try resyncing while paused. Since the PTS syncing code also calls ao_reset(), this could cause the pulseaudio daemon to consume some CPU time as well. This was caused by commit 33b57f55. Before that, the playloop was merely run more often, but didn't cause any problems. Fixes #1288.
* ytdl: bump requrired youtube-dl version to 2014.11.26ChrisK22014-11-261-1/+1
|
* ytdl: Try to handle multi-arc videosChrisK22014-11-261-14/+37
| | | | | | | | this currently uses a sketchy but apparently working workaround, which will be removed once the neccessary changes in youtube-dl are implemented Fixes #1277
* ytdl: When using DASH, print actual durationChrisK22014-11-261-1/+5
| | | | | prints the actual duration as reported by youtube-dl to the terminal when available
* client API: make sure youtube-dl is not used by defaultwm42014-11-251-0/+1
| | | | | | | Currently, --ytdl is off by default, but even if this is changed, never enable it by default for the client API. It would be inappropriate to start an intrusive external subprocess behind the host application's back.
* audio: make mp_audio_config_to_str return a stack-allocated stringwm42014-11-251-3/+2
| | | | Simpler overall.
* audio: make mp_chmap_to_str() return a stack-allocated stringwm42014-11-241-1/+1
| | | | Simplifies memory management.
* lua: remove redundant callwm42014-11-241-1/+0
|
* lua: always handle key repeat on the script sidewm42014-11-241-4/+5
| | | | | | Simpler, and leaves the decision to repeat or not fully to the script (instead of requiring the user to care about it when remapping a script binding).
* lua, ipc: remove leftoverswm42014-11-242-10/+0
| | | | | | MPV_EVENT_SCRIPT_INPUT_DISPATCH is now unused/deprecated. Also remove a debug-print from defaults.lua.
* command: don't queue framestepswm42014-11-231-1/+14
| | | | | If repeated framestep commands are sent, just unpause the player, instead of playing N frames for N repeated commands.
* player: don't crash when using sub_seek without subtitleswm42014-11-231-2/+0
| | | | | | Recent regression. It turns out the assertion was completely unneeded. Fixes #1285.
* input, lua: redo input handlingwm42014-11-234-43/+145
| | | | | Much of it is the same, but now there's the possibility to distinguish key down/up events in the Lua API.
* client API: restrict client nameswm42014-11-232-20/+22
| | | | | | Use a fixed size array for the client name, which also limits the client name in size. Sanitize the client name string, and replace characters that are not in [A-Za-z0-9] with '_'.
* input: set mouse area by default for all inputwm42014-11-231-1/+1
| | | | | | | | | | Otherwise, mouse button bindings added by mp.add_key_binding() would be ignored. It's possible that this "breaks" some older scripts using undocumented Lua script functions, but it should be safe otherwise. Fixes #1283.
* lua: subprocess: move to osdep/subprocess-{win,posix}.cJames Ross-Gowan2014-11-221-478/+3
| | | | | | The subprocess code was already split into fairly general functions, separate from the Lua code. It's getting pretty big though, especially the Windows-specific parts, so move it into its own files.
* lua: subprocess: use macros for SetHandleInformationJames Ross-Gowan2014-11-221-1/+2
| | | | | Apparently both parameters refer to the same set of flags (the first is a mask for which flags to set.)
* lua: subprocess: fix handle inheritance race conditionJames Ross-Gowan2014-11-221-11/+87
| | | | | | | | | | | | | | | Normally, when creating a process with inherited handles on Windows, the process inherits all inheritable handles from the parent, including ones that were created on other threads. This can cause a race condition, where unintended handles are copied into the new process, preventing them from being closed correctly while the process is running. The only way to prevent this on Windows XP was to serialise the creation of all inheritable handles, which is clearly unacceptable for libmpv. Windows Vista solves this problem by allowing programs to specify exactly which handles are inherited, so do that on Vista and up. See http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx
* lua: subprocess: fix Ctrl+C handling on WindowsJames Ross-Gowan2014-11-221-3/+11
| | | | | | | | | | | | The CREATE_NO_WINDOW flag is used to prevent the subprocess from creating an empty console window when mpv is not running in a console. When mpv is running in a console, it causes the subprocess to detach itself, and prevents it from seeing Ctrl+C events, so it hangs around in the background after mpv is killed. Fix this by only specifying CREATE_NO_WINDOW when mpv is not attached to a console. When it is attached to a console, subprocesses will automatically inherit the console and correctly receive Ctrl+C events.
* lua: subprocess: cancel pending I/O before returnJames Ross-Gowan2014-11-221-2/+7
| | | | | | | I'm not sure if this is necessary, but it can't hurt, and it's what you're supposed to do before leaving the stack frame that contains the OVERLAPPED object and the buffer. If there is no pending I/O, CancelIo will do nothing and GetOverlappedResult will silently fail.
* Remove some superfluous NULL checkswm42014-11-213-6/+2
| | | | | | | | In all of these situations, NULL is logically not allowed, making the checks redundant. Coverity complained about accessing the pointers before checking them for NULL later.
* lua: add a way to add repeatable key bindingswm42014-11-211-3/+5
| | | | For these, autorepeat is enabled.
* command: dvd: better audio/video recovery on angle switchingwm42014-11-201-5/+2
| | | | | | | | Does the same thing as the drop_buffers command. When implementing that command, it turned out that resetting the higher level playback state was more effective for achieving smooth recovery. Untested; I don't even have any DVDs or DVD images with multiple angles.
* command: add drop_bufferswm42014-11-201-0/+10
| | | | | | | | | | | | | | | This command was actually requested on IRC ages ago, but I forgot about it. The main purpose is that the decoding state can be reset without issuing a seek, in particular in situations where you can't seek. This restarts decoding from the middle of the packet stream; since it discards the packet buffer intentionally, and the decoder will typically not output "incomplete" frames until it has recovered, it can skip a large amount of data. It doesn't clear the byte stream cache - I'm not sure if it should.
* options: add --ytdl-format option for youtube-dl formatJaime Marquínez Ferrándiz2014-11-201-3/+12
| | | | | | | | | It's passed with the '--format' option to youtube-dl. If it isn't set, we don't pass '--format best' so that youtube-dl can use the options from its configuration file. Signed-off-by: wm4 <wm4@nowhere>
* player: integrate ytdl_hook.luawm42014-11-192-0/+5
|
* lua: add youtube-dl hook scriptChrisK22014-11-191-0/+163
| | | | | | | This merely adds the file without using it, for the sake of retaining authorship information. Signed-off-by: wm4 <wm4@nowhere>
* command: add an ab_loop commandwm42014-11-181-0/+20
| | | | | | As suggested in #1241; to make using the feature easier. Also add better OSD-formatting for the ab-loop-a/b properties.
* command: improve A-B loop behaviorwm42014-11-183-3/+16
| | | | | | If the B point is set, then loop back to A. Also, update the OSD bar if necessary.
* lua: subprocess: support cancellation on WindowsJames Ross-Gowan2014-11-181-1/+9
|
* lua: subprocess: use overlapped I/O on WindowsJames Ross-Gowan2014-11-181-56/+133
| | | | | | | Instead of threads, use overlapped (asynchronous) I/O to read from both stdout and stderr. Like in d0643fa, stdout and stderr could be closed at different times, so a sparse_wait function is added to wrap WaitForMultipleObjects and skip NULL handles.
* command: implement A-B loopswm42014-11-182-9/+65
| | | | | | | | | | | | | Probably needs to be polished a bit more. Also, might require a key binding that can set/clear the loop points in a more intuitive way. For now, something like this can be put into input.conf to use it: ctrl+y set ab-loop-a ${time-pos} # set A ctrl+x set ab-loop-b ${time-pos} # set B ctrl+c set ab-loop-a no # clear (mostly) Fixes #1241.
* command: adjust previous commitwm42014-11-171-1/+3
| | | | | | | | Due to the current code structure, the "current" entry and the entry which is playing can be different. This is probably silly, but still try to mark the entries correctly. Refs #1260.
* command: playlist property: return if an entry is currently playingwm42014-11-171-0/+2
| | | | | | | | This actually doesn't even write/return the new sub-property, because I dislike the idea of dumping that field for every single playlist entry, even though it's "needed" only for one. Fixes #1260.
* lua: subprocess: remove minor code duplicationwm42014-11-161-31/+22
| | | | | | | | Now that the code for stderr and stdout does exactly the same things, and the specialization is in the callbacks, this is blatantly duplicated. Also, define a typedef for those callbacks to reduce the verbosity.
* lua: subprocess: add Windows implementationJames Ross-Gowan2014-11-161-46/+257
| | | | Doesn't handle mp_cancel yet.
* man: document osc seekbarstyle optionahoka2014-11-151-1/+1
|
* osc: add validation for string user optionsahoka2014-11-151-0/+16
|
* osc: add seekbarstyle optionahoka2014-11-151-0/+5
|
* sub: workaround braindead libass APIwm42014-11-153-10/+14
| | | | | | | | | | | | | | | | libass won't use embedded fonts, unless ass_set_fonts() (called by mp_ass_configure_fonts()) is called. However, we call this function when the ASS_Renderer is initialized, which is long before the .ass file is actually loaded. (I'm not sure why it tries to keep 1 ASS_Renderer, but it always did this.) Fix by calling mp_ass_configure_fonts() after loading them. This also means this function will be called multiple times - hopefully this is harmless (it will reinit fontconfig every time, though). While we're at it, also initialize the ASS_Renderer lazily. Fixes #1244.
* 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-131-1/+33
| | | | | | | 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-131-3/+3
|
* command: make sub-properties more flexiblewm42014-11-131-1/+1
| | | | | This makes it work with all kind of types, instead of just some simple ones.
* command: export mpv configure arguments as propertywm42014-11-131-0/+7
| | | | | It seems strange that a client API user can't get this string, other than analyzing the mpv log output.
* player: simplify audio uninit on segment switcheswm42014-11-121-5/+4
| | | | | | |