summaryrefslogtreecommitdiffstats
path: root/audio
Commit message (Collapse)AuthorAgeFilesLines
* af: remove old filter compatibility hackwm42015-01-152-42/+1
|
* audio/filter: switch remaining filters to refcountingwm42015-01-154-44/+58
| | | | | All of these filters are very similar in frame management, and copy data to a new frame during filtering.
* audio/filter: switch remaining in-place filters to refcountingwm42015-01-159-127/+134
| | | | | | | | | | | | | | | | | | Adds about 7 lines of boilerplate per filter. This could be avoided by providing a different entrypoint (something like af->filter_inplace), which would basically mirror the old interface exactly for this kind of filter. But I feel like it would just be a hack to support all those old, useless filters better. (The ideal solution would be using a language that can do closures to provide a compat. wrapper, but whatever.) af_bs2b has terribly repetitious code for setting up filter functions for each format (most of them useless, in addition to bs2b being useless), so I did something terrible with macros. af_sinesuppress had commented code for float filtering (maybe it was broken; it has been commented every since it was added in 2006). Remove this code.
* af: verify filter input formatswm42015-01-151-1/+4
| | | | | | | | | | | Just to make sure all filters get the correct format. Together wih the check in af_add_output_frame(), this asserts that af->prev->fmt_out == af->fmt_in This also requires setting the "in" pseudo-filter (s->first) formats correctly. Before this commit, the fmt_in/fmt_out fields weren't used for this filter.
* ao_alsa: fix a small memory leakwm42015-01-141-0/+2
|
* af_lavcac3enc: use refcounted frameswm42015-01-141-89/+95
|
* af_lavfi: use refcounted frameswm42015-01-141-44/+57
|
* audio/filter: actually set fmt_in/fmt_out fieldswm42015-01-141-0/+2
|
* af_scaletempo: use refcounted frameswm42015-01-141-11/+23
|
* af_lavrresample: use refcounted frameswm42015-01-141-23/+46
|
* audio: add missing declarationwm42015-01-141-0/+1
|
* ao_pcm: add append modewm42015-01-141-1/+3
| | | | | Pretty useful for debugging, although a bit useless or possibly misleading too (see comments in the manpage).
* audio: fix initial audio PTSwm42015-01-141-24/+25
| | | | | | | | | | Commit 5e25a3d2 broke handling of the initial frame (the one decoded with initial_audio_decode()). It didn't update the pts_offset field, leading to a shift in timestamps by one audio frame. Fix by calling the actual decode function in a single place. This requires slightly more changes than what would be necessary to fix the bug, but it also somewhat simplifies the data flow.
* audio: fix assertion failure on audio decodingwm42015-01-141-2/+2
| | | | | | | There are several cases in which a decoder may need several packets to produce some output audio. Commit 5e25a3d2 broke this. Fixes #1471.
* af_convert24: use refcounted frameswm42015-01-131-8/+13
| | | | | This requires allocating a fully new frame. 32->24 could be in-place, but this is not possible for 24->32.
* audio/filters: use refcounted frames for some in-place filterswm42015-01-133-7/+31
| | | | | These are also quite simple, but require requesting write access to the frames. The error handling (for OOM) is a bit annoying.
* audio/filters: use refcounted frames for some simple filterswm42015-01-134-10/+18
| | | | These are read-only, and very trivial to convert.
* af_volume: use refcounted frameswm42015-01-131-8/+15
|
* audio: use refcounted frames in the filter chainwm42015-01-133-77/+227
| | | | | | | | | | | | | | | | | | | The goal is switching the whole audio chain to using refcounted frames. This brings the architecture closer to FFmpeg, enables better integration with libavfilter, will reduce useless copying somewhat, and will probably allow better timestamp tracking. For now, every filter goes through a semi-awful wrapper in af_do_filter(), though. This will be fixed step by step, and the wrapper should eventually be removed. Another thing that will have to be done is improving the timestamp handling and avoiding extra copies for the AO. Some of the new code is rather similar to the video filter code (the core filter code basically just has types replaced). Such code duplication is normally very unwanted, but in this case there's probably no other choice. On the other hand, this code is pretty simple (even if somewhat tricky). Maybe there will be unified filter code in the future, but this is still far away.
* audio: add some utility functions for refcounted frameswm42015-01-132-10/+64
| | | | Used in the following commits.
* audio/filter: remove unused af_calc_filter_multiplier()wm42015-01-136-31/+2
| | | | | | | | | | | | The purpose of this function was to filter only as much audio input as needed to produce a certain amount of audio output. This could (in theory) avoid excessive buffering when e.g. changing playback speed with resampling. Use of this was already removed in commit 5fd8a1e0. No problems were experienced, so let's assume this feature is practically worthless. (Though it's possible that it was quite useful over a decade ago, or in some cornercases with evil files.)
* ao_pulse: exit AO if stream failswm42015-01-111-1/+5
| | | | | | This can for example reproduced by killing the pulseaudio server. If this happens, just try to reload the AO, instead of breaking everything forever.
* ao_alsa: fix dtshd passthroughwm42015-01-091-2/+6
| | | | | | | We must not try to remap channels with this. Whethever ALSA gives us, and whatever we do with it, the result will probably be nonsense. Untested, as I don't have the required hardware.
* ao: remove coreaudio_exclusive from autoprobing listwm42015-01-071-2/+2
| | | | Apparently this was a mistake.
* ao_pulse: disable latency calculation hacks by defaultwm42015-01-071-1/+0
| | | | | | | | | | | | | | This used to be required to workaround PulseAudio bugs. Even later, when the bugs were (partially?) fixed in PulseAudio, I had the feeling the hacks gave better behavior. On the other hand, I couldn't actually reproduce any bad behavior without the hacks lately. On top of this, it seems our hacks sometimes perform much worse than PulseAudio's native implementation (see #1430). So disable the hacks by default, but still leave the code and the option in case it still helps somewhere. Also, being able to blame PulseAudio's code by using its native API is much easier than trying to debug our own (mplayer2-derived) hacks.
* win32: request UTF-16 API variants, Vista+ APIs, and COM C macroswm42015-01-075-13/+1
| | | | | Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into the build system, instead of defining them over and over in the code.
* player: print used number of threads in verbose modewm42015-01-051-1/+1
| | | | Also, don't use av_log() for mpv output.
* af_volume: dump applied replaygain in verbose modewm42015-01-041-1/+5
|
* ao/wasapi: style/code formatting tweaksKevin Mitchell2015-01-023-64/+63
|
* ao/wasapi: improve exclusive mode format searchKevin Mitchell2015-01-021-46/+36
| | | | fixes #1376
* ao/wasapi: revamp set_waveformatexKevin Mitchell2015-01-021-27/+43
| | | | | | | | * bits instead of bytes * add valid_bits argument * just pass in the mp_chmap and get the number and wavext channel map from that * indicate valid bits in waveformat_to_str * make appropriate accomodations in try_format
* ao/wasapi: add CO_E_NOTINITIALIZED to explain_errKevin Mitchell2015-01-021-0/+1
| | | | someone on irc reported seeing this error
* ao_portaudio: remove this audio outputwm42014-12-292-280/+0
| | | | | It's just completely useless. We have good native support for all 3 desktop platforms, and ao_sdl or ao_openal as fallbacks.
* ao_alsa: print channel map if setting it failswm42014-12-291-1/+2
| | | | | | | | | | This message is printed when the audio device advertised a channel map, but couldn't set it - which is probably a dmix bug (we'll never know, ALSA doesn't take bug reports). Print the requested map, so that the user (maybe) can make a connection when seeing the message and the actually used channel map, which might be less confusing. Or at least less useless.
* ao: add debug log with the detected channel mapsStefano Pigozzi2014-12-291-0/+6
| | | | This could be helpful with bug reports.
* chmap_sel: add multichannel fallback heuristicStefano Pigozzi2014-12-294-0/+123
| | | | | | | | | | | | Instead of just failing during channel map selection, try to select a close layout that makes most sense and upmix/downmix to that instead of failing AO initialization. The heuristic is rather simple, and uses the following steps: 1) If mono is required always prefer stereo to a multichannel upmix. 2) Search for an upmix that is an exact superset of the required channel map. 3) Search for a downmix that is the exact subset of the required channel map. 4) Search for either an upmix or downmix that is the closest (minimum difference of channels) to the required channel map.
* chmap: add a 7.1(rear) layout nameStefano Pigozzi2014-12-291-0/+1
| | | | This is common on Apple systems so it's handy to have a label for it.
* ao_coreaudio: remove useless guardStefano Pigozzi2014-12-271-6/+0
| | | | useless after 069016fd6c
* ao_coreaudio: fix some naming conventionsStefano Pigozzi2014-12-271-5/+5
|
* ao_coreaudio: fix channel mappingStefano Pigozzi2014-12-271-19/+70
| | | | | | | | | | | | | | | There where 3 major errors in the previous code: 1) The kAudioDevicePropertyPreferredChannelLayout selector returns a single layout not an array. 2) The check for AudioChannelLayout allocation size was wrong (didn't account for variable sized struct). 3) Didn't query the kAudioDevicePropertyPreferredChannelsForStereo selector since I didn't know about it's existence. All of these are fixed. Might help with #1367
* ao_coreaudio: fix typoStefano Pigozzi2014-12-271-1/+1
|
* ao_coreaudio: move some code to make output readableStefano Pigozzi2014-12-271-1/+1
|
* ao_coreaudio: add more layout debug outputsStefano Pigozzi2014-12-271-19/+25
| | | Should help remote debugging #1367 with --msg-level=ao=debug
* win32: add mmap() emulationwm42014-12-262-3/+0
| | | | | | | | Makes all of overlay_add work on windows/mingw. Since we now don't explicitly check for mmap() anymore (it's always present), this also requires us to make af_export.c compile, but I haven't tested it.
* ao_coreaudio: fix AudioChannelLayout allocationsStefano Pigozzi2014-12-261-34/+46
| | | | | | | | AudioChannelLayout uses a trailing variable sized array so we need to query CoreAudio for the size of the struct it is going to need (or the conversion of that particular layout would fail). Fixes #1366
* ao_alsa: fix unpause path atfer previous commitwm42014-12-231-0/+2
| | | | The resume code was accidentally fully removed from this code path.
* ao_alsa: fix resuming from suspend modewm42014-12-231-4/+12
| | | | | | | | | | | snd_pcm_prepare() was not always called, which could result in an infinite loop. Whether snd_pcm_prepare() was actually called depended on whether the device was a hw device (or other characteristics; depending on snd_pcm_hw_params_can_pause()), and required real suspend (annoying for testing), so it was somewhat tricky to reproduce without knowing these things.
* ao_alsa: fix setting mono channel mapwm42014-12-201-0/+5
| | | | | | | When setting the ALSA channel map, we never actually set the map we got from ALSA directly, but convert it to mpv's, and then back to ALSA's. mpv and ALSA use different conventions for mono, and there is already an exception for ALSA->mpv, but not mpv->ALSA.
* ao_alsa: remove some dead codewm42014-12-201-6/+0
| | | | | | | | This was only added recently (c1e97161) as an attempt to minimize the bad impact of channel layout device aliases. But use of these was removed in commit 49df0132. Now this code does pretty much nothing, and shouldn't be needed anymore. It does something when using spdif, but this fallback won't work anyway.
* audio: fix previous commitwm42014-12-201-4/+4
| | | | | This would have always forced mono first (if supported by the AO), instead of stereo.
* audio: fix fallback if audio API does not support monowm42014-12-201-6/+5
| | | | This makes it fallback to stereo properly.
* ao_coreaudio: fix mono/stereo channel mappingStefano Pigozzi2014-12-161-9/+7
| | | | | | Needed after af3bbb800d since now we use channel mapping all the time. Fixes #1357
* ao_coreaudio: add missing goto for error pathStefano Pigozzi2014-12-161-0/+1
|
* ao/wasapi: use IsEqualGUID and IsEqualPropertyKeyKevin Mitchell2014-12-163-30/+9
| | | | before we were reinventing this wheel
* ao_alsa: remove old multichannel methodwm42014-12-151-49/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The "old" method (before the ALSA channel map API) used device aliases like "surround51" to set the channel layout. The "interesting" part was that these devices usually redirect to a hardware device. This means playing stereo would lead you to the "default" device (dmix), while e.g. 5.1 to "surround51", which automatically takes care of the fact that dmix can't do 5.1. This is pretty much nonsense, though. It shouldn't depend on the damn input media file whether the player is going to use shared access (dmix) or exclusive access (direct hw device). As a consequence, by default ao_alsa will do only what dmix can do. If the user actually wants multichannel, he has to select a suitable hw device with --audio-device. From there on, the correct speaker mapping will be ensured via the channel mapping API. The change is preparation for making multichannel output the default (as far as supported by the audio output API). Of the common APIs, only ALSA messes up beyond repair, so I feel like this change is needed. On ancient alsa-lib versions, only stereo and mono can be played with this branch.
* ao_alsa: add ridiculous hack to deal with braindead ALSA behaviorwm42014-12-151-3/+42
| | | | | | | | | | | | | | | | | | | | | dmix reports channel layouts it doesn't support. The rest of the technical part of the story is in the code comment. This seems to be the only reasonable way to fallback from trying to initialize certain devices (like dmix) with multichannel audio. We could probably add support for such padding channels to our audio chain or to ao_alsa itself, but this would probably be much more work than this commit. What dmix does is probably a bug. I've tried to report it to ALSA. Thay have a link on their website to a bug tracker, but it's a dead link, and has been for years. I've posted to alsa-devel, but received no reply. I'm thus assuming this absolutely retarded behavior is by design, and nothing will happen to improve upon it. I'm considering sending Lennart Poettering a "thank you" email, because with PulseAudio, multichannel audio just works (although some other things just don't work).
* ao/wasapi: set the ao with the waveformat channelmapKevin Mitchell2014-12-151-1/+10
| | | | hopefully this fixes #1350
* af_hrtf: Fix out-of-range read.reimar2014-12-061-2/+7
| | | | | | | Based on patch by Yuriy Kaminskiy [yumkam gmail]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@37330 b3059339-0415-0410-9bf9-f77b7e298cf2 Signed-off-by: wm4 <wm4@nowhere>
* ao_alsa: minor simplificationwm42014-12-051-5/+1
| | | | | | | | Whether we print it as warning or error doesn't really matter; we continue anyway. (I don't actually know what the implications of running in non-blocking mode are; for what's it worth, when I tested with explicitly changing to non-blocking, it seemed to work fine anyway, so don't change that part.)
* ao_alsa: hackfix mono playbackwm42014-12-051-0/+3
| | | | | | ALSA returns "FL" as channel layout when trying to play mono. mpv and libavresample don't like this; in particular, using libavresample to convert stereo to "FL" fails.
* coreaudio: don't output too many channel descriptionsStefano Pigozzi2014-12-051-0/+6
| | | | for #1279 and #1249
* coreaudio: add missing \n in log lineStefano Pigozzi2014-12-051-1/+1
|
* coreaudio: don't print layout a second timeStefano Pigozzi2014-12-051-1/+1
| | | | For #1279
* ao_alsa: simplify, remove no-block suboptionwm42014-12-051-17/+8
| | | | | | | | | | | If no-block was given, the device would be opened with SND_PCM_NOBLOCK. Also, after opening, blocking mode was unconditionally enabled anyway with snd_pcm_nonblock(). Further, if opening with SND_PCM_NOBLOCK failed, opening was retried without this flag. This doesn't make any sense to me, and I've never heard of someone using this suboption. I suspect it has to do with ancient ALSA bugs or API caveats. Remove it and simplify the code.
* ao_alsa: try to fallback to "default" device if device is busywm42014-12-041-1/+6
| | | | | | | | | | | | | ALSA is crap. It's impossible to make multichannel playback just do the right thing. dmix (the default on most distros) can do stereo only, and will refuse to play multichannel. On the other hand, if you try like mpv (and mplayer) to open a multichannel device (like "surround51" etc.), this will actually open a hardware device, which will either fail if dmix is active, or block out dmix if opening succeeds. This commit falls back to "default" (i.e. dmix) if opening a multichannel device fails, which is a tiny step towards the right behavior. (Although fixing it fully is impossible.)
* coreaudio: reject descriptions with too many channelsStefano Pigozzi2014-12-041-0/+7
| | | | This is a fix attempt for #1279 and #1249.
* coreaudio: fix more layout printsStefano Pigozzi2014-12-041-2/+2
|
* coreaudio: fix prints of uint32_t in log_layoutStefano Pigozzi2014-12-041-10/+10
|
* audio: fix one of the previous commitswm42014-12-011-1/+1
| | | | | Fixes commit 52c51149. It broke multichannel (or possibly everything) for ao_alsa, ao_oss, ao_sndio.
* ao_coreaudio: initialize fetched properties to zerosStefano Pigozzi2014-12-011-2/+2
| | | Should hopefully fix #1249 and #1279
* audio: allow more than 20 channel map entrieswm42014-12-014-8/+19
| | | | | | | | | | | | | This could trigger an assertion when using ao_alsa or ao_coreaudio. The code was simply assuming the number of channel maps was bounded statically (which was true at first in both AOs). Fix by using dynamic memory allocation. It needs to be explicitly enabled by the AOs by setting a temp context, because otherwise the memory couldn't be freed. (Or at least this seems to be the most elegant solution.) Fixes #1306.
*