1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-02 21:12:23 +00:00

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.
This commit is contained in:
wm4 2015-05-05 22:08:04 +02:00
parent 656703e279
commit 4ffcf2531b

View File

@ -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))