summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* read stats oldread_stats_oldwm42020-02-051-1/+6
|
* rendezvous: fix a typowm42018-08-311-1/+1
|
* demux: allow cache sizes > 2GBwm42018-08-241-4/+8
| | | | | There was no reason to limit this. Only some int fields had to be changed to size_t.
* demux_lavf: v4l streams are not seekablewm42018-08-241-0/+2
| | | | | | | FFmpeg is retarded enough not to give us any indication whether it is (unless we query fields not in the ABI/API). I bet FFmpeg developers love it when library users have to litter their code with duplicated information.
* player: don't print status line again when quittingwm42018-08-111-2/+5
| | | | | | | | Quitting is slightly asynchronous, so the status line can be updated again. Normally, that's fine, but if quitting comes with a message (such as with quit_watch_later), it will print the status line again after the message, which looks annoying. So flush and clear the status message if it's updated during quitting.
* HACK: prefetch subtitles on track switch a bit morewm42018-06-301-1/+4
| | | | To get overlapping shit etc.
* player: don't cache subtitles across deselectionwm42018-06-302-6/+6
| | | | | This means reselection triggers full reinit. This is better if you have options that "edit" subtitles or whatever.
* player: fix coding stylewm42018-05-241-3/+3
| | | | | I'm also not sure whether this condition doesn't subtly break a lot of things.
* m_config: remove a redundant conditionwm42018-05-241-3/+1
| | | | Always true, because a few lines above it checks for the same thing.
* demux_lavf: drop obscure genpts optionwm42018-05-242-11/+0
| | | | | This code shouldn't even exist in libavformat. If you still need it, you can enable it via --demuxer-lavf-o.
* vo: remove bogus #ifwm42018-05-241-2/+0
| | | | | | | | | | | | If anyone happened to build with GL disabled, this could lead to option changes not always refreshing the screen. Since vo_gpu is always enabled now (just not necessarily any backend for it), we can drop the #if completely. (The way this works is a bit idiotic - the option cache exists only to grab the change notification, which will trigger a redraw and make vo_gpu update its own second copy of them. But at least it avoids some layering issues for now.)
* terminal-unix: stop trying to read when terminal disappearswm42018-05-241-2/+4
| | | | | | | | Avoids 100% CPU usage due to terminal code retrying read(). Seems like this was "forgotten" (or there was somehow the assumption poll() would not signal POLLIN anymore). Fixes #5842.
* options: add --http-proxywm42018-05-242-0/+11
| | | | Often requested, trivial.
* command: avoid some direct MPOpts write accesseswm42018-05-241-7/+7
| | | | | | | | | | | This is working towards a change intended in the future: nothing should write to the option struct directly, but use functions that raise proper notifications. Until this is complete it will take a while, and this commit does not change all cases of direct access, just some simple ones. In all of these 3 changes, the actual write access is done by the generic property-option bridge.
* m_config: fix build with emulated stdatomicwm42018-05-241-2/+3
| | | | | | | | | | | | C11 can access atomic variables normally (in which case they use the strictest memory access semantics). But the mpv stdatomic wrapper for C99 compilers does not allow it, because it couldn't give any guarantees. This means we always need to access them with atomic macros. While we're at, use relaxed semantics for the m_config_cache field, since because it's accessed from a single thread only (essentially used in a non-atomic way). Switch the comparison arguments to make the formatting look slightly less weird.
* m_config: make m_config_cache_update() return more fine grainedwm42018-05-241-3/+7
| | | | | | | | | Although the new code actually fires update notifications only when needed, m_config_cache_update() itself returned a rather coarse change value, which could indicate change even if none of the cached options were changed. On top of that, some code (like vo_gpu) calls the update function on every frame, which would reconfigure the renderer even on unrelated option changes.
* player: get rid of mpv_global.optswm42018-05-2416-63/+75
| | | | | | | | This was always a legacy thing. Remove it by applying an orgy of mp_get_config_group() calls, and sometimes m_config_cache_alloc() or mp_read_option_raw(). win32 changes untested.
* vd_lavc: move hwdec opts to local config, don't use global MPOptswm42018-05-244-43/+50
| | | | | | | The --hwdec* options are a good fit for the vd_lavc local option struct. This annoyingly requires manual prefixing of most of these options with --vd-lavc (could be avoided by using more sub-struct craziness, but let's not).
* path: don't access global option structwm42018-05-244-7/+20
| | | | | | | The path functions need to access the option that forces non-default config directories. Just add it as a field to mpv_global - it seems justified. The accessed options were always enforced as immutable after init, so there's not much of a change.
* m_config: add a special define to access main configwm42018-05-242-5/+7
| | | | | | | | Passing NULL to mp_get_config_group() returns the main option struct. This is just a dumb hack to deal with inconsistencies caused by legacy things (as I'll claim), and will probably be changed in the future. So before littering the whole code base with hard to find NULL parameters, require using callers an easy to find separate define.
* ao: use a local option structwm42018-05-246-19/+44
| | | | Instead of accessing MPOpts.
* player: remove deprecated vo/ao auto profileswm42018-05-242-9/+2
| | | | | These were deprecated almost 2 years ago. Now they happen to be in the way.
* m_config: optimize initialization of each optionwm42018-05-241-5/+9
| | | | | | | | | | | | | | | | | | | | | | Options with dynamic memory allocations (such as strings) require some care. They need to be fully copied on initialization, and if a static default value was declared, we must not free that value either. Instead of going through the entire thing even for simple types like integers, really run it only for options with dynamic allocations. To distinguish types which use dynamic allocations, we can use the fact that they require a free callback (otherwise they would leak). As a result initialization of simple types becomes chaper, and the init function does nothing at all if src==dst for a simple type. (It's funny how mplayer had M_OPT_TYPE_DYNAMIC since 2002, until we replaced it by the same heuristic as used here in commit 3bb134969eb6. It's also funny how the new check was used only for some asserts, and finally removed in commit 7539928c1c. I guess at this time I felt like having uniform code was more important than pointless micro-optimizations.) The src==NULL case is removed because it can't happen.
* m_config: remove extra default_data fieldwm42018-05-243-20/+29
| | | | Just wastes memory (a few KB, because there are so many options).
* m_config: remove unused fieldswm42018-05-242-8/+2
|
* build: prefer C11 modewm42018-05-241-1/+6
| | | | | | C99 still works, but in theory we're using C11 features already, such as stdatomic.h. gcc/clang let us use it in C99 mode too, but using C11 is at least more proper.
* m_config: reduce redundant option change notificationswm42018-05-241-1/+1
|
* m_config: remove an old temporary hackwm42018-05-242-308/+336
| | | | | | | | | | | | | | | | Actually rewrite most of the option management code. This affects how options are allocated, and how thread-safe access to them is done. One thing that is nicer is that creating m_config_cache does not need to ridiculously recreate and store the entire option list again. Instead, option metadata and option storage are now separated. m_config contains the metadata, and m_config_data all or parts of the actual option values. (m_config_cache simply uses the metadata part of m_config, which is immutable after creation.) The mentioned hack was introduced in commit 1a2319f3e4cc4, and is the global state around g_group_mutex. Although it was "benign" global state, it's good that it's finally removed.
* osdep: add portable C11-like alignof() macrowm42018-05-241-0/+5
|
* m_config: remove outdated commentwm42018-05-241-1/+0
|
* m_config: check for int16_t offset overflowwm42018-05-241-1/+3
| | | | | | | | For some reason shadow_offset is a int16_t variable (to save some space or something), which means the static part of the entire option list must be below 32KB. This is fine, but still add a check against overflows. (Currently it's 3.6KB. This does not include dynamic allocations like strings.)
* m_config: remove an unused functionwm42018-05-242-15/+0
|
* m_option: remove an unused fieldwm42018-05-242-13/+0
|
* m_config: cosmetics: fix 2 typoswm42018-05-241-2/+2
|
* input: remove now unused "abort command" and cancel infrastructurewm42018-05-245-75/+7
| | | | The previous commit removed all uses.
* player: make playback termination asynchronouswm42018-05-248-32/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, stopping playback aborted the demuxer and I/O layer violently by signaling mp_cancel (bound to libavformat's AVIOInterruptCB mechanism). Change it to try closing them gracefully. The main purpose is to silence those libavformat errors that happen when you request termination. Most of libavformat barely cares about the termination mechanism (AVIOInterruptCB), and essentially it's like the network connection is abruptly severed, or file I/O suddenly returns I/O errors. There were issues with dumb TLS warnings, parsers complaining about incomplete data, and some special protocols that require server communication to gracefully disconnect. We still want to abort it forcefully if it refuses to terminate on its own, so a timeout is required. Users can set the timeout to 0, which should give them the old behavior. This also removes the old mechanism that treats certain commands (like "quit") specially, and tries to terminate the demuxers even if the core is currently frozen. This is for situations where the core synchronized to the demuxer or stream layer while network is unresponsive. This in turn can only happen due to the "program" or "cache-size" properties in the current code (see one of the previous commits). Also, the old mechanism doesn't fit particularly well with the new one. We wouldn't want to abort playback immediately on a "quit" command - the new code is all about giving it a chance to end it gracefully. We'd need some sort of watchdog thread or something equally complicated to handle this. So just remove it. The change in osd.c is to prevent that it clears the status line while waiting for termination. The normal status line code doesn't output anything useful at this point, and the code path taken clears it, both of which is an annoying behavior change, so just let it show the old one.
* player: change the role of the "stop_play" and "playing" variablewm42018-05-245-18/+23
| | | | | | | | | | | | | | | | | Before this, mpctx->playing was often used to determine whether certain new state could be added to the playback state. In particular this affected external files (which added tracks and demuxers). The variable was checked to prevent that they were added before the corresponding uninit code. We want to make a small part of uninit asynchronous, but mpctx->playing needs to stay in the place where it is. It can't be used for this purpose anymore. Use mpctx->stop_play instead. Make it never have the value 0 outside of loading/playback. On unloading, it obviously has to be non-0. Change some other code in playloop.c to use this, because it seems slightly more correct. But mostly this is preparation for the following commit.
* demux: add a way to destroy the demuxer asynchronouslywm42018-05-242-8/+93
| | | | | | | | | | | | | | This will enable the player core to terminate the demuxers in a "nicer" way without having to block on network. If it just used demux_free(), it would either have to block on network, or like currently, essentially kill all I/O forcefully. The API is slightly awkward, because demuxer lifetime is bound to its allocation. On the other hand, changing that would also be awkward, and introduce weird in-between states that would have to be handled in tons of places. Currently unused, to be user later.
* player: move a function (no functional changes)wm42018-05-241-7/+7
|
* manpage: update --demuxer-thread optionwm42018-05-241-3/+6
| | | | Be a bit more detailed, and discourage disabling it.
* player: some further cleanup of the mp_cancel crapwm42018-05-246-79/+62
| | | | | | | | | | 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.
* demux: get rid of free_demuxer[_and_stream]()wm42018-05-248-27/+31
| | | | | | | Them being separate is just dumb. Replace them with a single demux_free() function, and free its stream by default. Not freeing the stream is only needed in 1 special case (demux_disc.c), use a special flag to not free the stream in this case.
* player: simplify edition switchingwm42018-05-244-13/+4
| | | | | | | | | | | | | | The player fully restarts playback when the edition or disk title is changed. Before this, the player tried to reinitialized playback partially. For example, it did not print a new "Playing: <file>" message, and did not send playback end to libmpv users (scripts or applications). This playback restart code was a bit messy and could have unforeseen interactions with various state. There have been bugs before. Since it's a mostly cosmetic thing for an obscure feature, just change it to a full restart. This works well, though since it may have consequences for scripts or client API users, mention it in interface-changes.rst.
* command: whitelist some blocking accesses for certain demuxers/streamswm42018-05-247-8/+18
| | | | | | | | | | | | | | | | | | | | | The properties/commands touched in this commit are all for obscure special inputs (BD/DVD/DVB/TV), and they all block on the demuxer/stream layer. For network streams, this blocking is very unwelcome. They will affect playback and probably introduce pauses and frame drops. The player can even freeze fully, and the logic that tries to make playback abortable even if frozen complicates the player. Since the mentioned accesses are not needed for network streams, but they will block on network streams even though they're going to fail, add a flag that coarsely enables/disables these accesses. Essentially it establishes a whitelist of demuxers/streams which support them. In theory you could to access BD/DVD images over network (or add such support, I don't think it's a thing in mpv). In these cases these controls still can block and could even "freeze" the player completely. Writing to the "program" and "cache-size" properties still can block even for network streams. Just don't use them if you don't want freezes.
* timer: remove an unused helper functionwm42018-05-242-16/+0
| | | | It's also dumb.
* 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
|
* command: make loadlist command async and abortablewm42018-05-245-7/+15
| | | | | | | | | | Don't allow it to freeze everything when loading a playlist from network (although you definitely shouldn't do that, but whatever). This also affects the really obscure --ordered-chapters-files option. The --playlist option on the other hand has no choice but to freeze the shit, because there's no concept of aborting the player during command line parsing.
* player: make various commands for managing external tracks abortablewm42018-05-245-54/+96
| | | | | | | | | | | | | | | | | | | | | Until now, they could be aborted only by ending playback, and calling mpv_abort_async_command didn't do anything. This requires furthering the mess how playback abort is done. The main reason why mp_cancel exists at all is to avoid that a "frozen" demuxer (blocked on network I/O or whatever) cannot freeze the core. The core should always get its way. Previously, there was a single mp_cancel handle, that could be signaled, and all demuxers would unfreeze. With external files, we might want to abort loading of a certain external file, which automatically means they need a separate mp_cancel. So give every demuxer its own mp_cancel, and "slave" it to whatever parent mp_cancel handles aborting. Since the mpv demuxer API conflates creating the demuxer and reading the file headers, mp_cancel strictly need to be created before the demuxer is created (or we couldn't abort loading). Although we give every demuxer its own mp_cancel (as "enforced" by cancel_and_free_demuxer), it's still rather messy to create/destroy it along with the demuxer.
* demux: add a "cancel" fieldwm42018-05-245-5/+8
| | | | | Instead of relying on demuxer->stream->cancel. This is better because the stream is potentially closed and replaced.
* stream_file: use a separate mp_cancel thingwm42018-05-241-2/+8
| | | | | | | | | | | | | The intention is to avoid that the parent mp_cancel retains the internally allocated wakeup pipe. File FDs are a relatively scarce resource, so try to avoid having too many. This might matter for subtitle files, for which it is relatively likely that they are loaded in large quantities. demux_lavf.c will close the underlying stream for most subtitle files, and now it will free the wakeup pipe too. Actually, there are currently only 1 or 2 mp_cancel objects per mpv core, but this could change if every external subtitle track gets its own mp_cancel in later commits.
* 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-242-0/+269
| | | | | | | | | | | | | | | | 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-2415-145/+171
| | | | | | | | | | | | 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.
* cmd: do not use a random value for MP_CMD_OPT_ARGwm42018-05-241-1/+1
| | | | | | | | | | | This flag is used only by the command parser. Its value overlapped with some of the existing m_option flags, but only flags that did not matter for the command parser (i.e. the flag bits used had mostly private uses in each component). It's still a bit unclean and dangerous to use an essentially random value, so reuse M_OPT_OPTIONAL_PARAM for it. Since M_OPT_OPTIONAL_PARAM has a slightly longer name than MP_CMD_OPT_ARG, I'm going to keep the old name.
* input: slightly improve --input-cmdlist outputwm42018-05-242-6/+7
| | | | | Output argument names, whether varargs are used, and indicate optional arguments correctly (instead of only half of them).
* command: give named arguments to almost all commandswm42018-05-245-249/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, only 1 command or so had named arguments. There is no reason why other commands can't have them, except that it's a bit of work to add them. Commands with variable number of arguments are inherently incompatible to named arguments, such as the "run" command. They still have dummy names, but obviously you can't assign multiple values to a single named argument (unless the argument has an array type, which would be something different). For now, disallow using named argument APIs with these commands. This might change later. 2 commands are adjusted to not need a separate default value by changing flag constants. (The numeric values are C only and can't be set by users.) Make the command syntax in the manpage more consistent. Now none of the allowed choice/flag names are in the command header, and all arguments are shown with their proper name and quoted with <...>. Some places in the manpage and the client.h doxygen are updated to reflect that m