summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* player/command: add track-list/N/decoderKacper Michajłow44 hours1-0/+2
|
* player/command: add video-codec-info and audio-codec-infoKacper Michajłow4 days2-0/+10
| | | | | | | | | | | Adds support for extracting codec profile. Old properties are redirected to new one and removed from docs. Likely will stay like that forever as there is no reason to remove them. As a effect of unification of properties between audio and video, video-codec will now print codec (format) descriptive name, not decoder long name as it were before. In practice this change fixes what docs says. If you really need decoder name, use the `track-list/N/decoder-desc`.
* msg: use fwriteKacper Michajłow6 days1-6/+3
| | | | No need to recalc string length.
* msg: use defines for hide/restore cursor codeKacper Michajłow6 days1-2/+2
|
* msg: don't keep status line in partialKacper Michajłow6 days1-2/+2
| | | | | Noticed while looking at this code, we shouldn't append status line to partial when !print_term.
* m_property: add `>` for fixed precision floating-point expansionKacper Michajłow2024-03-212-0/+25
| | | | | | | | | | | | | | This enhancement makes it easier to create constant width property expansions, useful for the `--term-status-msg`. Additionally, it changes to `%f` printing with manual zero trimming, which is easier to control than `%g`. With this method, we can directly specify precision, not just significant numbers. This approach also avoids overly high precision for values less than 1, which is not necessary for a generic floating-point print function. A new print helper function is added, which can be used with adjusted precision for specific cases where a different default is needed. This also unifies the code slightly.
* msg: clear buffered status_line on flushKacper Michajłow2024-03-211-0/+1
| | | | It shouldn't be used after flush anymore.
* msg: simplify the line_skip calculationKacper Michajłow2024-03-211-13/+7
| | | | | | | | | | | Make it more straightforward by always calculating top offset first instead of having two branches, that tries to calc it directly. This also fixes missing negative check before `\033[%dA` which was in practice only problem on macOS which was handling negative values, while in fact it shouldn't. Fixes: #13484
* common/msg: fix warning: void function should not return void expressionnanahi2024-03-191-4/+7
|
* common/msg: fix warning: use of non-standard escape character '\e'nanahi2024-03-191-1/+1
|
* input/player: add loadfile/loadlist insert-at commandDavid Vaughan2024-02-262-2/+4
|
* player: change insert_next to insert_atDavid Vaughan2024-02-262-21/+10
| | | | | | | | | | Change the `playlist_insert_next` function to `playlist_insert_at` (ie, insert at the location of an entry, rather than after it, and rename to be clearer that it doesn't have anything to do with the currently-playing entry). Also, replace calls to `playlist_add` with calls to `playlist_insert_at`, since the former has become redundant.
* player: add loadfile insert-next commandsDavid Vaughan2024-02-262-0/+23
| | | | | | | | | | | | | This commit adds two new commands (`insert-next` and `insert-next-play`) which mirror the existing commands, `append` and `append-play` in functionality, with the difference that they insert directly after the current playlist entry, rather than at the end of the playlist. This change gives MPV a piece of functionality already found in (for example) Spotify's media player: "play next". Additionally, using the new `insert-next` command, users can trivially write a script to play a new piece of media immediately without otherwise clearing or altering the remainder of the playlist.
* encode_lavc: don't use deprecated `avcodec_close`llyyr2024-02-191-1/+1
| | | | Deprecated upstream https://github.com/FFmpeg/FFmpeg/commit/1cc24d749569a42510399a29b034f7a77bdec34e
* common: don't force terminal log buffer to small sizesfan52024-01-272-5/+41
| | | | | | | | | | | | Using the 'terminal-default' log level a client can request to get all messages that would normally appear on the terminal. 8c2d73f112055a9e52e5bda4934c2ac90e31def7 changed the size of the relevant buffer to 100 lines, which was prone to quickly overflowing once you enable verbose or debug output. This size is kept for the early terminal buffer but now enlarged once a client actually requests this log level. This fixes the overflow risk while not consuming more resources if this feature is unused.
* version.h.in: bump copyright yearnanahi2024-01-271-1/+1
|
* msg: reset status_lines when setting --really-quietGuido Cella2024-01-211-0/+6
| | | | | | | | | | This prevents mp_msg_flush_status_line() from printing an unnecessary newline when changing file after setting --really-quiet at runtime. If mpv is backgrounded, this newline garbles the output of TUI programs. With this change the cursor is not re-enabled after setting --really-quiet at runtime and quitting with mpv in the foreground, so enable it on uninit.
* common: stream: don't mention Libav in errors/warningsllyyr2024-01-202-3/+3
|
* terminal: don't print escape sequence if not ttyKacper Michajłow2024-01-151-1/+3
|
* msg: return zero length if bstr_split_utf8 failsKacper Michajłow2024-01-101-1/+1
| | | | | | | | | | In theory bstr_split_utf8 should skip invalid sequence and move further, but it doesn't do that currently, so just the string if unsuported code if found. Fixes infinite loop on code.len == 0 condition. Fixes: 5864b72d1a0aecd7e2d56e546fb615d291c88274
* msg: improve term_disp_width to support unicodeKacper Michajłow2024-01-041-13/+12
| | | | | | | All characters are assumed to be single-width. This is consistent with the rest of the code and documentation. Fixes: #13150
* msg: reduce nesting in mp_msg_flush_status_lineKacper Michajłow2023-12-271-18/+22
| | | | Cosmetic change only.
* msg: keep status line on the end of fileKacper Michajłow2023-12-272-3/+10
| | | | | | Apparently found useful by some users. Fixes: #13092
* common/av_log: do not assume AVClass.item_name is always setKacper Michajłow2023-12-241-1/+6
| | | | | | After recent change in FFmpeg it is not longer safe to call item_name. Ref: https://github.com/FFmpeg/FFmpeg/commit/0c6203c97a99f69dbaa6e4011d48c331e1111f5e
* playlist: correctly populate playlist-path with the --playlist optionDudemanguy2023-12-131-0/+1
| | | | | | | | | | When using the --playlist option on the commandline, it would mark all entries on the command as having the playlist-path of the value of that passed option, not just the ones that were expanded from it. Fix this by moving the playlist_populate_playlist_path to the same place where the playlist file gets expanded. Ref https://github.com/mpv-player/mpv/issues/13075#issuecomment-1852179164
* common/av_log: use bstr for log callbackKacper Michajłow2023-11-281-10/+14
| | | | | | - don't use 4KiB stack array - keep one bstr allocation for lifetime of the log - avoid dummy strlen
* build: restrict git describe to top level source directoryJan Palus2023-11-271-1/+4
| | | | | fix version determination when building mpv from release tarball extracted within another git repository
* common/msg: remove redundant checkKacper Michajłow2023-11-181-1/+1
| | | | It is already strcmp above, so cannot be NULL.
* msg: ensure status line is always visibleKacper Michajłow2023-11-081-1/+27
| | | | Restore last status line if it has been cleared by another message.
* msg: factor out print codeKacper Michajłow2023-11-081-52/+61
| | | | Will be useful for next commit.
* msg: convert dump_stats to bstrKacper Michajłow2023-11-081-5/+3
|
* msg: use bstr for partial msgKacper Michajłow2023-11-081-11/+6
|
* msg: check isatty separately per each streamKacper Michajłow2023-11-081-12/+29
|
* msg: refactor how terminal messages are printedKacper Michajłow2023-11-081-99/+156
| | | | | | | | | | | | - prepare string before printing - reduce amount of fflush(), especially for multiline messages - clear status line and keep it always at the bottom - indent module name to the longest value - disable cursor for status line - properly support wrapped status line Overall makes status line less flickering and remove stray status instead of scrolling them up.
* msg: don't mix partial log messages, with unrelated log levelsKacper Michajłow2023-11-081-9/+11
|
* mp_thread: add win32 implementationKacper Michajłow2023-11-051-1/+0
|
* mp_thread: prefer tracking threads with idKacper Michajłow2023-11-052-6/+6
| | | | | | | | | | | | | | This change essentially removes mp_thread_self() and instead add mp_thread_id to track threads and have ability to query current thread id during runtime. This will be useful for upcoming win32 implementation, where accessing thread handle is different than on pthreads. Greatly reduces complexity. Otherweis locked map of tid <-> handle is required which is completely unnecessary for all mpv use-cases. Note that this is the mp_thread_id, not to confuse with system tid. For example on threads-posix implementation it is simply pthread_t.
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-056-140/+125
|
* mp_threads: rename threads for consistent naming across all of themKacper Michajłow2023-10-271-1/+1
| | | | | | | | I'd like some names to be more descriptive, but to work with 15 chars limit we have to make some sacrifice. Also because of the limit, remove the `mpv/` prefix and prioritize actuall thread name.
* timer: remove MP_START_TIMENRK2023-10-271-2/+2
| | | | | instead require mp_raw_time_ns() to not return 0, which all current implementation already should follow.
* msg: make mp_msg_find_level case insensitiveKacper Michajłow2023-10-271-1/+1
|
* various: sort some standard headersNRK2023-10-202-6/+6
| | | | | | | | | | | | since i was going to fix the include order of stdatomic, might as well sort the surrouding includes in accordance with the project's coding style. some headers can sometime require specific include order. standard library headers usually don't. but mpv might "hack into" the standard headers (e.g pthreads) so that complicates things a bit more. hopefully nothing breaks. if it does, the style guide is to blame.
* various: remove ATOMIC_VAR_INITNRK2023-10-201-1/+1
| | | | | | | | | | | the fallback needed it due to the struct wrapper. but the fallback is now removed so it's no longer needed. as for standard atomics, it was never really needed either, was useless and then made obsolete in C17 and removed in C23. ref: https://gustedt.wordpress.com/2018/08/06/c17-obsoletes-atomic_var_init/ ref: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT
* osdep: remove atomic.hNRK2023-10-202-2/+2
| | | | | | | replace it with <stdatomic.h> and replace the mp_atomic_* typedefs with explicit _Atomic qualified types. also add missing config.h includes on some files.
* video/mp_image: handle non-power-of-two alignmentNiklas Haas2023-10-191-0/+4
| | | | Needed for odd formats like rgb24.
* common: add mp_lcm helperNiklas Haas2023-10-192-0/+8
|
* common/tags: add mp_tags_move_from_av_dictionary()Claude Heiland-Allen2023-10-182-0/+9
| | | | | | | | | | Abstracts a common pattern, in which the av dictionary is cleared immediately after copying to mp tags, so that additional tags later in the stream get appended to empty tags, instead of being appended to existing tags that were already copied.
* stats: convert timers to nanosecondsDudemanguy2023-10-161-10/+10
|
* command: fix segfault with playlist-{next,prev}-playlistGuido Cella2023-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | This was wrongly assuming that playlist_path is always set for the current playlist entry, but it's only set when a file was added by expanding a playlist. The crash in playlist_get_first_in_next_playlist can be reproduced with mpv foo.mkv foo.zip, playlist-next, playlist-prev, playlist-next-playlist. You need to run playlist-next, playlist-prev first because foo.zip's playlist_path is NULL until you do that, which makes playlist_get_first_in_next_playlist return immediately. The crash in cmd_playlist_next_prev_playlist can be replicated with mpv --loop-playlist foo.zip foo.mkv, running playlist-next until foo.mkv, and playlist-play-next. Again, you need to open foo.zip first or its playlist_path is NULL which skips running strcmp(entry->playlist_path, mpctx->playlist->current->playlist_path). Fixes https://github.com/mpv-player/mpv/issues/12495#issuecomment-1760968608
* command: add playlist-next-playlist and playlist-prev-playlistGuido Cella2023-10-092-0/+72
| | | | | | | | | | | | playlist-prev-playlist goes to the beginning of the previous playlist because this seems more useful and symmetrical to playlist-next-playlist. It does not go to the beginning when the current playlist-path starts with the previous playlist-path, e.g. with mpv --loop-playlist foo/, which expands to foo/{1..9}.zip, the current playlist path foo/1.zip beings with the playlist-path foo/ of {2..9}.zip and thus playlist-prev-playlist goes to 9.zip rather than to 2.zip. Closes #12495.
* loadfile: fix an old wonky playlist heuristicDudemanguy2023-10-051-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2c6a3cb1f27e02b2e66390a2465ab648905a64d0 originally added this struct member and then 1be863afdbe9017aa227234e8525b209fb818224 later added some more logic to loadfile that uses this. There's been more changes since then of course, but bits using playback_short and playback_start have mostly stayed the same. It's a bit strange it's worked this way for so long since it makes an assumption on how long files should be and leads to weird, broken behavior on playlists with shorter videos. The main reason for playlist_short, as far as I can tell, is to deal with some fringe cases with short videos and trying to go back in the playlist. More specifically, if you use --loop=inf on a very short video (say less than 1 second) and try to go back in the playlist, you won't be able to without any of this special logic that deals with it. But the current approach has several side effects like going back multiple items in the playlist instead of just one if the video is less than one second. This is just bad so delete everything related to playlist_short and playlist_start. Instead, let's handle this by keeping track of playlist-prev attempts. Going forward in the playlist doesn't require any special handling since a bad/broken file will just advance to the next one. So it's only going backwards that requires some special consideration. If we're going backwards and the user isn't using force, then mark the playlist entry with a special flag. If the file loads successfully in play_current_file, we can just clear the flag and not worry about it. However if there's a failure, then we set a bool telling play_current_file that it should go back one more item in the playlist if possible and try again. This way, we avoid the previously mentioned --loop=inf edgecase and the user can still attempt to retry previously failed items in the playlist (like a url or such). Fixes #6576, fixes #12548.
* msg: use nanosecond precisionDudemanguy2023-09-291-3/+3
| | | | | | | | | | The timestamps when making a log file is actually dependent on MP_START_TIME. This is a 10 microsecond offset that was added to the timer as an offset. With the nanosecond change, this unit needs to be converted as well so the offset is the same as before. After doing that, we need to change the various mp_time_us calls in msg to mp_time_ns and do the right conversion. This fixes the logs timestamps (i.e. so they aren't negative anymore).
* win32/pthread: define _POSIX_TIMERS to notify they are not supportedKacper Michajłow2023-09-291-2/+1
|
* recorder: fix a couple of memory leaksDudemanguy2023-09-261-7/+16
| | | | Not sure how long these have been around but it leaked on every packet.
* options: remove a few options marked with .deprecation_messageDudemanguy2023-09-213-23/+0
| | | | | | | | | | | A bit different from the OPT_REPLACED/OPT_REMOVED ones in that the options still possibly do something but they have a deprecation message. Most of these are old and have no real usage. The only potentially controversial ones are the removal of --oaffset and --ovoffset which were deprecated years ago and seemingly have no real replacement. There's a cryptic message about --audio-delay but who knows. The less encoding mode code we have, the better so just chuck it.
* options: remove ancient option fallbacks/deprecationDudemanguy2023-09-211-7/+0
| | | | | | | | | | | | | We've got an ungodly amount of OPT_REPLACED and OPT_REMOVED sitting around in the code. This is harmless, but the vast majority of these are ancient. 26f4f18c0629998a9b91e94722d166866d8b80a3 is the last commit that touched the majority of these and of course that only changed how options were declared so all of this stuff was deprecated even before that. No use in keeping these, so just delete them all. As an aside, there was actually a cocoa_opts but it had only a single option which was replaced by something else and empty otherwise. So that entire thing was just simply removed. OPT_REPLACED/OPT_REMOVED declarations that were added in 0.35 or later were kept as is.
* various: add missing include in header fllesllyyr2023-09-211-0/+1
| | | | Mostly cosmetic
* vo: add --video-cropKacper Michajłow2023-08-312-0/+32
| | | | | | Just cropping by VO that works with hwdec. Fixes: #12222
* common: constify mp_rect_equalsKacper Michajłow2023-08-312-2/+2
|
* playlist: remove unused code to track redirectsGuido Cella2023-08-282-19/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that the code to track redirects (playlists and directories) never worked correctly, only the last redirect is remembered and num_redirects is never greater than 1. You can see this by doing quit-watch-later with the old watch later system, before dbf244fd2f, on a m3u playlist of files and a m3u playlist of directories. Only in the first case a redirect entry for the m3u file is created, because in the second case the m3u redirect is replaced by the directory one. If you did mpv --directory-mode=lazy /foo it did create redirect entries for all subdirectories e.g. /foo/bar, /foo/bar/baz, /foo/bar/baz/qux, this made it seem like it worked correctly, but actually /foo/bar/bar/qux was the only redirect entry and thus it was considered as the first redirect, and mpv created redirect entries for each segment of the first redirect only. In the previous commit dbf244fd2f, rather than figuring out how to fix the code to track redirects, and since creating redirect entries for multiple redirects is overkill, I just used the new playlist-path property which does the same thing but only for the last redirect. By replacing the only other use of the old redirect code with playlist-path, we can remove it.
* player: add playlist-path propertiesDudemanguy2023-08-132-0/+10
| | | | | | | | | | | | A bit of a long standing pain with scripting is that when opening a file that gets interpreted as a playlist (like an m3u), the original path of the file gets thrown away later. Workarounds basically consist of getting the filename before mpv expands the path, but that's not really reliable. Instead of throwing it away, save the original playlist path by copying to the playlist entries when applicable (demuxer playlist and the playlist option). Then expose these as properties: playlist-path for the currently playing entry and playlist/N/playlist-path for each specific entry. Closes #8508, #7605.
* version: move NO_BUILD_TIMESTAMPS check to version.h.inKacper Michajłow2023-08-022-5/+5
|
* build: remove version.pyKacper Michajłow2023-08-022-0/+11
| | | | | | | | | | | | | After second thought version.py does not do anything useful. Meson has built-in function vcs_tag that mostly replicate what version.py did. For the build time we can just use __DATE__ and __TIME__. Of course this changes time string format a little, but in my opinion it looks nicer in fact. Also it will use local time, instead UTC. But I would argue that date string is only informative for users to check how old the specific mpv build is. It doesn't have to be precise, it weren't for years anyway before recent change.
* build: remove outdated generated directoryDudemanguy2023-07-311-1/+1
| | | | | | | | | | | | | | | | This only existed as essentially a workaround for meson's behavior and to maintain compatibility with the waf build. Since waf put everything in a generated subdirectory, we had to put make a subdirectory called "generated" in the source for meson so stuff could go to the right place. Well now we don't need to do that anymore. Move the meson.build files around so they go in the appropriate place in the subdirectory of the source tree and change the paths of the headers accordingly. A couple of important things to note. 1. mpv.com now gets made in build/player/mpv.com (necessary because of a meson limitation) 2. The macos icon generation path is shortened to TOOLS/osxbundle/icon.icns.inc.
*