summaryrefslogtreecommitdiffstats
path: root/audio/audio.h
Commit message (Collapse)AuthorAgeFilesLines
* af_lavcac3enc: use common code for AVFrame setupwm42016-07-241-0/+1
|
* audio: add a helper for getting frame end PTSwm42016-06-271-0/+1
| | | | Although I don't see any use for it yet, why not.
* audio: move frame clipping to a generic functionwm42016-02-211-0/+1
|
* audio: move mp_audio->AVFrame conversion to a functionwm42016-01-291-0/+1
| | | | | | | | | 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).
* audio: move PTS setting out of the decoderwm42015-11-081-0/+2
| | | | | | | Instead of requiring the decoder to set the PTS directly on the dec_audio context (including handling absence of PTS etc.), transfer the packet PTS to the decoded audio frame. Marginally simpler, and gives more control to the generic code.
* audio/filter: remove some useless filterswm42015-09-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | All of these filters are considered not useful anymore by us. Some have replacements in libavfilter (useable through af_lavfi). af_center, af_extrastereo, af_karaoke, af_sinesuppress, af_sub, af_surround, af_sweep: pretty simple and useless filters which probably nobody ever wants. af_ladspa: has a replacement in libavfilter. af_hrtf: the algorithm doesn't work properly on most sources, and the implementation was buggy and complicated. (The filter was inherited from MPlayer; but even in mpv times we had to apply fixes that fixed major issues with added noise.) There is a ladspa filter if you still want to use it. af_export: I'm not even sure what this is supposed to do. Possibly it was meant for GUIs rendering audio visualizations, but it couldn't really work well. For example, the size of the audio depended on the samplerate (fixed number of samples only), and it couldn't retrieve the complete audio, only fragments. If this is really needed for GUIs, mpv should add native visualization, or a proper API for it.
* audio: fix format function consistency issueswm42015-06-261-1/+1
| | | | | | | | | | | Replace all the check macros with function calls. Give them all the same case and naming schema. Drop af_fmt2bits(). Only af_fmt2bps() survives as af_fmt_to_bytes(). Introduce af_fmt_is_pcm(), and use it in situations that used !AF_FORMAT_IS_SPECIAL. Nobody really knew what a "special" format was. It simply meant "not PCM".
* audio: remove unused readonly fieldwm42015-06-151-1/+0
| | | | Its last use was removed in 433402b5.
* audio: deal with AVFrame-style buffer assignmentswm42015-06-121-1/+4
| | | | | | | | | | | | | | | | In the AVFrame-style system (which we inreasingly map our internal data stuctures on), buffers and plane pointers don't necessarily have a 1:1 correspondence. For example, a single buffer could cover 2 or more planes, all while other planes are covered by a second buffer, and so on. They don't need to be ordered in the same way. Change mp_audio_get_allocated_size() to retrieve the maximum size all planes provide. This also considers the case of planes not pointing to buffer start. Change mp_audio_realloc() to reset all planes, even if corresponding buffers are not reallocated. (The caller has to be careful anyway if it wants to be sure the contents are preserved on realloc calls.)
* audio: introduce mp_audio readonly bitwm42015-05-041-0/+1
| | | | Convenience for the following commit.
* audio: add missing declarationwm42015-01-141-0/+1
|
* audio: add some utility functions for refcounted frameswm42015-01-131-0/+6
| | | | Used in the following commits.
* audio: make mp_audio_config_to_str return a stack-allocated stringwm42014-11-251-2/+2
| | | | Simpler overall.
* audio: add mp_audio_make_writeable()wm42014-11-101-0/+2
|
* audio: add function to convert AVFrame to mp_audio referenceswm42014-11-101-0/+3
| | | | | This is somewhat duplicated from ad_lavc.c and af_lavfi.c, but will eventually be used by both.
* audio: add mp_audio_poolwm42014-11-101-0/+4
| | | | | | A helper to allocate refcounted audio frames from a pool. This will replace the static buffer many audio filters use (af->data), because such static buffers are incompatible with refcounting.
* audio: use AVBufferRef to allocate audio frameswm42014-11-101-1/+1
| | | | | | | A first step towards refcounted audio frames. Amazingly, the API just does what we want, and the code becomes simpler. We will need to NIH allocation from a pool, though.
* af_fmt2bits: change to af_fmt2bps (bytes/sample) where appropriateMarcoen Hirschberg2014-05-281-1/+1
| | | | | | In most places where af_fmt2bits is called to get the bits/sample, the result is immediately converted to bytes/sample. Avoid this by getting bytes/sample directly by introducing af_fmt2bps.
* audio: better rejection of invalid formatswm42013-11-271-0/+1
| | | | | | | | | This includes the case when lavc decodes audio with more than 8 channels, which our audio chain currently does not support. the changes in ad_lavc.c are just simplifications. The code tried to avoid overriding global parameters if it found something invalid, but that is not needed anymore.
* mp_audio: use av_malloc (cargo cult for libav*)wm42013-11-121-0/+3
| | | | | | | | | | | | | | | libav* is generally freaking horrible, and might do bad things if the data pointer passed to it are not aligned. One way to be sure that the alignment is correct is allocating all pointers using av_malloc(). It's possible that this is not needed at all, though. For now it might be better to keep this, since the mp_audio code is intended to replace another buffer in dec_audio.c, which is currently av_malloc() allocated. The original reason why this uses av_malloc() is apparently because libavcodec used to directly encode into mplayer buffers, which is not the case anymore, and thus (probably) doesn't make sense anymore. (The commit subject uses the word "cargo cult", after all.)
* audio/filter: prepare filter chain for non-interleaved audiowm42013-11-121-5/+26
| | | | | | | | | | | | | | | | | | 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.
* audio/filters: add af_forcewm42013-05-121-0/+1
| | | | | Its main purpose is for testing in case channel layout stuff breaks, in particular in connection with old audio filters.
* audio: print channel map additionally to channel count on terminalwm42013-05-121-0/+3
|
* af: use mp_chmap for mp_audio, include channel map in format negotiationwm42013-05-121-1/+5
| | | | | Now af_lavrresample pretends to reorder the channels, although it doesn't yet, and nothing sets non-standard layouts either.
* audio: add some setters for mp_audio, and require filters to use themwm42013-05-121-0/+38
mp_audio has some redundant fields. Setters like mp_audio_set_format() initialize these properly. Also move the mp_audio struct to a the file audio.c. We can remove a mysterious line of code from af.c: in.format |= af_bits2fmt(in.bps * 8); I'm not sure if this was ever actually needed, or if it was some kind of "make it work" quick-fix that works against the way things were supposed to work. All filters etc. now set the format correctly, so if there ever was a need for this code, it's definitely gone.