History

audio: add AO_INIT_MEDIA_ROLE_MUSIC

This allows the AO to set the media role directly during init().

Thomas Weißschuh committed 3 years ago

Commit 6e023541 parent 1bbc7a22 files · +19 −0Browse files

Unified · Split

2 files
  1. audio/out/ao.h +2 −0
  2. player/audio.c +17 −0
audio/out/ao.h+2−0
@@ -56,6 +56,8 @@ enum { · 55 unmodified lines
56 AO_INIT_STREAM_SILENCE = 1 << 2,56 AO_INIT_STREAM_SILENCE = 1 << 2,
57 // Force exclusive mode, i.e. lock out the system mixer.57 // Force exclusive mode, i.e. lock out the system mixer.
58 AO_INIT_EXCLUSIVE = 1 << 3,58 AO_INIT_EXCLUSIVE = 1 << 3,
59 // Initialize with music role.
60 AO_INIT_MEDIA_ROLE_MUSIC = 1 << 4,
59};61};
60 62
61struct ao_device_desc {63struct ao_device_desc {
player/audio.c+17−0
@@ -190,6 +190,20 @@ void update_playback_speed(struct MPContext *mpctx) · 189 unmodified lines
190 update_speed_filters(mpctx);190 update_speed_filters(mpctx);
191}191}
192 192
193static bool has_video_track(struct MPContext *mpctx)
194{
195 if (mpctx->vo_chain && mpctx->vo_chain->is_coverart)
196 return false;
197
198 for (int n = 0; n < mpctx->num_tracks; n++) {
199 struct track *track = mpctx->tracks[n];
200 if (track->type == STREAM_VIDEO && !track->attached_picture && !track->image)
201 return true;
202 }
203
204 return false;
205}
206
193static void ao_chain_reset_state(struct ao_chain *ao_c)207static void ao_chain_reset_state(struct ao_chain *ao_c)
194{208{
195 ao_c->last_out_pts = MP_NOPTS_VALUE;209 ao_c->last_out_pts = MP_NOPTS_VALUE;
@@ -416,6 +430,9 @@ static int reinit_audio_filters_and_output(struct MPContext *mpctx) · 220 unmodified lines
416 opts->audio_output_channels.num_chmaps);430 opts->audio_output_channels.num_chmaps);
417 }431 }
418 432
433 if (!has_video_track(mpctx))
434 ao_flags |= AO_INIT_MEDIA_ROLE_MUSIC;
435
419 mpctx->ao_filter_fmt = out_fmt;436 mpctx->ao_filter_fmt = out_fmt;
420 437
421 mpctx->ao = ao_init_best(mpctx->global, ao_flags, mp_wakeup_core_cb,438 mpctx->ao = ao_init_best(mpctx->global, ao_flags, mp_wakeup_core_cb,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t