summaryrefslogtreecommitdiffstats
path: root/audio/filter
Commit message (Collapse)AuthorAgeFilesLines
* af, vf: improvements to libavfilter bridgewm42017-05-312-1/+8
| | | | | | Add the "lavfi-" prefix (details see manpage additons). Tag the filter name as "(lavfi)" in the verbose filter list output.
* af_format: change license to LGPLwm42017-05-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This case is a bit weird, because MPlayer certainly also has a file named af_format.c. Both appear to have the function of converting audio data between sample formats. However, mpv's af_format.c is a rewrite, and doesn't actually do conversion by itself. It's similar to vf_format.c, and forces the generic filter chain code to insert conversion filters, instead of doing conversion explicitly. mpv's current af_format.c started out as af_force.c in d9582ad0a41. It was renamed to af_format.c in e60b8f181d, while the old af_format.c was split into two new filters. In 943c785619 the filename was changed to af_format.c as well. The new af_format.c does not contain any libaf code, except for some potentially copy & pasted skeleton and boilerplate code. (We don't account for this in per-filter file licenses, as the old libaf code has to be removed fully, at which point the filters will have to be ported to another framework, which will removed that boilerplate code.) The old filters based on af_format.c were progressively replaced and removed. Support for non-native endian and formats with signedness different from native FFmpeg was completely removed in 831d7c3c400b. The old 24 bit conversion code was removed in 552dc0d564 (made unnecessary by 5a9f817bfde8). Also list hwdec_vaglx.c as GPL-only, which doesn't have anything to do with this commit.
* af_scaletempo: change license to LGPLwm42017-05-091-7/+7
| | | | | | | | | | | | All authors have agreed. The initial commit d33703496c as well as the current code contain this line: * inspired by SoundTouch library by Olli Parviainen We assume this is about the algorithm (not the code), and the author of the original patch actually wrote all code himself.
* af_lavcac3enc: change license to LGPLwm42017-05-091-7/+7
| | | | | | | All authors have agreed. As usual with these things, this probably does not include residues from the libaf framework.
* af: remove unused GET_VOLUME codewm42017-04-272-6/+0
| | | | The entire af code is going to be removed, but Ordnung muss sein.
* audio: fix replaygain volume scalewm42017-04-271-1/+1
| | | | | | | | The new replaygain code accidentally applied the linear gain as cubic volume level. Fix this by moving the computation of the volume scale out of the af_volume filter. (Still haven't verified whether the replaygain code works correctly.)
* vf_lavfi, af_lavfi: remove unused/deprecated includewm42017-04-051-1/+0
| | | | | Looks like Libav is going to drop it, unnecessarily making compilation fail.
* audio: deprecate most audio filterswm42017-04-044-0/+8
| | | | | Well, ok, only 4 filters. The rest will survive in one or the other form.
* af: implement generic lavfi option bridge toowm42017-04-042-10/+99
| | | | | | Literally copy-pasted from the same commit for video filters. (Once new code for filters is implemented, this will all go away or at least get unified anyway.)
* af_lavfi: remove forced "format" filterwm42017-04-041-27/+2
| | | | | | | This was supposed to restrict output to formats supported by us. But we usually support all FFmpeg sample formats anyway (if not, it will error out gracefully, and we would add the missing format). Basically, it's just useless bloat.
* command: add better runtime filter toggling methodwm42017-03-251-0/+3
| | | | | | | | | | Basically, see the example in input.rst. This is better than the "old" vf-toggle method, because it doesn't require the user to duplicate the filter string in mpv.conf and input.conf. Some aspects of this changes are untested, so enjoy your alpha testing.
* af_drc: removeJan Janssen2017-03-252-336/+0
| | | | | | | | | | | | | | | | Remove low quality drc filter. Anyone whishing to have dynamic range compression should use the much more powerful acompressor ffmpeg filter: mpv --af=lavfi=[acompressor] INPUT Or with parameters: mpv --af=lavfi=[acompressor=threshold=-25dB:ratio=3:makeup=8dB] INPUT Refer to https://ffmpeg.org/ffmpeg-filters.html#acompressor for a full list of supported parameters. Signed-off-by: wm4 <wm4@nowhere>
* build: explicitly check for FFmpeg vs. Libav, and their exact versionswm42017-01-271-0/+3
| | | | | | | | | | | | | | | | | | In a first pass, we check whether libavcodec is present. Then we try to compile a snippet and check for FFmpeg vs. Libav. (This could probably also be done by somehow checking the pkgconfig version. But pkg-config can't deal with that idiotic FFmpeg idea that a micro version number >= 100 identifies FFmpeg vs. Libav.) After that we check the project-specific version numbers. This means it can no longer happen that we accidentally allow older, unsupported versions of FFmpeg, just because the Libav version numbers are somehow this way. Also drop the resampler checks. We hardcode which resampler to each with each project. A user can no longer force use of libavresample with FFmpeg.
* build: replace some FFmpeg API checks with version checkswm42017-01-241-1/+1
| | | | | | The FFmpeg versions we support all have the APIs we were checking for. Only Libav missed them. Simplify this by explicitly checking for FFmpeg in the code, instead of trying to detect the presence of the API.
* af_lavfi, vf_lavfi: work around recent libavfilter EOF bugwm42017-01-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Looks quite like a bug. If you have a filter chain with only the dynaudnorm filter, and send call av_buffersrc_add_frame(s, NULL), then subsequent av_buffersink_get_frame() calls will return EAGAIN instead of EOF. This was apparently caused by a recent change in FFmpeg. Some other circumstances (which I didn't fully analyze and which is due to the playloop's absurd temporary-EOF behavior on seeks) then led the decoder loop to send data again, but since libavfilter was stuck in the EOF state now, it could never recover. It kept sending new input (due to missing output), until the demuxer refused to return more audio packets. Each time a filter error was printed. Fortunately, it's pretty easy to workaround. We just mark the p->eof flag as we send an EOF frame to libavfilter. The p->eof flag is used only to recover from temporary EOF: it resets the filter if new data is available again. We don't care much about av_buffersink_get_frame() returning a broken EAGAIN state in this situation and essentially ignore it, meaning if we get EAGAIN after sending EOF, we assume effectively that EOF was fully reached.
* Remove compatibility thingswm42016-12-072-21/+0
| | | | | | Possible with bumped FFmpeg/Libav. These are just the simple cases.
* af_pan: fix typoHector Martin2016-09-191-2/+3
| | | | | | | | | This was in the parser code all along. As far as I can tell, *cp was intended. There is no need to check cp for NULL (nor does it make any sense to do so every time around the loop) for AF_CONTROL_COMMAND. However, s->matrixstr can be NULL, so checking for that separately is in order.
* af_rubberband: default to channels=togetherHector Martin2016-09-191-0/+1
| | | | | | | | For stereo and typical L/R-first channel arrangements, this avoids undesirable phasing artifacts, especially obvious when speed is changed and then reset. Without this, there is a very audible change in the stereo field even when librubberband is no longer actually making any speed changes.
* af_rubberband: add af-command and option to change the pitchHector Martin2016-09-191-0/+25
| | | | | This allows both fixed and dynamic control over the audio pitch using librubberband, which was previously not exposed to the user.
* af_pan: add af-command support to change the matrixHector Martin2016-09-191-19/+31
| | | | | This allows for seamless changes in the downmixing matrix without having to reinitialize the filter chain.
* af_pan: coding style fixesHector Martin2016-09-191-103/+104
|
* m_config: add helper function for initializing af/ao/vf/vo suboptionswm42016-09-021-4/+4
| | | | | | | | Normally I'd prefer a bunch of smaller functions with fewer parameters over a single function with a lot of parameters. But future changes will require messing with the parameters in a slightly more complex way, so a combined function will be needed anyway. The now-unused "global" parameter is required for later as well.
* af_lavrresample: better swr reinitializationPaul B Mahol2016-08-201-4/+5
|
* af_lavrresample: fix error if resampler could not be recreatedwm42016-08-191-4/+5
| | | | | | | | There are situations where the resampler is destroyed and recreated during playback. If recreating the resampler unexpectedly fails, the filter function is supposed to return an error. This wasn't done correctly, because get_out_samples() accessed the resampler before the check. Move the check up to fix this.
* audio: improve aspects of EOF handlingwm42016-08-182-0/+7
| | | | | | | | | | | The code actually kept going out of EOF mode into resync mode back into EOF mode when the playloop had to wait after an audio EOF caused by the endpts. This would break seamless looping (as added by the next commit). Apply endpts earlier, to ensure the filter_audio() function always returns AD_EOF in this case. The idiotic ao_buffer makes this an amazing pain in the ass.
* af_lavrresample: work around libswresample misbehaviorwm42016-08-161-10/+10
| | | | | | | | | | | | | | | | | | The touched code is for seek resets and such - we simply want to reset the entire resample state. But I noticed after a seek a tiny bit of audio is missing (mpv's audio sync code inserted silence to compensate). It turns out swr_drop_output() either does not reset some internal state as we expect, or it's designed to drop not only buffered samples, but also future samples. On the other hand, libavresample's avresample_read(), does not have this problem. (It is also pretty explicit in what it does - return/skip buffered data, nothing else.) Is the libswresample behavior a bug? Or a feature? Does nobody even know? Who cares - use the hammer to unfuck the situation. Destroy and deallocate the libswresample context and recreate it. On every seek.
* audio: log replaygain values in af_volume instead demuxerwm42016-08-131-6/+10
| | | | | | | The demuxer layer usually doesn't log per-stream information, and even the replaygain information was logged only if it came from tags. So log it in af_volume instead.
* audio/filter: remove delay audio filterPaul B Mahol2016-08-122-196/+0
| | | | Similar filter is available in libavfilter.
* af_lavcac3enc: allow passing options to libavcodecwm42016-08-091-0/+7
|
* audio: use --audio-channels=auto behavior, except on ALSAwm42016-08-041-8/+8
| | | | | | | | | | | | | | | | | | | | | | | This commit adds an --audio-channel=auto-safe mode, and makes it the default. This mode behaves like "auto" with most AOs, except with ao_alsa. The intention is to allow multichannel output by default on sane APIs. ALSA is not sane as in it's so low level that it will e.g. configure any layout over HDMI, even if the connected A/V receiver does not support it. The HDMI fuckup is of course not ALSA's fault, but other audio APIs normally isolate applications from dealing with this and require the user to globally configure the correct output layout. This will help with other AOs too. ao_lavc (encoding) is changed to the new semantics as well, because it used to force stereo (perhaps because encoding mode is supposed to produce safe files for crap devices?). Exclusive mode output on Windows might need to be adjusted accordingly, as it grants the same kind of low level access as ALSA (requires more research). In addition to the things mentioned above, the --audio-channels option is extended to accept a set of channel layouts. This is supposed to be the correct way to configure mpv ALSA multichannel output. You need to put a list of channel layouts that your A/V receiver supports.
* af_lavcac3enc: skip output if there was no input framewm42016-08-021-0/+3
| | | | Unrealistic corner case: drainning was initiated right after a seek.
* af_lavcac3enc: fix buffering timestamps calculationswm42016-08-011-3/+9
| | | | In theory, an encoder could buffer some data.
* af_lavcac3enc: fix memory leakwm42016-08-011-1/+1
| | | | A major one. Oops.
* af_lavcac3enc: fix a debug messagewm42016-07-311-1/+1
|
* af_lavcac3enc: error out properly if encoding failswm42016-07-311-0/+4
|
* af_lavcac3enc: fix aspects of AVFrame handlingwm42016-07-311-0/+3
| | | | | | | | | | We send a refcounted frame to the encoder, but then disrespect refcounting rules and write to the frame data without making sure the buffer is really writeable. In theory this can lead to reallocation on every frame is the encoder really keeps a reference. If we really cared, we could fix this by providing a buffer pool. But then again, we don't care.
* af_lavcac3enc: use common code for AVFrame setupwm42016-07-241-11/+2
|
* af: avoid rebuilding filter chain in another minor casewm42016-07-151-0/+3
| | | | | No need to create additional noise of we can trivially see that rebuiding the chain won't change anything.
* audio: fix code for adjusting conversion filterswm42016-07-111-4/+5
| | | | | | | | | | | | | | | This code was supposed to adjust existing conversion filters (to make them output a different format). But the code was just broken, apparently a refactoring accident. It accessed af instead of af->prev. The bug tended to add new conversion filters, even if an existing one could have been used. (Can be tested by inserting a dummy lavrresample filter followed by a format filter which forces conversion.) In addition, it's probably better to return the actual error code if reinitializing the filter fails. It would then respect an AF_FALSE return value, which means format negotiation failed, instead of a generic error.
* af_volume: don't let softvol overwrite af_volume volumedb sub-optionwm42016-07-111-2/+2
| | | | | | | | | | af_volume has a volumedb sub-option, which allows the user to set an explicit volume. Until recently, the player read back this value and used it as initial softvol volume. But now it just overwrites it. Instead of overwriting it, multiply the different gain values. Above all, this will do the right thing if only softvol is used, or if the user only adds the af_volume filter manually.
* audio: add heuristic to move auto-downmixing before other filterswm42016-07-101-7/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, you want downmixing to happen first thing in the filter chain. This is reflected in codec downmixing, which feeds the filter chain downmixed audio in the first place. Doing this has the advantage of needing less data to process. But the main motivation is that if there is a drc filter in the chain, you want to process it the downmixed audio. Add an idiotic heuristic to achieve this. It tries to detect whether the audio was indeed automatically downmixed (or upmixed). To detect what the output format is going to be, it builds the filter chain normally, and then retries with the heuristic applied (and for extra paranoia, retries without the heuristic again if it fails to successfully rebuild the filter chain for unknown reasons). This is simple and will work in almost all cases. Doing it in a more complete way is rather hard, because filters are so generic. For example, we know absolutely nothing about the behavior of af_lavfi, which creates an opaque filter graph with libavfilter. We don't know why a filter would e.g. change the channel layout on its output. (Our heuristic bails out in this case.) We're also slave to the lowest common denominator of how our format negotiation works, and how libavfilter's works. In theory, we could make this mechanism explicit by introducing a special dummy filter. The filter chain would then try to convert between input and output formats at the dummy filter, which would give the user more control over how downmix happens. On the other hand, the user could just insert explicit conversion filters instead, so this would probably have questionable value.
* audio: add auto-inserted flag to filter list loggingwm42016-07-101-0/+2
| | | | Like the video filter chain.
* audio: cleanup audio filter format negotiationwm42016-07-103-149/+62
| | | | | | | | | | | | | | | | | | The algorithm and functionality is the same, but the code becomes much simpler and easier to follow. The assumption that there is only 1 conversion filter (lavrresample) helps with the simplification, but the main change is to use the same code for format/channels/rate. Get rid of the different AF_CONTROL_SET_* controls, and change the af->data parameters directly. (af->data is badly named, but essentially is a placeholder for the output format.) Also, instead of trying to use the af_reinit() loop to init inserted conversion filters or filters with changed output formats, do it inline, and move the common code to a filter_reinit() function. This gets rid of the awful retry variable. In general, this should not change any runtime behavior.
* audio: insert audio-inserted filters at end of chainwm42016-07-091-34/+1
| | | | | | This happens to be better for the af_volume filter (for softvol), and saves some code too. It's "better" because you want to affect the final filtered audio, such as after a manually inserted drc filter.
* vf, af: print filter labels in verbose modewm42016-07-061-0/+2
|
* Fix misspellingsstepshal2016-06-261-1/+1
|
* af_lavcac3enc: use av_err2str() call (fixes Libav build)wm42016-06-231-2/+1
| | | | | I added this call because I thought it'd be nice, but Libav doesn't have this function (macro, actually).
* af_lavcac3enc: make encoder configurablewm42016-06-231-2/+5
|
* af_lavcac3enc: implement flushing on seekwm42016-06-231-0/+7
| | | | | There's a lot of data that could have been buffered, and which has to be discarded.
* af_lavcac3enc: port to new encode APIwm42016-06-231-9/+57
|
* af_lavcac3enc: automatically configure most encoder parameterswm42016-06-231-29/+57
| | | | | | | | | | | Instead of hardcoding what the libavcodec ac3 encoder expects, configure it based on the AVCodec fields. Unfortunately, it doesn't export the list of sample rates, so that is done manually. This commit actually fixes the rate always to 48Khz. I don't even know whether the other rates worked. (Possibly did, but they'd still change the spdif parameters, and would work differently from ad_spdif.c.)
* af_lavcac3enc: drop log message prefixeswm42016-06-231-9/+7
| | | | MPlayer leftover. They're already added by the logging code.
* af_lavcac3enc: fix custom bitrateswm42016-06-231-2/+3
| | | | | | Probably has been broken for ages. (Not sure why anyone would use this feature, though.)
* build: make libavfilter mandatorywm42016-02-051-2/+0
| | | | | | The complex filter support that will be added makes much more complex use of libavfilter, and I'm not going to bother with adding hacks to keep libavfilter optional.
* af_lavrresample: change fudged channelswm42016-02-041-2/+2
| | | | | | | | | | | | | Remove flc-frc <-> sl<->sr. This was just plain wrong, and a mistaken change to make 7.1 work properly on CoreAudio with 7.1(rear) layout. Also see the following commit. Add br-br <-> sl<->sr, because we decided that it makes sense. Note that this "fudging" is applied only if the channel pairs are replaced, i.e. they would get dropped and be replaced with silence. This is done to compensate for libswresample's default rematrixing (which takes care of some more common cases).
* audio: move mp_audio->AVFrame conversion to a functionwm42016-01-291-20/+3
| | | | | | | | | This also makes it refcounted, i.e. the new AVFrame will reference the mp_audio buffers, instead of potentially forcing the consumer of the AVFrame to copy the data. All the extra code is for handling the >8 channels case, which requires very messy dealing with the extended_ fields (not our fault).
* af_lavfi, vf_lavfi: fix compilation on Libavwm42016-01-221-0/+1
| | | | It has no avfilter_graph_send_command().
* command: add af-command commandwm42016-01-223-0/+21
| | | | Similar to vf-command. Requested. Untested.
* audio: change downmix behavior, add --audio-normalize-downmixwm42016-01-203-4/+10
| | | | | | This is probably the 3rd time the user-visible behavior changes. This time, switch back because not normalizing seems to be the more expected behavior from users.
* Relicense some non-MPlayer source files to LGPL 2.1 or laterwm42016-01-192-14/+14
| | | | | | | | | | | | | | |