aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio/filter
Commit message (Collapse)AuthorAge
* Move options/config related files from mpvcore/ to options/Gravatar wm42013-12-17
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsgGravatar wm42013-12-16
| | | | | | | | | The tmsg stuff was for the internal gettext() based translation system, which nobody ever attempted to use and thus was removed. mp_gtext() and set_osd_tmsg() were also for this. mp_dbg was once enabled in debug mode only, but since we have log level for enabling debug messages, it seems utterly useless.
* audio: flush remaining data from the filter chain on EOFGravatar wm42013-12-05
| | | | | | | | | | | | | | | | | This can be reproduced with: mpv short.wav -af 'lavfi="aecho=0.8:0.9:5000|6800:0.3|0.25"' An audio file that is just 1-2 seconds long should play for 8-9 seconds, which audible echo towards the end. The code assumes that when playing with AF_FILTER_FLAG_EOF, the filter will either produce output, or has all remaining data flushed. I'm not really sure whether this really works if there are multiple filters with EOF handling in the chain. To handle it correctly, af_lavfi should retry filtering if 1. EOF flag is set, 2. there were input samples, and 3. no output samples were produced. But currently it seems to work well enough anyway.
* audio/filter: change filter callback signatureGravatar wm42013-12-05
| | | | | | | | | The new signature is actually closer to how it actually works, and someone who is not familiar to the API and how it works might make fewer fatal mistakes with the new signature than the old one. Pretty weird. Do this to sneak in a flags parameter, which will later be used to flush remaining data of at least vf_lavfi.
* af: remove af->setup fieldGravatar wm42013-12-04
| | | | Used to be used by filters that didn't use the option parser.
* af: remove legacy option parsing hacksGravatar wm42013-12-04
|
* af_pan: change options, use option parserGravatar wm42013-12-04
| | | | Similar to af_channels etc...
* af_ladspa: change options, use option parserGravatar wm42013-12-04
|
* af_delay: change option parsing, fix bugs, use option parserGravatar wm42013-12-04
| | | | Similar situation to af_channels.
* af_channels: use "unknown" channel layoutsGravatar wm42013-12-04
| | | | | | | | | This will make af_channels output a channel layout that is compatible with any destination layout. Not sure if that's a good idea though, since the way the AO choses a layout is perhaps less predictable. On the other hand, using the old MPlayer standard layouts doesn't make much sense either. We'll see whether this improves or breaks someone's use case.
* af_channels: change options, fix bugs, use option parserGravatar wm42013-12-04
| | | | | | | Apparently this stopped working after some planar changes (broken format negotiation). Radically change option parsing in an incompatible way. Suggest alternatives to this filter, since it barely has any importance anymore.
* af_sweep: use option parserGravatar wm42013-12-04
|
* af_surround: use option parserGravatar wm42013-12-04
|
* af_sub: use option parserGravatar wm42013-12-04
|
* af_sinesuppress: use option parserGravatar wm42013-12-04
|
* af_hrtf: use option parserGravatar wm42013-12-04
|
* af_extrastereo: use option parserGravatar wm42013-12-04
|
* af_export: use option parserGravatar wm42013-12-04
| | | | Probably requires the user to quote the shared buffer filename.
* af_equalizer: use option parserGravatar wm42013-12-04
|
* af_drc: use option parserGravatar wm42013-12-04
|
* af_center: use option parserGravatar wm42013-12-04
|
* af: returning NULL on filtering means errorGravatar wm42013-12-04
| | | | | | This code used to be ok, until the assert() was added. Simplify the loop statement, since the other NULL check for data doesn't make sense anymore.
* options: add options that set defaults for af/vf/ao/voGravatar wm42013-12-01
| | | | | | | | There are some use cases for this. For example, you can use it to set defaults of automatically inserted filters (like af_lavrresample). It's also useful if you have a non-trivial VO configuration, and want to use --vo to quickly change between the drivers without repeating the whole configuration in the --vo argument.
* Use O_CLOEXEC when creating FDsGravatar wm42013-11-30
| | | | | | | | | | | | | | This is needed so that new processes (created with fork+exec) don't inherit open files, which can be important for a number of reasons. Since O_CLOEXEC is relatively new (POSIX.1-2008, before that Linux specific), we #define it to 0 in io.h to prevent compilation errors on older/crappy systems. At least this is the plan. input.c creates a pipe. For that, add a mp_set_cloexec() function (which is based on Weston's code in vo_wayland.c, but more correct). We could use pipe2() instead, but that is Linux specific. Technically, we have a race condition, but it won't matter.
* af_lavi: actually free the filter graph on uninitGravatar wm42013-11-27
| | | | | | | This was a memory leak. Also remove the AF_CONTROL_COMMAND_LINE code, which was inactive. (It's never called if the new option parser is used.)
* audio/filter: rename af_tools.c to tools.cGravatar wm42013-11-18
| | | | This always bothered me.
* audio: drop buffered filter data when seekingGravatar wm42013-11-18
| | | | | This could lead to (barely) audible artifacts with --af=scaletempo and modified playback speed.
* audio/filter: remove unneeded AF_CONTROLs, convert to enumGravatar wm42013-11-18
| | | | | | | | The AF control commands used an elaborate and unnecessary organization for the command constants. Get rid of all that and convert the definitions to a simple enum. Also remove the control commands that were not really needed, because they were not used outside of the filters that implemented them.
* af: cleanup documentation commentsGravatar wm42013-11-18
| | | | | | And by "cleanup", I mean "remove". Actually, only remove the parts that are redundant and doxygen noise. Move useful parts to the comment above the function's implementation in the C source file.
* audio: fix mid-stream audio reconfigurationGravatar wm42013-11-18
| | | | | | | | | | | | | | | | | | | | | Commit 22b3f522 not only redid major aspects of audio decoding, but also attempted to fix audio format change handling. Before that commit, data that was already decoded but not yet filtered was thrown away on a format change. After that commit, data was supposed to finish playing before rebuilding filters and so on. It was still buggy, though: the decoder buffer was initialized to the new format too early, triggering an assertion failure. Move the reinit call below filtering to fix this. ad_mpg123.c needs to be adjusted so that it doesn't decode new data before the format change is actually executed. Add some more assertions to af_play() (audio filtering) to make sure input data and configured format don't mismatch. This will also catch filters which don't set the format on their output data correctly. Regression due to planar_audio branch.
* af_lavrresample: set cutoff as double, not intGravatar wm42013-11-17
| | | | Regression introduced with commit a89549e8.
* audio: drop "_NE"/"ne" suffix from audio formatsGravatar wm42013-11-15
| | | | | | You get the native format by not appending any suffix to the format. This change includes user-facing names, e.g. for the --format option.
* af_lavcac3enc: use option parserGravatar wm42013-11-15
| | | | | | | This changes option parsing as well as filter defaults slightly. The default is now to encode to spdif (this is way more useful than writing raw AC3 - what was this even useful for, other than writing broken ac3 -in-wav files?). The bitrate parameter is now always in kbps.
* af_lavcac3enc: use planar formatsGravatar wm42013-11-12
| | | | | | | | | | | Remove the awkward planarization. It had to be done because the AC3 encoder requires planar formats, but now we support them natively. Try to simplify buffer management with mp_audio_buffer. Improve checking for buffer overflows and out of bound writes. In theory, these shouldn't happen due to AC3 fixed frame sizes, but being paranoid is better.
* af_lavcac3enc: simplify format negotiationGravatar wm42013-11-12
| | | | | | | | | | | | | The format negotiation is the same, except don't confusingly copy the input format into af->data, just to overwrite it later. af->data should alwass contain the output format, and the existing code was just a very misguided use of the af_test_output() helper function. Just set af->data to the output format immediately, and modify the input format properly. Also, if format negotiation fails (and needs another iteration), don't initialize the libavcodec encoder.
* audio/filter: fix mul/delay scale and valuesGravatar wm42013-11-12
| | | | | | | | | | | | | Before this commit, the af_instance->mul/delay values were in bytes. Using bytes is confusing for non-interleaved audio, so switch mul to samples, and delay to seconds. For delay, seconds are more intuitive than bytes or samples, because it's used for the latency calculation. We also might want to replace the delay mechanism with real PTS tracking inside the filter chain some time in the future, and PTS will also require time-adjustments to be done in seconds. For most filters, we just remove the redundant mul=1 initialization. (Setting this used to be required, but not anymore.)
* af: don't require filters to allocate af_instance->data, redo buffersGravatar wm42013-11-12
| | | | | | | | | | | | | Allocate af_instance->data in generic code before filter initialization. Every filter needs af->data (since it contains the output configuration), so there's no reason why every filter should allocate and free it. Remove RESIZE_LOCAL_BUFFER(), and replace it with mp_audio_realloc_min(). Interestingly, most code becomes simpler, because the new function takes the size in samples, and not in bytes. There are larger change in af_scaletempo.c and af_lavcac3enc.c, because these had copied and modified versions of the RESIZE_LOCAL_BUFFER macro/function.
* af_lavfi: add support for non-interleaved audioGravatar wm42013-11-12
|
* af_volume: add support for non-interleaved audioGravatar wm42013-11-12
|
* af_lavrresample: add support for non-interleaved audioGravatar wm42013-11-12
|
* audio/filter: prepare filter chain for non-interleaved audioGravatar wm42013-11-12
| | | | | | | | | | | | | | | | | | Based on earlier work by Stefano Pigozzi. There are 2 changes: 1. Instead of mp_audio.audio, mp_audio.planes[0] must be used. 2. mp_audio.len used to contain the size of the audio in bytes. Now mp_audio.samples must be used. (Where 1 sample is the smallest unit of audio that covers all channels.) Also, some filters need changes to reject non-interleaved formats properly. Nothing uses the non-interleaved features yet, but this is needed so that things don't just break when doing so.
* af: don't skip filtering if there's no more audioGravatar wm42013-11-10
| | | | | | | | | | | | | | My main problem with this is that the output format will be incorrect. (This doesn't matter right, because there are no samples output.) This assumes all audio filters can deal with len==0 passed in for filtering (though I wouldn't see why not). A filter can still signal an error by returning NULL. af_lavrresample has to be fixed, since resampling 0 samples makes libavresample fail and return a negative error code. (Even though it's not documented to return an error code!)
* af_volume: use only one volume setting for all channelsGravatar wm42013-11-09
| | | | | | | | In theory, af_volume could use separate volume levels for each channel. But this was never used anywhere. MPlayer implemented something similar before (svn r36498), but kept the old path for some reason.
* af_scaletempo: uncrustifyGravatar wm42013-11-09
| | | | | | | | | Also do some cosmetic changes, like merging definition and initialization of local variables. Remove an annoying debug mp_msg() from af_open(). It just printed the command line parameters; if this is really needed, it could be added to af.c instead (similar as to what vf.c does).
* af_lavrresample: reconfigure libavresample only on successful initGravatar wm42013-11-09
| | | | | If filter initialization fails anyway, we don't need to reconfigure libavresample.
* af_lavrresample: move libavresample setup to separate functionGravatar wm42013-11-09
| | | | | | | Helps with readability. Also remove the ctx_opt_set_* helper macros and use av_opt_set_* directly (I think these macros were used because the lines ended up too long, but this commit removes two indentation levels, giving more space).
* af_convert24: fix complicated and incorrect format negotiationGravatar wm42013-11-09
| | | | | The conversion works for native endian only. The correct check lists supported format combination explicitly, but is also much simpler.
* af_surround: fix format negotiationGravatar wm42013-11-09
| | | | This did strange things; perhaps caused by the channel layout changes.
* af: allow filters to return AF_OK, even if format doesn't matchGravatar wm42013-11-09
| | | | | | | This should allow to make format negotiation much simpler, since it takes the responsibility to compare actual input and accepted input formats from the filters. It's also backwards compatible. Filters which have expensive initialization still can use the old method.
* af: always remove auto-inserted filters, improve error messageGravatar wm42013-11-09
| | | | | | | | | | It's probably better if all auto-inserted filters are removed when doing an af_add operation. If they're really needed, they will be automatically re-added. Fix the error message. It used to be for an actual internal error, but now it happens when format negotiation fails, e.g. when trying to use spdif and real audio filters.