summaryrefslogtreecommitdiffstats
path: root/misc
Commit message (Collapse)AuthorAgeFilesLines
* misc/jni: reduce duplication in mapping structsfan52024-02-282-6/+6
| | | | | 'name' was in fact unused when reading fields or methods, so it can be merged with 'method'. Also changed the type of 'mandatory' to bool.
* misc/jni: introduce macros for deleting referencessfan52024-02-282-20/+20
|
* misc/jni: general code cleanup and refactorsfan52024-02-281-155/+119
| | | | Make it align with mpv's coding conventions in general and avoid unecessary Lavu use.
* options/path: move path utility functions to misc/path_utilsnanahi2024-02-232-0/+283
| | | | | These utility functions have nothing to do with user and config dir/file. Move them to a separate file.
* osdep/io: move I/O utility functions to misc/io_utilsnanahi2024-02-232-0/+112
| | | | | | | The purpose of osdep/io is to provide a wrapper for POSIX I/O functions on Windows. The last 2 functions are utility functions which don't serve this purpose. Move them to a separate file.
* various: replace dead links in commentsnanahi2024-02-111-1/+1
| | | | | Replace various dead links with live replacements or archives. Less friction for anyone who wants to look up these references.
* timer: remove unnecesary time conversionsKacper Michajłow2023-11-051-1/+1
|
* mp_thread: prefer tracking threads with idKacper Michajłow2023-11-052-9/+11
| | | | | | | | | | | | | | 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-057-144/+143
|
* various: sort some standard headersNRK2023-10-201-2/+2
| | | | | | | | | | | | 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-201-1/+1
| | | | | | | 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.
* thread_tools: suppress -Wstringop-overflow false-positiveKacper Michajłow2023-10-191-0/+7
|
* charset_conv: suppress unused-label warningKacper Michajłow2023-10-191-1/+2
|
* dispatch: change mp_dispatch_queue_process timer to nanosecondsDudemanguy2023-10-161-2/+2
| | | | | The playloop is the only thing that adjusts the timeout with a value other than 0, so nothing else needs to be changed.
* demux: change the default of metadata-codepage to autoDudemanguy2023-10-071-1/+2
| | | | | | | There's really no reason not to do this especially since sub-codepage already defaults to auto. Also change logging in charset_conv since telling us that the data is UTF-8 if the passed codepage value is "auto" or "utf-8" is really not useful information (that's the expectation).
* charset_conv: remove ancient warning about deprecated syntaxDudemanguy2023-10-071-12/+0
| | | | | wm4 removed this in 4adfde5dd1e67775228a345cea00ea03ba6bc68f and left a warning. Nobody needs to know that enca:pl used to work.
* timer: rename mp_add_timeout to reflect what it actually doesKacper Michajłow2023-09-291-1/+1
|
* timer: rename mp_time_us_to_timespec to reflect what it actually doesKacper Michajłow2023-09-291-1/+1
|
* various: add missing include in header fllesllyyr2023-09-211-0/+1
| | | | Mostly cosmetic
* meson: include our local copy of libavutil uuid if ffmpeg is too oldPhilip Langdale2023-09-041-2/+2
| | | | | | | | | In the previous change, I added the uuid files. In this change, we check the libavutil version and if it's too old, we compile in our local copy. We have to change the include paths of the uuid code to find some other libavutil headers, but nothing beyond that.
* misc: add copy of uuid from ffmpegPhilip Langdale2023-09-042-0/+287
| | | | | | | | | | | To avoid taking a dependency on ffmpeg 5.1 before we're ready (we need a newer Ubuntu LTS release to drop ffmpeg 4.x support), ut not force us to wait to add support for picking Vulkan devices by UUID, I'm copying the uuid code from ffmpeg into mpv. It's one file with no private dependencies, so it's easier to copy than to reimplement in any other way. Licence is LGPL so matches us.
* json: unify json_parse depth to MAX_JSON_DEPTH=50cvzi2023-07-081-0/+2
|
* osdep: add mp_get_user_langsrcombs2023-06-251-0/+2
|
* misc: add language-matching utilitiesrcombs2023-06-252-0/+391
|
* charset_conv: fix memory corruption in mp_iconv_to_utf8low-batt2023-04-291-0/+3
| | | | | | | | | | | | | | | If mp_iconv_to_utf8 was given an empty string to convert in the buf parameter it would corrupt memory when writing a null into outbuf before returning it to the caller. This happened when streaming from a URL that ends in a slash. For such a URL the method mp_basename returns an empty string. The method append_dir_subtitles passes the result returned from mp_basename to mp_iconv_to_utf8 which then corrupts memory. This was detected using Guard Malloc. The fix changes mp_iconv_to_utf8 check up front if buf is empty and if it is return buf as the result in compliance with the documented behavior of the method when no conversion is needed. Fixes #11626
* various: fix various typos in the code baseAlexander Seiler2023-03-281-1/+1
| | | | Signed-off-by: Alexander Seiler <seileralex@gmail.com>
* misc/node: add bstr-based variants for map_get() and map_add()rcombs2023-01-282-2/+16
|
* misc/json: don't wrap top-level pretty strings/infs in quotesrcombs2023-01-281-2/+5
| | | | This makes pretty-printing nodes substantially more friendly.
* various: replace abort() with MP_ASSERT_UNREACHABLE() where appropriatesfan52023-01-121-1/+1
| | | | | | | | In debug mode the macro causes an assertion failure. In release mode it works differently and tells the compiler that it can assume the codepath will never execute. For this reason I was conversative in replacing it, e.g. in mpv-internal code that exhausts all valid values of an enum or when a condition is clear from directly preceding code.
* misc/random: add xoshiro random number implementationLeo Izen2022-08-172-0/+116
| | | | | | | Add xoshiro as a PRNG implementation instead of relying on srand() and rand() from the C standard library. This, in particular, lets us avoid platform-defined behavior with respect to threading.
* osdep: rename MP_UNREACHABLENiklas Haas2021-11-031-1/+1
| | | | | It was pointed out on IRC that the name is misleading, since the actual semantics of the macro is to assert first.
* osdep: add MP_UNREACHABLENiklas Haas2021-11-031-1/+1
| | | | | | | | | This seems to work on gcc, clang and mingw as-is, but I made it conditional on __GNUC__ just in case, even though I can't figure out which compilers we care about that don't export this define. Also replace all instances of assert(0) in the code by MP_UNREACHABLE(), which is a strict improvement.
* ring: remove thiswm42020-08-292-239/+0
| | | | | The code is OK, and it could be restored if it's needed again. But it is unused now, so remove it.
* dispatch: add strange mechanism for making worker threads responsivewm42020-03-052-2/+26
| | | | | This is probably a sin for the sake of user experience. See a following commit that wires up f_decoder_wrapper with it.
* bstr: remove unused bstr_splitlines() functionwm42019-12-232-23/+0
|
* misc: add jni helpersAman Gupta2019-11-192-0/+590
|
* Use mp_log2() instead of av_log2()wm42019-10-311-3/+1
|
* Replace uses of FFMIN/MAX with MPMIN/MAXwm42019-10-312-12/+13
| | | | And remove libavutil includes where possible.
* json: write NaN/Infinity float values as stringswm42019-10-251-2/+4
| | | | | | | | | | | | | JSON doesn't support these for some god-awful reason. (JSON would have been so much better if it weren't based on JavaScript, the plague of this world.) We don't really care whether these specific values "round trip", so we might as well write them in a standard-compliant way. Untested. I was too lazy to even run this, but it probably works. See #6691.
* demux: sort filenames naturally when playing a directory / archivePhilip Sequeira2019-09-292-0/+90
|
* rendezvous: fix a typowm42018-08-311-1/+1
|
* player: some further cleanup of the mp_cancel crapwm42018-05-242-30/+23
| | | | | | | | | | Alway give each demuxer its own mp_cancel instance. This makes management of the mp_cancel things much easier. Also, instead of having add/remove functions for mp_cancel slaves, replace them with a simpler to use set_parent function. Remove cancel_and_free_demuxer(), which had mpctx as parameter only to check an assumption. With this commit, demuxers have their own mp_cancel, so add demux_cancel_and_free() which makes use of it.
* thread_pool: add a helper functionwm42018-05-242-10/+30
| | | | | The behavior of mp_thread_pool_queue() doesn't or shouldn't change, but the new helper function requires touching its logic.
* thread_pool: move comments to .h filewm42018-05-242-17/+17
|
* thread_tools: unify mp_cancel POSIX/win32 paths, add featureswm42018-05-242-52/+153
| | | | | | | | | | | | | | | The OS specifics are merged because the resulting ifdeffery is not much worse than the old ifdeffery, but the logic that is now shared is becoming more complex. Create all objects lazily. The intention is to make mp_cancel instances cheaper. POSIX pipes and win32 Events are pretty heavy weight, and are only needed in special situations. Add a mechanism to "chain" mp_cancel instances. Needed by the later commits for whatever reasons. Untested on win32.
* misc: add linked list helperswm42018-05-241-0/+107
| | | | | | | | | | | | | | | | This provides macros for managing intrusive doubly linked lists. There are many ways how to do those in a "generic" way in C. For example Solaris style lists are pretty nice: https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/sys/list.h https://github.com/illumos/illumos-gate/blob/master/usr/src/common/list/list.c I even have an independent implementation of this, which could be ISC licensed. But I think it's easier to vomit ~100 lines of preprocessor garbage, which has a lower footprint, and I think it wins slightly on the side of type safety, simplicity, and ease of use, even if it doesn't look as magically nice.
* thread_tools: minor simplificationwm42018-05-241-3/+1
|
* misc: move mp_cancel from stream.c to thread_tools.cwm42018-05-242-0/+158
| | | | | | | | | | | | It seems a bit inappropriate to have dumped this into stream.c, even if it's roughly speaking its main user. At least it made its way somewhat unfortunately to other components not related to the stream or demuxer layer at all. I'm too greedy to give this weird helper its own file, so dump it into thread_tools.c. Probably a somewhat pointless change.
* json: add some non-standard extensionswm42018-05-241-3/+33
| | | | | Also clarify this and previously existing differences to standard JSON in ipc.rst.
* json: format slightly nicer escape sequenceswm42018-05-241-5/+18
| | | | | | Make use the escape sequences allowed by JSON. Also update the linked RFC to the newest one.
* misc: move some helper code from client.cwm42018-05-242-0/+54
| | | | | (Slightly oddly function names, because I want to avoid starting them with mpv_*, which is reserved for public API.)
* node: move a mpv_node helper from ipc.c to shared codewm42018-05-242-0/+14
| | | | This particular one is needed in a following commit.
* thread_pool: set thread namewm42018-05-241-0/+3
|
* thread_pool: make it slightly less dumbwm42018-05-242-42/+141
| | | | | | | | | | | | The existing thread pool code is the most primitive thread pool possible. That's fine, but one annoying thing was that it used a static number of threads. Make it dynamic, so we don't need to "waste" idle threads. This tries to add threads as needed. If threads are idle for some time, destroy them again until a minimum number of threads is reached. Also change the license to ISC.
* misc: add a synchronization helperwm42018-05-242-0/+101
| | | | | | | | | | | | | | | | | This is almost like rendezvous(), except it allows async wakeup, and does not require global state. It will be used by a later commit. struct mp_waiter is intended to be allocated on the stack, and uses an initializer including PTHREAD_MUTEX_INITIALIZER. This is the first case in mpv that it uses PTHREAD_MUTEX_INITIALIZER for stack-allocated mutexes. It seems POSIX still does not allow this formally, but since POSIX is worth less than used toilet paper, I don't really care. Modern OSes use futexes, which means you can make _every_ memory location a lock, and this code tries to make use of it, without using OS specific code. The name of the source file is rather generic, because I intend to dump further small helpers there (or maybe move mp_rendezvous() to it).
* dispatch: add an assert()wm42018-05-241-0/+1
|
* player: remove in_dispatch fieldwm42018-04-182-8/+30
| | | | (Not sure if worth the trouble, but it does seem less awkward.)
* dispatch: simplify, disallow recursive invocationwm42018-04-181-75/+60
| | | | | | | | | Recursive invocation was needed up until the previous commit. Drop this feature, and simplify the code. It's more logical, and easier to detect miuses of the API. This partially reverts commit 3878a59e. The original reason for it was removed.
* command: use mpv_node helpers instead of duplicated codewm42018-03-261-1/+4
| | | | | | They didn't exist yet when this code was added. Completely untested.
* m_option: pretty print mpv_node for OSDwm42017-10-302-6/+30
| | | | | | Somewhat useful for debugging. Unfortunately libass (or something else) strips leading whitespace, making it look slightly more ugly than necessary. Still an improvement.
* command: change demuxer-cache-state property to return multiple rangeswm42017-10-262-0/+18
| | | | | | | | | | | | | | | | | | Even if the demuxer cache does not multiple ranges yet. This is to reduce the pain should caching of multiple ranges ever be implemented. Also change it from the sub properties stuff to return a mpv_node directly, which is less roundabout. Sub-property access won't work anymore, though. Remove the seekable-start/-end fields as well, as they're redundant with the ranges. All this would normally be considered an API change, but since it's been only a few days with no known users, change it immediately. This adds some node.c helpers as well, as the code would be too damn fugly otherwise.
* options: add a thread-safe way to notify option updateswm42017-08-222-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, we had a thread-safe way to read options, but no option update notification mechanism. Everything was funneled though the main thread's central mp_option_change_callback() function. For example, if the panscan options were changed, the function called vo_control() with VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This worked, but's pretty inconvenient. Most of these problems come from the fact that MPlayer was written as a single-threaded program. This commit works towards a more flexible mechanism. It adds an update callback to m_config_cache (the thing that is already used for thread-safe access of global options). This alone would still be rather inconvenient, at least in context of VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and takes care of some annoying synchronization issues. We extend mp_dispatch_queue itself to make this easier and slightly more efficient. As a first application, use this to reimplement certain VO scaling and renderer options. The update_opts() function translates these to the "old" VOCTRLs, though. An annoyingly subtle issue is that m_config_cache's destructor now releases pending notifications, and must be released before the associated dispatch queue. Otherwise, it could happen that option updates during e.g. VO destruction queue or run stale entries, which is not expected. Rather untested. The singly-linked list code in dispatch.c is probably buggy, and I bet some aspects about synchronization are not entirely sane.
* bstr: short-circuit bstr_equals on pointer equalityNiklas Haas2017-08-031-1/+4
| | | | | More efficient in cases where we're comparing a bstr against itself, which can happen in e.g. the ICC profile code.
* vo_opengl: support loading custom user texturesNiklas Haas2017-07-272-0/+41
| | | | | | | | | | | Parsing the texture data as raw strings makes the textures the most portable and self-contained. In order to facilitate different types of shaders, the parse_user_shader interaction has been changed to instead have it loop through blocks and call the passed functions for each valid block parsed. This is more modular and also cleaner, with better code separation. Closes #4586.
* misc/ring: fix comment typoKevin Mitchell2017-07-091-2/+2
|
* bstr: short-circuit bstr_equals()wm42017-07-021-2/+2
|
* misc/json: avoid redundant conditionRaúl Peñacoba2017-07-011-1/+1
| | | | Closes #4415
* ring: use 64 bit counterswm42017-06-281-3/+3
| | | | | | | | | Apparently, this messes up on wraparound (although it shouldn't). After 2^32 bytes an audio "blip" happens with AOs that use this ringbuffer. Whatever, we can fix this by switching to a 64 bit counter. There's also a good chance the ringbuffer will be dropped completely, so don't waste more time on this.
* misc: add a thread poolwm42017-04-012-0/+135
| | | | To be used by the following commits.
* osx: consistent normalisation when searching for external filesAkemi2017-02-022-1/+6
| | | | | | | | | | | | | | | | | | | | |