summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-05 22:08:04 +0200
committerwm4 <wm4@nowhere>2015-05-05 22:10:33 +0200
commit4ffcf2531bb525c19c3b6df75ecb27c5cffbdd28 (patch)
tree6020004b821abf78243bccd25a8c45c2b9184f78 /audio/out
parent656703e279bc88cd7dc81e30f333e4104b6687b2 (diff)
downloadmpv-4ffcf2531bb525c19c3b6df75ecb27c5cffbdd28.tar.bz2
mpv-4ffcf2531bb525c19c3b6df75ecb27c5cffbdd28.tar.xz
ao_coreaudio_utils: decide formats by comparing raw bits
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.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_coreaudio_utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/audio/out/ao_coreaudio_utils.c b/audio/out/ao_coreaudio_utils.c
index e8eccdc5d3..5eacc7f208 100644
--- a/audio/out/ao_coreaudio_utils.c
+++ b/audio/out/ao_coreaudio_utils.c
@@ -283,12 +283,13 @@ bool ca_asbd_is_better(AudioStreamBasicDescription *req,
return false;
if (old->mChannelsPerFrame > MP_NUM_CHANNELS)
return true;
+ if (req->mFormatID != new->mFormatID)
+ return false;
+ if (req->mFormatID != old->mFormatID)
+ return true;
- int mpfmt_req = ca_asbd_to_mp_format(req);
- int mpfmt_old = ca_asbd_to_mp_format(old);
- int mpfmt_new = ca_asbd_to_mp_format(new);
- if (af_format_conversion_score(mpfmt_req, mpfmt_old) >
- af_format_conversion_score(mpfmt_req, mpfmt_new))
+ if (!value_is_better(req->mBitsPerChannel, old->mBitsPerChannel,
+ new->mBitsPerChannel))
return false;
if (!value_is_better(req->mSampleRate, old->mSampleRate, new->mSampleRate))