summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-05 22:08:04 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-07 10:52:02 +0900
commit5523c04af51a9e1c1975af501a71849baa2d4d40 (patch)
tree27dc8709d464602fde6030b96cff236e169a6360
parent625fb59d08a49f13aa786243ddb1550247d43d0f (diff)
downloadmpv-5523c04af51a9e1c1975af501a71849baa2d4d40.tar.bz2
mpv-5523c04af51a9e1c1975af501a71849baa2d4d40.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. (cherry picked from commit 4ffcf2531bb525c19c3b6df75ecb27c5cffbdd28)
-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))