mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink-input: add callbacks that are called whenever the mute/volume changes
This commit is contained in:
		
							parent
							
								
									52e5d4b1d2
								
							
						
					
					
						commit
						9f97b7cbe1
					
				
					 3 changed files with 38 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -126,6 +126,8 @@ static void reset_callbacks(pa_sink_input *i) {
 | 
			
		|||
    i->state_change = NULL;
 | 
			
		||||
    i->may_move_to = NULL;
 | 
			
		||||
    i->send_event = NULL;
 | 
			
		||||
    i->volume_changed = NULL;
 | 
			
		||||
    i->mute_changed = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Called from main context */
 | 
			
		||||
| 
						 | 
				
			
			@ -968,7 +970,10 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_boo
 | 
			
		|||
        pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_SOFT_VOLUME, NULL, 0, NULL) == 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* The virtual volume changed, let's tell people so */
 | 
			
		||||
    /* The volume changed, let's tell people so */
 | 
			
		||||
    if (i->volume_changed)
 | 
			
		||||
        i->volume_changed(i);
 | 
			
		||||
 | 
			
		||||
    pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -999,6 +1004,11 @@ void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save) {
 | 
			
		|||
    i->save_muted = save;
 | 
			
		||||
 | 
			
		||||
    pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_SOFT_MUTE, NULL, 0, NULL) == 0);
 | 
			
		||||
 | 
			
		||||
    /* The mute status changed, let's tell people so */
 | 
			
		||||
    if (i->mute_changed)
 | 
			
		||||
        i->mute_changed(i);
 | 
			
		||||
 | 
			
		||||
    pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1263,6 +1273,10 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
 | 
			
		|||
 | 
			
		||||
    /* Notify everyone */
 | 
			
		||||
    pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], i);
 | 
			
		||||
 | 
			
		||||
    if (i->volume_changed)
 | 
			
		||||
        i->volume_changed(i);
 | 
			
		||||
 | 
			
		||||
    pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_CHANGE, i->index);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue