summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* command: make "add <property> 0" not change the valuewm42015-09-101-4/+2
| | | | | | | | | | | | | | | The value 0 was treated specially, and effectively forced the increment to 1. Interestingly, passing 0 or no value also does not include the scale (from touchpads etc.), but this is probably an accidental behavior that was never intentionally added. Simplify it and make the default increment 1. 0 now means what it should: the value will not be changed. This is not particularly useful, but on the other hand there is no need for surprising and unintuitive semantics. OARG_CYCLEDIR() failed to apply the default value, because m_option_type_cycle_dir was missing a copy handler - add this too.
* osd: delay libass initialization as far as possiblewm42015-09-071-0/+2
| | | | | | | | | | | | Until now, most OSD objects created the associated ASS_Renderer instance as soon as possible, even if nothing was going to be rendered. Maybe this was even intentional. Change this for the sake of lowering resource usage, and strictly initialize ASS_Renderer only when it's really needed. For the OSC, initialization has to be forced, because of the insane mechanism for translating mouse coordinates to OSD coordinates.
* options: fix --no-configwm42015-09-051-2/+0
| | | | | | | | | | | | | | | | | | This was completely broken. It was checked manually in some config loading paths, so it appeared to work. But the intention was always to completely disable reading from the normal config dir. This logic was broken in commit 2263f37d. The manual checks are actually redundant, and are not needed if --no-config is implemented properly - remove them. Additionally, the change to load the libmpv defaults from an embedded profile also failed to set "config=no". The option is marked as not being settable by a config file, and the libmpv default profile is parsed as a config file, so this option was rejected. Fix it by removing the CONF_NOCFG flag. (Alternatively, m_config_set_profile() could be changed not to set the "config file" flag by default, but I'm not bothering with this.)
* player: log error code on playback exitwm42015-09-031-0/+2
| | | | So far, this required using the client API to know it.
* screenshot: avoid confusing template error message with no fileKevin Mitchell2015-09-021-9/+11
| | | | | | | Previously, with mpv --force-window=yes --idle=yes --screenshot-template="%f", mpv would display an error saying that the template was incorrect, which it isn't, there's just no file to put in the format. In this case, just use the string "NO_FILE".
* osc: reinit on playlist changesKevin Mitchell2015-08-291-0/+1
| | | | | | This takes care of the corner case where the player is started with a single playlist entry so that the next/prev arrows are greyed out, but remain that way even after new elements are added to the playlist.
* player: slightly better error reporting when opening file failswm42015-08-281-2/+7
| | | | Return MPV_ERROR_LOADING_FAILED instead of MPV_ERROR_NOTHING_TO_PLAY.
* client API: improve an error messagewm42015-08-281-1/+1
| | | | | This refers to media played by mpv, and these don't necessarily have to be files. They can be network resources or entirely abstract URLs too.
* osc: exit tick immediately if disabled.torque2015-08-281-0/+2
| | | | | | | | | | | Even after it has been disabled with the `disable-osc` message, the OSC continues to run the tick function. Completely preventing tick from being called is impractical since there are several different places that it's called in the code, so just make it immediately return if the OSC has been disabled. This prevents the OSC from continuing the clear the OSD on every tick, allowing other scripts to disable it so that they may draw to the OSD.
* ytdl: catch bogous extractor infoChrisK22015-08-271-12/+12
| | | | | | | Some extractors may claim to have extracted subtitles, but then set the relevant fields to null. Try to catch those cases. Fixes #2254
* video: disable interpolation during framesteppingwm42015-08-251-0/+1
| | | | | | | It just causes annoying artifacts. Interestingly, this means keeping down the frame stepping key (".") will play video with interpolation disabled.
* audio: don't sleep when finishing audio resyncwm42015-08-231-1/+1
| | | | | | | This should avoid unnecessary sleeping when audio playback start resync has finished and goes into the normal playback state. This is tricky; see e.g. commit 402fe381.
* player: add --playlist-pos optionwm42015-08-221-1/+8
| | | | Oddly often requested.
* command: make the playback-time property writablewm42015-08-211-0/+5
| | | | | | | Provides a simplistic way to seek without having to care about weird situations like timestamp vs. playback time. This is good, because the seek command is currently timestamp based, so when using the seek command the user _does_ have to care.
* player: return better guess for playback time during seekswm42015-08-211-13/+27
| | | | | | | | Always compute the estimated absolute time of the seek target, and display this as playback time during seeks. Improves behavior with e.g. .ts files, for which we try to avoid seeks by timestamp.
* player: deliver IDLE event after uninitializing statewm42015-08-201-1/+1
| | | | | | | | | A client API user might count on the fact that audio and video outputs have already been uninitialized. (They remain uninitialized before entering idle mode in order to allow smooth transition to the next playlist entry.) Since event delivery is asynchronous, this has to happen after actually doing the uninitialization, or the client will essentially run into a race condition.
* video: don't decode 2 frames ahead with display-syncwm42015-08-191-2/+1
| | | | | This is not needed. It was used only temporarily in a development branch, and is a leftover from earlier rebasing.
* stream: provide a stream_get_size() convenience functionwm42015-08-181-2/+1
| | | | | And use it everywhere, instead of retrieving the size manually. Slight simplification.
* player: actually close files on playback endwm42015-08-151-1/+1
| | | | Regression since commit 75b1d504.
* player: use OSD formattin for DS on the terminal status linewm42015-08-121-1/+5
|
* demux: remove redundant demux_chapter.name fieldwm42015-08-122-7/+2
| | | | | | | | | | Instead, force everyone to use the metadata struct and set a "title" field. This is only a problem for the timeline producers, which set up chapters manually. (They do this because a timeline is a separate struct.) This fixes the behavior of the chapter-metadata property, which never returned a "title" property for e.g. ordered chapters.
* osc: avoid annoying verbose mode log spamwm42015-08-101-6/+22
| | | | | | | | enable_key_bindings()/disable_key_bindings() now prints a log message on each call, thus we should avoid makign redundant calls. This could probably be solved more elegantly, but since this is all legacy/private API, don't bother.
* player: add display sync modewm42015-08-105-6/+267
| | | | | | | | | | | | | | | | | | | | | | | | If this mode is enabled, the player tries to strictly synchronize video to display refresh. It will adjust playback speed to match the display, so if you play 23.976 fps video on a 24 Hz screen, playback speed is increased by approximately 1/1000. Audio wll be resampled to keep up with playback. This is different from the default sync mode, which will sync video to audio, with the consequence that video might skip or repeat a frame once in a while to make video keep up with audio. This is still unpolished. There are some major problems as well; in particular, mkv VFR files won't work well. The reason is that Matroska is terrible and rounds timestamps to milliseconds. This makes it rather hard to guess the framerate of a section of video that is playing. We could probably fix this by just accepting jittery timestamps (instead of explicitly disabling the sync code in this case), but I'm not ready to accept such a solution yet. Another issue is that we are extremely reliant on OS video and audio APIs working in an expected manner, which of course is not too often the case. Consequently, the new sync mode is a bit fragile.
* player: separate controls for user and video controlled speedwm42015-08-105-22/+59
| | | | | | | | | | For video sync, we want separate playback speed controls for user- requested speed and the "correction" speed for video timing. Further, we use this separation to make sure only a resampler is inserted if playback speed is only changed for video sync correction. As of this commit, this is basically inactive code. It's just preparation for the video sync code (the following commit).
* player: redo estimated-vf-fps calculationwm42015-08-104-7/+81
| | | | | | | | | | | | | | Additionally to taking the average, this tries to use the demuxer FPS to eliminate jitter, and applies some other heuristics to check if the result is sane. This code will also be used for the display sync code (it will actually make use of the require_exact parameter). (The value of doing this over keeping the simpler demux_mkv hack is somewhat questionable. But at least it allows us to deal with other container formats that use jittery timestamps, such as mp4 remuxed from mkv.)
* command: improve A-B loop OSD messageswm42015-08-101-2/+2
|
* player: raise maximum idle timewm42015-08-071-1/+1
| | | | No reason to wake up every other minute.
* lua: implement input_enable_section/input_disable_section via commandswm42015-08-064-38/+14
| | | | | | | | | | | | | | | Removes some more internal API calls from the Lua scripting backend. Which is good, because ideally the scripting backend would use libmpv functions only. One awkwardness is that mouse sections are still not supported by the public commands (and probably will never), so flags like allow-hide- cursor make no sense to an outside user. Also, the way flags are passed to the Lua function changes. But that's ok, because they're only undocumented internal functions, and not supposed to be used by script users. osc.lua only does due to historical reasons.
* lua: make mp.input_define_section use the define-section commandwm42015-08-062-21/+7
|
* command: add a command for defining input bindingswm42015-08-061-0/+5
| | | | | | This was requested. It was more or less present internally already and used for Lua scripting. Lua will switch to the "public" functions in the following commits.
* command: always make video-aspect property accessiblewm42015-08-041-14/+14
| | | | | | Now it can always be read. Normally returns the value of the video- aspect option. Writing it sets the option. If the aspect is not forced, it will attempt to return whatever is the current video aspect.
* command: fix video-aspect property update notificationwm42015-08-041-1/+1
| | | | Fixes #2194.
* osc: completely disable if no VO window existswm42015-08-041-1/+7
| | | | | Fixes relatively excessive CPU usage when paused while playing audio only.
* command: make auto-deinterlacing output at field ratewm42015-08-041-1/+1
| | | | | | This was requested by a user. The vdpau and vaapi deinterlacers already do this.
* player: use demux_open_url() to open main fileswm42015-08-041-61/+24
| | | | | | | | | | | | | | | | Instead of opening a stream and then a demuxer, do both at once with demux_open_url(). This requires some awkward additions to demuxer_params, because there are some weird features associated with opening the main file. E.g. the relatively useless --stream-capture features requires enabling capturing on the stream before the demuxer is opened, but on the other hand shouldn't be done on secondary files like external subtitles. Also relatively bad: since demux_open_url() returns just a demuxer pointer or NULL, additional error reporting is done via demuxer_params. Still, at least conceptually, it's ok, and simpler than before.
* player: remove higher-level remains of DVD/BD menu supportwm42015-08-036-430/+0
| | | | | | | | | | | | | | | Nobody wanted to restore this, so it gets the boot. If anyone still wants to volunteer to restore menu support, this would be welcome. (I might even try it myself if I feel masochistic and like wasting a lot of time for nothing.) But if it does get restored, it should be done differently. There were many stupid things about how it was done. For example, it somehow tried to pull mp_nav_events through all the layers (including needing to "buffer" them in the demuxer), which was needlessly complicated. It could be done simpler. This code was already inactive, so this commit actually changes nothing. Also keep in mind that normal DVD/BD playback still works.
* video: unbreak EOF with video-only files that have timestamp resetswm42015-08-031-1/+2
| | | | | | | Normally when there's a timestamp reset, we make audio resync to make sure audio and video line up (again). But in video-only mode, just setting audio to resyncing breaks EOF detection, because there's no code which would get audio_status out of this bogus state.
* audio: fix --end handling (again)wm42015-08-031-5/+2
| | | | | | | | | | Commit c5818046 fixed one case of audio EOF handling, and caused a new one. This time, the ao_buffer doesn't actually contain everyting that should be played - because if --end is used, only a part of it is played. Of course this is stupid, and it will be changed later. For now, this smaller change fixes the bug. Fixes #2189.
* audio: remove questionable speed change adjustmentwm42015-08-011-3/+0
| | | | | | | | | time_frame is when the next video frame should be shown. It's normally overwritten by the video timing code. This also says something about "nosound mode" (--no-audio today), but at least these days we don't use it at all if video is disabled. Remove it; it likely has no function at all.
* video: move frame duration code to a separate functionwm42015-08-011-11/+23
| | | | Minor preparation for something else.
* ytdl: get start_timeRicardo Constantino2015-07-291-0/+6
|
* ytdl: print command in debug modeRicardo Constantino2015-07-291-0/+1
|
* command: let track properties return option value in idle modewm42015-07-291-1/+5
| | | | | In idle mode (no file playing), the track properties such as vid/sid/aid should return the option setting, instead of the value "no".
* video: move up vo_frame setupwm42015-07-281-12/+12
|
* video: always decode at least 2 frames in advancewm42015-07-261-5/+1
| | | | | | | Remove the exception for decoding only 1 frame if VO framedrop is disabled. This was originally done to be able to test potential regressions when we enabled VO framedrop and decoding 2 frames by default. It's not needed anymore.
* audio: remove an unused parameterwm42015-07-241-3/+2
|
* audio: fix EOF state with --keep-openwm42015-07-241-1/+1
| | | | | | | | | | In paused mode, we never entered the audio EOF state. This shows e.g. in --keep-open mode, which will not set the eof-reached property correctly. Regression since commit c06cd1b9. This commit was the wrong fix. We need to respect the buffer state, and pausing has nothing to do with this. Fixes #2167.
* command: add property indicating per-file optionswm42015-07-231-0/+1
| | | | Fixes #2165, more or less.
* video: always re-probe auto deint filter on filter reconfigwm42015-07-213-10/+24
| | | | | | | | | If filters are disabled or reconfigured, attempt to remove and probe the deinterlace filter again. This fixes behavior if e.g. a software deint filter was automatically inserted, and then hardware decoding is enabled during playback. Without this commit, initializing hw decoding would fail because of the software filter; with this commit, it'll replace it with the hw deinterlacer instead.
* vo: minor simplification for queue size handlingwm42015-07-202-3/+3
| | | | | | | | | | Instead of calling it "future frames" and adding or subtracting 1 from it, always call it "requested frames". This simplifies it a bit. MPContext.next_frames had 2 added to it; this was mainly to ensure a minimum size of 2. Drop it and assume VO_MAX_REQ_FRAMES is at least 2; together with the other changes, this can be the exact size of the array.
* command: add track-list/N/audio-channels propertydeuiore2015-07-181-0/+8
| | | | | | Signed-off-by: wm4 <wm4@nowhere> (With some heavy modifications from the original patch.)
* player: show larger cache sizes in MB on status linewm42015-07-141-1/+5
|
* player: add missing \n to a messagewm42015-07-131-1/+1
|
* sub: call ass_set_fonts() only oncewm42015-07-131-10/+3
| | | | | | | | | | | | | ass_set_fonts() is called by mp_ass_configure_fonts(), which was called every time a subtitle renderer was initialized. I'm not sure why this was done - I can't find a good reason, and most likely there's none. However, it did cause problems with an experimental libass branch. It crashed some time after switching to a second subtitle track. The branch will hopefully be merged soon, and it seems unlikely that libass wants to fix its problems with its ridiculous API (rather it should normalize its API so that the issue doesn't happen in the first place), so just apply this change. It makes our code simpler too.
* player: extend --hls-bitrate optionwm42015-07-131-4/+10
| | | | Fixes #2116.
* player: put --term-playing-msg in a separate log categorywm42015-07-131-1/+3
| | | | Fixes #1983.
* player: parse and expose m3u playlist titleswm42015-07-101-2/+3
| | | | Requested. Closes #2100.
* video: don't force video refresh if video is restartingwm42015-07-101-1/+3
|
* player: refactor chapter seek codewm42015-07-103-24/+7
| | | | | | | mp_seek_chapter() had only 1 caller. Also the code was rather roundabout; the entire function can be compressed to 5 lines of code. (The new code is functionally the same - "mpctx->last_chapter_seek = -2;" was effectively a dead assingment.)
* client API: fix mpv_get_property_async() string casewm42015-07-101-1/+1
| | | | | | | The logic for this code didn't survive the previous refactor. It always crashed in async mode. Fixes #2121.
* player: never overwrite stop_play fieldwm42015-07-085-13/+21
| | | | | | | This is a real pain: if a quit command is received, it's set to PT_QUIT. And then other code could overwrite it, making it not quit. The annoying bit is that stop_play is written and read in many places. Just not overwriting it unconditionally seems to be the best course of action.
* command: allow changing deinterlace property any timewm42015-07-081-1/+1
| | | | Don't require video decoding to be active.
* command: make deinterlace property use interlaced-only yadif modewm42015-07-071-1/+1
|
* player: add missing include directivewm42015-07-061-0/+1
|
* sub: protect ASS_Renderer statewm42015-07-063-1/+8
| | | | | | | | | | | | | | | | | | | Each subtitle track gets its own decoder instance (sd_ass). But they use a shared ASS_Renderer. This is done mainly because of fontconfig. Initializing fontconfig is very slow when using it with memory fonts, so there's a practical need to cache this memory font state, which is done by not creating separate ASS_Renderers. This is very dirty and very evil, but we probably can't get rid of it any time soon. The shared ASS_Renderer was not properly synchronized. While the program logic guarantees that only one sd_ass instance is visible at a time, there are other interactions that require synchronization. In particular, I suspect concurrent execution of mp_ass_configure_fonts() and sd_ass.get_bitmaps cause issues in a newer libass development branch. So here's a shitty hack that hopefully fixes things, hopefully only until libass becomes less dependent on fontconfig.
* player: simplify reload logicwm42015-07-024-20/+15
| | | | Instead of only reloading the demuxer, reopen the stream as well.
*