summaryrefslogtreecommitdiffstats
path: root/player/configfiles.c
Commit message (Collapse)AuthorAgeFilesLines
* player: fix watch later config comments when ignoring pathGuido Cella2024-02-241-2/+5
| | | | | | | | | | | | | With --ignore-path-in-watch-later-config, --write-filename-in-watch-later-config still writes the absolute path of files in the comment, even though the hash is calculated from the basename. Make it write the basename to avoid confusion. Also stop writing redirect entries for parent directories with --ignore-path-in-watch-later-config, both because it's redundant, and because with this patch it would write the basename of directories in the comment, which would be wrong because their hashes are calculated from the absolute paths.
* options: rename --watch-later-directory to --watch-later-dirDudemanguy2023-10-251-1/+1
| | | | Same logic as the previous commit.
* player: always write redirect entries for resuming playbackGuido Cella2023-08-281-36/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 35f43dfacbe added a system to write resume files for redirects, i.e. directories and playlists that mpv expands. It creates a resume file for each redirect, and for the first redirect only, it writes a resume file for each segment of its path, without even converting it to an absolute path if it's relative. This is incomplete: mpv 'Iron Maiden/1982 The Number of the Beast/8 Hallowed Be Thy Name.mp3' This doesn't save any redirect entry. mpv --directory-mode=recursive 'Iron Maiden', then quit-watch-later on Hallowed Be Thy Name This saves a redirect entry for "Iron Maiden", but not for "1982 The Number of the Beast". It doesn't save redirect entries for the directories above "Iron Maiden" either because "Iron Maiden" isn't converted to an absolute path. In both of these cases mpv --directory-mode=lazy 'Iron Maiden' won't resume from "Hallowed Be Thy Name" because "1982 The Number of the Beast" isn't the first subdirectory and there is no redirect entry for it. 503dada42f made mpv recursively expand subdirectories precisely to fix this, and f266eadf1e added back an option not to expand them. But if we fix how redirect entries are stored, we can make the superior --directory-mode=lazy (because it's faster and doesn't result in massive playlists) the default, and also ensure that mpv will resume playback even when you quit-watch-later a file without redirects and then play the directories above it. Fix this by always creating redirect entries for all segments of the absolute path of the file, so that both mpv 'Iron Maiden/1982 The Number of the Beast/8 Hallowed Be Thy Name.mp3' and mpv --directory-mode=lazy 'Iron Maiden' will create redirect entries for /$USER /$USER/music /$USER/music/Iron Maiden /$USER/music/Iron Maiden/1982 The Number of the Beast making mpv --directory-mode=lazy "Iron Maiden" resume from "Hallowed Be Thy Name". This commit also makes mpv delete the redirect entries of parent directories when resuming playback, because if for example you have a playlist with all the songs in a discography: 1980 Iron Maiden/1 Prowler.mp3 1980 Iron Maiden/2 Remember Tomorrow.mp3 ... 1981 Killers/1 The Ides of March.mp3 1981 Killers/2 Wrathchild.mp3 ... Now mpv will eventually create redirect entries for every album. If you later decide to play the directories instead and there are 20 albums, you would have to do mpv * 20 times to clear all the redirect entries.
* player: delete watch_later file after successful loadDudemanguy2023-07-081-4/+6
| | | | | | | | | | Currently, mpv immediately deletes the watch_later file after an attempt at playing the file is made. This is not really ideal because the file may fail to load for a variety of reasons (including not even existing), but the state is cleared anyway unconditionally. Instead, just wait until after playback is successfully initialized before deleting it. This way silly mistakes like forgetting to mount the drive doesn't result in deleting your watch_later data. Fixes #3427.
* player: improve diagnostics around writing watch_later filessfan52023-05-211-2/+4
|
* player: use XDG_STATE_HOME for watch_laterDudemanguy2023-05-091-16/+16
| | | | | | | | | | | | | | | | | | A pain point for some users is the fact that watch_later is stored in the ~/.config directory when it's really not configuration data. Roughly 2 years ago, XDG_STATE_DIR was added to the XDG Base Directory Specification[0] and its description, user-specific state data, actually perfectly matches what watch_later data is for. Let's go ahead and use this directory as the default for watch_later. This change only affects non-darwin unix-like systems (i.e. Linux, BSDs, etc.). The directory doesn't move for anyone else. Internally, quite a few things change with regards to the path selection. If the platform in question does not have a statedir concept, then the path selection will simply return "home" instead (old behavior). Fixes #9147. [0]: https://gitlab.freedesktop.org/xdg/xdg-specs/-/commit/4f2884e16db35f2962d9b64312917c81be5cb54b
* path: expand internal path selection API to allow for additional typesDudemanguy2023-05-091-3/+3
| | | | | | | | Currently, nothing new is actually implemented but the idea is simply to just pass a type string all the way up from mp_find_user_file down to actually getting the platform path. This allows for selecting different directories besides the user's native config directory. See the next commit for an implementation.
* options: read config file as streamThomas Weißschuh2023-04-291-2/+2
| | | | | This aligns the possible sources of config files other loaded data. For example `--input-conf`.
* various: drop unused #include "config.h"Thomas Weißschuh2023-02-201-1/+0
| | | | | | Most sources don't need config.h. The inclusion only leads to lots of unneeded recompilation if the configuration is changed.
* player: don't force saving start in watch-later-optionsDudemanguy2023-01-091-2/+7
| | | | | | | | | | | | The watch-later mechanism has always unconditionally wrote start to files to save the playback position. When this was later expanded to watch-later-options, this logic was kept in place. But we don't actually have to unconditionally write this and can allow users to remove the option from the list if they want to. The start value still requires some special handling; it should always be written if possible regardless of the value changing. However, we can just place it within the default set of options for watch-later-options so it can be removed like any other.
* options: add watch-later-optionsGuido Cella2021-07-211-74/+14
| | | | | | | | | | This allows configuring which options are saved by quit-watch-later. Fixes #4126, #4641 and #5567. Toggling a video or audio filter twice would treat the option as changed because the backup value is NULL, and the current value of vf/af is a list with one empty item, so obj_settings_list_equal had to be changed.
* player: fix property nameGuido Cella2021-06-241-1/+1
| | | | | | | | | | | | | Commits 4d1ffec and 6e481d0 renamed sub-ass-style-override to sub-ass-override. But in commit bd603c2, when renaming it in quit-watch-later's backup_properties, which determines which properties are saved by quit-watch-later/write-watch-later-config, it was incorrectly renamed to sub-style-override instead, and thus never got saved even if modified at runtime. Instead mpv attempted to save the non-existing property "sub-style-override", but since no error is raised when saving non-existing properties with quit-watch-later, no one noticed it. This commit renames the saved property to the correct new name "sub-ass-override" so that it does get saved.
* command: add delete-watch-later-configVladimir Panteleev2020-10-221-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the delete-watch-later-config command, to complement write-watch-later-config. This is an alternative to #8141. The general problem that this change is attempting to help solve has been described in #336, #3169 and #6574. Though persistent playback position of a single file is generally a solved problem, this is not the case for playlists, as described in #8138. The motivation is facilitating intermittent playback of very large playlists, consisting of hundreds of entries each many hours long. Though the current "watch later" mechanism works well - provided that the files each occur only once in that playlist, and are played only via that playlist - the biggest issue is that the position is lost completely should mpv exit uncleanly (e.g. due to a power failure). Existing workarounds (in the form of Lua scripts which call write-watch-later-config periodically) fail in the playlist case, due to the mechanism used by mpv to determine where within a playlist to resume playback from. The missing puzzle piece needed to allow scripts to implement a complete solution to this problem is simply a way to clean up the watch-later configuration that the script asked mpv to write using write-watch-later-config. With that in place, scripts can then register an end-file event listener, check the stop playback reason, and in the "eof" and "stop" case, invoke delete-watch-later-config to delete any saved positions written by write-watch-later-config. The script can then proceed to immediately write a new one when the next file is loaded, which altogether allows mpv to resume from the correct playlist and file position upon next startup. Because events are delivered and executed asynchronously, delete-watch-later-config takes an optional filename argument, to allow scripts to clear watch-later configuration for files after mpv had already moved on from playing them and proceeded to another file. A Lua script which makes use of this change can be found here: https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef (A modification of the one written by @Hakkin, in that this one takes advantage of the new command, and also saves the state immediately when a new file is loaded.)
* player: warn if both proper and compat. config directories existwm42020-06-251-2/+11
| | | | | No idea why there's logic to add them all to the search path, so "both" are used. In any case, this isn't something anyone should use.
* player: fix minor coding style issuewm42020-01-261-1/+2
|
* player: check if file is URL before attempting to get mtimeChris Down2020-01-261-2/+5
| | | | | | I noticed an oversight when using ytdl-hook -- if the path is a URL, we try to `stat()` it, which obviously doesn't work. To mitigate that, don't check or update mtimes for URLs.
* player: write watch-later config even for unseekable streamswm42020-01-171-5/+7
| | | | | | | | | | | | I think there was a user complaint that this does not restore the playlist position. There's no reason not to save the "state" for unseekable streams; what we probably don't want is to make restoring trying to issue a seek. So just don't save the position. (Although we probably could anyway, since seek requests on unseekable streams are ignored now.) Fixes: issue number forgotten, if it even exists.
* configfiles: Fix utime retcode checkChris Down2019-12-311-1/+1
| | | | | In final fixups for #7139 it seems I managed to screw up utime error checks. Everything still works, but we MP_WARN when we don't need to.
* playlist: change from linked list to an arraywm42019-12-281-1/+2
| | | | | | | | | | | | | | | | | | | Although a linked list was ideal at first, there are cases where it sucks, and became increasingly awkward (with the mpv command API preferring integer indexes to access the list). In future, we probably want to add more playlist-related functionality, so better change it to an array now. An array isn't always ideal either. Since playlist entries are still separate objects (because in some cases you need a stable "iterator" to it), but you still need to efficiently get the next/previous playlist entry, there's a pl_index field, that needs to be maintained. E.g. adding an entry at the start of the playlist => update the pl_index field for all other entries. Well, it's not really worth to do something more complicated to avoid these things. This commit is probably buggy as shit. It's not like I bothered to test everything. That's _your_ role.
* player: Optionally validate st_mtime when restoring playback stateChris Down2019-11-201-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I often watch sporting events. On many occasions I get files with the same filename for each session. For example, for F1 I might have the following directory structure: F1/ FP1.mkv FP2.mkv FP3.mkv Qualification.mkv Race.mkv Since usually one simply watches one race after the other, I usually just rsync the new event's files over the old ones, so, for example, Race.mkv will be replaced from the file for the last event with the file from the new event. One problem with this is that I like to use --resume-playback for other kinds of media, so I have it on by default. That works great for, say, a movie, but doesn't work so well with this scheme, because you can trivially forget to pass --no-resume-playback on the command line and end up 2 hours in, watching spoilers as the race results scroll down the screen :-) This patch adds a new option, --resume-playback-check-mtime, which validates that the file's mtime hasn't changed since the watch_later configuration was saved. It does this by setting the watch_later configuration to have the same mtime as the file after it is saved. Switching back and forth between checking mtime and not checking mtime works fine, as we only choose whether to compare based on it, but we update the watch_later configuration mtime regardless of its value.
* options: remove M_SETOPT_RUNTIMEwm42019-11-101-2/+1
| | | | | | | Used to contain flags for "save" setting of options at runtime. Now there is nothing special needed anymore and it's 0. So drop it completely, and remove anything that distinguishes between runtime and initialization time.
* player: update for --video-aspect deprecationNiklas Haas2019-10-041-1/+1
| | | | We had some dangling references to this option.
* Remove optical disc fancification layerswm42019-09-131-5/+0
| | | | | | | | | | | | | | | | | This removes anything related to DVD/BD/CD that negatively affected the core code. It includes trying to rewrite timestamps (since DVDs and Blurays do not set packet stream timestamps to playback time, and can even have resets mid-stream), export of chapters, stream languages, export of title/track lists, and all that. Only basic seeking is supported. It is very much possible that seeking completely fails on some discs (on some parts of the timeline), because timestamp rewriting was removed. Note that I don't give a shit about optical media. If you want to watch them, rip them. Keeping some bare support for DVD/BD is the most I'm going to do to appease the type of lazy, obnoxious users who will care. There are other players which are better at optical discs.
* player: remove deprecated vo/ao auto profileswm42018-05-311-9/+0
| | | | | These were deprecated almost 2 years ago. Now they happen to be in the way.
* player: silence config file loading message on resumingwm42018-01-131-6/+7
| | | | | | This is just an implementation detail; seems to be ugly to log it by default. Other cases of the try_load_config() function should be logged, though.
* player: change default section when loading encoding-profiles.confwm42017-07-121-3/+3
| | | | | | | It used to use the "encoding" section. Change this to the default section to remove another small special case. encoding-profiles.conf didn't use this by default anyway. The previous revert could mitigate potential impacts of this a little.
* Revert "player: always load encoding-profiles.conf"wm42017-07-121-3/+3
| | | | | | | | | | This reverts commit 0dcb51c7fa2c676ec30f2bac216f904dfc4ffa6f. I randomly decided that this was better. It can be re-applied once it actually becomes necessary in some way. Note that this worked fine. My main gripe with this is that it can spam the log file with encoding stuff even if playback mode is used.
* player: document where the magic "encoding" section name is usedwm42017-06-261-0/+1
|
* player: always load encoding-profiles.confwm42017-06-261-3/+3
| | | | | | | | | | | This makes things like --show-profile=enc-v-h264 just work again. Currently I don't see a reason why we should not always load the encoding profiles. Although I guess this used to be different in the past. (It probably won't take long until I revert this again - seems like a fight you can't win for some reason.) Fixes #4551.
* player: change license of most core files to LGPLwm42017-06-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These files have all in common that they were fully or mostly taken from mplayer.c. (mplayer.c was a huge file that contains almost all of the playback core, until it was split into multiple parts.) This was probably the hardest part to relicense, because so much code was moved around all the time. player/audio.c still does not compile. We'll have to redo audio filtering. Once that is done, we can probably actually provide an actual LGPL configure switch. Here is a relatively detailed list of potential issues: 8d190244: author did not reply, parts were made GPL-only in a previous commit. 7882ea9b: author could not be reached, but the code is gone. wscript still has --datadir switch, but I don't think this is relevant to copyright. f197efd5: unclear origin, but I consider the code gone anyway (replaced with generic OSD mechanisms). 8337d9c2: author did not reply, but only the option still exists (under a different name), other code was removed. d8fd7131: did not reply. Disabled in a previous commit. 05258251: same author as above. Both fields actually seem to have vanished (even when tracking renames), so no action taken. d459e644, 268b2c1a: author did not reply, but we reuse only the options (with different names and slightly or fully different semantics, and completely different implementations), so I don't think this is relevant for copyright. 09e742fe, 17c39c4e: same as above. e8a173de, bff4b3ee: author could not be reached. The commands were reworked to properties, and the code outside of the TV code were moved back to the TV code. So I don't think copyright applies to the current command.c parts (mp_property_tv_color, mp_property_tv_freq, mp_property_tv_scan). The TV parts remain GPL. 0810e427: could not be reached. Disabled in a previous commit. 43744a2d: unknown author, but this was replaced by dynamic alloc (if the change is even copyrightable). 116ca0c7: unknown author; reasoning see input.c relicensing commit. e7e4d1d8: these semantics still exist, but as generic code, and this code was fully removed. f1175cd9: the author of the cited patch is unknown, and upon inspection it turns out that I was only using the idea to pause the player on EOF, so I claim it's not copyright relevant. 25affdcc: author could not be reached (yet) - but it's only a function rename, not copyrightable. 5728504c was committed by Arpi (who agreed), but hints that it might be by a different author. In fact it seems to be mostly this patch: http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2001-November/002041.html The author did not respond, but it all seems to have been removed later. It's a terrible mess though. Arpi reverted the A-V sync code at first, but left the RTC code for a while. The following commits remove these changes 100%: 14b35442, 7181a091, 31482783, 614f8475, df58e822. cehoyos did explicitly not agree to LGPL, but was involved in the following changes: c99d8fc8: applied a patch and didn't modify it, the original author agreed. 40ac0d31: author could not be reached, but all code is gone anyway. The "af" command has a similar function, but works completely different and actually reuses a mechanism older than this patch. 54350436: applied a patch, but didn't modify it, except for adding a German translation, which was removed later. a2dda036: same situation as above 240b743e: this was made GPL-only in a previous commit 7b25afd7: same as above (for now) kirijua could not be reached, but was a regular patch contributor: c2c997fd: video equalizer code move; probably not copyrightable. Is GPL due to Nick anyway. be54f481: technically, this became the audio track property later. But all what is left is the fact that you pass a track ID to it, so consider the original coypright non-relevant. 2f376d1b: this was rewritten in b7052b43, but for now we can afford to be careful, so this was marked as GPL only in a previous commit. 43844d09: remaining parts in main.c were reverted in a previous commit. anders has mostly disagreed with the LGPL relicensing. Does not want libaf to become LGPL, but made some concessions. In particular, he granted us permission to relicense 4943e9c52c and 242aa6ebd4. We also consider some of his changes remaining in mpv not relevant for copyright (such as 735de602 - we won't remove the this option completely). We will completely remove his other contributions, including the entire audio filter chain. For now, this stuff is marked as GPL only. The remaining question is how much code in player/audio.c (based on the former mplayer.c and dec_audio.c) is under his copyright. I made claims about this in a previous commit. Nick(ols) Kurshev, svn username "nick" and "nickols_k", could not be reached. He had a lot of changes in early MPlayer. It seems all of that was removed, at least in mpv. His main work, like VIDIX or libswscale work, does not exist in mpv anymore, but the changes to mplayer.c and other core parts still deserve attention: a4119f6b, fb927549, ad3529b8, e11b23dc, 5f2178be, 93c371d5: removed in b43d67e0, d1628d12, 24ed01fe, df58e822. 0a83c6ec, 104c125e, 4e067f62, aec5dcc8, b587a3d6, f3de6e6b: DR, VAA, and "tune" stuff was fully removed later on or replaced with other mechanisms. 340183b0: screenshots were redone later (the VOCTRL was even removed, with an independent implementation using the same VOCTRL a few years later), so not relevant anymore. Basically only the 's' shortcut remains (but not its implementation). 92c5c274, bffd4007, 555c6766: for now marked as GPL only in a previous commit. Might contain some trace amounts of "michael"'s copyright, who agreed to LGPL only once the core is relicensed. This will still be respected, but I don't think it matters at this in this case. (Some code touched by him was merged into mplayer.c, and then disappeared after heavy refactoring.) I tried to be as careful and as complete as possible. It can't be excluded that amends to this will be made later. This does not make the player LGPL yet.
* options: another missed --sub-ass-style-override usewm42017-06-071-1/+1
| | | | Dammit.
* player: fix potential segfault when playing dvd:// with DVD disabledwm42017-05-011-1/+1
| | | | | | | Tries to access the options, which are obviously not allocated if there is no DVD support compiled. Fixes #4393.
* player: fix previous commitwm42016-10-031-3/+3
| | | | ...
* player: remove some explicit options accesses when saving resume filewm42016-09-221-29/+26
| | | | | | | | | | | | | Basically, make use of all the new code. Unfortunately, the new code and it's "compromise semantics" with the old behavior before the options/properties merge bites back: this vid/aid/sid, deinterlace, and video-aspect properties have neutral default settings (such as "auto"), but return the current value during playback, so we would unnecessarily force this value when playback is resumed. So leave those as they are. Also, the colormatrix options were removed a long time ago.
* player: some M_SETOPT_RUNTIME cleanupswm42016-09-221-1/+2
| | | | | | | | | 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.
* player: add --watch-later-directory optionDavid Logie2016-09-221-2/+10
| | | | | | | This option allows the user to set the directory where "watch later" files are stored. Signed-off-by: wm4 <wm4@nowhere>
* player: Save sub-speed value when resuming playbackVladimir Panteleev2016-09-131-0/+1
|
* stream_dvd, stream_dvdnav: remove weird option parsing stuffwm42016-09-081-2/+2
| | | | | | Same deal as with stream_bluray. Untested because I don't give a fuck about your shitty DVDs.
* config: deprecate ao and vo auto-profileswm42016-09-031-0/+2
| | | | | | | | | These never made any sense. They checked the --vo/--ao option, and applied the profile corresponding to the first entry. So the only way to get any use of those was to use the --ao or --vo option explicitly. You can get the same functionality by making a manual profile, making these force the ao/vo, and then using --profile on command line instead of --vo/--ao.
* options: make mp_vo_opts options an actual sub-option groupwm42016-08-301-2/+2
| | | | | | | | | | | Just a minor refactor along the planned option change. This commit will make it easier to update (i.e. copy) the VO options without copying _all_ options. For now, behavior should be equivalent, though. (The VO options were put into a separate struct quite early - when all global variables were removed from the source code. It wasn't clear whether the separate struct would have any actual purpose, but it seems it will now. Awesome, huh.)
* audio: drop --softvol=no and --softvol=autowm42016-07-091-1/+2
| | | | | | | | | | | | | | Drop the code for switching the volume options and properties between af_volume and AO volume controls. interface-changes.rst mentions the changes in detail. Do this because this was exceedingly complex and had other problems as well. It was also very hard to test. It's just not worth the trouble. Some leftovers like AOCONTROL_HAS_PER_APP_VOLUME will be removed at a later point. Fixes #3322.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111