Unified · Split
| @@ -0,0 +1 @@ | ||
| 1 | +add --audio-exclusive option support for ao=audiounit and make non-exclusive the new default | |
| @@ -2001,8 +2001,8 @@ Audio · 2000 unmodified lines | ||
| 2001 | 2001 | Enable exclusive output mode. In this mode, the system is usually locked |
| 2002 | 2002 | out, and only mpv will be able to output audio. |
| 2003 | 2003 | |
| 2004 | − This only works for some audio outputs, such as ``wasapi``, ``coreaudio`` | |
| 2005 | − and ``pipewire``. Other audio outputs silently ignore this option. | |
| 2004 | + This only works for some audio outputs, such as ``wasapi``, ``coreaudio``, | |
| 2005 | + ``pipewire`` and ``audiounit``. Other audio outputs silently ignore this option. | |
| 2006 | 2006 | They either have no concept of exclusive mode, or the mpv side of the |
| 2007 | 2007 | implementation is missing. |
| 2008 | 2008 | |
| @@ -115,7 +115,12 @@ static bool init_audiounit(struct ao *ao) · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | MP_VERBOSE(ao, "max channels: %ld, requested: %d\n", maxChannels, (int)ao->channels.num); |
| 117 | 117 | |
| 118 | − [instance setCategory:AVAudioSessionCategoryPlayback error:nil]; | |
| 118 | + AVAudioSessionCategoryOptions options = 0; | |
| 119 | + if (!(ao->init_flags & AO_INIT_EXCLUSIVE)) { | |
| 120 | + options |= AVAudioSessionCategoryOptionMixWithOthers; | |
| 121 | + } | |
| 122 | + | |
| 123 | + [instance setCategory:AVAudioSessionCategoryPlayback withOptions:options error:nil]; | |
| 119 | 124 | [instance setMode:AVAudioSessionModeMoviePlayback error:nil]; |
| 120 | 125 | [instance setActive:YES error:nil]; |
| 121 | 126 | [instance setPreferredOutputNumberOfChannels:prefChannels error:nil]; |