summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* Fix compilationDiogo Franco (Kovensky)2015-02-251-2/+5
| | | | Broken by unchecked cherry-picking of 53867aa.
* ytdl: add --no-warningswm42015-02-251-1/+1
| | | | | | | | Silences "[ytdl_hook] WARNING: video doesn't have subtitles", which was an annoying and pointless message printed with almost all youtube videos. (cherry picked from commit 7cff2e41316d508754b7b0725f5236de180f5cc2)
* ytdl: Adapt to new subtitles structureJaime Marquínez Ferrándiz2015-02-251-9/+11
| | | | | | The requested formats can be sorted by preference and the result gives now an url or the subtitles file content (cherry picked from commit 7281a72fabc610c70b4803ffb739c4155862c2d0)
* encoding: allow encoding to channel configurations other than stereowm42015-02-251-1/+3
| | | | | | | | | | | | A while ago, we made mpv output the native number of channels by default, instead of stereo. I assumed this was not wanted for encode mode. This commit keeps the assumption, but allows setting the number of audio output channels at all, instead of always forcing stereo. (Pretty much a hack.) (cherry picked from commit 636d6d724d36b90812a0c145bbf40143be9a52e8)
* player: fix demuxer lifetime managementwm42015-02-242-54/+43
| | | | | | | | | | | | | 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. (cherry picked from commit 53867aa9d834fd6a6314803655bd4c444d0e1df4)
* player: move timeline scanning (ordered chapters etc.) to a threadwm42015-02-211-7/+15
| | | | | | | | | | | | | | Do timeline building (scanning & opening reference files for ordered chapters, and more) in a thread. As a result, this process can actually be stopped without having to kill the player. This is pretty simple: just reuse the demuxer opening thread. We have to give up on the idea that open_demux_reentrant() is reusable, though. (Althoughthe timeline readers still need some fixes before they react to the quit request.) (cherry picked from commit 44411674ebb764adeb806040d24700bc4cc493cc)
* player: cosmetics: async/non-blocking -> reentrantwm42015-02-213-13/+13
| | | | | | | | 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. (cherry picked from commit 2c305d5b2990d31911d7faa4c9117bf4eb89c88b)
* demux_edl: make independent from MPContextwm42015-02-192-6/+0
| | | | (cherry picked from commit d7a4cb14ff8dc61d87cec54abcd7f7623e8cc666)
* demux_edl: move implementationwm42015-02-191-302/+0
| | | | | | Same deal as with demux_cue, and a separate commit for the same reasons. (cherry picked from commit 1e44c811f3683f62714ff5ecc2e4f233eb8bb668)
* demux_cue: make independent from MPContextwm42015-02-192-5/+0
| | | | | | Also see previous commit(s). (cherry picked from commit 10781c2a9c175a8f9e445df4a91031301f225351)
* demux_cue: move implementationwm42015-02-191-415/+0
| | | | | | | | | | Move the implementation, of which most was in tl_cue.c, to demux_cue.c. Currently, this is illogical, because tl_cue.c still accesses MPContext. This is going to change, and then it will be better if everything is in demux_cue.c. This is only a separate commit to distinguish code movement and actual work; the next commit will do the actual work. (cherry picked from commit 7f03f46882ec4e9eb9d9857cf5cc393bb3afa7ca)
* matroska: move timeline code to demux/wm42015-02-191-654/+0
| | | | | | | Separate from previous commit, because git is bad at tracking file renames when the file contents are also changed. (cherry picked from commit edc0007e74ab4ad043f35eed8cdebd9ed73c8062)
* matroska: make timeline code independent of MPContextwm42015-02-193-114/+117
| | | | (cherry picked from commit 5a186d5942bda0c7cae56bc524a6dceccb5c7d3f)
* player: use a separate context for timeline loader stuffwm42015-02-192-22/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. (cherry picked from commit a0a089f6a48c2775478b544185a0ddeabf43cce8)
* player: use a macro to remove an element from an arraywm42015-02-191-6/+1
| | | | | | Should be equivalent. (cherry picked from commit 969edb9e0b86500ed0af9c26209ad7000adb5157)
* player: actually close files when using sub_removewm42015-02-191-13/+38
| | | | | | | | | | | Also effects some other cases. The real reason for this is for keeping track of which demuxers can be closed (see following commit). Since I don't want to use reference counting for this, some sort of simplistic mark-and-sweep is done to determine whether a demuxer is still needed. (cherry picked from commit f54220d95150ee53a33cc6626b7d0ff8b235c7f0)
* osxbundle: config file special case isn't needed anymorewm42015-02-161-6/+0
| | | | | | | | The previous commit effectively fixes the mess caused by 'config' vs. 'mpv.conf', and the hack introduced by commit e01a6dac and extended by commit db167cd4 isn't needed anymore. (cherry picked from commit 816d7bba1f3842146fa12c98232070559e72e807)
* player: undeprecate 'config' fileswm42015-02-161-22/+5
| | | | | | | | | Actually, it's pretty simple to look for multiple filenames at once, since mp_find_all_config_files() is already a bit "special" anyway. See #1569. Reverts most of commit db167cd4 (keeps osx-bundle.conf). (cherry picked from commit a27aa68dd33c613218d261b14ef1cf763abc1c33)
* Fix build on OSX broken by previous commitwm42015-02-161-1/+1
| | | | | | Hopefully. (cherry picked from commit 5247416735e86417d466f0137cf907b5921602a1)
* vf_vapoursynth: add display refresh rate propertyJulian2015-02-161-0/+2
| | | | | | | This value is not necessarily trustworthy (it might change) and can be 0. (cherry picked from commit 349067a6ab2d03024b3e984e80314f303dd14432)
* player: deprecate 'config' files (use mpv.conf), warn against clasheswm42015-02-161-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently there's at least one distro which ships a /etc/mpv/mpv.conf file (mpv doesn't install such a file). This breaks config files named 'config' located in the user's mpv config directory, because mpv first loads files named 'config' and then 'mpv.conf'. There is no mechanism for putting files with different names into the same config path order. (Even worse, that mpv.conf file only set an option to the default value. Why do distros always do very stupid things?) Print a warning on collisions. Although using 'config' was well-supported, supporting both names is starting to become messy, so deprecate 'config' and print a warning if one is found. At least we will be able to remove the whole mess once 'config' files are ignored... This also affects the osx-bundle, which intentionally used these not-so- optimal semantics. Solve it in a different way. (Unfortunately with an ifdef - it's not required, but having to explain everyone why mpv tries to load a osx-bundle.mpv file on Linux and Windows would consume energy.) Closes #1569. (cherry picked from commit db167cd438b516371bc2a7b6e08a57f2054dc742)
* command: mark get_property as deprecatedwm42015-02-161-0/+4
| | | | | | | Using it just makes no sense. But we're really being nice about this and don't remove it immediately. (cherry picked from commit fd5403cb404ca8fb30c2c6b1f415201bbce40d77)
* encoding: fixed-vo option was removedwm42015-02-161-1/+0
| | | | (cherry picked from commit 96547a810e87d06121704ed67e3cf44430752c67)
* player: add a --loop=force modewm42015-02-162-8/+6
| | | | | | | | | Requested. See manpage additions. This also makes the magical loop_times constants slightly saner, but shouldn't change the semantics of any existing --loop option values. (cherry picked from commit aee0978d50e21d8f114382fdb9c014c029f71a04)
* osx: move code to unset input context to the right placewm42015-02-161-4/+4
| | | | | | | | | Setting the input context is always called, both in cplayer and libmpv, and under HAVE_COCOA. Unsetting the input context was done only the cplayer uninit call. Also it was under HAVE_COCOA_APPLICATION, so it was not unset in libmpv (dangling pointer). (cherry picked from commit c59a4f12db96784b054f28d52eaa33cb7553d630)
* osx: move cocoa specific call out of common codewm42015-02-161-8/+0
| | | | This is almost equivalent, and gets rid of the ifdef.
* player: drop explicit exit() callswm42015-02-161-14/+9
| | | | | | | | | | | The code in main.c calls exit() explicitly, but the code is actually easier to follow by simply exiting from main() instead. The exit() call in av_log.c happens only on severely broken builds, so replace it with abort(). (Shuts up rpmlint warnings.) (cherry picked from commit e920a00ebad645cd14d341f4dabd4c5c077d2e0c)
* Revert "player: make --force-window create the window immediately on start"wm42015-02-121-1/+0
| | | | | | | | | | | | | This reverts commit acc5e8f57419debdb74234a228b44db75023e28b. As expected, some didn't like this. Others won't like this revert. Whatever. See #1561. This should go into mpv 0.8.0 before it's released. (cherry picked from commit 7bbc6170193a22d5d66370e4e3a97d23bcbc3903)
* tl_matroska: only check the chapter count when adding chaptersBen Boeckel2015-02-061-3/+3
| | | | | | | Fixes #1445 without failing in the case where file outside.mkv with N chapters references inside.mkv with N+1 chapters. Since we don't care about the number of chapters in inner files (yet; nested chapters would change this, but also make chapters dynamic anyways), don't check there.
* tl_matroska: squeeze down the number of parametersBen Boeckel2015-02-061-62/+77
| | | | | | Much cleaner. The difference between timeline_info and inner_timeline_info is that timeline_info is stuff the top-level cares about and inner_timeline_info is just for the current chapter.
* player: do not autoload audio with audio files, enable autoloadingwm42015-02-051-0/+12
| | | | | | | | | | | | | | Autoload external audio files only if there's at least a video track (which is not coverart pseudo-video). Enable external audio file autoloading by default. Now that we actively avoid doing stupid things like loading an external audio file for an audio-only file, this should be fine. Additionally, don't autoload subtitles if a subtitle is played. Although you currently can't play subtitles without audio or video, it's disturbing and stupid that the player might load subtitle files with different extension and then fail.
* matroska: warn against mismatching segmentswm42015-02-041-0/+49
| | | | | | | | Matroska ordered chapters require all segment files to have the same layout. If a referenced file has more tracks than the main file or misses some tracks, the file is invalid. Also see issue #1553.
* player: move timeline specific handling to timeline loaderswm42015-02-044-14/+14
| | | | In particular, gets rid of the Matroska specifics from the common code.
* command: add on_unload hookwm42015-02-041-0/+10
| | | | Fixes #1552.
* player: make --force-window create the window immediately on startwm42015-02-031-0/+1
| | | | | | | | | | | | | | | | Before this change, window creation was delayed until the video was initialized. This guaranteed that the first window size was that of the video, so the WM would place it correctly. Some time ago, it was requested on the IRC channel that --force-window should not do this. Sometimes, it can take a while until video is initialized, e.g. when youtube-dl is used (which incurs lots of network delay). In this case, it's awkward that it takes so long until a window (any window) is shown. On the other hand, this can cause incorrect window placement with some WMs. We simply hope that this won't happen with modern WMs. (Although it does with the WM I use, crappy old IceWM.)
* player: remove --fixed-vowm42015-02-033-7/+2
| | | | | | | In ancient times, this was needed because it was not default, and many VOs had problems with it. But it was always default in mpv, and all VOs are required to deal with it. Also, running --fixed-vo=no is not useful and just creates weird corner cases. Get rid of it.
* command: new commands audio_add/audio_remove/audio_reloadxylosper2015-02-033-34/+37
| | | | | | | | 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)
* command: add property returning detected audio deviceStefano Pigozzi2015-02-031-1/+11
| | | | | This can be useful to adjust some other audio related properties at runtime depending on the audio device being used.
* command: add property returning detected hwdec APIwm42015-02-021-1/+32
| | | | | | | | | This is somewhat imperfect, because detection of hw decoding APIs is mostly done on demand, and often avoided if not necessary. (For example, we know very well that there are no hw decoders for certain codecs.) This also requires every hwdec backend to identify itself (see hwdec.h changes).
* player: add external audio file auto-loadingwm42015-02-021-44/+58
| | | | | | Apparently some people want this. Not enabled by default. Fixes #967.
* command: add properties returning the current VO and AO driverwm42015-02-021-2/+18
| | | | This wasn't possible before.
* client API: add mpv_wait_async_requests()wm42015-02-021-8/+12
| | | | | | | | | | | | | | | | | | | | This does what it's documented to do. The implementation reuses the code in mpv_detach_destroy(). Due to the way async requests currently work, just sending a synchronous dummy request (like a "ignore" command) would be enough to ensure synchronization, but this code will continue to work even if this changes. The line "ctx->event_mask = 0;" is removed, but it shouldn't be needed. (If a client is somehow very slow to terminate, this could silence an annoying queue overflow message, but all in all it does nothing.) Calling mpv_wait_async_requests() and mpv_wait_event() concurrently is in theory allowed, so change pthread_cond_signal() to pthread_cond_broadcast() to avoid missed wakeups. As requested in issue #1542.
* command: add dummy get implementation for tv-channel propertywm42015-02-021-0/+2
| | | | | A small cosmetic change with the effect that pressing 'k' shows "unavailable" instead of "error" (even if no TV code is active).
* player: dump audio jitter to stats filewm42015-02-011-4/+5
| | | | | This allows us to plot the difference between video timestamps, and the adjusted video timestamps due to syncing video to audio speed.
* command: send additional property change events in-between loadingwm42015-02-013-0/+3
| | | | | | | | Opening the stream and opening the demuxer are both done asynchronously, meaning the player reacts to client API requests. They also can potentially take a while. Thus it's better to process outstanding property changes, so that change events are sent for properties that were changed during opening.
* command: improve observability of some audio propertieswm42015-02-011-1/+2
| | | | | | | | | In particular, this would fix the sending the initial change event. It was easily missed because MPV_EVENT_FILE_LOADED usually triggered it, but the actual property could change only later, because audio initialization really is kind of asynchronous to it. This probably fixes #1544.
* player: don't treat audio playback restart while paused specialwm42015-01-301-4/+1
| | | | | | I guess this was supposed to be some sort of optimization, but even though it probably works, it's pretty meaningless and I couldn't measure a difference. One special case killed.
* player: minor simplification in A/V-sync related codewm42015-01-302-10/+6
| | | | Just minor things.
* Revert "player: allow seeking audio between video frames"wm42015-01-301-9/+1
| | | | | | | | This reverts commit 7b3feecbc23e3e0b0d9cf66f02af53d127a0b681. It's broken, hr-seek never ends at a video position before seek pts. Not sure what I was thinking, although it did work anyway when artificially forcing a video frame to display before seek pts.
* player: print desync message on negative A/V-sync toowm42015-01-301-1/+1
| | | | | | | | At least there is _some_ problem if this happens. It would mean that audio is playing slower than video. Normally, video is synced to audio, so if audio stops playback completely, video will not advance at all. But using things like --autosync, it's well possible that this kind of desync happens.
* player: rearrange some A/V-sync related codewm42015-01-301-6/+5
| | | | | | | | | | | | Move the update_avsync_before_frame() call further down. Moving it closer to where the time_frame value is used (and which the function updates) should make the code more readable. With this change, there's no need anymore to reset the time_frame value on the video reconfig path. Move the update_avsync_after_frame() up. Now no meaningful amount of time passes since the previous get_relative_time() call anymore, and the second one can be removed.
* player: use correct type for some relative timeswm42015-01-301-3/+3
| | | | | | We use double for these things everywhere, just this code didn't. It likely doesn't matter much, and this code is for an optional feature too.
* command: change sub-visibility OSD messagewm42015-01-291-1/+2
| | | | | | | | | | | | | Now it shows one of: - "Subtitles hidden" (sub-visibility=no) - "Subtitles visible" (sub-visibility=yes, sub!=no) - "Subtitles visible (but no subtitles selected)" (otherwise) It should be a bit more self-explanatory than before. On the other hand, I have no clue about UI issues. This also gets close to what's reasonably possible with the OSD expansion string syntax, which is why it looks so awful.
* player: move more code out of central playloop functionwm42015-01-291-58/+73
| | | | | | | | | | ...into its own functions. The central playloop function is still too big, but looks much cleaner now. No changes in functionality. The code moved to handle_playback_restart() is unindented by 1 level and moving it out of the if condition around. The if condition is inverted and early-exits from the function. Also some comments are changed.
* player: remove redundant variablewm42015-01-295-12/+9
| | | | | | 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: allow seeking audio between video frameswm42015-01-281-1/+9
| | | | | | | | | | | | | | | This allows seeking audio between two video frames that are relatively far away. The implementation of this is a bit subtle. It pretend the audio position is different, and the actual PTS adjustment happens in audio.c with this line: sync_pts -= mpctx->audio_delay - mpctx->delay; Effectively this is the same as setting sync_pts to hrseek_pts after this line, though. (I'm actually not sure if this could be written in a more straightforward way; probably yes.)
* player: enable hr-seek on audio after video endwm42015-01-281-1/+2
| | | | | | | | | | | | | | | | | | Some files can have audio after video has ended, and playback of the audio-only remainder is supposed to work just fine. Seeking is broken-ish though. Not much can be done about this, since it's the way demuxers work. Also, such files are obscure corner cases. But enabling hr-seek for audio after video end can improve the situation a lot. This helps with issue #1533. The reported also provided a command line to produce such a file: ffmpeg -i image.jpg -i audio.flac -threads $(nproc) \ -c:v libvpx -crf 10 -qmin 5 -qmax 55 \ -vf scale=360:-1 -sws_flags lanczos -c:a libvorbis -ac 2 \ -b:a 128K out.webm
* player: demote matroska ordered c