New upstream version 21.0.2+dfsg1
This commit is contained in:
parent
1f1bbb3518
commit
baafb6325b
706 changed files with 49633 additions and 5044 deletions
|
|
@ -187,9 +187,15 @@ static inline enum audio_format convert_ca_format(UInt32 format_flags,
|
|||
|
||||
static inline enum speaker_layout convert_ca_speaker_layout(UInt32 channels)
|
||||
{
|
||||
/* directly map channel count to enum values */
|
||||
if (channels >= 1 && channels <= 8 && channels != 7)
|
||||
return (enum speaker_layout)channels;
|
||||
switch (channels) {
|
||||
case 1: return SPEAKERS_MONO;
|
||||
case 2: return SPEAKERS_STEREO;
|
||||
case 3: return SPEAKERS_2POINT1;
|
||||
case 4: return SPEAKERS_4POINT0;
|
||||
case 5: return SPEAKERS_4POINT1;
|
||||
case 6: return SPEAKERS_5POINT1;
|
||||
case 8: return SPEAKERS_7POINT1;
|
||||
}
|
||||
|
||||
return SPEAKERS_UNKNOWN;
|
||||
}
|
||||
|
|
@ -199,6 +205,14 @@ static bool coreaudio_init_format(struct coreaudio_data *ca)
|
|||
AudioStreamBasicDescription desc;
|
||||
OSStatus stat;
|
||||
UInt32 size = sizeof(desc);
|
||||
struct obs_audio_info aoi;
|
||||
int channels;
|
||||
|
||||
if (!obs_get_audio_info(&aoi)) {
|
||||
blog(LOG_WARNING, "No active audio");
|
||||
return false;
|
||||
}
|
||||
channels = get_audio_channels(aoi.speakers);
|
||||
|
||||
stat = get_property(ca->unit, kAudioUnitProperty_StreamFormat,
|
||||
SCOPE_INPUT, BUS_INPUT, &desc, &size);
|
||||
|
|
@ -207,13 +221,13 @@ static bool coreaudio_init_format(struct coreaudio_data *ca)
|
|||
|
||||
/* Certain types of devices have no limit on channel count, and
|
||||
* there's no way to know the actual number of channels it's using,
|
||||
* so if we encounter this situation just force to stereo */
|
||||
if (desc.mChannelsPerFrame > 8) {
|
||||
desc.mChannelsPerFrame = 2;
|
||||
desc.mBytesPerFrame = 2 * desc.mBitsPerChannel / 8;
|
||||
desc.mBytesPerPacket =
|
||||
desc.mFramesPerPacket * desc.mBytesPerFrame;
|
||||
}
|
||||
* so if we encounter this situation just force to what is defined in output */
|
||||
if (desc.mChannelsPerFrame > 8) {
|
||||
desc.mChannelsPerFrame = channels;
|
||||
desc.mBytesPerFrame = channels * desc.mBitsPerChannel / 8;
|
||||
desc.mBytesPerPacket =
|
||||
desc.mFramesPerPacket * desc.mBytesPerFrame;
|
||||
}
|
||||
|
||||
stat = set_property(ca->unit, kAudioUnitProperty_StreamFormat,
|
||||
SCOPE_OUTPUT, BUS_INPUT, &desc, size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue