aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio
Commit message (Collapse)AuthorAge
...
* af_lavrresample: use a new libswresample function if availableGravatar wm42015-06-04
| | | | | It was recently added to libswresample, and it does exactly what we need.
* af_lavrresample: change output samples calculationGravatar wm42015-06-04
| | | | | | This is better, because now we call swr_get_delay() with the output samplerate, instead of with the input samplerate and then multiplying it with the ratio and rounding it up.
* ao_alsa: hack against potential spdif failureGravatar wm42015-06-04
|
* af_lavrresample: use native libavresample function for output sizeGravatar wm42015-06-02
| | | | This also drops the unused get_drain_samples() function.
* ao_coreaudio_exclusive: move generic functions to utilsGravatar wm42015-06-02
|
* ao_coreaudio_exclusive: react to device removalGravatar wm42015-06-02
| | | | | | | | | | | | | | Listening to kAudioDevicePropertyDeviceHasChanged does not send any property change notifications when the device dies. Makes no sense, but I suppose in CoreAudio logic a dead/removed device can't send any notifications. This caused the player to essentially pause playback if the audio device was removed during playback. Fix by listening to the kAudioHardwarePropertyDevices property too, which will actually be sent in this specific case. Then, if querying the already dead device fails, we know we have to reload.
* ao_coreaudio_exclusive: make property listeners event-basedGravatar wm42015-06-02
| | | | | | | | | | | | | | | | In short, instead of letting the coreaudio property listener set atomic flags (which are then polled), make the property listeners actually active. The format change listener used during audio output now simply calls ao_request_reload() on its own. All code involved is thread-safe, so there's no need to do it during this audio callback (we assumed the callback was never run concurrently with itself). The listener installed temporarily during ca_change_format() is changed to post a semaphore. Get rid of the weird retry logic and replace it with a flat loop + timeout. It appears the maximum wait time could be 2500ms; reduce the total timeout to 500ms instead.
* ao: allow ao_uninit(NULL)Gravatar wm42015-06-02
|
* af_lavrresample: fix and simplify flushing on playback speed changeGravatar wm42015-06-02
| | | | | | | | | | | This manually retrieved the remaining audio from the resampler. It subtly missed a conversion which could leave to an unsubtle crash. This could happen if reorder_planes() was supposed to insert NA channels, and the resampler/actual output format were different. Simplify it by reusing the normal drain path. One oddness is that the filter will add an output frame outside of normal filtering, but that should be fine.
* ao_alsa: hack back mono outputGravatar wm42015-05-25
| | | | | The ALSA API is inconsistent and doesn't report support. Just requesting 1 channel actually works. Whatever.
* audio: make softvol scale cubicGravatar wm42015-05-22
| | | | | | | | This brings the volume control closer to what is percepted as linear volume change. Adjust the --softvol-max default to roughly the old maximum (roughly doubles the gain).
* audio: change range of volume option/propertyGravatar wm42015-05-22
| | | | | | | | | Now --volume takes an absolute volume, meaning it doesn't depend on --softvol-max. 0 is still silence, and 100 now always means unchanged volume. The OSD and the "volume" property are changed accordingly. Also raise the minimum value of --softvol-max. A value below 100 makes no sense and breaks the OSD.
* chmap: use av_popcount64()Gravatar wm42015-05-21
| | | | Saves us some code, and also happens to fix #1968.
* ad_spdif: use DTS-HD passthrough only if the audio is really DTS-HDGravatar wm42015-05-19
| | | | | | | | | | | | | | | | | | | | | | | Apparently some A/V receivers do not behave well if "normal" DTS is passed through using the high bitrate spdif format normally used for DTS-HD (other receivers are fine with it). Parse the first packet passed to ad_spdif by decoding it with libavcodec in order to get the profile. Ignore the --ad-spdif-dtshd if it's not DTS-HD. (If the codec profile changes midstream, the user is out of luck. But this is probably an insignificant corner case.) I thought about parsing the bitstream, but let's not. While it probably wouldn't be that much effort, we are trying to keep it down on codec details here - otherwise we could just do our own spdif framing instead of using libavformat's spdif pseudo-muxer. Another possibility, using the codec parameters signalled by libavformat, is disregarded. Our builtin Matroska decoder doesn't do this, and also we do not want on the demuxer having to decode some packets in order to retrieve codec params (as libavformat does). Fixes #1949.
* ad_spdif: set output format lazilyGravatar wm42015-05-19
| | | | | Preparation for the following commit, which looks at the packet data before deciding what to output.
* threads: use utility+POSIX functions instead of weird wrappersGravatar wm42015-05-11
| | | | | | | There is not much of a reason to have these wrappers around. Use POSIX standard functions directly, and use a separate utility function to take care of the timespec calculations. (Course POSIX for using this weird format for time values.)
* ao: make better use of atomicsGravatar wm42015-05-11
| | | | | The main reason for this was compatibility; but some associated problems have been solved in the previous commit.
* audio: simplify furtherGravatar wm42015-05-08
| | | | | | Drop mp_chmap_diff() (which is unused too now), and implement mp_chmap_diffn() in a slightly simpler way. (Too bad there is no standard function for counting set bits.)
* audio: remove mp_chmap_contains()Gravatar wm42015-05-08
| | | | It's unsued now.
* ao: log reordered versions of channel mapsGravatar wm42015-05-08
| | | | Useful for debugging cases when no standard orders are used.
* audio: redo channel map fallback selectionGravatar wm42015-05-08
| | | | | | | | | | | | | | | | | | | | Instead of somehow having 4 different cases with each their own weight, do it with a single function that decides which channel layout is the better fallback. This is simpler, and also introduces new (fixed) semantics. The new test added to test/chmap_sel.c actually works now. This is a mixed case with no perfect upmix or downmix, but the better choice is the one which loses the least channels from the original layout. One test also changes. If the input is 7.1(wide-side), and the available layouts are 7.1 and 5.1(side), the latter is now chosen instead of the former. This makes sense: both layouts contain 6 out of 8 channels from the original layout, but the 5.1(side) one is smaller. This follows the general logic. The 7.1 layout has FLC/RLC speakers instead of BL/BR, and judging by the names, "front left center" is completely different from "back left". If these should be exchangeable, a separate exception would have to be added.
* audio: add chmap utility functionGravatar wm42015-05-08
|
* ao_alsa: log requested numbers of channels if ALSA rejects themGravatar wm42015-05-08
|
* audio: fix messed up assert()Gravatar wm42015-05-07
| | | | This made no sense and always evaluated to true.
* audio: remove UNKNOWN pseudo speakersGravatar wm42015-05-07
| | | | | | Reuse MP_SPEAKER_ID_NA for this. If all mp_chmap entries are set to NA, the channel layout has special "unknown channel layout" semantics, which are used to deal with some corner cases.
* audio: define only a single NA speaker IDGravatar wm42015-05-07
| | | | | Remove the requirement from mp_chmap that speaker entries must be unique. Use this to get rid of all the redundant NA speaker IDs.
* ao_coreaudio_utils: don't list some formats as "unusable"Gravatar wm42015-05-07
| | | | | While mpv has no internal equivalent representation, they can still be used as physical CoreAudio formats. Thus this label is confusing.
* ao_sndio: add notice about padding channelsGravatar wm42015-05-06
| | | | (I won't do this, but someone else seeing this might.)
* ao_alsa: use new padding channels supportGravatar wm42015-05-06
| | | | | | | | | | | | Sometimes, ALSA will return channel layouts with padded channels (NA speakers). Use them instead of failing. This still includes the old "braindeath" code to retry with a layout without NA channels. This might be helpful for performance, and also the padded channel layout string looks confusing. To be fair, I have not encountered a case yet which would really need this, and for which the old "braindeath" code did not fix it.
* ao_alsa: move ALSA -> mp channel map to a functionGravatar wm42015-05-06
| | | | | One side effect is that the warning about too many channels goes away, and is replaced with printing the ALSA channel map as "unknown".
* ao_coreaudio_exclusive: check new format before waiting for changeGravatar wm42015-05-06
| | | | | It seems if the format was already set, setting the same format will not cause a property change.
* ao_coreaudio_exclusive: use atomics instead of volatileGravatar wm42015-05-06
| | | | | | | | | | | volatile barely means anything. The polling is kind of bad too, but relatively harmless as device opening/closing is a rare event, and the format change is not expected to take long. Remove the pointless talloc call too (must have been a leftover from previous refactoring).
* ao_coreaudio_exclusive: rename "digital" -> "compressed"Gravatar wm42015-05-06
| | | | PCM is digital too.
* ao_coreaudio_exclusive: explicitly check for spdif formatsGravatar wm42015-05-06
|
* ao_coreaudio_exclusive: merge init_digital() functionGravatar wm42015-05-06
| | | | | | No reason to keep them separate. It's an artifact from the old ao_coreaudio.c, which kept usage of two different APIs in the same file. Removes a forward reference too.
* ao_coreaudio_utils: decide formats by comparing raw bitsGravatar wm42015-05-05
| | | | | | | | | | | | | | | | Instead of trying to use af_format_conversion_score() (which tries to be all kinds of clever), just compare the raw bits as a quality measure. Do this because otherwise, weird formats like padded 24 bit formats will be excluded, even though they might be the highest precision formats for some hardware. This means that for now, the user would have to check whether the format is usable at all before calling ca_asbd_is_better(). But since this is currently only used for ao_coreaudio.c and for the physical format, it doesn't matter. If coreaudio-exclusive should get PCM support, the best would be to revert this change, and to add support for 24 bit formats directly.
* ao_coreaudio: log considered physical formatsGravatar wm42015-05-05
|
* ao_coreaudio: restore old physical format if format was changedGravatar wm42015-05-05
|
* af: don't attempt to remove last filter for spdif filter removalGravatar wm42015-05-05
| | | | | | | | | | | | | | | Some time ago, a mechanism was added for automatically removing PCM-only filters if the input format is spdif. This could cause an infinite loop if the AO did not support spdif, but was falling back to some PCM format. Then this code tried to remove the last filter, which is a dummy filter for receiving and queuing filter output. af_remove() simply fails gracefully in this case, so this happens over and over again. Fix by explicitly checking whether the filter to remove is a dummy filter. (af_remove() also fails only if the dummy filters are attempted to be removed - checking this directly is simpler.)
* audio: minor cosmeticsGravatar wm42015-05-05
| | | | | These ( ) were probably not removed when the format constants were changed from defines to an enum.
* ao_coreaudio: move channel mapping code to a separate fileGravatar wm42015-05-05
| | | | | | | | | | Move all of the channel map retrieval/negotiation code to a separate file. This will (probably) be helpful when extending ao_coreaudio_exclusive.c. Nothing else changes, other than some minor cosmetics and renaming, and changing some details for decoupling it from the ao_coreaudio.c internals.
* ao_coreaudio_utils: don't require talloc for fourcc_repr()Gravatar wm42015-05-05
| | | | | Instead, apply a trick to make the caller allocate enough space on the stack.
* ao_coreaudio_utils: unbreak default device selectionGravatar wm42015-05-05
| | | | | | It appears this is the reason coreaudio-exclusive does not work without explicitly specifying a device, even if the default device maps to something passthrough-capable.
* ao_coreaudio_exclusive: fix latency calculation non-senseGravatar wm42015-05-05
| | | | Didn't use the properties it was supposed to use.
* ao_coreaudio_utils: refine format selectionGravatar wm42015-05-05
| | | | | | | | | | | Instead of always picking a somehow better format over the previous one, select a format that is equal to or better the requested format, but is also reasonably close. Drop the mFormatID comparison - checking the sample format handles this already. Make sure to exclude channel counts that can't be used.
* ao_coreaudio: change physical format before channel negotiationGravatar wm42015-05-05
| | | | | | If for example the physical format is set to stereo, the reported multichannel layout will actually be stereo. It fixes itself only after the physical format is changed.
* ao_coreaudio: add an option for changing the physical formatGravatar wm42015-05-05
| | | | | | | | | | | | ao_coreaudio uses AudioUnit - the OSX software mixer. In theory, it supports multichannel audio just fine. But in practice, this might be disabled by default, and the user is supposed to select a multichannel base format in the "Audio MIDI Setup" utility. This option attempts to change this setting automatically. Some possible disadvantages and caveats are listed in the manpage additions. It is off by default, since changing this might be rather bad behavior for a normal application.
* ao_coreaudio_utils: add a format negotiation helper functionGravatar wm42015-05-05
|
* af_lavrresample: remove dead undefsGravatar wm42015-05-05
|
* ao_coreaudio: support padded channel layoutsGravatar wm42015-05-05
| | | | | | | If for example the audio settings are set to 5.1 output, but the hardware does 8 channels natively (HDMI), the reported channel layout will have 2 dummy channels. To avoid falling back to stereo, we have to write audio in this format to the device.