summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_coreaudio_common.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-06-23 11:18:54 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-07-22 21:53:17 +0200
commit1640ce326276afa64528bfb10c20ae1cae3f1ad5 (patch)
tree84f453b8df61d1083a2902fe8d1c091287e02324 /audio/out/ao_coreaudio_common.c
parentf9a31bc3d9fba6f42f5d8c9dd0afccbe5f690589 (diff)
downloadmpv-1640ce326276afa64528bfb10c20ae1cae3f1ad5.tar.bz2
mpv-1640ce326276afa64528bfb10c20ae1cae3f1ad5.tar.xz
ao_coreaudio: refactor initialization
The initialization is split more clearly between compressed and lpcm case. For the compressed case, format selection is simplified a lot and negotiation removed. The way it was written it just passed back to the core the original requested format, not what was found available on hardware. Since this is most likely useless for the compressed case, I didn't bother with this. In the future I'd like to split this AO in two one that only uses the AUHAL and the other with direct access to the hardware so that even passthrough of lcpm can be possible. This would decrease the latency, audiophiles would like that.
Diffstat (limited to 'audio/out/ao_coreaudio_common.c')
-rw-r--r--audio/out/ao_coreaudio_common.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/audio/out/ao_coreaudio_common.c b/audio/out/ao_coreaudio_common.c
index 56bb99314f..1755004f3f 100644
--- a/audio/out/ao_coreaudio_common.c
+++ b/audio/out/ao_coreaudio_common.c
@@ -76,6 +76,7 @@ static bool check_ca_st(int level, OSStatus code, const char *message)
} while (0)
#define CHECK_CA_ERROR(message) CHECK_CA_ERROR_L(coreaudio_error, message)
+#define CHECK_CA_WARN(message) check_ca_st(MSGL_WARN, err, message)
static void ca_print_asbd(const char *description,
const AudioStreamBasicDescription *asbd)
@@ -206,6 +207,17 @@ static Boolean IsAudioPropertySettable(AudioObjectID id,
return AudioObjectIsPropertySettable(id, &p_addr, outData);
}
+static int AudioFormatIsDigital(AudioStreamBasicDescription asbd)
+{
+ switch (asbd.mFormatID)
+ case 'IAC3':
+ case 'iac3':
+ case kAudioFormat60958AC3:
+ case kAudioFormatAC3:
+ return CONTROL_OK;
+ return CONTROL_FALSE;
+}
+
static int AudioStreamSupportsDigital(AudioStreamID stream)
{
AudioStreamRangedDescription *formats = NULL;
@@ -225,14 +237,10 @@ static int AudioStreamSupportsDigital(AudioStreamID stream)
for (int i = 0; i < n_formats; ++i) {
AudioStreamBasicDescription asbd = formats[i].mFormat;
ca_print_asbd("supported format:", &(asbd));
-
- switch (asbd.mFormatID)
- case 'IAC3':
- case 'iac3':
- case kAudioFormat60958AC3:
- case kAudioFormatAC3:
+ if (AudioFormatIsDigital(asbd)) {
free(formats);
- return CONTROL_OK;
+ return CONTROL_TRUE;
+ }
}
free(formats);