summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2023-02-02 04:41:14 +0000
committersfan5 <sfan5@live.de>2023-07-31 14:01:44 +0200
commit6e023547ead032f2323dff345f3b81d75e437ff2 (patch)
tree71259b7db6b2e7b8982013e7020ef24630f75910 /player/audio.c
parent1bbc7a2cd086e025d66d8f70e2399c58d26e9972 (diff)
downloadmpv-6e023547ead032f2323dff345f3b81d75e437ff2.tar.bz2
mpv-6e023547ead032f2323dff345f3b81d75e437ff2.tar.xz
audio: add AO_INIT_MEDIA_ROLE_MUSIC
This allows the AO to set the media role directly during init().
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/player/audio.c b/player/audio.c
index 48aa90b1d2..fbba8acd11 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -190,6 +190,20 @@ void update_playback_speed(struct MPContext *mpctx)
update_speed_filters(mpctx);
}
+static bool has_video_track(struct MPContext *mpctx)
+{
+ if (mpctx->vo_chain && mpctx->vo_chain->is_coverart)
+ return false;
+
+ for (int n = 0; n < mpctx->num_tracks; n++) {
+ struct track *track = mpctx->tracks[n];
+ if (track->type == STREAM_VIDEO && !track->attached_picture && !track->image)
+ return true;
+ }
+
+ return false;
+}
+
static void ao_chain_reset_state(struct ao_chain *ao_c)
{
ao_c->last_out_pts = MP_NOPTS_VALUE;
@@ -416,6 +430,9 @@ static int reinit_audio_filters_and_output(struct MPContext *mpctx)
opts->audio_output_channels.num_chmaps);
}
+ if (!has_video_track(mpctx))
+ ao_flags |= AO_INIT_MEDIA_ROLE_MUSIC;
+
mpctx->ao_filter_fmt = out_fmt;
mpctx->ao = ao_init_best(mpctx->global, ao_flags, mp_wakeup_core_cb,