summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* af_lavfi: implement af-metadata propertywm42015-09-111-10/+21
| | | | | | | Works like vf-metadata. Unfortunately requires some code duplication (even though it's not much). Fixes #2311.
* 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.
* 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.
* demux: remove redundant demux_chapter.name fieldwm42015-08-121-5/+1
| | | | | | | | | | 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.
* player: add display sync modewm42015-08-101-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | 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-101-5/+18
| | | | | | | | | | 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-101-7/+3
| | | | | | | | | | | | | | 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
|
* lua: implement input_enable_section/input_disable_section via commandswm42015-08-061-2/+1
| | | | | | | | | | | | | | | 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.
* 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.
* 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: remove higher-level remains of DVD/BD menu supportwm42015-08-031-24/+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.
* 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".
* 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-211-8/+14
| | | | | | | | | 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.
* 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: parse and expose m3u playlist titleswm42015-07-101-2/+3
| | | | Requested. Closes #2100.
* player: refactor chapter seek codewm42015-07-101-1/+6
| | | | | | | 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.)
* player: never overwrite stop_play fieldwm42015-07-081-7/+11
| | | | | | | 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: simplify reload logicwm42015-07-021-4/+4
| | | | Instead of only reloading the demuxer, reopen the stream as well.
* x11: Handle external fullscreen togglesEduardo Sánchez Muñoz2015-06-281-1/+1
| | | | | | | | | | | | | | | Some window managers let you change the fullscreen state of any window using a key combination. For example, on XFWM you can use Alt+F11 and on Compiz you can configure a key combination with the "Extra WM actions" plugin. With this change mpv will handle these fullscreen state changes. So, if you enter into fullscreen mode using the WM's shortcut and then you use mpv's fullscreen toggle, you will get back into window mode. Merges PR #2081. Signed-off-by: wm4 <wm4@nowhere>
* demux: export forced flagwm42015-06-271-0/+1
| | | | | | At least Matroska files have a "forced" flag (in addition to the "default" flag). Export this flag. Treat it almost like the default flag, but with slightly higher priority.
* audio: output human-readable channel layouts toowm42015-06-251-0/+1
| | | | | This gets you the "logical" channel layout, instead of the exact thing we're sending to the AO. (Tired of the cryptic shit ALSA gives me.)
* command: export stereo 3D tagswm42015-06-231-0/+4
| | | | Fixes #2066.
* command: do not exit playback if the B point of A-B loop is past EOFwm42015-06-161-18/+21
| | | | | | | | | | | | | | The previous behavior is confusing if the B point is near EOF (consider B being the duration of the file, which is strictly speaking past the last video timestamp). The new behavior is fine as well for B being far past EOF. Achieve this by checking the EOF state in addition to whether playback has reached the B point. Also, move the A-B loop code out of command_event(). It just isn't useful anymore, and obfuscates the code more than it makes it loop simple. Fixes #2046.
* command: add keypress, keydown, and keyup commands.torque2015-06-111-0/+30
| | | | | These commands are used to simulate keypresses using the key names from input.conf.
* command: fix audio-out-detected-device propertywm42015-06-091-2/+3
| | | | | | | 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.
* command: remove unnecessary event IDswm42015-06-091-2/+0
| | | | | These were actually not needed for correct function, since individual property change notifications via mp_notify_property() are used.
* command: make property event mask matching more restrictivewm42015-06-091-1/+2
| | | | | | 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.
* player: print track list when switching trackswm42015-06-031-0/+4
|
* player: print a message along with track listwm42015-06-031-4/+4
| | | | Slightly less strange.
* player: don't print stream list when adding external tracks during loadwm42015-06-031-5/+7
| | | | | | | | | 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.
* command: remove deprecated get_property commandwm42015-05-271-34/+0
| | | | | | This command has been deprecated in the 0.8.x and 0.9.x releases - get rid of it. Its only point ever was MPlayer compatibility, which broke years ago anyway.
* command: better choice when to allow playback-related commandswm42015-05-261-16/+16
| | | | | | | | For certain reasons, we allow adding external tracks even before the main file is loaded. This somewhat breaks in old assumption, which uses mpctx->num_sources to determine whether a command can be applied in the current state. Use the newer playback_initialized instead, which is a much better choice for this purpose.
* command: fix track property when no file is loadedwm42015-05-261-2/+8
| | | | | | | | | | | The previous commit removed this. Although mp_switch_track() can now be called in all situations, we still don't want it to be called here. Setting a track property while no file is loaded would simply deselect the track instead of setting the underlying option to the requested value. Likewise, if the "cycle" command (M_PROPERTY_SWITCH) is used, don't just deselect the track.
* player: fix crashes when adding external tracks before loading main filewm42015-05-261-20/+13
| | | | | | | | | | | | | | | | Adding an external audio track before loading the main file didn't work right. For one, mp_switch_track() assumes it is called after the main file is loaded. (The difference is that decoders are only initialized once the main file is loaded, and we avoid doing this before that for whatever reason.) To avoid further messiness, just allow mp_switch_track() to be called at any time. Also make it do what mp_mark_user_track_selection() did, since the latter requires current_track to be set. (One could probably simply allow current_track to be set at this point, but it'd interfere with default track selection anyway and thus would be pointless.) Fixes #1984.
* command: change the hwdec propertieswm42015-05-251-30/+43
| | | | | | Another very minor step towards property/option unification. Not bothering with interface compatibility here.
* video: do not use MP_NOPTS_VALUE for A/V differencewm42015-05-241-2/+0
| | | | | | There's no need for this, it just creates more corner cases. Also always reset it on seeks etc..
* player: add function to compute past frame durationswm42015-05-241-17/+6
| | | | | And use it for the estimated-vf-fps property (it should be doing the same as before).
* command: add protocol-list propertywm42015-05-231-0/+16
| | | | Fixes #1972.
* command: allow changing track properties while no file is loadedwm42015-05-221-16/+20
| | | | | | | | | | Now it simply changes the options, i.e. what will be requested, instead of returning M_PROPERTY_UNAVAILABLE. This is another minor step towards unifying options and properties. Still a bit weird: it will always return "no" if no file is loaded, and disregards the option value.
* player: use an array for stream ID options and suchwm42015-05-221-4/+2
| | | | This makes the code slightly more generic.
* command: deprecate audio-sampleratewm42015-05-221-43/+2
| | | | | | | Also replace their implementation with the recently introduced properties. One significant difference is that audio-channels using OSD formatting does not print the channel layout. The user can just use the replacement property instead.
* command: add audio-params and audio-out-params propertieswm42015-05-221-1/+40
|
* command: rename audio-format propertywm42015-05-221-4/+6
| | | | Clashes with the option.
* command: deprecate the "length" propertywm42015-05-221-4/+4
| | | | It collides with the --length option.
* command: add a new property deprecation mechanismwm42015-05-221-0/+29
| | | | Looks like this will be needed a lot...
* audio: change range of volume option/propertywm42015-05-221-2/+2
| | | | | | | | | Now --volume takes an absolute volume, meaning it doesn't depend on --softvol-max. 0 is still silence, and 100 now always means unchanged volume. The OSD and the "volume" property are changed accordingly. Also raise the minimum value of --softvol-max. A value below 100 makes no sense and breaks the OSD.
* command: explicitly show mouse cursor when unfullscreeningwm42015-05-211-2/+6
|
* command: refactor if/else statements to switchRobin2015-05-201-11/+19
| | | | | | The code checking for the type of seeking contained some if else statements. To improve readability, I decided to refactor those statements to a switch statement.
* command: change OSD symbol for absolute perc. seekrrooij2015-05-191-2/+4
| | | | | | | | | | The OSD symbol for seeking to an absolute percentage was always OSD_FFW, even when it should be OSD_REW. It uses the correct OSD symbols now, by checking the current position ratio. Note: The symbol is still incorrectly given when the absolute percentage is very close to the current position ratio. Fortunately, that's a rare use case.
* command: use consistent comment stylerrooij2015-05-191-1/+1
| | | | Signed-off-by: wm4 <wm4@nowhere>
* input: add relative percentage seekrrooij2015-05-191-0/+5
| | | | | | | | | | | Only absolute percentage seeking was permitted first. It is now also possible to seek by relative percentage. MPSEEK_FACTOR is used as seek_type. Fixes #1950. Signed-off-by: wm4 <wm4@nowhere>
* command: add playlist_shuffle commandwm42015-05-171-0/+5
| | | | Fixes #965.
* command: let sub_reload remove the old track firstwm42015-04-281-8/+10
| | | | | | In the most simple case, this prevents the track ID from changing. One disadvantage is that if the file fails loading, the track is gone for good and would have to be re-added explicitly by the user.
* player: log track list when adding or removing external fileswm42015-04-281-0/+5
| | | | | | | | | Should help with debugging, and might be slightly more userfriendly. Note that this is called manually in multiple entry-points, instead of the functions doing the actual work (like mp_remove_track()). This is done so that exiting the player or calling the sub_reload command won't print redundant in-between states.
* command: demuxer-cache-time propertyxylosper2015-04-211-1/+21
| | | | | | | | Approximate time of video buffered in the demuxer, in seconds. Same as `demuxer-cache-duration` but returns the last timestamp of bufferred data in demuxer. Signed-off-by: wm4 <wm4@nowhere>
* client API: add a screenshot_raw commandwm42015-04-201-0/+39
| | | | | | | | | Requested. The wild code for setting up the mpv_node probably deserves to be cleaned up later. Fixes #1800.
* client API: add glue for making full use of mpv_command_node()wm42015-04-201-2/+2
| | | | | Until now, the return value was always MPV_FORMAT_NONE. Now a command can actually set it. This will be used in one of the following commits.
* player: change video-bitrate and audio-bitrate propertieswm42015-04-201-47/+28
| | | | | | | | | | | | | | Remove the old implementation for these properties. It was never very good, often returned very innaccurate values or just 0, and was static even if the source was variable bitrate. Replace it with the implementation of "packet-video-bitrate". Mark the "packet-..." properties as deprecated. (The effective difference is different formatting, and returning the raw value in bits instead of kilobits.) Also extend the documentation a little. It appe