summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: move replaygain control to top-level optionswm42017-04-261-4/+4
| | | | | | | | | | | | | | | | | | | | | af_volume is deprecated, and so are its replaygain sub-options. To make it possible to use replaygain without deprecated options (and of course to make it available at all after af_volume is dropped), reintroduce them as top-level options. This also means that they are easily changeable at runtime by using them as properties. Change the "volume" property to use the new update mechanism as well. We don't actually bother sharing the implementation between new and deprecated mechanisms, as the deprecated one will simply be deleted. For the from_dB() functions, we mention anders' copyright, although I'm not sure if a mere formula is copyrightable. This will have to be determined later. This whole change is mostly untested. Our distributed human CI will take care of it.
* player: fix core-idle and eof-reached update notifcationswm42017-04-141-4/+4
| | | | | | | | Make mpv_observe_property() work correctly on them even with --keep-open-pause=no. This also changes the situations in which the screensaver is enabled/disabled subtly.
* player: unmess pause state handlingwm42017-04-141-7/+3
| | | | | | | | | Merge the pause_player() and unpause_player() functions. Make sure the pause events are emitted properly. We can now set the internal pause state based on a predicate, instead of e.g. handle_pause_on_low_cache() making a mess to trigger the internal pause state as wanted. Preparation for some more changes.
* command, manpage: some leftover mentions of renamed --loop optionwm42017-04-111-1/+1
|
* command: update sub-fps etc. options on runtime changeswm42017-04-101-11/+7
| | | | | | | | | | | | | Un-special-case the sub-speed property, and apply subtitle speed updates in more cases. In particular, this respects runtime changes of the sub-fps option. (A minor consequence of this is that the subtitle speed is recomputed more often even in cases when it's not necessary. Also, the subtitle update is slightly "delayed" rather than strictly instant. Both of these likely are absolutely not observable by the user, although the subtitle speed verbose log message will be printed more often if the subtitle format is MicroDVD.)
* player: make screenshot commands honor the async flagwm42017-04-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | And also change input.conf to make all screenshots async. (Except the every-frame mode, which always uses synchronous mode and ignores the flag.) By default, the "screenshot" command is still asynchronous, because scripts etc. might depend on this behavior. This is only partially async. The code for determining the filename is still always run synchronously. Only encoding the screenshot and writing it to disk is asynchronous. We explicitly document the exact behavior as undefined, so it can be changed any time. Some of this is a bit messy, because I wanted to avoid duplicating the message display code between sync and async mode. In async mode, this is called from a worker thread, which is not safe because showing a message accesses the thread-unsafe OSD code. So the core has to be locked during this, which implies accessing the core and all that. So the code has weird locking calls, and we need to do core destruction in a more "controlled" manner (thus the outstanding_async field). (What I'd really want would be the OSD simply showing log messages instead.) This is pretty untested, so expect bugs. Fixes #4250.
* command: add property notifications for hwdec propertieswm42017-03-311-3/+3
| | | | | | | | | | This is a bit approximate, because we rely on the pixel format changing if the hardware decoding changes. This is not always true, as the pixel format for software decoded video and hardware decoded video copied back to CPU RAM could be the same. (Not sure if that is actually the case for any supported cases.) But for now this should fix most of #4289.
* command: add expand-text command to property-expand a stringAvi Halachmi (:avih)2017-03-261-0/+10
|
* command: add better runtime filter toggling methodwm42017-03-251-1/+4
| | | | | | | | | | Basically, see the example in input.rst. This is better than the "old" vf-toggle method, because it doesn't require the user to duplicate the filter string in mpv.conf and input.conf. Some aspects of this changes are untested, so enjoy your alpha testing.
* command: add demux-start-time propertyMatthias Hunstock2017-03-251-0/+11
| | | | Add a demux_start_time property, update docs.
* command: add a property to signal whether networking is usedwm42017-03-241-0/+12
| | | | | | Requested. The property semantics are a bit muddy due to lack of effort. Anticipated use is different display of cache status, so it should not matter anyway.
* command: add a redundant NULL checkwm42017-02-201-1/+1
| | | | | | | | | Currently, tracks have always associated streams, so there can't be a NULL dereference on the next line. But all the code is written with the possibility in mind that we might want tracks without streams, so make it consistent. Found by coverity.
* command: fix wrong sizeof() argumentwm42017-02-201-1/+1
| | | | | | | Found by coverity. All of these cases happened to work, probably even in 32 bit (when the name pointer allowed it to use only 4 bytes of space).
* player: add experimental stream recording featurewm42017-02-071-0/+22
| | | | | This is basically a WIP, but it can't remain in a branch forever. A warning is print when using it as it's still a bit "shaky".
* command: nicer OSd-formatting for loop-filewm42017-01-311-0/+1
|
* win32: snap to screen edgespavelxdd2017-01-271-0/+1
| | | | | | | Disabled by default. The snap sensitivity value depends on the screen DPI. The default value is 16px on a 96 DPI screen. Fixes #2248
* command: shorten long playlists on OSDwm42017-01-261-4/+77
| | | | | | | | | | | | A hacky, convoluted, half-working mess that attempts to cut off overlong playlists. It does so by relying on the ASS formatting rule that the font size is specified in the virtual PlayResY resolution. This means we can (normally) easily tell how many lines fit on the screen. On the other hand, this does not work if the text is wrapped. This as a kludge until a Betterâ„¢ solution is available.
* command: fix potential crash for script-binding with multi-commandswm42017-01-241-1/+2
| | | | | | | | "show-text test; script-binding display_stats" can potentially crash. It sends a message event. None of the string arguments can be NULL, which fails if cmd->key_name is NULL. This in turn can be due to commands combined with ";" (basically the key association doesn't consider nested commands).
* player: remove --stream-capture option/propertywm42017-01-211-24/+0
| | | | | | | | | | | | | | | This was excessively useless, and I want my time back that was needed to explain users why they don't want to use it. It captured the byte stream only, and even for types of streams it was designed for (like transport streams), it was rather questionable. As part of the removal, un-inline demux_run_on_thread() (which has only 1 call-site now), and sort of reimplement --stream-dump to write the data directly instead of using the removed capture code. (--stream-dump is also very useless, and I struggled coming up with an explanation for it in the manpage.)
* command: rename framedrop propertieswm42017-01-201-6/+10
| | | | | | | | | | "drop-frame-count" -> "decoder-frame-drop-count" "vo-drop-frame-count" -> "frame-drop-count" This gets rid of the backwards "drop-frame" part in the name. Maybe calling the new property "frame-drops" would be better, but there are already a bunch of similar properties that end in "-count".
* player: add prefetching of the next playlist entrywm42017-01-181-1/+1
| | | | | | | | | | | | Since for mpv CLI, the player state is a singleton, full prefetching is a bit tricky. We do it only on the demuxer layer. The implementation reuses the old "open thread". This means there is significant potential for regressions even if the new option is not used. This is made worse by the fact that I barely tested this code. The generic mpctx_run_reentrant() wrapper is also removed - this was its only user, and its remains become part of the new implementation.
* command: remove worthless error handling codewm42017-01-091-6/+5
| | | | | | The property calls will always succeed anyway. On the other hand, the error handling is kind of incomplete (doesn't check setting ab-loop-a when ab-loop-b is also set), so drop this code.
* player: remove dysfunctional edition switching OSD codewm42017-01-051-1/+0
| | | | | | | | | | | | | Was intended to show a "nice" message on edition switching. In practice, the message was never visible. The OSD code checks whether a demuxer is loaded, and if not, discards the message - meaning if the OSD code happened to run before the demuxer was fully loaded, no message was shown. This is apparently a regression due to extensions to the OSD and the situations in which it can be used. Remove the broken code since it's too annoying to fix. Instead, a default property message will be shown, which is a bit uglier, but actually not too unuseful.
* Remove compatibility thingswm42016-12-071-4/+0
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.
* options: some simplificationswm42016-11-291-2/+1
| | | | | | | | Remove more stuff that was needed only for legacy suboptions. One user-visible change is that parent-options like --tv are now not visible anymore. They lead to a special error message when used before, but now they're simply not part of the option list anymore.
* command: warn against deprecated properties in all caseswm42016-11-231-13/+9
| | | | | | | | | For some reason, some types of accesses didn't warn, for example when using mp.observe_property() in Lua. This was because the deprecation handling code explicitly checks certain accesses. I'm not quite certain why it was done this way. Just make it warn always. This could be backported to the current release, if we cared.
* command: redefine some deprecated propertieswm42016-11-221-37/+0
| | | | | | | | | | | | | | As threatened by the API changes document. We can actually keep the deprecated --playlist-pos and --cache options, since they are aliases and not used by the corresponding properties. They are inconsistent, but do no harm. Keep them for now for the sake of the command line user. mpv_identify.sh partially stopped working, because it was never updated. The shell magic can't deal with property names that contain "/", so we can't replace "samplerate" with "audio-params/samplerate" - just remove these properties. (How about you use ffprobe?)
* player: removing last playlist entry while looping should not stopwm42016-11-181-1/+1
| | | | | | | Run "playlist-remove current" while the last playlist entry is being played stopped playback. Fix this and return to the first entry instead. Fixes #3808.
* command: if window-scale can't be set properly, set it as optionwm42016-10-251-13/+8
| | | | Kind of sketchy, but happens to fix #3724.
* command: silence deprecation warnings with --reset-on-next-file=allwm42016-10-221-2/+11
| | | | | | | | | | | | | | | | | | | | | | --reset-on-next-file=all triggers m_config_backup_all_opts(), which backups all options (even deprecated ones). Later, when the option values are reset with m_config_restore_backups(), mp_on_set_option() is called, which in turn calls mp_property_do_silent(), which in turn will call mp_property_generic_option() and m_config_get_co(), which triggers the deprecation message. Unfortunately there's no good way to determine whether an option has actually changed (there's no option value compare operation), so the deprecated options have to be set no matter what. On the other hand, we can't pass through additional flags through the property layer. So we add a dumb global flag to silence the deprecation warnings in these cases. Fortunately m_config_get_co_raw() works to silence the warnings. m_config_get_co() also resolves aliases (deprecated and non-deprecated), but aliased options are handled differently by the option-property bridge, so we don't need to do that here, so the only purpose of it is to trigger a warning for deprecated (non-alias) options.
* command: fix reset-on-next-file=all and tv-freq optionwm42016-10-221-1/+2
| | | | | | | | The tv-freq options and properties use different types, thus must be treated as incompatible. Fixes an assertion with reset-on-next-file=all, which tries to set the option. Fixes #3708.
* options: handle --audio-device changes like the other optionswm42016-10-051-4/+1
| | | | | | Don't require special property code for handling updates, and simply use the UPDATE_AUDIO flag instead. Also make runtime changes to --audio-client-name take effect.
* audio: move some fallback handling to common AO reload functionwm42016-10-051-15/+2
| | | | | | | | | Now a reload requested by an AO behaves in exactly the same way as changing an AO-related options (like --audio-channels or --audio-exclusive). This is good for testing and uniform behavior. (You could go as far as saying it's a necessity, because the spotty and obscure AO reload behavior is hard to reproduce and thus hard to test at all.)
* command: flush and uninitialize audio output first on option changeswm42016-10-051-1/+3
| | | | | | | | | | | | This affects changing audio configuration options. Explicitly flush and uninitialize the audio output first before doing the rest. This should ensure all state attached to the audio output is discarded and not used during the reconfiguration. Also add a comment to the reinit_audio_filters() call. It doesn't necessarily restore the audio chain fully, but makes sure a seek is issued if the amnount of buffered audio discarded was huge enough to cause "problems".
* command: include deprecated/aliased options in property bridgewm42016-10-041-18/+28
| | | | | | | | If we really want client API users to use mpv_set_property() instead of mpv_set_option(), then compatibility handling of deprecated options should be included. Otherwise, there's the danger that client API users either break too early (and without a warning), or mpv_set_option() will continue to have a reason to exist.
* player: fix previous commitwm42016-10-031-2/+7
| | | | ...
* command: allow absolute seeks relative to end of streamPhilip Sequeira2016-10-021-0/+9
| | | | | | "seek -10 absolute" will seek to 10 seconds before the end. This more or less matches the --start option and negative seeks were otherwise useless (they just clipped to 0).
* player: make --stop-screensaver runtime-changeablewm42016-10-021-0/+3
| | | | | | | | | | Move the screensaver enable/disable determination to a central place, and call it if the stop-screensaver property is changed. Also, do not stop the screensaver when in idle mode (i.e. no file is loaded). Fixes #3615.
* player: enable reading from stdin after loading input.confwm42016-09-291-1/+1
| | | | Someone requested this.
* win32: make --priority runtime-settableJames Ross-Gowan2016-09-281-0/+16
| | | | | | | | | | I'm not sure if this option affects anything or if it's a placebo, especially since the VO thread is now registered with MMCSS. Still, I think --priority=high may have helped back when I used mplayer2 on a netbook. It's also possible that encoding-mode users would want to set --priority=idle. Anyway, it was one of the last M_OPT_FIXED options, so fix that.
* command: fix inverted condition in sub-reload commandwm42016-09-261-1/+1
| | | | Fixes #3586 (probably). Untested.
* command: some minor corrections to previous commitwm42016-09-241-20/+19
| | | | | | | | | | | | | | | | | | | | | | | | The last commit was fine - just making some enhancements. Rename the function to parse_node_chapters(), since it really has not much to do with Lua. Don't use len<0 as check whether it makes sense to set chapters, and instead check for mpctx->demuxer (that includes the possibility to set chapters e.g. within a preload hook, but after chapters are initialized from the demuxer). Return M_PROPERTY_ERROR instead of M_PROPERTY_OK if the mpv_node has the wrong type. It's ok if a chapter has no title, so change the checks accordingly. Remove a Yoda condition. Notify that chapter metadata might have changed with mp_notify() (the chapter list itself is already taken care by generic code). Fix leaking the metadata allocations of the new chapter list.
* command: make it possible to set chapters via lua pluginsMaurycy Skier2016-09-241-1/+70
|
* m_config, command: remove some minor code duplicationwm42016-09-231-3/+2
| | | | | | I would have been fine with this, but now I want to add another flag, and the duplication would become more messy than having a strange function for deduplication.
* command: make most options observablewm42016-09-231-0/+6
| | | | | | | | | | | The property observation mechanism turns properties into integer IDs for fast comparison. This means if two properties get the same ID, they will receive the same notifications. Use this to make properties under options/ receive notifications. The option-property bridge marks top-level properties with the same name as the options. This still might not work in cases the C code sets values on options structs directly.
* command: fix potential UBwm42016-09-231-5/+5
| | | | Pointed out by quilloss on github.
* player: make audio-channels etc. runtime settablewm42016-09-221-0/+7
| | | | | | | | | If one of the audio output format options is set, brually reinit the audio chain. Since the audio-channels property is still mapped to the deprecated read-only property, "options/audio-channels" currently has to be used, e.g. "cycle-values options/audio-channels 2 7.1".
* command: add a load-script commandwm42016-09-221-0/+7
| | | | | | | The intention is to give libmpv users as much flexibility to load scripts as using mpv from CLI, but without restricting libmpv users from having to decide everything on creation time, or having to go through hacks like recreating the libmpv context to update state.
* command: fix missing update notifications in some caseswm42016-09-221-0/+1
|
* player: some M_SETOPT_RUNTIME cleanupswm42016-09-221-19/+6
| | | | | | | | | Add this flag where needed. You shouldn't be able to set e.g. config-dir in these situations. Remove the mpctx->initialized check from the property/option bridge, since it's in use strictly only after initialization. Likewise, the apply-profile command doesn't need to check this.
* options: make input options generally runtime-settablewm42016-09-211-0/+21
|
* command: make bitrate properties observablewm42016-09-211-1/+2
|
* command: add a video-dec-params propertywm42016-09-201-1/+16
| | | | | | This is the actual decoder output, with no overrides applied. (Maybe video-params shouldn't contain the overrides in the first place, but damage done.)
* command: change update handling of some video-related propertieswm42016-09-201-24/+9
| | | | | | | | Use the new mechanism, instead of wrapped properties. As usual, extend the update handling to some options that were forgotten/neglected before. Rename video_reset_aspect() to video_reset_params() to make it more "general" (and we can amazingly include write access to video-aspect as well in this).
* player: kill associated OSD and key bindings when removing a scriptwm42016-09-201-1/+2
| | | | | The former was done already for Lua scripts, but move it to the generic code.
* player: make --osc/--ytdl settable during playbackwm42016-09-201-0/+3
| | | | | | | | | Setting the osc or ytdl properties will now load/unload the associated scripts. (For ytdl this does not mean the currently played URL will be reloaded.) Also add a changelog entry for this, which also covers the preceding work for --terminal.
* options, command: simplify some option updateswm42016-09-191-47/+13
| | | | | | | Remove wrapper properties for OSD and video position updates, use the new mechanism for them. We can mark the options directly. Update behavior will work for more options (since I've casually marked more affected options than the old less direct mechanism covered).
* player: make --terminal freetly settable at runtimewm42016-09-191-1/+1
| | | | | | | | | | | | | | | | | | | So client API users don't have to care about whether to set this before or after mpv_initialize(). We still don't enable terminal at any point before mpv_initialize(), because reasons. This also subtly changes some behavior how terminal options are applied while parsing. This essentially reverts the behavior as it was reported in issue #2588. Originally, I was hoping to get rid of the pre-parse option pass, but it seems this is absolutely not possible due to the way config and command line parsing are entangled. Command line options take priority over configfile options, so they have to be applied later - but we also want to apply logging and terminal options as specified on th