summaryrefslogtreecommitdiffstats
path: root/player/lavfi.c
Commit message (Collapse)AuthorAgeFilesLines
* player: replace old lavfi wrapper with new filter codewm42018-01-301-819/+0
| | | | | lavfi.c is not necessary anymore, because f_lavfi.c (which was actually converted from it) can be used now.
* lavfi: fix warnings with newer libavfilter versionswm42017-10-271-2/+2
| | | | | Most likely will cause new warnings with avfilter_graph_alloc_filter() on old libavfilter versions. Ingore that part.
* audio: introduce a new type to hold audio frameswm42017-08-161-23/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is pretty pointless, but I believe it allows us to claim that the new code is not affected by the copyright of the old code. This is needed, because the original mp_audio struct was written by someone who has disagreed with LGPL relicensing (it was called af_data at the time, and was defined in af.h). The "GPL'ed" struct contents that surive are pretty trivial: just the data pointer, and some metadata like the format, samplerate, etc. - but at least in this case, any new code would be extremely similar anyway, and I'm not really sure whether it's OK to claim different copyright. So what we do is we just use AVFrame (which of course is LGPL with 100% certainty), and add some accessors around it to adapt it to mpv conventions. Also, this gets rid of some annoying conventions of mp_audio, like the struct fields that require using an accessor to write to them anyway. For the most part, this change is only dumb replacements of mp_audio related functions and fields. One minor actual change is that you can't allocate the new type on the stack anymore. Some code still uses mp_audio. All audio filter code will be deleted, so it makes no sense to convert this code. (Audio filters which are LGPL and which we keep will have to be ported to a new filter infrastructure anyway.) player/audio.c uses it because it interacts with the old filter code. push.c has some complex use of mp_audio and mp_audio_buffer, but this and pull.c will most likely be rewritten to do something else.
* player: make --lavfi-complex changeable at runtimewm42017-08-121-2/+11
| | | | | | | | Tends to be somewhat glitchy if subtitles are enabled, and you enable and disable tracks. On error, this will disable --lavfi-complex, which will result in whatever behavior.
* player: fix --lavfi-complex freezewm42017-08-111-4/+4
| | | | | | | | | | | | | | | | | | | Commit 0e0b87b6f3297 fixed that dropped packets did not trigger further work correctly. But it also made trivial --lavfi-complex freeze. The reason is that the meaning if DATA_AGAIN was overloaded: the decoders meant that they should be called again, while lavfi.c meant that other outputs needed to be checked again. Rename the latter meaning to DATA_STARVE, which means that the current input will deliver no more data, until "other" work has been done (like reading other outputs, or feeding input). The decoders never return DATA_STARVE, because they don't get input from the player core (instead, they get it from the demuxer directly, which is why they still can return DATA_WAIT). Also document the DATA_* semantics in the enum. Fixes #4746.
* lavfi: temporary workaround for FFmpeg av_buffersrc_parameters_set() bugwm42017-02-221-0/+9
| | | | | The function ignores AVBufferSrcParameters.channel_layout. Set it manually using the API.
* lavfi: support hwdec filters for --lavfi-complexwm42017-02-201-0/+18
| | | | | | Not so important by itself, but important for when we replace the vf libavfilter wrapper with the common implementation. (Which will hopefully happen, but not too soon.)
* lavfi: use AVBufferSrcParameterswm42017-02-201-23/+34
| | | | | It's nice that you don't have to create a parameter string anymore, but the rest sure is complicated as hell.
* lavfi: use mp_image to store the filter pad formatwm42017-02-201-16/+19
| | | | | | | | | | Preparation for enabling hw filters. mp_image_params can't have an AVHWFramesContext reference (because it can't hold any allocations, and isn't meant to hold "active" data in the first place. So just use a mp_image. It has all real data removed, because that would essentially leak 1 frame once the decoder or renderer don't need it anymore.
* lavfi: fix minor memory leakwm42017-02-131-9/+11
| | | | | | | | | | | The AVFrame in the tmp_frame field was never actually deallocated. Since this AVFrame holds data temporarily only, and is unreferenced immediately after use, there is actually no need to make it per-pad, so simplify it a bit. (There's also no real value in caching this tmp_frame at all, but I guess it makes the control flow slightly simpler.)
* lavfi: cosmetics: more consistent variable namingwm42017-02-091-3/+3
|
* lavfi: slightly better disconnected output handlingwm42017-02-081-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | If we have a disconnected output, read data only passively (and don't cause input to be written). Otherwise, we're in danger of making libavfilter queue too many frames on other outputs which are connected to the same input, but don't read as quickly. Also don't set pad->output_needed in this specific case, because it would nonsensically make lavfi_process() return true, even if nothing is going on. This commit breaks if there is a simple filter chain with a connected input, but a disconnected output, like --lavfi-complex='[aid1] copy [ao]' and the audio output didn't initialize correctly. This will eventually starve video as the audio packet queue get full (it will print a warning, and then assume video EOF and exit). But whatever. Probably fixes #4118.
* lavfi: shut up false positive compiler warningswm42016-04-261-2/+8
| | | | | | | As a positive side-effect, this also errors out gracefully for the extremely unlikely but possible case certain builtin filters are not available. (This could happen only with crippled libavfilter builds that can't be used by anything using its public API.)
* 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.
* lavfi: stop playback on some unrecoverable situationswm42016-02-101-1/+3
| | | | Also improve the error message for the missing label case.
* 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.)
* 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-051-0/+722
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)