summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_coreaudio.c
Commit message (Collapse)AuthorAgeFilesLines
* options: deprecate suboptions for the remaining AO/VOswm42016-09-051-0/+1
|
* ao_coreaudio: actually use stop callbackwm42016-08-091-1/+1
| | | | | | The .pause callback is never used for pull.c-based AOs. This means this always streamed silence instead of deactivating audio.
* ao_coreaudio: remove detected_devicewm42016-04-261-5/+0
| | | | | | | | | | | Setting this here is a race condition. It's called from a CoreAudio callbacks, and there are no locks. It's a string, so this can be potentially severe. It's hard to fix and only CoreAudio supported it, so remove it. This causes the "audio-out-detected-device" property to return nothing on all platforms.
* ao_coreaudio: replace fourcc_repr()wm42016-01-111-4/+4
| | | | Replace with the more general mp_tag_str().
* ao_coreaudio: avoid unnecessary format changeswm42015-10-211-0/+6
| | | | | Not particularly important; just being nice and potentially avoiding problems caused by format setting.
* ao_coreaudio: fix some minor memory leakswm42015-10-211-0/+6
|
* ao_coreaudio: fix device latency, share the codewm42015-07-061-5/+1
| | | | | | | | | ao_coreaudio (using AudioUnit) accounted only for part of the latency - move the code in ao_coreaudio_exclusive to utils, and use that for the AudioUnit code. (There's still the question why CoreAudio and AudioUnit require you to jump through hoops this much, but apparently that's how it is.)
* ao_coreaudio: add exclusive suboptionwm42015-07-031-2/+4
|
* ao_coraudio: reject all non-PCM formatswm42015-07-031-1/+1
| | | | | Currently this is equivalent. On the other hand, all audio code should reject formats that is not in a category known to it.
* ao_coreaudio: restore physical format if it can't be set exactlywm42015-06-301-1/+2
| | | | | | | | May help with (supposedly) bad drivers, which can put the device into some sort of broken state when trying to set a different physical format. When the previous format is restored, it apparently recovers. This might make the change-physical-format suboption more robust.
* ao_coreaudio: log hotplug events explicitlywm42015-06-291-3/+6
|
* 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".
* ao_coreaudio: support non-interleaved outputwm42015-06-261-4/+5
| | | | | This saves us the trouble of interleaving the audio data for no reason.
* ao_coreaudio: explicitly skip input streamswm42015-06-261-4/+14
| | | | | | | This may or may not fix some issues with the format switching code. Actually, it seems somewhat unlikely, but then checking the stream type isn't incorrect either, and is probably something the API user should always be doing.
* ao_coreaudio: change physical stream format synchronouslywm42015-06-091-4/+1
|
* ao_coreaudio: log considered physical formatswm42015-05-051-0/+4
|
* ao_coreaudio: restore old physical format if format was changedwm42015-05-051-0/+16
|
* ao_coreaudio: move channel mapping code to a separate filewm42015-05-051-255/+4
| | | | | | | | | | 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()wm42015-05-051-4/+4
| | | | | Instead, apply a trick to make the caller allocate enough space on the stack.
* ao_coreaudio: change physical format before channel negotiationwm42015-05-051-4/+10
| | | | | | 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 formatwm42015-05-051-0/+55
| | | | | | | | | | | | 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: support padded channel layoutswm42015-05-051-2/+6
| | | | | | | 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.
* ao_coreaudio: fix out of bounds accesswm42015-05-041-0/+2
| | | | | | ca_label_to_mp_speaker_id() checked whether the last entry was >= 0, but actually this condition was never true, and MP_SPEAKER_ID_UNKNOWN0 is not negative.
* ao_coreaudio: do not signal per-app volumewm42015-04-011-2/+0
| | | | | CoreAudio doesn't seem to have this concept. The volume is reset the next time audio is opened.
* ao_coreaudio: move some helpers to utilswm42015-03-101-16/+0
| | | | Needed by ao_coreaudio_exclusive.c in the next commit.
* ao_coreaudio: add support for hotplug notificationsStefano Pigozzi2015-02-141-17/+90
| | | | | | | | | | This commit adds notifications for hot plugging of devices. It also extends the old behaviour of the `audio-out-detected-device` property which is now backed by the hotplugging code. This allows clients to be notified when the actual audio output device changes. Maybe hotplugging should be supported for ao_coreaudio_exclusive too, but it's device selection code is a bit fragile.
* ao_coreaudio: use device UID instead of ID for selectionStefano Pigozzi2015-02-031-1/+4
| | | | | | | | | | Previously we let the user use the audio device ID, but this is not persistent and can change when plugging in new devices. That of course made it quite worthless for storing it as a user setting for GUIs, or for user scripts. In theory getting the kAudioDevicePropertyDeviceUID can fail but it doesn't on any of my devices, so I'm leaving the error reporting quite high and see if someone complains.
* command: add property returning detected audio deviceStefano Pigozzi2015-02-031-0/+2
| | | | | This can be useful to adjust some other audio related properties at runtime depending on the audio device being used.
* 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
* 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_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
|
* 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
* 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: allow more than 20 channel map entrieswm42014-12-011-1/+1
| | | | | | | | | | | | | 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.
* coreaudio: redirect IEC61937 to coreaudio_exclusiveStefano Pigozzi2014-10-231-0/+6
|
* coreaudio: use the new device selection APIStefano Pigozzi2014-10-121-15/+5
| | | | | The CoreAudio API is built around device IDs so we store the integer as string and read it back.
* audio/out: remove old thingswm42014-09-061-3/+4
| | | | | | | | Remove the unnecessary indirection through ao fields. Also fix the inverted result of AOCONTROL_HAS_TEMP_VOLUME. Hopefully the change is equivalent. But actually, it looks like the old code did it wrong.
* ao_coreaudio: report hardware latency to ao_read_dataStefano Pigozzi2014-07-031-3/+42
| | | | | Commit a6a4cd2c88 added reporting of playout latency, this commit also adds support for reporting hardware and constant audio unit latency.
* ao_coreaudio: report latency more correctlyStefano Pigozzi2014-07-021-1/+19
| | | | | | | | | | Previous code was completly wrong. This still doesn't report the device latency, but we report the buffer latency (as before the AO refactoring) and the AudioUnit's latency (this is a new 'feature'). Apparently we can also report the device actual latency and we should also calculate the actual sample rate of the audio device instead of using the nominal sample rate, but I'll leave this for a later commit.
* ao_coreaudio: move channel mapping away from utilsStefano Pigozzi2014-07-021-0/+128
| | | | | Channel mapping functions are only used in the AUHAL based coreaudio, so move them there.
* ao_coreaudio: use mpv's internal pull APIStefano Pigozzi2014-07-021-82/+9
|
* ao_coreaudio: remove useless commentsStefano Pigozzi2014-07-021-5/+3
|
* ao_coreaudio: rename init_lpcm -> init_audiounitStefano Pigozzi2014-07-021-6/+9
|
* ao_coreaudio: fill asbd with an helper functionStefano Pigozzi2014-07-021-20/+1
|
* ao_coreaudio: split control to helper functionsStefano Pigozzi2014-07-021-23/+30
|
* ao_coreaudio: remove useless call to print_asbdStefano Pigozzi2014-07-021-2/+0
|
* ao_coreaudio: move spdif code to a new AOStefano Pigozzi2014-07-021-433/+77
| | | | | | | | | | | | | | | | The mplayer1/2/mpv CoreAudio audio output historically contained both usage of AUHAL APIs (these go through the CoreAudio audio server) and the Device based APIs (used only for output of compressed formats in exclusive mode). The latter is a very unwieldy and low level API and pretty much forces us to write a lot of code for little workr. Also with the widespread of HDMI, the actual need for outputting compressed audio directly to the device is getting lower (it was very useful with S/PDIF for bandwidth constraints not allowing a number if channels transmitted in LPCM). Considering how invasive it is (uses hog/exclusive mode), the new AO (`ao_coreaudio_device`) is not going to be autoprobed but the user will have to select it.
* ao_coreaudio: remove useless codeStefano Pigozzi2014-05-101-15/+0
| | | | | This code doesn't actually makes much of a difference, and the AudioUnit mostly wants layout tags anyway.
* ao_coreaudio: don't fallback to full waveextStefano Pigozzi2014-05-101-4/+5
| | | | | | The code was falling back to the full waveext chmap_sel when less than 2 channels were detected. This new code is slightly more correct since it only fills the chmap_sel with the stereo or mono chmap in the fallback case.
* ao_coreaudio: print an error when channel mapping failsStefano Pigozzi2014-05-101-1/+5
|
* ao_coreaudio: use description-based channel layoutsStefano Pigozzi2014-05-101-12/+5
| | | | | | | | | | | | CoreAudio supports 3 kinds of layouts: bitmap based, tag based, and speaker description based (using either channel labels or positional data). Previously we tried to convert everything to bitmap based channel layouts, but it turns out description based ones are the most generic and there are built-in CoreAudio APIs to perform the conversion in this direction. Moreover description based layouts support waveext extensions (like SDL and SDR), and are easier to map to mp_chmaps.
* audio/out: make draining a separate operationwm42014-03-091-4/+1
| | | | | | | | | | | | Until now, this was always conflated with uninit. This was ugly, and also many AOs emulated this manually (or just ignored it). Make draining an explicit operation, so AOs which support it can provide it, and for all others generic code will emulate it. For ao_wasapi, we keep it simple and basically disable the internal draining implementation (maybe it should be restored later). Tested on Linux only.
* audio/out: make ao struct opaquewm42014-03-091-0/+1
| | | | | | We want to move the AO to its own thread. There's no technical reason for making the ao struct opaque to do this. But it helps us sleep at night, because we can control access to shared state better.
* msg: rename mp_msg_log -> mp_msgwm42013-12-211-1/+1
| | | | Same for companion functions.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-2/+2
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-1/+1
| | | | | | | | | 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.
* audio/out: prepare for non-interleaved audiowm42013-11-121-3/+5
| | | | | | | | | | | | | | | | | | | This comes with two internal AO API changes: 1. ao_driver.play now can take non-interleaved audio. For this purpose, the data pointer is changed to void **data, where data[0] corresponds to the pointer in the old API. Also, the len argument as well as the return value are now in samples, not bytes. "Sample" in this context means the unit of the smallest possible audio frame, i.e. sample_size * channels. 2. ao_driver.get_space now returns samples instead of bytes. (Similar to the play function.) Change all AOs to use the new API. The AO API as exposed to the rest of the player still uses the old API. It's emulated in ao.c. This is purely to split the commits changing all AOs and the commits adding actual support for outputting N-I audio.
* audio/out: reject non-interleaved formatswm42013-11-121-0/+2
| | | | | | | | | | No AO can handle these, so it would be a problem if they get added later, and non-interleaved formats get accepted erroneously. Let them gracefully fall back to other formats. Most AOs actually would fall back, but to an unrelated formats. This is covered by this commit too, and if possible they should pick the interleaved variant if a non-interleaved format is requested.
* osx: fix -Wshadow warnings on platform specific codeStefano Pigozzi2013-11-041-3/+3
|
* audio/out: remove useless info struct and redundant fieldswm42013-10-231-6/+5
|
* ao_coreaudio: clear output buffer on buffer underrunStefano Pigozzi2013-10-031-0/+1
| | | | | | | | Output silence to the output buffer during underruns. This removes small occasional glitches that happen before the AUHAL is actually paused from the `audio_pause` call. Fixes #269
* ao_coreaudio: fetch device name only for verbose log levelStefano Pigozzi2013-10-011-6/+8
| | | | | The previous code fetched the device name regardless of log level and then only printed it if log level was verbose.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* ao_coreaudio: move to new log APIStefano Pigozzi2013-08-011-29/+27
|
*