summaryrefslogtreecommitdiffstats
path: root/mpvcore/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* mplayer: escape strings if needed when writing watch_later configwm42013-10-141-2/+19
| | | | | | | | | This fixes handling of e.g. "--vf=lavfi=[ noise ]" when used with playback resume functionality. The spaces made it bug out, and there are more cases where it could potentially break. We could always escape for simplicity, but for now make old and new mpv builds somewhat interoperable and use this new escaping only if needed.
* mplayer: print ffmpeg library versions along with mpv version infowm42013-10-141-2/+4
| | | | | | | | | | Also change what the FFmpeg version info looks like, and additionally dump lavfi/lavr/lswr versions. (Don't bother with libavdevice and libpostproc, they're not important enough.) Unfortunately, there's no "single" FFmpeg/Libav version due to fatal braindeath on the FFmpeg/Libav side. We can't map the versions to releases either (it simply isn't accessible anywhere).
* mplayer, vo_image: simplify OSD redrawing, fix vo_image crashwm42013-10-131-6/+1
| | | | | | | | | | | | | | | | | | vo_image didn't handle OSD redrawing correctly anymore after OSD redrawing behavior was changed in commit ed9295c (or maybe it has been a problem for a longer time, and only showed up now). Basically, flip_page was called unexpectedly and when no image was stored, which made it crash trying to access the image. This could happen when for example provoking OSD redrawing by pausing while using --vo=image, or by using this command line: mpv --vo=image '-vf=lavfi="select=not(mod(n\,3))"' Fix by removing the code that pretends vo_image can redraw OSD, and by removing the framestepping fallback, which could make bad things happen if the VO didn't support OSD redrawing. By now, there aren't any real VOs that can't redraw the OSD properly, so this code is not needed and just complicates things like vo_image. This change likely will also be useful for vo_lavc (encoding).
* mplayer: print a warning if libass is not compiledwm42013-10-131-0/+3
| | | | | | Libass is technically an optional dependency, but in practice users tend to disable libass accidentally or for the hell of it to get something "minimal", without being aware of the consequences.
* options: --loop=N means playback N times, not N+1 timesPhilip Sequeira2013-10-121-2/+2
| | | | | | | | | | The argument or this change is that --loop should set how often the file is played, not the number of additional repeats. Based on pull request 277, with additions to the manpage and removal of "--loop=0". Signed-off-by: wm4 <wm4@nowhere>
* mplayer: don't resume playlist if --no-resume-playback is usedwm42013-10-061-0/+2
|
* command: add commands for displaying overlayswm42013-10-051-0/+2
| | | | | | Requested by github issue #255. Does not work where mmap is not available (i.e. Windows).
* mplayer: fix some issues with playlist_prev commandwm42013-10-051-1/+9
| | | | | | | | | | | | | | | | You couldn't jump to the first entry in the playlist, if that entry was marked as "too short". But this is usually fine, because it doesn't get into the way of the user. (This feature is meant to allow being able to jump backwards through the playlist even if a file immediately stops playback right after initialization, not to prevent playing these files at all.) Also, apply the skip logic when wrapping around the playlist when going backwards. This happens with --loop, because looping pretends the playlist is infinitely repeated forwards and backwards (as long as the playlist_prev/next commands are concerned). Also add some comments.
* mplayer: fix cleanup if VO initialization failswm42013-10-051-0/+1
| | | | | Just specifying a VO that doesn't exist would make it crash. Regression caused by commit 6a0408b.
* mplayer: don't keep previous video frame with --force-windowwm42013-10-041-15/+14
| | | | | | | | | | When for example switching off the video stream, and --force-window is used, forcefully reconfigure the VO. This will reset the size, and will clear the window with black. Needed some effort, because you don't always want to clear the window on "discontinuity" points like going to a next file: this would introduce some flicker.
* mplayer: osd bar depends on VO, not video decodingwm42013-10-021-1/+1
| | | | The OSD bar wasn't displayed, and instead a fallback message was shown.
* mplayer: make VO interaction work in --idle modewm42013-10-021-19/+34
| | | | | | | Didn't handle VO events, didn't handle OSD message management. There is probably still some strangeness left. --idle mode was never made for direct interaction.
* mplayer: change default window size for --force-windowwm42013-10-021-1/+1
| | | | Closer to the ubiquitous 16:9 screen aspect ratio. Requested by ChrisK3.
* command: subtitle support depends on VO, not video decodingwm42013-10-021-2/+2
| | | | | | | | | 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.
* core: add --force-windowwm42013-10-021-14/+77
| | | | | | | | | | | | | | | | | This commit adds the --force-window option, which will cause mpv always to create a window when started. This can be useful when pretending that mpv is a GUI application (which it isn't, but users pretend anyway), and playing audio files would run mpv in the background without giving a window to control it. This doesn't actually create the window immediately: it only does so only after initializing playback and when it is clear that there won't be any actual video. This could be a problem when starting slow or completely stuck network streams (mpv would remain frozen in the background), or if video initialization somehow is stuck forever in an in-between state (like when the decoder doesn't output a video frame, but doesn't return an error either). Well, we can pretend only so much that mpv is a GUI application.
* core: don't require "refresh" seek for --keep-openwm42013-10-021-7/+1
| | | | | | | | | | | | | | | | | | | | | Seeking normally resets the VO and throws away the currently displayed frame, so if you seek outside the video with --keep-open enabled, the window would normally be "stuck" and not redraw properly, because there is no source video frame that could be redrawn. To deal with this, a precise seek to the position of the last displayed video frame was issued. This usually worked, but it can fail for formats where seeking is broken or not possible (consider reading from a pipe). Fix this by changing the semantics for vo_seek_reset(): now the video frame is remembered even after seeking. Note that this changes behavior a little when trying to seek outside of a file with --keep-open enabled. Since no actual seek is done anymore, the video will remain "frozen" on the previous position, and you can't unpause or framestep to see the video between current position and actual end of the video. If users complain, I might revert this commit.
* mplayer: fix looping of very short fileswm42013-09-291-6/+14
| | | | | | | | | | | | | | | Commit 884c179 attempted to make it possible to skip backwards through the playlist, even for files which fail to intitialize, or play for a very short time. This was also used to prevent mpv from looping forever and doing nothing if --loop=inf is used, and no file in the playlist is playable. This broke looping of very short files, because mpv was assuming that this case happened. But there are legitimate use cases. Fix this by making the looping case special. Instead of checking whether playback was "very short", check whether something could be decoded and displayed/played. If yes, allow looping.
* Add initial Lua scripting supportwm42013-09-261-0/+38
| | | | | | | | | | | | | | | | | | | | | | 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.
* mplayer: attempt to make playback resume work with DVD/BDwm42013-09-221-7/+20
| | | | | | | | | | | | | | | | 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.
* Merge branch 'volume_restore'wm42013-09-201-41/+9
|\
| * mixer: make struct opaquewm42013-09-201-3/+3
| | | | | | | | Also remove stray include statements from ao_alsa and ao_oss.
| * mixer: restore volume with playback resumewm42013-09-201-2/+1
| | | | | | | | | | | | | | | | | | 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.
| * mixer: refactor, fix some aspects of --volume handlingwm42013-09-191-35/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor how mixer.c does volume/mute restoration and initialization. Move to handling of --volume and --mute to mixer.c. Simplify the implementation of these and hopefully fix bugs/strange behavior related to using them as file-local options (this uses a somewhat dirty trick: the option values are reverted to "auto" after initialization). Put most code related to initialization and volume restoring in probe_softvol() and restore_volume(). Having this code all in one place is less confusing. Instead of trying to detect whether to use softvol at runtime, detect it at initialization time using AOCONTROL_GET_VOLUME (same with mute, AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work if the GET variants work. Hopefully this is always the case. This is also preparation for being able to change volume/mute settings if audio is disabled, and for allowing restoring value with playback resume.
| * mixer: minor refactoringwm42013-09-191-7/+4
| | | | | | | | | | Let struct mixer access access MPOpts to simplify some things. Rename some variables and functions. There should be no functional changes.
* | mplayer: rename a somewhat misnamed functionwm42013-09-191-2/+2
|/
* Config path functions can return NULLwm42013-09-181-3/+5
| | | | | | | It's quite unlikely, but functions like mp_find_user_config_file() can return NULL, e.g. if $HOME is unset. Fix all the code that didn't check for this correctly yet.
* mplayer: read subtitle packets as soon as possiblewm42013-09-161-8/+5
| | | | | | | | | | | | | Call update_subtitles() on every iteration of the playloop, so that subtitle packets are read as soon as possible, instead of every time a video frame is displayed. This helps in case the packet queue is swamped with subtitle packets, which can happen with certain insane mkv files. The change will simply cause the subtitle queue to be emptied on each playloop iteration. The timestamps update_subtitles() uses for display are the same before and after this commit. (Important for files which have subtitle packets with timestamps or duration not set.)
* mplayer: attempt to skip playlist entries which can't be playedwm42013-09-151-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* mplayer: don't run heartbeat command while pausedwm42013-09-151-1/+1
| | | | | | | | This is commonly used to disable the screensaver with broken/non- standard X screensavers. During pause, the screensaver should not be disabled, so not calling this command while paused seems sensible. See github issue #236.
* mplayer: m_option: fix clang -Wformat compiler warningStefano Pigozzi2013-09-141-1/+1
| | | | Code was using %d format instead %zd to print size_t data.
* mplayer: print a message when writing watch_later config for resumewm42013-09-131-0/+2
|
* mplayer: change "Playing" message printed before playback startwm42013-09-131-1/+1
| | | | | Change it from "Playing file." to "Playing: file". The idea is that it looks nicer without that trailing dot. (See github issue #229.)
* core: restore user-set video and audio filters with resume functionalitywm42013-09-131-0/+2
| | | | | This requires adding a function that converts the filter list back to a string.
* core: add --deinterlace option, restore it with resume functionalitywm42013-09-131-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* input: convert to new msg APIStefano Pigozzi2013-09-101-1/+1
|
* mplayer: remove duplicated mouse autohide checkStefano Pigozzi2013-09-101-2/+0
|
* mplayer: print libquvi results in verbose modewm42013-09-101-0/+31
| | | | Helpful for debugging.
* quvi: restore playback position when switching formatswm42013-09-101-1/+2
| | | | This simply issues a seek after reloading.
* mplayer: mentioned --list-options in --help outputwm42013-09-101-1/+3
| | | | | | It's annoying for users if you can't get a list of options with --help, but on the other hand, printing all options would be overkill. So just mentioned --list-options.
* mplayer: cosmetics: split some code off of run_playloop()wm42013-09-081-117/+159
| | | | | | run_playloop() is already stuffed enough. This function is still quite big, but all the other code shares various variables, so it's not as easy to split.
* mplayer: add --cursor-autohide-fs-only optionwm42013-09-081-18/+23
| | | | | | | | This option makes the cursor always visible in windowed mode. Apparently, this is what (some?) Windows and OSX users expect. It's disabled by default for now. Restructure the cursor hide logic a bit for this purpose.
* options: cosmetics: move cursor_autohide_delay definitionwm42013-09-081-4/+4
| | | | No functional changes.
* mplayer: don't auto-load explicitly loaded subtitle fileswm42013-09-071-1/+7
| | | | | | | | | | | Even if a subtitle was explicitly loaded with -sub, it was still auto- loaded (if auto-loading applied to that file). Fix this by explicitly checking whether a file is already loaded. The check is maximal naive and just compares the filenames as strings. The change in find_subfiles.c is so that "-sub something.ass" happens to work (auto-loading prepended a "./" to it, so the naive filename comparison check didn't work).
* mplayer: remove unused mp_add_subtitles() parameterwm42013-09-071-3/+3
|
* command: make options writeable in idle modewm42013-09-071-0/+4
| | | | | | | | | | | | 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.
* mplayer: try to resume playback only if a resume file actually existswm42013-09-051-1/+1
| | | | | Well, this was dumb. The resume message was printed for every file, whether a resume config file existed or not.
* mplayer: print informative message when resuming playbackwm42013-09-041-0/+2
| | | | In particular, this informs the user how to disable this.
* mplayer: make --save-position-on-quit save only on quitwm42013-09-041-2/+1
| | | | | | | | | | | | When enabling --save-position-on-quit, playback position stored not only on quit, but in any case playback of a file was stopped. This includes going to the next file with playlist navigation commands. After some discussion on IRC, it turned out that nobody thought this was good behavior. Disable it, and really make it save only on quit. Maybe the option is useless now, as the user could remap the CLOSE_WIN key binding. On the other hand, CLOSE_WIN sounds and _is_ a bit obscure.
* mplayer: always write playback resume info, even at start/end of filewm42013-09-041-3/+3
| | | | | | | | | | | | | | | | | | Before this commit, the player didn't write resume info if the playback position was within the first or last percent of the file. This was sometimes annoying, and with playlist resume can lead to unintuitive behavior. (It wouldn't resume the playlist if the currently played file was at 0-1% or 99-100%, even if you were in the middle of a playlist.) Moreover, the "percent > 99" check is a bit bogus anyway, because 100 (in integer) is rarely reached. Drop the check, and make sure using --save-position-on-quit won't write resume info when reaching EOF. The latter check is needed to make sure playback of the file starts at beginning when playing it again after EOF.
* mplayer: allow resuming from playlistwm42013-09-041-1/+21
| | | | | | | | | | | | | | | | | | 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.
* path: add a common mp_is_url() functionwm42013-09-041-6/+3
| | | | Remove the duplicated code.
* mplayer: handle --reset-on-next-file=""wm42013-09-041-4/+6
| | | | | | | The option list contains an empty string member with this option value, so ignore that. I'm not sure whether the option list should maybe be empty in this case, but it could be the wrong thing in case of other options.
* mplayer: don't let playback resume force options that are file localwm42013-09-041