mirror of
https://github.com/mpv-player/mpv
synced 2025-03-08 15:18:00 +00:00
ao_coreaudio: explicitly skip input streams
This may or may not fix some issues with the format switching code. Actually, it seems somewhat unlikely, but then checking the stream type isn't incorrect either, and is probably something the API user should always be doing.
This commit is contained in:
parent
3c61e6eb4e
commit
8134a0601b
@ -192,18 +192,28 @@ static void init_physical_format(struct ao *ao)
|
||||
&streams, &n_streams);
|
||||
CHECK_CA_ERROR("could not get number of streams");
|
||||
|
||||
MP_VERBOSE(ao, "Found %zd substream(s).\n", n_streams);
|
||||
|
||||
for (int i = 0; i < n_streams; i++) {
|
||||
AudioStreamRangedDescription *formats;
|
||||
size_t n_formats;
|
||||
|
||||
err = CA_GET_ARY(streams[i],
|
||||
kAudioStreamPropertyAvailablePhysicalFormats,
|
||||
&formats, &n_formats);
|
||||
MP_VERBOSE(ao, "Looking at formats in substream %d...\n", i);
|
||||
|
||||
err = CA_GET_ARY(streams[i], kAudioStreamPropertyAvailablePhysicalFormats,
|
||||
&formats, &n_formats);
|
||||
|
||||
if (!CHECK_CA_WARN("could not get number of stream formats"))
|
||||
continue; // try next one
|
||||
|
||||
MP_VERBOSE(ao, "Looking at formats in substream %d...\n", i);
|
||||
|
||||
uint32_t direction;
|
||||
err = CA_GET(streams[i], kAudioStreamPropertyDirection, &direction);
|
||||
CHECK_CA_ERROR("could not get stream direction");
|
||||
if (direction != 0) {
|
||||
MP_VERBOSE(ao, "Not an output stream.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
AudioStreamBasicDescription best_asbd = {0};
|
||||
|
||||
|
@ -206,6 +206,14 @@ static int init(struct ao *ao)
|
||||
CHECK_CA_ERROR("could not get number of streams");
|
||||
|
||||
for (int i = 0; i < n_streams && p->stream_idx < 0; i++) {
|
||||
uint32_t direction;
|
||||
err = CA_GET(streams[i], kAudioStreamPropertyDirection, &direction);
|
||||
CHECK_CA_ERROR("could not get stream direction");
|
||||
if (direction != 0) {
|
||||
MP_VERBOSE(ao, "Substream %d is not an output stream.\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
bool compressed = ca_stream_supports_compressed(ao, streams[i]);
|
||||
|
||||
if (compressed) {
|
||||
|
Loading…
Reference in New Issue
Block a user