summaryrefslogtreecommitdiffstats
path: root/mpvcore/command.c
Commit message (Collapse)AuthorAgeFilesLines
* command: preferably show "add"/"cycle"/"set" command errors on OSDwm42013-10-121-10/+10
| | | | | | Before this, they were shown on terminal only. Now they use the OSD mechanism, which shows them on the video window or the terminal, depending on settings and what's available.
* command: don't allow changing volume if no audio initializedwm42013-10-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Changing volume when audio is disabled was a feature request (github issue #215), and was introduced with commit 327a779. But trying to fix github issue #280 (volume is not correct in no-audio mode, and if audio is re-enabled, the volume set in no-audio mode isn't set), I concluded that it's not worth the trouble and the current implementation is questionable all around. (For example, you can't change the real volume in no-audio mode, even if the AO is open - this could happen with gapless audio.) It's hard to get right, and the current mixer code is already hilariously overcomplicated. (Virtually all of mixer.c is an amalgamation of various obscure corner cases.) So just remove this feature again. Note that "options/volume" and "options/mute" still can be used in idle mode to adjust the volume used next time, though these properties can't be used during playback and thus not in audio-only mode. Querying the volume still "works" in audio-only mode, though it can return bogus values.
* command: sub_seek: avoid getting stuckwm42013-10-071-0/+5
| | | | | | | | | First, don't try to seek if the result is 0 (i.e. nothing found, or subtitle event happens to be exactly on spot). Second, since we never can make sure that we actually seek to the exact subtitle PTS (seeking "snaps" to video PTS), offset the seek by 10ms. Since most subtitle events are longer than 10ms, this should work fine.
* command: add commands for displaying overlayswm42013-10-051-4/+137
| | | | | | Requested by github issue #255. Does not work where mmap is not available (i.e. Windows).
* command: add properties for retrieving OSD dimensionswm42013-10-051-0/+23
|
* command: add sub_seek input commandwm42013-10-021-6/+16
| | | | | | | Essentially reuses the sub_step command, and is subject to the same restrictions. Seems to behave a bit strange sometimes, but generally works.
* command: don't let "avsync" property print NOPTS valuewm42013-10-021-0/+2
| | | | | | Can happen when seeking in audio files with attached picture. MP_NOPTS_VALUE doesn't really make sense outside of mpv internals, so don't return it.
* command: subtitle support depends on VO, not video decodingwm42013-10-021-11/+7
| | | | | | | | | We can render subtitles if a VO is open. Whether we're decoding video (i.e. if mpctx->sh_video is set) doesn't really matter. Subtitle display with --force-window still doesn't quite work yet, because there's nothing to actually force redrawing of subtitles in this mode.
* input: translate mouse position to OSD space earlywm42013-09-271-13/+0
| | | | | | | | | | | | | | Until now, mouse positions were just passed to the core as-is, even if the mouse coordinates didn't map to any useful coordinate space, like OSD coordinates. Lua scripting (used by the OSC, the only current user of mouse input) had to translate mouse coordinates manually to OSD space using mp_get_osd_mouse_pos(). This actually didn't work correctly in cases mouse coordinates didn't map to OSD (like vo_xv): the mouse coordinates the OSC got were correct, but input.c was still expecting "real" mosue coordinates for mouse areas. Fix this by converting to OSD coordinates before passing the mouse position to the core.
* video: let sh_video->disp_w/h always be container sizewm42013-09-261-4/+8
| | | | | | | Nothing really accesses it. Subtitle initialization actually does in a somewhat meaningful way, but there container size is probably fine, as subtitles were always initialized before the first video frame was decoded.
* video: let sh_video->aspect always be container aspect ratiowm42013-09-261-7/+15
| | | | | | | Now writing -1 to the 'aspect' property resets the video to the auto aspect ratio. Returning the aspect from the property becomes a bit more complicated, because we still try to return the container aspect ratio if no frame has been decoded yet.
* Add initial Lua scripting supportwm42013-09-261-0/+72
| | | | | | | | | | | | | | | | | | | | | | This is preliminary. There are still tons of issues, and any aspect of scripting may change in the future. I decided to merge this (preliminary) work now because it makes it easier to develop it, not because it's done. lua.rst is clear enough about it (plus some sarcasm). This requires linking to Lua. Lua has no official pkg-config file, but there are distribution specific .pc files, all with different names. Adding a non-pkg-config based configure test was considered, but we'd rather not. One major complication is that libquvi links against Lua too, and if the Lua version is different from mpv's, you will get a crash as soon as libquvi uses Lua. (libquvi by design always runs when a file is opened.) I would consider this the problem of distros and whoever builds mpv, but to make things easier for users, we add a terrible runtime test to the configure script, which probes whether libquvi will crash. This is disabled when cross-compiling, but in that case we hope the user knows what he is doing.
* vaapi: add vf_vavpp and use it for deinterlacingxylosper2013-09-251-0/+3
| | | | | | | | Merged from pull request #246 by xylosper. Minor cosmetic changes, some adjustments (compatibility with older libva versions), and manpage additions by wm4. Signed-off-by: wm4 <wm4@nowhere>
* command: fix short buffer when handling of long property nameswm42013-09-241-6/+4
| | | | | | This wasn't enough and could lead to a cut off message shown on OSD. Just make it dynamic, since we already use dynamic memory allocation at this point anyway.
* mplayer: attempt to make playback resume work with DVD/BDwm42013-09-221-1/+2
| | | | | | | | | | | | | | | | The problem with DVD/BD and playback resume is that most often, the filename is just "dvd://", while the actual path to the DVD disk image is given with --dvd-device. But playback resume works on the filename only. Add a pretty bad hack that includes the path to the disk image if the filename starts with dvd://, and the same for BD respectively. (It's a bad hack, but I want to go to bed, so here we go. I might revert or improve it later, depending on user feedback.) We have to cleanup the global variable mess around the dvd_device. Ideally, this should go into MPOpts, but it isn't yet. Make the code paths in mplayer.c take MPOpts anyway.
* command: when changing volume while muted, show an extra message on OSDwm42013-09-211-1/+2
| | | | | So nobody has to wonder why everything is silent, even if they raise the volume.
* command: when changing a property, allow showing an extra OSD messagewm42013-09-211-28/+45
| | | | | | | | | | This is for properties that normally show a bar, and thus do not show an OSD message (as per classic mplayer behavior). Setting an extra_msg allows showing an OSD message anyway, except if OSD messages are explicitly suppressed. This refactors the whole show_property_osd() function a bit, and replaces the weird sep field with a more general method.
* command: don't append, but prepend deinterlace filter by defaultwm42013-09-201-1/+1
| | | | | | In most cases, it's better if deinterlacing happens before any other filtering, so prepend the filter to the user's filter list, instead of appending it.
* command: use a list of potential deinterlacer filterswm42013-09-201-13/+22
| | | | | | | | Instead of hardcoding a single filter. This might be helpful for modeling the vaapi deinterlacer as a video filter. The idea is that a software deinterlacer would be tried first, and if that fails (because vaapi hardware decoding uses HW surfaces, which a software deinterlacer does not accept), the vaapi filter would be tried.
* mixer: make struct opaquewm42013-09-201-10/+10
| | | | Also remove stray include statements from ao_alsa and ao_oss.
* mixer: allow accessing volume and mute property on disabled audiowm42013-09-201-8/+0
| | | | | | | | | | | | | | | | | | The volume is set as soon as the audio chain is created again. This works only in softvol mode. For system wide volume or otherwise externally user controllable volume, this code is intentionally disabled. It would be extremely weird if changing volume (while audio is not initialized) would do nothing, and then suddenly change it when the audio chain is created. There's another odd corner case: the user-set volume will be thrown away if it's set before the _first_ audio chain initialization. This is because the volume restore logic recognizes a change from nothing to softvol or an AO, and circumventing that would require additional code. Also, we don't even know the start volume before that point. Forcing the volume with --volume will can override the volume set during no-audio mode, depending on the situation.
* mixer: restore volume with playback resumewm42013-09-201-0/+16
| | | | | | | | | Note that this is intentionally never done if the AO or softvolume is different, or if the current volume control method is thought to control system wide volume (such as ALSA) or otherwise user controllable (such as PulseAudio). The intention is to keep things robust and to avoid messing with the user's audio settings as far as possible, while still providing the ability to resume volume if it makes sense.
* command: force video refresh when changing aspectwm42013-09-151-1/+2
| | | | | Pausing the player and changing the aspect would leave the VO without a frame to display.
* mplayer: attempt to skip playlist entries which can't be playedwm42013-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is for situations when repeated attempts at playing a playlist entry failed, and playlist navigation becomes impossible due to that. For example, it wasn't possible to skip backwards past an unplayable playlist entry: mpv file1.mkv doesntexist.mkv file3.mkv You couldn't skip back to file1.mkv from file3.mkv. When running a single "playlist_prev" command, doesntexist.mkv would be played, which would fail to load. As reaction to the failure to load it, the next file would be played, which is file3.mkv. To make this even worse, the file could successfully load, but run only for a split second. So just loading successfully isn't good enough. Attempt to solve this by marking problematic playlist entries as failed, and by having playlist_prev skip past such playlist entries. We define failure as not being able to play more than 3 seconds (or failing to initialize to begin with). (The 3 seconds are in real time, not file duration.) "playlist_prev force" still exhibits the old behavior. Additionally, use the same mechanism to prevent pointless infinite reloading if none of the files on the playlist exist. (See github issue All in all, this is a heuristic, and later adjustments might be necessary. Note: forward skips (playlist_next) are not affected at all. (Except for the interaction with --loop.)
* core: add --deinterlace option, restore it with resume functionalitywm42013-09-131-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The --deinterlace option does on playback start what the "deinterlace" property normally does at runtime. You could do this before by using the --vf option or by messing with the vo_vdpau default options, but this new option is supposed to be a "foolproof" way. The main motivation for adding this is so that the deinterlace property can be restored when using the video resume functionality (quit_watch_later command). Implementation-wise, this is a bit messy. The video chain is rebuilt in mpcodecs_reconfig_vo(), where we don't have access to MPContext, so the usual mechanism for enabling deinterlacing can't be used. Further, mpcodecs_reconfig_vo() is called by the video decoder, which doesn't have access to MPContext either. Moving this call to mplayer.c isn't currently possible either (see below). So we just do this before frames are filtered, which potentially means setting the deinterlacing every frame. Fortunately, setting deinterlacing is stable and idempotent, so this is hopefully not a problem. We also add a counter that is incremented on each reconfig to reduce the amount of additional work per frame to nearly zero. The reason we can't move mpcodecs_reconfig_vo() to mplayer.c is because of hardware decoding: we need to check whether the video chain works before we decide that we can use hardware decoding. Changing it so that this can be decided in advance without building a filter chain sounds like a good idea and should be done, but we aren't there yet.
* quvi: restore playback position when switching formatswm42013-09-101-0/+7
| | | | This simply issues a seek after reloading.
* quvi: coerce libquvi 0.4 support into allowing format switchingwm42013-09-101-3/+9
| | | | | | | | | | | | | libquvi 0.4 doesn't allow us listing the formats supported by a streaming site without doing additional network accesses, so switching formats was not supported with it. (It's different with libquvi 0.9.) But the most important case is switching between SD and HD. Usually, --quvi-format=default will get SD, while --quvi-format=best gives HD. Use this, and pretend that an URL supported by libquvi 0.4 supports both of these. "cycle quvi-format" will switch between these. If the user specifies something else via --quvi-format, this is included in the list of switchable formats additionally to "default" and "best".
* command: make title property unavailable if there's no supportwm42013-09-101-3/+3
| | | | | Instead of returning 0 if the stream doesn't have title info, make the property unavailable.
* demux: retrieve per-chapter metadatawm42013-09-081-2/+15
| | | | | | | | | | Retrieve per-chapter metadata, but don't do much with it. We just make the metadata of the _current_ chapter available as chapter-metadata property. Returning the full chapter list with metadata would be no problem, except that the property interface isn't really good with structured data, so it's not available for now. Not sure if it's worth it, but it was requested via github issue #201.
* demux: refactor tag handlingwm42013-09-081-13/+23
| | | | | Make the code somewhat reuseable, instead of bound to a single demuxer instance. The plan is to add support for per-chapter tags later.
* mplayer: remove unused mp_add_subtitles() parameterwm42013-09-071-2/+2
|
* command: make options writeable in idle modewm42013-09-071-0/+8
| | | | | | | | | | | | Until now, options could be accessed as properties via "options/name", but the access was read-only. Change it so that write access is possible in --idle mode. (All options have to support setting options at that time, simply because of the way MPlayer designed per-file options. During playback, normal properties take care of changing things, including things backed by options.) This is work in progress. There are some issues: at least setting the "vf" and "af" options won't work for strange reasons.
* command: remove some unneeded codewm42013-09-071-6/+1
| | | | | | | chapter_display_name() always returns something. The "chapter < -1" check is not needed, because this is done at the start of the function.
* mplayer: allow resuming from playlistwm42013-09-041-2/+4
| | | | | | | | | | | | | | | | | | This includes the case of passing multiple files to command line (internally this is the same as loading a playlist). Resuming works by finding the first playlist entry that can be resumed. Alternative implementations would be possible, such as hashing the playlist contents. But this implementation is simpler, and doesn't have the disadvantage that changes to the playlist (like appending entries) will throw away the resume point. This makes loading large playlists a bit slower, because it has to look into ~/.mpv/watch_later/ for every entry. Loading a 15000 entries playlist now increases from 150ms to 400ms. Considering you rarely load playlists this big with mpv (because it's impractical considering the terminal and non-GUI nature of the player), this is probably ok.
* command: unescape URLs for ${filename} and ${media-title}wm42013-09-041-2/+7
| | | | | | | | | | | Undo URL percent encoding if the filename appears to be an URL. This will fix display of the actual filename in some cases. We don't put any effort into checking whether the URL is really percent encoded, because we don't really know how the protocol handler is going to interpret the URL. For stream_lavf, we probably can't know. Still, from the perspective of this commit, it seems to make sense to assume they are percent encoded.
* input: print more debug infos, raise loglevelwm42013-09-011-0/+3
|
* video: add unscaled mode with --video-unscaledwm42013-09-011-0/+1
|
* core: add a playlist demuxerwm42013-08-261-1/+1
| | | | | | | | | Modeled after the old playlist_parser.c, but actually new code, and it works a bit differently. Demuxers (and sometimes streams) are the component that should be used to open files and to determine the file format. This was already done for subtitles, but playlists still use a separate code path.
* video: handle video output levels with mp_image_paramswm42013-08-241-14/+8
| | | | | | | | | | | | Until now, video output levels (obscure feature, like using TV screens that require RGB output in limited range, similar to YUY) still required handling of VOCTRL_SET_YUV_COLORSPACE. Simplify this, and use the new mp_image_params code. This gets rid of some code. VOCTRL_SET_YUV_COLORSPACE is not needed at all anymore in VOs that use the reconfig callback. The result of VOCTRL_GET_YUV_COLORSPACE is now used only used for the colormatrix related properties (basically, for display on OSD). For other VOs, VOCTRL_SET_YUV_COLORSPACE will be sent only once after config instead of twice.
* command: simplify video brightness/gamma/etc. handling a bitwm42013-08-201-44/+17
| | | | | | | | | | | | | We don't need to store the offsets of the options corresponding to the properties, because the option-property bridge knows about this already. The check against 1000 was for the case if e.g. the --brightness option is not used. Always overwrite the option value instead, both when querying and setting the property. (This is needed to make the settings persistent even if vf_eq is used and the video chain is reinitialized.) This commit assumes that VFCTRL_SET_EQUALIZER is always paired with VFCTRL_GET_EQUALIZER (likewise for VOCTRL), which is the case.
* video: make it possible to scale/pan the video by arbitrary amountswm42013-08-191-4/+9
| | | | | | | | | | | Add --video-align-x/y, --video-pan-x/y, --video-scale options and properties. See the additions to the manpage for description and semantics. These transformations are intentionally done on top of panscan. Unlike the (now removed) --panscanrange option, this doesn't affect the default panscan behavior. (Although panscan itself becomes kind of useless if the new options are used.)
* command: more intuitive chapter seek behaviorPhilip Sequeira2013-08-171-1/+22
| | | | | | | | | If close to chapter start, skipping back goes to previous chapter (no change). If more than <threshold> seconds in, skipping back will now go to the beginning of the current chapter instead. The threshold is set by the new option --chapter-seek-threshold and defaults to 5 seconds. A negative value disables the new functionality.
* command: allow seek to "chapter -1"Philip Sequeira2013-08-171-1/+1
| | | | | This will seek to the start of the file regardless of whether the first real chapter starts there or not.
* input: add support for precise scroll axesAlexander Preisinger2013-08-071-3/+3
| | | | | | | | | | | | | | | Support horizontal and vertical axes of input devices. If the input device support precise scrolling with an input value then it should first be scaled to a standard multiplier, where 1.0 is the default. The multiplier will then applied to the following commands if possible: * MP_CMD_SEEK * MP_CMD_SPEED_MULT * MP_CMD_ADD All other commands will triggered on every axis event, without change the values specified in the config file.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-4/+4
| | | | Followup commit. Fixes all the files references.
* core: move contents to mpvcore (1/2)Stefano Pigozzi2013-08-061-0/+2673
core is used in many unix systems for core dumps. For that reason some tools work under the assumption that the file is indeed a core dump (for example autoconf does this). This commit just renames the files. The following one will change all the includes to fix compilation. This is done this way because git has a easier time tracing file changes if there is a pure rename commit.