summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: make mp_chmap_to_str() return a stack-allocated stringwm42014-11-241-1/+1
| | | | Simplifies memory management.
* 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.
* input, lua: redo input handlingwm42014-11-231-9/+21
| | | | | Much of it is the same, but now there's the possibility to distinguish key down/up events in the Lua API.
* Remove some superfluous NULL checkswm42014-11-211-2/+1
| | | | | | | | 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.
* 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.
* 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-181-2/+14
| | | | | | If the B point is set, then loop back to A. Also, update the OSD bar if necessary.
* command: implement A-B loopswm42014-11-181-2/+48
| | | | | | | | | | | | | 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.
* 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: make the osd-msg prefix work for playlist_next/prevwm42014-11-111-0/+2
| | | | | 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 decoders output refcounted frameswm42014-11-101-2/+2
| | | | | | | | | | | | | | 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.
* 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.
* command: send property-change event on playlist changeAlessandro Ghedini2014-11-091-0/+5
|
* audio/out: make ao_request_reload() idempotentwm42014-11-091-6/+1
| | | | | | | | | | 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.
* command: silence a warning on win32wm42014-11-081-0/+2
| | | | | Same goal as a change in the #1255 PR, but IMO slightly less ifdefferish.
* command: fix option-flags propertywm42014-11-081-1/+3
| | | | The sub-path wasn't adjusted, and it worked only in some situations.
* command: export the flag whether an option was set on commandlinewm42014-11-071-0/+26
| | | | Can be useful for certain scripts; I think someone requested this.
* command: add display-names propertyKevin Mitchell2014-11-071-0/+25
| | | | | | | 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.
* command: use playback time as reference for sub_seekwm42014-11-051-2/+3
| | | | | | | | | update_subtitle() already uees playback_pts to make subtitles work better in no-audio mode. Using get_current_time() usually gets playback_pts, but also has the advantage that it will use the seek target time during seeks. This will result in multiple sub_seek commands doing the right thing (at least as long as they're far enough apart so that seeking is actually initiated when the second command is run).
* command: add window-minimized property (X11 only)wm42014-11-021-0/+18
| | | | | | More or less requested by #1237. Should be simple to extend this to other backends.
* command: make window-scale property observablewm42014-11-021-0/+1
| | | | | | | | | | | | Add a generic mechanism to the VO to relay "extra" events from VO to player. Use it to notify the core of window resizes, which in turn will be used to mark all affected properties ("window-scale" in this case) as changed. (I refrained from hacking this as internal command into input_ctx, or to poll the state change, etc. - but in the end, maybe it would be best to actually pass the client API context directly to the places where events can happen.)
* command: expose mpv version as propertywm42014-11-021-0/+8
| | | | A client API user has no other way to know the version.
* player: always use demux_chapterwm42014-11-021-3/+4
| | | | | | | | | Instead of defining a separate data structure in the core. For some odd reason, demux_chapter exported the chapter time in nano-seconds. Change that to the usual timestamps (rename the field to make any code relying on this to fail compilation), and also remove the unused chapter end time.
* player: update meaning of drop_frame_cntwm42014-11-011-1/+1
| | | | | Rename the variable, update comments, and update the documentation of the property which returns its value.
* sub: remove osd_get_sub()wm42014-11-011-1/+1
| | | | | Trades one strange thing against another, but seems slightly less strange.
* player: don't display zero duration for files with unknown durationwm42014-10-291-6/+8
| | | | | | On OSD/terminal, just don't display the duration if unavailable. Make the "length" property unavailable if duration is unavailable.
* player: handle edition reloading slightly differentlywm42014-10-281-1/+1
| | | | | | | Use the codepath that is normally used for DVD/BD title switching and DVB channel switching. Removes some extra artifacts from the client API: now MPV_EVENT_END_FILE will never be called on reloads (and neither is MPV_EVENT_START_FILE).
* command: play the correct entry with loadfile ... append-playAlessandro Ghedini2014-10-271-1/+1
| | | | | The playlist may be non-empty even if the player is idle. Instead of playing the first entry, play the entry that was just added.
* command: try 'icy-title' metadata for media-title as wellAlessandro Ghedini2014-10-271-0/+3
|
* command: add audio-device propertywm42014-10-271-0/+11
| | | | Meant for changing the --audio-device at runtime.
* audio: add command/function to reload audio outputwm42014-10-271-0/+16
| | | | | Anticipated use: simple solution for dealing with audio APIs which request configuration changes via events.
* Drop libquvi supportwm42014-10-251-3/+0
| | | | | | | | | | | No development activity (or even any sign of life) for almost a year. A replacement based on youtube-dl will probably be provided before the next mpv release. Ask on the IRC channel if you want to test. Simplify the Lua check too: libquvi linking against a different Lua version than mpv was a frequent issue, but with libquvi gone, no direct dependency uses Lua, and such a clash is rather unlikely.
* command: finish hook execution if client failswm42014-10-241-5/+22
| | | | | Translation: if the (to be added) youtube-dl Lua script crashes, don't wait forever when opening something.
* command: add vo-configured propertywm42014-10-241-1/+10
| | | | | | | | | So a client API user can know when a window is created or destroyed. Also might be useful for the OSC: it could disable itself if video is disabled. Before this commit, there were only indirect ways of detecting this.
* command: fix debug outputwm42014-10-241-1/+1
| | | | It was a bit ugly/annoying.
* command: print executed commands with -vwm42014-10-231-0/+2
|
* command: add a "cached" mode to sub_addwm42014-10-231-1/+22
| | | | | This avoids reloading a subtitle if it was already added. In all cases, the subtitle is selected.
* command: return error on invalid/absent IDs with ff-sid/ff-aidwm42014-10-231-2/+6
| | | | | | Instead of just disabling the stream. Also, check if the selected track has the right type, or we'd crash.
* command: make reverse cycle_values match up with forward onewm42014-10-211-4/+3
| | | | | | | | | The behavior of reverse cycling (with the "!reverse" magic value) was a bit weird and acted with a "delay". This was because the command set the value the _next_ command should use. Change this and make each command invocation select and use the next command directly. This requires an "uninitialized" special index in the counter, but that is no problem at all.
* command: fix video-rotate update when pausedwm42014-10-211-11/+11
| | | | | | | | | | | Due to the way video-rotate currently works, the state will be automatically updated once new video is decoded. So the filter chain doesn't need to be reinitialized automatically, but there is a need to trigger the video instant refresh code path instead. Also move the support function closer to an annoying similar yet different function. They probably can be unified next time major changes are done to this code.
* command: add cursor-autohide propertywm42014-10-211-0/+14
| | | | | | | | | | | Allows properly changing/updating the cursor state. Useful for client API window embedding, because the host application may not want the mpv window to grab mouse input, and this has to manually handle the cursor. Changing the cursor of foreign windows is usually not sane. It might make sense to allow changing the cursor icon, but that would be much more complicated, so I won't add it unless someone actually requests it.
* command: add playback-abort propertywm42014-10-211-0/+8
| | | | Now this is obscure.
* command: add video-rotate propertywm42014-10-211-0/+12
|
* player: add stream selection by ffmpeg indexwm42014-10-211-0/+36
| | | | | | | | | Apparently using the stream index is the best way to refer to the same streams across multiple FFmpeg-using programs, even if the stream index itself is rarely meaningful in any way. For Matroska, there are some possible problems, depending how FFmpeg actually adds streams. Normally they seem to match though.
* command: add field-dominance propertyKevin Mitchell2014-10-211-0/+1
|
* command: extend sub_add commandwm42014-10-211-2/+10
|
* command: remove hook cancellation mechanismwm42014-10-201-11/+1
| | | | | I doubt anyone will actually use this correctly. Also, there was a bug (a typo) which prevented it from working at all.
* command: allow sub_add at an earlier stagewm42014-10-201-1/+1
|
* command: add "estimated-vf-fps" change notifcationwm42014-10-191-1/+2
|
* command: add a mechanism to allow scripts to intercept file loadswm42014-10-161-0/+138
| | | | | | | | | | | | | | | | | | | | | | | A vague idea to get something similar what libquvi did. Undocumented because it might change a lot, or even be removed. To give an idea what it does, a Lua script could do the following: -- type ID priority mp.commandv("hook_add", "on_load", 0, 0) mp.register_script_message("hook_run", function(param, param2) -- param is "0", the user-chosen ID from the hook_add command -- param2 is the magic value that has to be passed to finish -- the hook mp.resume_all() -- do something, maybe set options that are reset on end: mp.set_property("file-local-options/name", "value") -- or change the URL that's being opened: local url = mp.get_property("stream-open-filename") mp.set_property("stream-open-filename", url .. ".png") -- let the player (or the next script) continue mp.commandv("hook_ack", param2) end)
* command: allow setting per-file options at runtimewm42014-10-151-7/+24
| | | | | The intended use-case is for doing this at load time, after the load command was issued. (See following commit.)
* command: don't display non-sense if volume is unavailablewm42014-10-111-1/+1
| | | | | | | | | Showed "Volume: (unavailable)%". That was dumb. The message string is now a bit convoluted; mostly because the property expand syntax can't do "if-else", just "if". CC: @mpv-player/stable
* command: make volume/mute unavailable if audio is not initializedwm42014-10-111-6/+4
| | | | | | | | | | This does nothing good. This reverts a change made over a year ago - I don't remember why this was originally done this way. The main problem is that even if the volume option is set (something like "--volume=75"), the volume property will always return "100" until audio is initialized. If audio is uninitialized again, the volume property will remain frozen at its last value.
* command: make audio device list available to the client APIwm42014-10-101-0/+32
|
* player: minor simplificationwm42014-10-101-1/+1
|
* player: --save-position-on-quit should always work (2)wm42014-10-101-2/+5
| | | | | This reimplements the feature reverted in the previous commit in a different way.
* command: add cache-buffering-state propertywm42014-10-071-0/+11
|
* client API: clarify pause/unpause events, modify core-idle propertywm42014-10-071-1/+2
| | | | | | | | Whether you consider the semantics weird or not depends on your use case, but I suppose it's a bit confusing anyway. At this point, we keep MPV_EVENT_PAUSE/UNPAUSE for compatibility only. Make the "core-idle" property somewhat more useful in this context.
* player: remove central uninit_player() function and flags messwm42014-10-031-2/+2
| | | | | | | | | | | | | | Each subsystem (or similar thing) had an INITIALIZED_ flag assigned. The main use of this was that you could pass a bitmask of these flags to uninit_player(). Except in some situations where you wanted to uninitialize nearly everything, this wasn't really useful. Moreover, it was quite annoying that subsystems had most of the code in a specific file, but the uninit code in loadfile.c (because that's where uninit_player() was implemented). Simplify all this. Remove the flags; e.g. instead of testing for the INITIALIZED_AO flag, test whether mpctx->ao is set. Move uninit code to separate functions, e.g. uninit_audio_out().
* command: don't show message on "osd" command by defaultwm42014-10-031-3/+2
| | | | | | Apparently this was not very popular. CC: @mpv-player/stable
* command: allow passing memory addresses to overlay_addwm42014-10-031-0/+6
| | | | | | | | | For the sake of libmpv. Might make things much easier for the user, especially on Windows. On the other hand, it's a bit sketchy that a command exists that makes the player access arbitrary memory regions. (But do note that input commands are not meant to be "secure" and never were - for example, there's the "run" command, which obviously allows running random shell commands.)
* command: restructure overlay_add codewm42014-10-031-46/+63
| | | | | | |