summaryrefslogtreecommitdiffstats
path: root/player/core.h
Commit message (Collapse)AuthorAgeFilesLines
* player: refactor chapter seek codewm42015-07-101-1/+0
| | | | | | | mp_seek_chapter() had only 1 caller. Also the code was rather roundabout; the entire function can be compressed to 5 lines of code. (The new code is functionally the same - "mpctx->last_chapter_seek = -2;" was effectively a dead assingment.)
* player: add missing include directivewm42015-07-061-0/+1
|
* sub: protect ASS_Renderer statewm42015-07-061-0/+1
| | | | | | | | | | | | | | | | | | | Each subtitle track gets its own decoder instance (sd_ass). But they use a shared ASS_Renderer. This is done mainly because of fontconfig. Initializing fontconfig is very slow when using it with memory fonts, so there's a practical need to cache this memory font state, which is done by not creating separate ASS_Renderers. This is very dirty and very evil, but we probably can't get rid of it any time soon. The shared ASS_Renderer was not properly synchronized. While the program logic guarantees that only one sd_ass instance is visible at a time, there are other interactions that require synchronization. In particular, I suspect concurrent execution of mp_ass_configure_fonts() and sd_ass.get_bitmaps cause issues in a newer libass development branch. So here's a shitty hack that hopefully fixes things, hopefully only until libass becomes less dependent on fontconfig.
* player: simplify reload logicwm42015-07-021-1/+1
| | | | Instead of only reloading the demuxer, reopen the stream as well.
* player: unentangle --stream-dumpwm42015-07-021-1/+1
| | | | | | | | The final goal is making opening the demuxer and opening the stream the same operation. Stream dumping is a rather uninteresting feature, but has a small number of vocal users, and it's easy to keep.
* video: pass future frames to VOwm42015-07-011-1/+3
| | | | | | | | | | Now the VO can request a number of future frames with the last parameter of vo_set_queue_params(). This will be helpful to fix the interpolation code. Note that the first frame (after playback start or seeking) will usually not have any future frames (to make seeking fast). Near the end of the file, the number of future frames will become lower as well.
* demux: export forced flagwm42015-06-271-1/+1
| | | | | | At least Matroska files have a "forced" flag (in addition to the "default" flag). Export this flag. Treat it almost like the default flag, but with slightly higher priority.
* player: print a message along with track listwm42015-06-031-1/+1
| | | | Slightly less strange.
* player: fix crashes when adding external tracks before loading main filewm42015-05-261-4/+3
| | | | | | | | | | | | | | | | Adding an external audio track before loading the main file didn't work right. For one, mp_switch_track() assumes it is called after the main file is loaded. (The difference is that decoders are only initialized once the main file is loaded, and we avoid doing this before that for whatever reason.) To avoid further messiness, just allow mp_switch_track() to be called at any time. Also make it do what mp_mark_user_track_selection() did, since the latter requires current_track to be set. (One could probably simply allow current_track to be set at this point, but it'd interfere with default track selection anyway and thus would be pointless.) Fixes #1984.
* player: add function to compute past frame durationswm42015-05-241-0/+1
| | | | | And use it for the estimated-vf-fps property (it should be doing the same as before).
* player: use an array for stream ID options and suchwm42015-05-221-2/+2
| | | | This makes the code slightly more generic.
* player: make resuming playlists less noisy in verbose modewm42015-05-091-0/+2
| | | | | | | | | | | | | | | | | | | mp_find_config_file() will print the filename lookup and its result in verbose mode. This is wanted, but gets inconvenient when it is done for every playlist entry (for resuming). Lookup the watch_later subdir only once and cache the result instead. This drops the logic for loading the resume file from other locations, which should generally be unnecessary, though might lead to confusion if the user has mixed old and new config paths (which the user shouldn't). Also add a mp_find_user_config_file() function for a more straightforward and reliable way to get actual local configpaths, instead of possibly global and unwritable locations. Also, for symmetry, check the resume option in mp_load_playback_resume() just like mp_check_playlist_resume() does.
* build: move main-fn files to osdepwm42015-05-021-1/+0
| | | | | | And split the Cocoa and Unix cases. Simplify the Cocoa case slightly by calling mpv_main directly, instead of passing a function pointer. Also add a comment explaining why Cocoa needs a special case at all.
* player: log track list when adding or removing external fileswm42015-04-281-0/+1
| | | | | | | | | Should help with debugging, and might be slightly more userfriendly. Note that this is called manually in multiple entry-points, instead of the functions doing the actual work (like mp_remove_track()). This is done so that exiting the player or calling the sub_reload command won't print redundant in-between states.
* player: cleanup update_fps() functionwm42015-04-201-1/+0
| | | | | It was called only in 2 places, one of them redundant (the container FPS can not change).
* command: disc-mouse-on-button propertyxylosper2015-04-211-0/+1
| | | | | This property indicates whether mouse cursor is located on button or not for disc naviation.
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* player, client API: refactor cplayer init, reduce client API differenceswm42015-03-051-1/+1
| | | | | | | | | | | | | Move the command line parsing and some other things to the common init routine shared between command line player and client API. This means they're using almost exactly the same code now. The main intended side effect is that the client API will load mpv.conf; though still only if config loading is enabled. (The cplayer still avoids creating an extra thread, passes a command line, and prints an exit status to the terminal. It also has some different defaults.)
* player: use symbolic constant for seek precisionwm42015-03-041-2/+10
| | | | Meh.
* player: fix demuxer lifetime managementwm42015-02-221-2/+2
| | | | | | | | | | | Commit f54220d9 attempted to improve this, but it got worse. Now there was a crash when ytdl_hook.lua added external tracks. This happened because close_unused_demuxers() assumed that sources[0] was the main demuxer (so that it didn't close it). This assumption failed, because the ytdl script can add external tracks before the main file is loaded. The easy fix would have been to check for master_demuxer, and not i==0. But instead give up on the old idea, make some stricter assumptions how demuxers and external tracks map, and simplify the code.
* player: cosmetics: async/non-blocking -> reentrantwm42015-02-201-2/+2
| | | | | | These functions do blocking work on a separate thread, but wait until they return. So they are not async or non-blocking. But they do react to user-input and client API accesses, which makes them reentrant.
* demux_edl: make independent from MPContextwm42015-02-171-3/+0
|
* demux_cue: make independent from MPContextwm42015-02-171-2/+0
| | | | Also see previous commit(s).
* matroska: make timeline code independent of MPContextwm42015-02-171-2/+0
|
* player: use a separate context for timeline loader stuffwm42015-02-171-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | Instead of accessing MPContext in player/timeline/*, create a separate context struct, which the timeline loaders fill out. It turns out that there's not much in the way too big MPContext that these need to access. One major PITA is managing (and closing) the set of open demuxers. The problem is that we need a list of all demuxers to make sure no unneeded streams are enabled. This adds a callback to the demuxer_desc struct, with the intention of leaving to to the demuxer to call the right loader, instead of explicitly checking the demuxer type and dispatching manually in common code. I also considered making the timeline part of the demuxer state, but decided against: it's too much of a mess wrt. memory management and threading, and also doesn't make it clear who owns the child demuxers. With the struct timeline decoupled from the demuxer state, it's at least somewhat clear that the child demuxers are independent from the "main" demuxer. The actual changes to player/timeline/* are separated in the following commits, because they're quite verbose. Some artifacts will be removed later as soon as there's only 1 timeline loading mechanism.
* command: add rescan_external_fileswm42015-02-161-0/+3
| | | | | | | | | Requested. Hopefully will be useful for things that download and add external subtitles on demand. Or something. Closes #1586.
* command: new commands audio_add/audio_remove/audio_reloadxylosper2015-02-031-1/+2
| | | | | | | | These commands are counterparts of sub_add/sub_remove/sub_reload which work for external audio file. Signed-off-by: wm4 <wm4@nowhere> (minor simplification)
* player: remove redundant variablewm42015-01-291-2/+0
| | | | | | mpctx->audio_delay always has the same value as opts->audio_delay. (This was not the case a long time ago, when the audio-delay property didn't actually write to opts->audio_delay. I think.)
* player: don't enable demuxer readahead before selecting trackswm42015-01-161-1/+0
| | | | | | | | | | This is for the ordered chapters case only. In theory this could have resulted in initial audio, video or subs missing, although it didn't happen in practice (because no streams were selected, thus the demuxer thread didn't actually try to read anything). It's still better to make this explicit. Also, timeline_set_part() can be private to loadfile.c.
* video: better pipelining with vf_vapoursynthwm42015-01-031-0/+1
| | | | | | | | | | Most of this is explained in the code comments. This change should improve performance with vapoursynth, especially if concurrent requests are used. This should change nothing if vf_vapoursynth is not in the filter chain, since non-threaded filters obviously can not asynchronously finish filtering of frames.
* player: filter tags, add --display-tags optionwm42014-12-291-1/+1
| | | | | | | | This attempts to increase user-friendliness by excluding useless tags. It should be especially helpful with mp4 files, because the FFmpeg mp4 demuxer adds tons of completely useless information to the metadata. Fixes #1403.
* player: make --shuffle/--merge-files affect runtime loaded playlistswm42014-12-291-0/+1
| | | | | | | Until now, these options took effect only at program start. This could be confusing when e.g. doing "mpv list.m3u --shuffle". Make them always take effect when a playlist is loaded either via a playlist file, or with the "loadlist" command.
* player: cosmetics: rename a functionwm42014-12-271-2/+2
| | | | | Something which has this many important sideffects shouldn't start have a "get" prefix.
* player: cosmetics: move code aroundwm42014-12-211-1/+0
| | | | Separate commit to reduce noise in the following one.
* player: print only changed tagswm42014-12-191-0/+1
| | | | | | | | | | | | | | | | | The code in the demuxer etc. was changed to update all metadata/tags at once, instead of changing each metadata field. As a consequence, printing of the tags to the terminal was also changed to print everything on each change. Some users didn't like this. Add a very primitive way to avoid printing fields with the same value again if metadata is marked as changed. This is not always correct (could print unchanged fields anyway), but usually works. (In general, a rather roundabout way to reflect a changed title with ICY streaming...) Fixes #813 (let's call it a "policy change").
* client API: expose OpenGL rendererwm42014-12-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds API to libmpv that lets host applications use the mpv opengl renderer. This is a more flexible (and possibly more portable) option to foreign window embedding (via --wid). This assumes that methods like context sharing and multithreaded OpenGL rendering are infeasible, and that a way is needed to integrate it with an application that uses a single thread to render everything. Add an example that does this with QtQuick/qml. The example is relatively lazy, but still shows how relatively simple the integration is. The FBO indirection could probably be avoided, but would require more work (and would probably lead to worse QtQuick integration, because it would have to ignore transformations like rotation). Because this makes mpv directly use the host application's OpenGL context, there is no platform specific code involved in mpv, except for hw decoding interop. main.qml is derived from some Qt example. The following things are still missing: - a way to do better video timing - expose GL renderer options, allow changing them at runtime - support for color equalizer controls - support for screenshots
* player: make chapter seek to end jump to last frame with --keep-openwm42014-12-081-0/+1
| | | | | | | | There were complaints that a chapter seek past the last chapter was quitting the player. Change the behavior to what is expected: the last frame. If no chapters are available, this still does nothing.
* player: when seeking past EOF with --keep-open, seek to last framewm42014-12-071-2/+4
| | | | | | | | | | | | | | | | | | | | | It feels strange that seeking past EOF with --keep-open actually leaves the player at a random position. You can't even unpause, because the demuxer is in the EOF state, and what you see on screen is just what was around before the seek. Improve this by attempting to seek to the last video frame if EOF happens. We explicitly don't do this if EOF was reached normally to increase robustness (if the VO got a frame since the last seek, it obviously means we had normal playback before EOF). If an error happens when trying to find the last frame (such as not actually finding a last frame because e.g. the demuxer misbehaves), this will probably turn your CPU into a heater. There is no logic to prevent reinitiating the last-frame search if the last-frame search reached EOF. (Pausing usually prevents that EOF is reached again after a successful last-frame search.) Fixes #819.
* command: improve A-B loop behaviorwm42014-11-181-0/+1
| | | | | | If the B point is set, then loop back to A. Also, update the OSD bar if necessary.
* sub: workaround braindead libass APIwm42014-11-151-1/+0
| | | | | | | | | | | | | | | | libass won't use embedded fonts, unless ass_set_fonts() (called by mp_ass_configure_fonts()) is called. However, we call this function when the ASS_Renderer is initialized, which is long before the .ass file is actually loaded. (I'm not sure why it tries to keep 1 ASS_Renderer, but it always did this.) Fix by calling mp_ass_configure_fonts() after loading them. This also means this function will be called multiple times - hopefully this is harmless (it will reinit fontconfig every time, though). While we're at it, also initialize the ASS_Renderer lazily. Fixes #1244.
* player: make the osd-msg prefix work for playlist_next/prevwm42014-11-111-0/+1
| | | | | If input.conf e.g. contains "n osd-msg playlist_next", then pressing the n key will switch to the next file, and display the filename on OSD.
* player: always use demux_chapterwm42014-11-021-6/+1
| | | | | | | | | Instead of defining a separate data structure in the core. For some odd reason, demux_chapter exported the chapter time in nano-seconds. Change that to the usual timestamps (rename the field to make any code relying on this to fail compilation), and also remove the unused chapter end time.
* player: update meaning of drop_frame_cntwm42014-11-011-3/+2
| | | | | Rename the variable, update comments, and update the documentation of the property which returns its value.
* sub: remove osd_get_sub()wm42014-11-011-0/+2
| | | | | Trades one strange thing against another, but seems slightly less strange.
* player: improve exit message in some scenarioswm42014-10-311-11/+7
| | | | | | | | | | | | | | If you played e.g. an audio-only file and something bad happened that interrupted playback, the exit message could say "No files played". This was awkward, so show a different message in this case. Also overhaul how the exit status is reported in order to make this easier. This includes things such as not reporting a playback error when loading playlists (playlists contain no video or audio, which was considered an error). Not sure if I'm happy with this, but for now it seems like a slight improvement.
* client API: better error reportingwm42014-10-281-1/+2
| | | | Give somewhat more information on playback failure.
* player: handle edition reloading slightly differentlywm42014-10-281-2/+1
| | | | | | | Use the codepath that is normally used for DVD/BD title switching and DVB channel switching. Removes some extra artifacts from the client API: now MPV_EVENT_END_FILE will never be called on reloads (and neither is MPV_EVENT_START_FILE).
* Drop libquvi supportwm42014-10-251-1/+0
| | | | | | | | | | | No development activity (or even any sign of life) for almost a year. A replacement based on youtube-dl will probably be provided before the next mpv release. Ask on the IRC channel if you want to test. Simplify the Lua check too: libquvi linking against a different Lua version than mpv was a frequent issue, but with libquvi gone, no direct dependency uses Lua, and such a clash is rather unlikely.
* player: fix exiting if both audio and video fail initializingwm42014-10-231-0/+1
| | | | | | | | | | | | | The player was supposed to exit playback if both video and audio failed to initialize (or if one of the streams was not selected when the other stream failed). This didn't work; for one this check was missing from one of the failure paths. And more importantly, both checked the current_track array incorrectly. Fix these issues, and move the failure handling code into a common function. CC: @mpv-player/stable
* player: add stream selection by ffmpeg indexwm42014-10-211-2/+2
| | | | | | | | | Apparently using the stream index is the best way to refer to the same streams across multiple FFmpeg-using programs, even if the stream index itself is rarely meaningful in any way. For Matroska, there are some possible problems, depending how FFmpeg actually adds streams. Normally they seem to match though.
* ipc: decouple from MPContextwm42014-10-191-5/+1
| | | | Just a minor refactor to keep unneeded dependencies on the core low.
* input: implement JSON-based IPC protocolAlessandro Ghedini2014-10-171-0/+6
|
* command: add a mechanism to allow scripts to intercept file loadswm42014-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | A vague idea to get something similar what libquvi did. Undocumented because it might change a lot, or even be removed. To give an idea what it does, a Lua script could do the following: -- type ID priority mp.commandv("hook_add", "on_load", 0, 0) mp.register_script_message("hook_run", function(param, param2) -- param is "0", the user-chosen ID from the hook_add command -- param2 is the magic value that has to be passed to finish -- the hook mp.resume_all() -- do something, maybe set options that are reset on end: mp.set_property("file-local-options/name", "value") -- or change the URL that's being opened: local url = mp.get_property("stream-open-filename") mp.set_property("stream-open-filename", url .. ".png") -- let the player (or the next script) continue mp.commandv("hook_ack", param2) end)
* Revert "player: --save-position-on-quit should always work"wm42014-10-101-4/+0
| | | | | | | | | This reverts commit 45c8b97efbaff7a5031b008223eeed56f7b0607a. Some else complained (github issue #1163). The feature requested in #1148 will be implemented differently in the following commit.
* libmpv/cocoa: make global events work and get rid of is_cplayerStefano Pigozzi2014-10-091-1/+0
| | | | | | | After @frau's split of macosx_events from macosx_application, `is_cplayer' is not needed anymore. At the moment only global events such as Media Keys and Apple Remote work, because the VO-level ones were hardcoded to be disabled. (that will be fix in a later commit ).
* command: add cache-buffering-state propertywm42014-10-071-0/+1
|
* osd: don't let slow commands cut OSD messages shortwm42014-10-061-0/+1
| | | | Done for screenshot commands, requested by a user.
* player: --save-position-on-quit should always workwm42014-10-061-0/+4
| | | | | | | | | | | Now any action that stops playback of a file (even playlist navigation) will save the position. Normal EOF is of course excluded from this, as well as commands that just reload the current file. The option name is now slightly off, although you could argue what the word "quit" means. Fixes #1148