summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* command: dump tracklist if sub-add is run with the "cached" flagwm42016-03-141-0/+2
| | | | | mp_switch_track() doesn't do it automatically for whatever reason, so do it here.
* player: add missing audio reconfig eventswm42016-03-131-0/+4
| | | | | | | This also takes care of sending the required property change notifications. Fixes #2929 and maybe fixes #2920.
* ytdl_hook: handle optional format_note▟ ▖▟ ▖2016-03-101-1/+1
| | | | | some extractors don't return a format_note for their audio stream which resulted in commandv complaining "argument 4 is not a string" (got nil).
* demux: replace demux_pause/demux_unpause with demux_run_on_threadwm42016-03-091-7/+17
| | | | | | | This pause stuff is bothersome and is needed only for a few corner- cases. This commit removes it from the demuxer public API and replaces it with a demux_run_on_thread() function and refactors the code which needed demux_pause(). The next commit will change the implementation.
* command: change stream-pos semanticswm42016-03-091-12/+2
| | | | | | | | | | | | | Changing the byte stream position without cooperation of the demuxer seems a bit insane, and is certainly useless. A user should do factor seeks instead. For formats like ts, this will actually translate to byte seeks, while treating the rest of the playback chain a bit more gracefully. With this argument, remove write access to this property. If someone really complains, proper byte seeks could be added as seek mode (although I'm going to need a convincing argument for this). Read access changes too, but in a more subtle way.
* osd: cleanup: make OSDTYPE_ constants private to OSD codewm42016-03-084-10/+8
| | | | | | No need to have them everywhere. The only exception/annoyance is MAX_OSD_PARTS, which is now basically duplicated (and at runtime initialization is checked with an assert()).
* osd, lua: manage multiple ASS overlays set with set_osd_ass() callswm42016-03-081-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Until now, there was only 1 global ASS overlay that could be set by all scripts. This was often perceived as bug when multiple scripts tried to set their own ASS overlay. This was kind of hard to solve because the script could set its own ASS PlayResX/Y, which makes it impossible to share a single ASS_Renderer for multiple scripts. The OSC unfortunately makes use of this feature (and unfortunately can't be fixed because it's a POS), so we're stuck with this complication. Implement the worst-case solution and fix this by creating separate ASS track and renderer objects for each script that wants to set an ASS overlay. The z-order is decided by the order the scripts set their text first. This is essentially random, unless you do it at script init, and you pass scripts in a specific order. Script initialization is currently serialized (as a feature), so the first loaded script gets lowest Z-order. The Lua script API interestingly remains the same. (And also will remain undocumented, unsupported, and potentially volatile.)
* osc: fix mouse areaswm42016-03-081-1/+1
| | | | | | | | The scaling was the wrong way around, and the section name was missing. Regression since commit 5fa45fb5. Fixes #2916.
* osd, lua: remove weird OSD scalingwm42016-03-072-35/+40
| | | | | | | | | | | | | | | | | | | | | Do not scale OSD mouse input to the ASS OSD script resolution. The original idea of this mechanism was that the user doesn't have to care about the actual resolution of anything, and can just use the OSD resolution consistently. But this made things worse. Remove the implicit scaling, and always use the screen resolution. (Except with --vo=xv, where additional scaling is forced upon everything.) Drop get_osd_resolution(). There is no replacement. Rename get_screen_size() and get_screen_margins() to use "osd" instead of "screen". For anything but --vo=xv these are equivalent, but with --vo=xv the OSD resolution has additional implicit scaling. Add code to osc.lua which emulates the old behavior. Note that none of the changed functions were public API, so implicit breakage of scripts which used it is just going to happen.
* sub: make preloading more robustwm42016-03-062-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subtitles can be preloaded, which means they're fully read and copied into ASS_Track. This in turn is mainly for the sake of being able to do subtitle seeking (when it comes down to it, subtitle seeking is the cause for most trouble here). Commit a714f8e92 broke preloaded subtitles which have events with unknown duration, such as some MicroDVD samples. The event list gets cleared on every seek, so the property of being preloaded obviously gets lost. Fix this by moving most of the preloading logic to dec_sub.c. If the subtitle list gets cleared, they are not considered preloaded anymore, and the logic for demuxed subtitles is used. As another minor thing, preloadeding subtitles did neither disable the demux stream, nor did it discard packets. Thus you could get queue overflows in theory (harmless, but annoying). Fix this by explicitly discarding packets in preloaded mode. In summary, now the only difference between preloaded and normal demuxing are: 1. a seek is issued, and all packets are read on start 2. during playback, discard the packets instead of feeding them to the subtitle decoder This is still petty annoying. It would be nice if maintaining the subtitle index (and maybe a subtitle packet cache for instant subtitle presentation when seeking back) could be maintained in the demuxer instead. Half of all file formats with interleaved subtitles have this anyway (mp4, mkv muxed with newer mkvmerge).
* sub: pass all attachments to the subtitle decoderwm42016-03-031-1/+25
| | | | | | | | | | | | | | | | | Commit 8d4a179c made subtitle decoders pick up fonts strictly from the same source file (i.e. the same demuxer). It breaks some fucked up use-case, and 2 people on this earth complained about the change because of this. Add it back. This copies all attached fonts on each subtitle init. I considered converting attachments to use refcounting, but it'd probably be much more complex. Since it's slightly harder to get a list of active demuxers with duplicate removed, the prev_demuxer variable serves as a hack to achieve almost the same thing, except in weird corner cases. (In which fonts could be added twice.)
* command: fix property notification for cache-buffering-statewm42016-03-021-1/+1
|
* command: add encoder-list propertywm42016-03-011-1/+14
| | | | | Also change decoder-list (for the sake of sharing the underlying code for both properties).
* command: export canonical ffmpeg version identifierwm42016-02-291-0/+11
| | | | Was printed only with "mpv -h" or so.
* command: export list of all decoderswm42016-02-291-0/+32
| | | | | | | Was only available via --vd=help and --ad=help (i.e. not at all via client API). Not bothering with separating audio and video codecs, since this list isn't all that useful anyway in general. If someone complains, a type field could be added.
* command: export more information under track-listwm42016-02-291-3/+21
| | | | | | | | | | | | | Export a number of container fields, which may or may not be useful in some scenarios. They are explicitly marked as originating from the demuxer, in order to make it explicit that they might be unreliable. I'd actually like to remove all other cases where container information is exported, but those numerous cases are going to be somewhat hard to deprecate. Also, not directly related, export the description of the currently active decoder. (This has been requested before.)
* player: simplify mp_seek()wm42016-02-281-55/+46
|
* demux: remove relative seekingwm42016-02-283-14/+5
| | | | | | | | | | | | | | | | | | | Ever since a change in mplayer2 or so, relative seeks were translated to absolute seeks before sending them to the demuxer in most cases. The only exception in current mpv is DVD seeking. Remove the SEEK_ABSOLUTE flag; it's not the implied default. SEEK_FACTOR is kept, because it's sometimes slightly useful for seeking in things like transport streams. (And maybe mkv files without duration set?) DVD seeking is terrible because DVD and libdvdnav are terrible, but mostly because libdvdnav is terrible. libdvdnav does not expose seeking with seek tables. (Although I know xbmc/kodi use an undocumented API that is not declared in the headers by dladdr()ing it - I think the function is dvdnav_jump_to_sector_by_time().) With the current mpv policy if not giving a shit about DVD, just revert our half-working seek hacks and always use dvdnav_time_search(). Relative seeking might get stuck sometimes; in this case --hr-seek=always is recommended.
* osc: add always-on mode and unify visibility mode (always/never/auto)Avi Halachmi (:avih)2016-02-271-6/+61
| | | | | | | | | | | | | Adds always-on mode by internally utilizing hidetimeout as negative and forbidding the user to set negative values. This removes script-message to enable/disable the osc, and instead introduces a combined 'visibility' control with the values never/auto/always. It's available via script_opts and script_message as 'osc-visibility'. As message, it also supports a 'cycle' value. The del key is bound to cycling the visibility modes.
* osc: fix runtime enable_osc(true/false)Avi Halachmi (:avih)2016-02-271-4/+11
| | | | | | | | | | | There were few issues: - When it's disabled and then enabled, it was displaying the osc briefly and then autohide right away. Don't do that. - When it's enabled and then disabled, it was not removing the osc from screen if called while the osc is visible (because tick() is responsible for the hide but it doesn't render() the empty osc when the osc is disabled). - Due to delayed/async unbinding of mouse events it was possible to show_osc() after it got disabled e.g. from mouse_move. Prevent this.
* player: minor simplificationwm42016-02-274-18/+13
| | | | | | No need to pass endpts down in such a dumb way. Also remove an outdated comment somewhere.
* player: slightly simplify how demuxer streams are enabled/disabledwm42016-02-255-42/+31
| | | | | Instead of having reselect_demux_streams() look at all streams, make it look at the current stream that is being enabled/disabled.
* player: fix --force-window behaviorwm42016-02-251-2/+2
| | | | | | | | | | | | | | | | | _Of course_ the previous commit broke --force-window behavior (like it does every single time I touch it). vo_has_frame() gets cleared after a seek, so e.g. stopping playback of a file and going to the next by keeping the seek key down will enter a short moment without video at the end of the first file, which will set the stalled_video variable to true. Prevent it by using the indication whether the window was properly created (which is probably exactly what we want here). This function is also responsible for destroying the window when needed, and obviously we should never do that while video is active. (This is the actual bug, although the other change in this commit already hides the common breakage it caused.)
* player: honor --force-window if video is selected, but inactivewm42016-02-241-4/+10
| | | | | If a video track is selected, but no video is decoded from it (mostly with broken files), then create the window anyway.
* player: remove pointless callwm42016-02-231-1/+0
| | | | | This is the unfortunate video timer; it's already reset when it actually matters (after video was prepared and before video is actually started).
* player: simplify enabling demuxer threadswm42016-02-231-17/+6
| | | | | No need for this crazy loop anymore, and we can simply enable it for each demuxer when it's opened.
* player: remove unused MPContext.stream fieldwm42016-02-233-11/+1
| | | | | | | It was just dead code. Also fixes the stream-open-filename property, which is supposed to be read-only if a file was already opened.
* player: remove MPContext.sources fieldswm42016-02-232-17/+4
| | | | | | Some oddity that is not needed anymore. The only thing which still referenced them was avoiding loading external files more than once, which is now prevented by checking the list of tracks instead.
* player: remove initial seek on playback startwm42016-02-181-2/+0
| | | | | | Accidental leftover from commit ae55896f. (This seek ised to be done with ordered chapters, and was accidentally changed to always being done.)
* player: remove old timeline/ordered chapters supportwm42016-02-155-277/+51
|
* audio/video: expose codec info as separate fieldwm42016-02-152-0/+2
| | | | | Preparation for the timeline rewrite. The codec will be able to change, the stream header not.
* video: remove pointless parameter indirectionwm42016-02-151-1/+1
| | | | This is always the same value.
* player: add on_preloaded hookwm42016-02-151-0/+16
| | | | (Limited usefulness.)
* player: restore old/correct --force-window behaviorwm42016-02-151-0/+3
| | | | | | | | | When playback of a video ends, and the next file has no video at all (no cover art or anything), then the window must be cleared. This also resizes the window forcibly, which is by design. Fixes #2825.
* client API: handle double->int64 conversion correctlywm42016-02-131-1/+3
| | | | It signalled failure instead.
* lavfi: dump the filter graphwm42016-02-121-0/+13
| | | | | | | | Especially useful to see what video formats are involved on the various filter links. I suspect this function is not available on Libav, so add necessary ifdeffery preemptively.
* player: remove dead codewm42016-02-122-2/+2
| | | | Fixes CID 1350055 and CID 1350054.
* player: remove double assignment in declarationwm42016-02-121-1/+1
| | | | | | Fixes CID 1350058. (Still looks like this might be valid C, in some fucked up way.)
* player: abort loading if there is a problem with complex filterswm42016-02-101-5/+11
|
* lavfi: stop playback on some unrecoverable situationswm42016-02-101-1/+3
| | | | Also improve the error message for the missing label case.
* player: assume setlocale() returns NULL if locales are not supportedwm42016-02-101-1/+1
| | | | | | | | It would make somewhat sense for libcs which don't implement locales at all, such as Bionic. Beyond that, setlocale() is specified that it can return NULL, and we shouldn't crash if that happens.
* player: fix crash if no video decoder can be initializedwm42016-02-101-0/+1
| | | | Caused by the recent refactoring for complex filters.
* player: force refresh seek when changing audio filterswm42016-02-093-4/+18
| | | | | | | | | | | | | Unfortunately I see no better solution. The refresh seek is skipped if the amount of buffered audio is not overly huge. Unfortunately softvol af_volume insertion still can cause this issue, because it's outside of the normal dynamic filter chain changing code. Move the video refresh call to reinit_video_filters() to make it more uniform along with the audio code.
* player: add --external-file optionwm42016-02-081-14/+12
| | | | Mostly intended for use with --lavfi-complex.
* lavfi: fix EOF casewm42016-02-061-3/+4
| | | | | | | | | | | | This was dumb. Could make it burn 100% CPU and not exit at the end. (Because it would retry as instructed, instead of terminating playback.) It also needs to consider EOF as waiting for input. lavfi_process() will decide if it's really EOF, or if further input might come in the future. Without this, it'd would think that it does not need to wait for input, i.e. that new input will be available immediately. (Not so fond of the duplication of subtle logic.)
* audio: fix EOF handling if nothing could be decoded at allwm42016-02-061-0/+4
| | | | The code for decoding the initial frame has to handle this explicitly.
* player: remove some further current_track dependencieswm42016-02-052-9/+7
| | | | Now it's used for initialization only for audio and video.
* lavfi: fix build on Libavwm42016-02-051-0/+2
| | | | | | It doesn't provide this function. The code is not really designed to work without it, so it will probably mess up big time, but at least make it compile again.
* player: add complex filter graph supportwm42016-02-057-52/+1074
| | | | | | | | | | | | | | | | See --lavfi-complex option. This is still quite rough. There's no support for dynamic configuration of any kind. There are probably corner cases where playback might freeze or burn 100% CPU (due to dataflow problems when interaction with libavfilter). Future possible plans might include: - freely switch tracks by providing some sort of default track graph label - automatically enabling audio visualization - automatically mix audio or stack video when multiple tracks are selected at once (similar to how multiple sub tracks can be selected)
* player: move audio and video decoder init to separate functionswm42016-02-053-33/+74
| | | | Preparation.
* player: simplify error_on_track()wm42016-02-051-15/+13
| | | | | | track can't be NLUL at this point, so the if is redundant. Remove it and unindent the block. Also, make the function check whether the track is selected at all, which makes it safer and idempotent.
* options: set fs=yes by default on RPI, and change RPI defaults handlingwm42016-02-051-0/+5
| | | | | The main reason for changing the fullscreen default is that not doing it would change the vo_rpi default behavior with the previous commit.
* input: ignore --input-cursor for events injected by input commandswm42016-02-041-6/+6
| | | | | | Apparently useful for window embedding. Fixes #2750.
* sub: implement "sub-seek 0"wm42016-02-041-1/+1
| | | | | | | For bitmap subs, implement it properly. For libass, you need newest git master. Fixes #2791.
* command: fix track cycling logicwm42016-02-031-9/+4
| | | | | | Also remove the unused function argument. Fixes #2784.
* command: show original aspect in video-aspect property toowm42016-02-021-16/+19
| | | | | Basically, just make it append " (original)" if the original aspect ratio is selected.
* player: refactor: reduce some dependencies on current_trackwm42016-02-013-24/+15
| | | | Don't mind me.
* player: use different variable to indicate coverartwm42016-02-014-17/+15
| | | | Slightly better.
* audio/video: merge decoder return valueswm42016-02-012-7/+7
| | | | | | Will be helpful for the coming filter support. I planned on merging audio/video decoding, but this will have to wait a bit longer, so only remove the duplicate status codes.
* audio: use brutal resync only on larger PTS discontinuitieswm42016-01-311-2/+4
| | | | | | | | | Let's fix broken samples with questionable heuristic without real reasoning. Until this gets fixed properly, this is a good compromise, though. A proper fix would properly resync audio and video without brutally resetting the decoders, but on the other hand not doing the brutal reset would cause issues in other obscure corner cases such resyncing might cause.
* audio: fix a case of going to sleep before playback startwm42016-01-311-0/+1
| | | | | | | | | | | | | | | This code is tricky because it has to wakeup the mainloop to make progressing during syncing audio, but also has to avoid waking it up when it's not needed. Failure to do so either burns CPU by not ever going to sleep, or causes apparent "freezes" by going to sleep (and it will continue if the mainloop is woken up e.g. due to user input). In this case, simply starting A/V playback with --start=5 and removing an unrelated wakeup in osd.c can trigger such a "freeze". The unrelated wakeup did hide this bug, nonetheless it's a bug. (Can't wait to rewrite this shitty audio resync code. And it's all my fault.)
* vd_lavc: allow switching between hw/sw decoding any timewm42016-01-291-2/+1
| | | | | | | We just need to provide an entrypoint for it, and move the main init code to a separate function. This gets rid of the messy video chain full reinit in command.c, which completely destroyed and recreated the video state for the purpose of mid-stream hw/sw switching.
* player: refactor: some more minor decoder/output decouplingwm42016-01-293-16/+22