summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* encode: cosmeticswm42018-04-203-93/+107
| | | | Mostly whitespace changes; some semantic preserving transformations.
* vo_lavc: remove pointless uint32_t type for int valueswm42018-04-201-7/+2
| | | | | params->w/h are int, and the further use of these variables are int. The uint32_t is probably some refactoring artifact.
* encode: remove some unused functionswm42018-04-202-20/+0
|
* encoding: deprecate a bunch of obscure optionswm42018-04-204-10/+13
| | | | | --audio-delay does not work correctly yet, but hopefully this can be fixed later.
* audio: fix EOF handling if there was no data at allwm42018-04-201-0/+7
| | | | | | It stopped and did nothing, instead of terminating (or just letting video play, if there was any video). Regression due to recent filter changes.
* video: pass through container fps to filterswm42018-04-197-15/+16
| | | | | | | | | | | | This means vf_vapoursynth doesn't need a hack to work around the filter code, and libavfilter filters now actually get the frame_rate field on input pads set. The libavfilter doxygen says the frame_rate field is only to be set if the frame rate is known to be constant, and uses the word "must" (which probably means they really mean it?) - but ffmpeg.c sets the field to mere guesses anyway, and it looks like this normally won't lead to problems.
* demux: support for some kinds of timed metadatawm42018-04-188-121/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes ICY title changes show up at approximately the correct time, even if the demuxer buffer is huge. (It'll still be wrong if the stream byte cache contains a meaningful amount of data.) It should have the same effect for mid-stream metadata changes in e.g. OGG (untested). This is still somewhat fishy, but in parts due to ICY being fishy, and FFmpeg's metadata change API being somewhat fishy. For example, what happens if you seek? With FFmpeg AVFMT_EVENT_FLAG_METADATA_UPDATED and AVSTREAM_EVENT_FLAG_METADATA_UPDATED we hope that FFmpeg will correctly restore the correct metadata when the first packet is returned. If you seke with ICY, we're out of luck, and some audio will be associated with the wrong tag until we get a new title through ICY metadata update at an essentially random point (it's mostly inherent to ICY). Then the tags will switch back and forth, and this behavior will stick with the data stored in the demuxer cache. Fortunately, this can happen only if the HTTP stream is actually seekable, which it usually is not for ICY things. Seeking doesn't even make sense with ICY, since you can't know the exact metadata location. Basically ICY metsdata sucks. Some complexity is due to a microoptimization: I didn't want additional atomic accesses for each packet if no timed metadata is used. (It probably doesn't matter at all.)
* player: remove in_dispatch fieldwm42018-04-184-17/+35
| | | | (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.
* w32_common: avoid recursive dispatch queue callswm42018-04-181-1/+6
| | | | | | | | I suppose this doesn't matter in practice, i.e. even if calls relayed over the dispatch queue will cause WndProc to be invoked, WndProc will never run for a longer time. Preparation for removing recursion support from the dispatch queue code.
* scripting: change when/how player waits for scripts being loadedwm42018-04-185-22/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fundamentally, scripts are loaded asynchronously, but as a feature, there was code to wait until a script is loaded (for a certain arbitrary definition of "loaded"). This was done in scripting.c with the wait_loaded() function. This called mp_idle(), and since there are commands to load/unload scripts, it meant the player core loop could be entered recursively. I think this is a major complication and has some problems. For example, if you had a script that does 'os.execute("sleep inf")', then every time you ran a command to load an instance of the script would add a new stack frame of mp_idle(). This would lead to some sort of reentrancy horror that is hard to debug. Also misc/dispatch.c contains a somewhat tricky mess to support such recursive invocations. There were also some bugs due to this and due to unforeseen interactions with other messes. This scripting stuff was the only thing making use of that reentrancy, and future commands that have "logical" waiting for something should be implemented differently. So get rid of it. Change the code to wait only in the player initialization phase: the only place where it really has to wait is before playback is started, because scripts might want to set options or hooks that interact with playback initialization. Unloading of builtin scripts (can happen with e.g. "set osc no") is left asynchronous; the unloading wasn't too robust anyway, and this change won't make a difference if someone is trying to break it intentionally. Note that this is not in mp_initialize(), because mpv_initialize() uses this by locking the core, which would have the same problem. In the future, commands which logically wait should use different mechanisms. Originally I thought the current approach (that is removed with this commit) should be used, but it's too much of a mess and can't even be used in some cases. Examples are: - "loadfile" should be made blocking (needs to run the normal player code and manually unblock the thread issuing the command) - "add-sub" should not freeze the player until the URL is opened (needs to run opening on a separate thread) Possibly the current scripting behavior could be restored once new mechanisms exist, and if it turns out that anyone needs it. With this commit there should be no further instances of recursive playloop invocations (other than the case in the following commit), since all mp_idle()/mp_wait_events() calls are done strictly from the main thread (and not commands/properties or libmpv client API that "lock" the main thread).
* cocoa-cb: fix a warning with swift 4.1 and slight cleanupAkemi2018-04-171-3/+7
| | | | | | the icc profile data is mutated to an UnsafeMutablePointer and could possibly changed. therefore the size of it should be accessed before a possible change.
* HIDRemote: fix volume buttons on macOS 10.13Akemi2018-04-171-0/+8
| | | | | | | this is a backport of line 1039 to 1046 from https://github.com/iospirit/HIDRemote/commit/33a32ab6136feb8b8220e99ec52c7504c3a82242#diff-8a4d13f0849b3beffa4267954ca28517R1039 Fixes #5721
* hwdec_ios: fix crash after mapper_init failureAman Gupta2018-04-171-2/+4
|
* demux: mark eia608 packets as keyframesAman Gupta2018-04-171-0/+1
| | | | | | This fixes an issue where captions stop rendering after an in-demuxer-cache seek, because the demuxer keeps waiting to find a keyframe (ds->skip_to_keyframe set to true in execute_cache_seek).
* demux, player: mark dependent tracksAman Gupta2018-04-174-1/+5
| | | | | | | ffmpeg marks audio tracks which are not meant to be played standalone as DEPENDENT. these are typically used in DVB broadcasts for audio descriptions, and are meant to be mixed into the main audio track during playback.
* client API: make sure to send IDLE event after mpv_initialize()wm42018-04-161-0/+1
| | | | | | | | | | | This was slightly broken: since mp_initialize() did not necessarily interrupt core_thread() (which is waiting for initialization), it did not enter mp_play_files(), which would have sent an IDLE event. I suppose that in some cases (like with mpv-android), the initial IDLE event was never actually sent, because the first wakeup of the core thread happens with the "loadfile" command, which will disallow the core thread an IDLE event.
* demux_lavf: use new libavformat semantics for stream resyncwm42018-04-161-17/+2
| | | | | | | | | | I changed avio_flush() and introduced avformat_flush() exactly for this reason. Used with DVD/BD only (on seeks and when setting the "angle" property). Seems to work, but wasn't tested too thoroughly (I don't care about optical discs, I only want this ugly stuff gone that might even violate the API/ABI).
* client API: fix potential sporadic freezes on terminationwm42018-04-161-4/+4
| | | | | | | | | | | | | | | Although this was never observed to be happening, it seems definitely possible: we first tell the main thread to exit, and then we ask the main thread to do some work for us (with mp_dispatch_run()). Obviously this is racy, and the main thread could exit without doing this, which would block mp_dispatch_run() forever. Fix this by changing the order of operation, so that it makes sense. We could also just store the pthread_t of the main thread in some variable, but the fact that pthread_create() might set the pthread_t argument _after_ starting the thread makes this a bit messy (at least it doesn't seem to be guaranteed on a superficial look at the manpage).
* client API: clarify that Display pointers etc. need to stay validwm42018-04-162-8/+25
| | | | | | | | | | | | Normally, MPV_RENDER_PARAM* arguments are copied, unless documented otherwise. Of course we can't copy X11 Display or Wayland wl_display types, but for arguments that are "summarized" in a struct (like MPV_RENDER_PARAM_OPENGL_FBO), a copy is expected. Also add some unused infrastructure to make this explicit, and to make it easier to add parameter types that require a copy. Untested.
* f_lavfi: add an option to use old audio PTS handling for af_lavfiwm42018-04-153-1/+45
| | | | | The fix-pts option basically uses the old af_lavfi's (before filter rewrite) timestamp logic. The rest is explained in the manpage.
* DOCS/interface-changes.rst: adjust some audio filter change noteswm42018-04-151-3/+5
| | | | | | | | | | | | The first change is about spdif - I mostly ignore spdif issues these days, but it seems like the recent changes made handling of it slightly better (but I didn't really test). The second change is about broken libavfilter filters. We won't restore the old behavior, because people were complaining about the old behavior in the past. Possibly we could make libavfilter export this was metadata and use the old behavior if we know they're broken - but it doesn't exist yet.
* audio: do not try to resample spdif datawm42018-04-151-0/+5
| | | | | | Normally we don't even try this, but in corner cases it can happen. For example when inserting lavcac3enc at runtime, and display-sync-resample was active.
* audio: don't recreate AO if a filter changes the output formatwm42018-04-152-4/+32
| | | | | | | | | | | | | | | | | | | | | | | Until recently, the AO was reinitialized strictly only on decoder format changes. But the commit for simplifying audio format negotiation removed this. Now the AO is recreated for any format change. This is sort of annoying if you change playback speed. The insertion/removal of af_scaletempo can change the sample format. For example, the acompressor filter will convert output to double, so toggling scaletempo will force the format back to float. This recreates the AO under the --gapless-audio=weak default. This likely affects a lot of other filters too. Work this around by allowing sample format changes, and keeping the current AO format in these cases. This is probably not a big problem. Most audio APIs force the output format to float anyway. This means you actually have to worry about what the default gapless mode does to your audio. If you start with a file that uses 8 bit per sample, and then continue playing a 24 bit FLAC, it will be converted down to 8 bit per sample. (Assuming they are played in a way that uses the gapless logic.)
* ao_alsa: actually report underruns to userwm42018-04-151-5/+5
| | | | | | | | | Print them as a warning. Note that there may be some cases where it underruns, without being a bad condition. This could possibly happen e.g. if the last chunk is written, and then it resumes playback some time after that. Eventually I want to add more code to avoid such spurious warnings.
* f_output_chain: fix typowm42018-04-151-1/+1
|
* audio: change format negotiation, remove channel remix fudgingwm42018-04-153-229/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The audio format neogitation code was pretty complicated, although the idea was simple: when the format changes (or on the first audio frame), filter only the new frame through the entire filter chain, discard the resulting frame, but use the format to initialize the AO. This was useful for "fudging" the channel remix behavior (upmix or downmix), and moving it before other filters. Apparently this was useful for things like DRC filters, which might work better in stereo, and which also can only achieve the desired volume levels by doing it before a downmix, which would modify the volume. This mechanism was introduced in commit 60048b7eb957b (which the commit message also describes as "idiotic heuristic"). Knowing the output format is inherently necessary for this, because otherwise we can't know what the hell the user defined filters will do. There were problems with robustness. Some filters needed more than one frame. Resampling in particular would discard initial audio at high resampling ratios. Some filters might drop audio intentionally (like clipping data on timestamp ranges). There were also allegations that some decoders output 0 length frames (although that is invalid in libavcodec). The state machine was excessively complex and hard to understand too. There are 3 things that could have been done: 1. Fix robustness problems by doing more heuristics, like repeating audio frames or simply decoding several frames. Since filters can behave differently, this would have added lots of complexity. 2. Make use of libavfilter's format negotiation, and add the same to mpv builtin filters. This is sort of annoying, because the format negotiation in libavfilter changes the state of the filters. It also reports only some parameters (mostly all for audio, but a lot of holes for video). It would remove some of the state machine, but not all. 3. Drop the channel remix fudging, and do the same as the video chain. This would not require format negotiation, but instead you can just filter the audio frames, and look what comes out of it. If nothing comes out, simply never create an AO. This commit selects option 3. It removes the remix fudging, which means the loss of a feature. Users can instead add "--af=format=channels=2" before their DRC filter, or something. I'm also considering changing the default for --audio-channels back to stereo, and downmix in the decoder or at the start of the filter chain, which would give the same results, except requiring more configuration. Implementation-wise, this is still a bit different from the video path. The VO always remains the same instance, while the AO might have to be recreated on configuration changes. This still requires explicit format change handling + draining old data, but by putting it into f_autoconvert, not much new code is needed.
* f_autoconvert: be less clever about running specific codepathswm42018-04-151-28/+14
| | | | | | | This tried to avoid running the audio/video functions depending on whether any of the audio or video related format restrictions were called (so the filter would show an error if a mismatching media type was passed in). It was a shit idea anyway, so fuck it.
* ao_pulse: reduce requested device buffer sizewm42018-04-152-2/+2
| | | | | | Same deal as with the previous commit for ALSA. Untested.
* ao_alsa: reduce requested buffer sizewm42018-04-151-2/+2
| | | | | | There is a dedicated thread for feeding audio to the ALSA API from a buffer with a larger size. There is little reason to have such a large device buffer.
* ao_alsa: add options for controlling period/buffer sizewm42018-04-152-8/+30
|
* ytdl_hook: don't log error when loading is abortedwm42018-04-151-2/+6
|
* stream_libarchive: mark as needing cachewm42018-04-151-0/+1
| | | | | Seeking back can be excessively slow with most formats, so it'll benefit from this.
* demux: fix deadlock on "program" property changeswm42018-04-151-0/+6
| | | | | Tries to recursively lock a non-recursive lock, which usually ends in a deadlock. Must have been broken by some past refactor.
* demux_mkv: fix certain cases of recursive SeekHeadswm42018-04-151-4/+1
| | | | | | | | | | | | | | | Some shittily muxed files (by a certain HandBrake+libavformat combo) contain a SeekHead pointing to a SeekHead at the end of the file, which in turn points to track headers (also at the end of the file). This failed because the demuxer didn't bother to actually read the elements listed by the second SeekHead, so no track headers were read, and playback broke. Somehow commit 6fe75c38 broke this for no reason. It adds a "needed" field, which seems completely pointless and replaced the "parsed" flag in an incomplete way. In particular, the "needed" field was not set when a _recursive_ SeekHead was read, so those elements were not read. Just get rid of the field and use "parsed" instead.
* vo_gpu: hwdec: Use ffnvcodec to load CUDA symbolsPhilip Langdale2018-04-155-246/+50
| | | | | | The CUDA dynamic loader was broken out of ffmpeg into its own repo and package. This gives us an opportunity to re-use it in mpv and remove our custom loader logic.
* build: fixup vendored wayland protocols with variantsJan Ekström2018-04-152-10/+31
| | | | | | Utilize the SRC variable for this to get a built-in relative path. Can be tested by adding `--variant="random_string"` to configure and build.
* ao_openal: document the muted↔gain conversionJan Ekström2018-04-151-0/+3
| | | | This struck me as odd for a moment, so adding a comment.
* ao/openal: Remove notes on experimentality from the documentationLAGonauta2018-04-151-4/+1
| | | | | Also, multi-channel audio should be fast now with the use of the MC extensions.
* ao/openal: Add option to set buffering characteristicsLAGonauta2018-04-152-23/+70
| | | | | | | | | One can now set the number of buffers and the buffer size. This can reduce the CPU usage and the total latency stays mostly the same. As there are sync mechanisms the A/V sync continue intact and working. It also modifies 6.1 channel order, as per OpenAL spec and add AOPLAY_FINAL_CHUNK support
* ao/openal: Add better sample format and channel layout selectionLAGonauta2018-04-151-139/+73
| | | | Also re-added floating-point support.
* ao/openal: Add OpenAL Soft extension to get the correct latencyLAGonauta2018-04-151-1/+16
| | | | | | | | OpenAL Soft's AL_SOFT_source_latency extension allows one to correctly get the device output latency, facilitating the syncronization with video. Also added a simpler generic fallback that does not take into account latency of the device.
* ao/openal: Add support for direct channels outputLAGonauta2018-04-152-0/+16
| | | | | | | Uses OpenAL Soft's AL_DIRECT_CHANNELS_SOFT extension and can be controlled through a new CLI option, --openal-direct-channels. This allows one to send the audio data direrctly to the desired channel without effects applied.
* ao/openal: Add hardware mute supportLAGonauta2018-04-151-0/+12
| | | | | While the volume is set on the listener, mute is set on the sound source. Seemed easier that way.
* ao/openal: Use only one source for audio outputLAGonauta2018-04-151-52/+153
| | | | Floating point audio not supported on this commit.
* opengl: include details in EGL context errorsAman Gupta2018-04-121-3/+3
|
* demux_lavf: skip demuxer hack iteration if hacks are disabledsergey.dobrodey2018-04-121-3/+1
|
* demux_mkv: add V_AV1 identifier for AV1Jan Ekström2018-04-081-0/+1
| | | | | | | | | | | Quickly tested by a person who had FFmpeg linked with libaom. Seems as simple as the VP9 mappings, where there is no extradata/ initialization data off-band, and just stuff in the packets themselves. Do note that the AV1 video format itself at this point is still not frozen, so what you might produce one day might not be decodable the following day.
* manpage: document vaapi-deviceKevin Mitchell2018-04-081-0/+4
| | | | This was left out of e3e2c79 by mistake.
* manpage: move cuda-decode-device with hwdec optionsKevin Mitchell2018-04-081-10/+10
|
* js: use new hooks API (match f60826c3)Avi Halachmi (:avih)2018-04-072-10/+50
|
* js: dump(..): fix incorrect <VISITED> with array argumentAvi Halachmi (:avih)2018-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | When dump's argument is an array, it was displaying <VISITED> for all the array's object elements (objects, arrays, etc), regardless if they're actually visited or not. The reason is that we try to stringify twice: once normally which may throw (on cycles), and a second time while excluding visited items which is indicated by binding the replacer to an empty array - in which we hold the visited items, where the replacer tests if its 'this' is an array or not and acts accordingly. However, its "this" may also be an array even if we don't bind it to one, because its "normal" this is the main stringified object, so the test of Array.isArray(this) is true when the top object is an array, and the object items are indeed are in it - so the replacer considers them visited. Fix by binding to null on the first attempt such that "this" is an array only when we want it to test for visited items and not when the argument itself is an array.
* js: implement mp.register_idleAvi Halachmi (:avih)2018-04-072-7/+53
| | | | | | | | | | Due to earlier misinterpretation of the Lua docs as if mp.register_idle registers a one-shot callback, the JS docs suggested to use setTimeout. But the behavior and Lua docs are such that it's a repeating callback which fires just before the script thread goes to sleep. Implement it for JS too.
* js: implement mp.options.read_optionsAvi Halachmi (:avih)2018-04-072-8/+60
|
* config: replace config dir lua-settings/ with dir script-opts/Avi Halachmi (:avih)2018-04-076-5/+14
| | | | lua-settings/ is still supported, with deprecation warning.
* ao_opensles: let cfg_frames_per_buffer accept buffer size up to 0.5s at 192kHzTom Yan2018-04-051-1/+1
|
* ao_opensles: remove useless cfg_sample_rateTom Yan2018-04-052-5/+1
| | | | We should always use the ao-neutral --audio-samplerate option.
* ao_opensles: bump device buffer size to 250msTom Yan2018-04-051-1/+1
| | | | | | | |