• Home
  • Raw
  • Download

Lines Matching refs:o

48 static void set_real_ratio(pa_source_output *o, const pa_cvolume *v);
205 static void reset_callbacks(pa_source_output *o) { in reset_callbacks() argument
206 pa_assert(o); in reset_callbacks()
208 o->push = NULL; in reset_callbacks()
209 o->process_rewind = NULL; in reset_callbacks()
210 o->update_max_rewind = NULL; in reset_callbacks()
211 o->update_source_requested_latency = NULL; in reset_callbacks()
212 o->update_source_latency_range = NULL; in reset_callbacks()
213 o->update_source_fixed_latency = NULL; in reset_callbacks()
214 o->attach = NULL; in reset_callbacks()
215 o->detach = NULL; in reset_callbacks()
216 o->suspend = NULL; in reset_callbacks()
217 o->suspend_within_thread = NULL; in reset_callbacks()
218 o->moving = NULL; in reset_callbacks()
219 o->kill = NULL; in reset_callbacks()
220 o->get_latency = NULL; in reset_callbacks()
221 o->state_change = NULL; in reset_callbacks()
222 o->may_move_to = NULL; in reset_callbacks()
223 o->send_event = NULL; in reset_callbacks()
224 o->volume_changed = NULL; in reset_callbacks()
225 o->mute_changed = NULL; in reset_callbacks()
234 pa_source_output *o; in pa_source_output_new() local
433 o = pa_msgobject_new(pa_source_output); in pa_source_output_new()
434 o->parent.parent.free = source_output_free; in pa_source_output_new()
435 o->parent.process_msg = pa_source_output_process_msg; in pa_source_output_new()
437 o->core = core; in pa_source_output_new()
438 o->state = PA_SOURCE_OUTPUT_INIT; in pa_source_output_new()
439 o->flags = data->flags; in pa_source_output_new()
440 o->proplist = pa_proplist_copy(data->proplist); in pa_source_output_new()
441 o->driver = pa_xstrdup(pa_path_get_filename(data->driver)); in pa_source_output_new()
442 o->module = data->module; in pa_source_output_new()
443 o->source = data->source; in pa_source_output_new()
444 o->source_requested_by_application = data->source_requested_by_application; in pa_source_output_new()
445 o->destination_source = data->destination_source; in pa_source_output_new()
446 o->client = data->client; in pa_source_output_new()
448 o->requested_resample_method = data->resample_method; in pa_source_output_new()
449o->actual_resample_method = resampler ? pa_resampler_get_method(resampler) : PA_RESAMPLER_INVALID; in pa_source_output_new()
450 o->sample_spec = data->sample_spec; in pa_source_output_new()
451 o->channel_map = data->channel_map; in pa_source_output_new()
452 o->format = pa_format_info_copy(data->format); in pa_source_output_new()
454 if (!data->volume_is_absolute && pa_source_flat_volume_enabled(o->source)) { in pa_source_output_new()
461 pa_sw_cvolume_multiply(&o->volume, &data->volume, &remapped); in pa_source_output_new()
463 o->volume = data->volume; in pa_source_output_new()
465 o->volume_factor = data->volume_factor; in pa_source_output_new()
466 o->volume_factor_source = data->volume_factor_source; in pa_source_output_new()
467 o->real_ratio = o->reference_ratio = data->volume; in pa_source_output_new()
468 pa_cvolume_reset(&o->soft_volume, o->sample_spec.channels); in pa_source_output_new()
469 pa_cvolume_reset(&o->real_ratio, o->sample_spec.channels); in pa_source_output_new()
470 o->volume_writable = data->volume_writable; in pa_source_output_new()
471 o->save_volume = data->save_volume; in pa_source_output_new()
472 o->preferred_source = pa_xstrdup(data->preferred_source); in pa_source_output_new()
473 o->save_muted = data->save_muted; in pa_source_output_new()
475 o->muted = data->muted; in pa_source_output_new()
477 o->direct_on_input = data->direct_on_input; in pa_source_output_new()
479 reset_callbacks(o); in pa_source_output_new()
480 o->userdata = NULL; in pa_source_output_new()
482 o->thread_info.state = o->state; in pa_source_output_new()
483 o->thread_info.attached = false; in pa_source_output_new()
484 o->thread_info.sample_spec = o->sample_spec; in pa_source_output_new()
485 o->thread_info.resampler = resampler; in pa_source_output_new()
486 o->thread_info.soft_volume = o->soft_volume; in pa_source_output_new()
487 o->thread_info.muted = o->muted; in pa_source_output_new()
488 o->thread_info.requested_source_latency = (pa_usec_t) -1; in pa_source_output_new()
489 o->thread_info.direct_on_input = o->direct_on_input; in pa_source_output_new()
491 o->thread_info.delay_memblockq = pa_memblockq_new( in pa_source_output_new()
496 &o->source->sample_spec, in pa_source_output_new()
500 &o->source->silence); in pa_source_output_new()
502 pa_assert_se(pa_idxset_put(core->source_outputs, o, &o->index) == 0); in pa_source_output_new()
503 pa_assert_se(pa_idxset_put(o->source->outputs, pa_source_output_ref(o), NULL) == 0); in pa_source_output_new()
505 if (o->client) in pa_source_output_new()
506 pa_assert_se(pa_idxset_put(o->client->source_outputs, o, NULL) >= 0); in pa_source_output_new()
508 if (o->direct_on_input) in pa_source_output_new()
509 pa_assert_se(pa_idxset_put(o->direct_on_input->direct_outputs, o, NULL) == 0); in pa_source_output_new()
511 pt = pa_proplist_to_string_sep(o->proplist, "\n "); in pa_source_output_new()
513 o->index, in pa_source_output_new()
514 pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME)), in pa_source_output_new()
515 o->source->name, in pa_source_output_new()
516 pa_sample_spec_snprint(st, sizeof(st), &o->sample_spec), in pa_source_output_new()
517 pa_channel_map_snprint(cm, sizeof(cm), &o->channel_map), in pa_source_output_new()
523 *_o = o; in pa_source_output_new()
528 static void update_n_corked(pa_source_output *o, pa_source_output_state_t state) { in update_n_corked() argument
529 pa_assert(o); in update_n_corked()
532 if (!o->source) in update_n_corked()
535 if (o->state == PA_SOURCE_OUTPUT_CORKED && state != PA_SOURCE_OUTPUT_CORKED) in update_n_corked()
536 pa_assert_se(o->source->n_corked -- >= 1); in update_n_corked()
537 else if (o->state != PA_SOURCE_OUTPUT_CORKED && state == PA_SOURCE_OUTPUT_CORKED) in update_n_corked()
538 o->source->n_corked++; in update_n_corked()
542 static void source_output_set_state(pa_source_output *o, pa_source_output_state_t state) { in source_output_set_state() argument
544 pa_assert(o); in source_output_set_state()
547 if (o->state == state) in source_output_set_state()
550 if (o->source) { in source_output_set_state()
551 …if (o->state == PA_SOURCE_OUTPUT_CORKED && state == PA_SOURCE_OUTPUT_RUNNING && pa_source_used_by( in source_output_set_state()
552 !pa_sample_spec_equal(&o->sample_spec, &o->source->sample_spec)) { in source_output_set_state()
555 pa_source_reconfigure(o->source, &o->sample_spec, pa_source_output_is_passthrough(o)); in source_output_set_state()
558 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET… in source_output_set_state()
561 pa_source_output_set_state_within_thread(o, state); in source_output_set_state()
563 update_n_corked(o, state); in source_output_set_state()
564 o->state = state; in source_output_set_state()
567 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_STATE_CHANGED], o); in source_output_set_state()
570 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o-… in source_output_set_state()
573 if (o->source) in source_output_set_state()
574 pa_source_update_status(o->source); in source_output_set_state()
578 void pa_source_output_unlink(pa_source_output*o) { in pa_source_output_unlink() argument
581 pa_source_output_assert_ref(o); in pa_source_output_unlink()
587 pa_source_output_ref(o); in pa_source_output_unlink()
589 linked = PA_SOURCE_OUTPUT_IS_LINKED(o->state); in pa_source_output_unlink()
592 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK], o); in pa_source_output_unlink()
594 if (o->direct_on_input) in pa_source_output_unlink()
595 pa_idxset_remove_by_data(o->direct_on_input->direct_outputs, o, NULL); in pa_source_output_unlink()
597 pa_idxset_remove_by_data(o->core->source_outputs, o, NULL); in pa_source_output_unlink()
599 if (o->source) in pa_source_output_unlink()
600 if (pa_idxset_remove_by_data(o->source->outputs, o, NULL)) in pa_source_output_unlink()
601 pa_source_output_unref(o); in pa_source_output_unlink()
603 if (o->client) in pa_source_output_unlink()
604 pa_idxset_remove_by_data(o->client->source_outputs, o, NULL); in pa_source_output_unlink()
606 update_n_corked(o, PA_SOURCE_OUTPUT_UNLINKED); in pa_source_output_unlink()
607 o->state = PA_SOURCE_OUTPUT_UNLINKED; in pa_source_output_unlink()
609 if (linked && o->source) { in pa_source_output_unlink()
610 if (pa_source_output_is_passthrough(o)) in pa_source_output_unlink()
611 pa_source_leave_passthrough(o->source); in pa_source_output_unlink()
614 if (pa_source_flat_volume_enabled(o->source)) in pa_source_output_unlink()
615 pa_source_set_volume(o->source, NULL, false, false); in pa_source_output_unlink()
617 if (o->source->asyncmsgq) in pa_source_output_unlink()
618 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_RE… in pa_source_output_unlink()
621 reset_callbacks(o); in pa_source_output_unlink()
623 if (o->source) { in pa_source_output_unlink()
624 if (PA_SOURCE_IS_LINKED(o->source->state)) in pa_source_output_unlink()
625 pa_source_update_status(o->source); in pa_source_output_unlink()
627 o->source = NULL; in pa_source_output_unlink()
631 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o-… in pa_source_output_unlink()
632 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], o); in pa_source_output_unlink()
635 pa_core_maybe_vacuum(o->core); in pa_source_output_unlink()
637 pa_source_output_unref(o); in pa_source_output_unlink()
642 pa_source_output *o = PA_SOURCE_OUTPUT(mo); in source_output_free() local
644 pa_assert(o); in source_output_free()
646 pa_assert(pa_source_output_refcnt(o) == 0); in source_output_free()
647 pa_assert(!PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in source_output_free()
649 pa_log_info("Freeing output %u \"%s\"", o->index, in source_output_free()
650 o->proplist ? pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME)) : ""); in source_output_free()
652 if (o->thread_info.delay_memblockq) in source_output_free()
653 pa_memblockq_free(o->thread_info.delay_memblockq); in source_output_free()
655 if (o->thread_info.resampler) in source_output_free()
656 pa_resampler_free(o->thread_info.resampler); in source_output_free()
658 if (o->format) in source_output_free()
659 pa_format_info_free(o->format); in source_output_free()
661 if (o->proplist) in source_output_free()
662 pa_proplist_free(o->proplist); in source_output_free()
664 if (o->preferred_source) in source_output_free()
665 pa_xfree(o->preferred_source); in source_output_free()
667 pa_xfree(o->driver); in source_output_free()
668 pa_xfree(o); in source_output_free()
672 void pa_source_output_put(pa_source_output *o) { in pa_source_output_put() argument
675 pa_source_output_assert_ref(o); in pa_source_output_put()
678 pa_assert(o->state == PA_SOURCE_OUTPUT_INIT); in pa_source_output_put()
681 pa_assert(o->push); in pa_source_output_put()
682 pa_assert(o->kill); in pa_source_output_put()
684 …state = o->flags & PA_SOURCE_OUTPUT_START_CORKED ? PA_SOURCE_OUTPUT_CORKED : PA_SOURCE_OUTPUT_RUNN… in pa_source_output_put()
686 update_n_corked(o, state); in pa_source_output_put()
687 o->state = state; in pa_source_output_put()
690 if (pa_source_flat_volume_enabled(o->source)) in pa_source_output_put()
691 pa_source_set_volume(o->source, NULL, false, o->save_volume); in pa_source_output_put()
693 …if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) { in pa_source_output_put()
694 pa_assert(pa_cvolume_is_norm(&o->volume)); in pa_source_output_put()
695 pa_assert(pa_cvolume_is_norm(&o->reference_ratio)); in pa_source_output_put()
698 set_real_ratio(o, &o->volume); in pa_source_output_put()
701 if (pa_source_output_is_passthrough(o)) in pa_source_output_put()
702 pa_source_enter_passthrough(o->source); in pa_source_output_put()
704 o->thread_info.soft_volume = o->soft_volume; in pa_source_output_put()
705 o->thread_info.muted = o->muted; in pa_source_output_put()
707 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_AD… in pa_source_output_put()
709 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_NEW, o->in… in pa_source_output_put()
710 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], o); in pa_source_output_put()
712 pa_source_update_status(o->source); in pa_source_output_put()
716 void pa_source_output_kill(pa_source_output*o) { in pa_source_output_kill() argument
717 pa_source_output_assert_ref(o); in pa_source_output_kill()
719 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_kill()
721 o->kill(o); in pa_source_output_kill()
725 pa_usec_t pa_source_output_get_latency(pa_source_output *o, pa_usec_t *source_latency) { in pa_source_output_get_latency() argument
728 pa_source_output_assert_ref(o); in pa_source_output_get_latency()
730 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_get_latency()
732 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_GET… in pa_source_output_get_latency()
734 if (o->get_latency) in pa_source_output_get_latency()
735 r[0] += o->get_latency(o); in pa_source_output_get_latency()
744 void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { in pa_source_output_push() argument
750 pa_source_output_assert_ref(o); in pa_source_output_push()
751 pa_source_output_assert_io_context(o); in pa_source_output_push()
752 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->thread_info.state)); in pa_source_output_push()
754 pa_assert(pa_frame_aligned(chunk->length, &o->source->sample_spec)); in pa_source_output_push()
756 if (!o->push || o->thread_info.state == PA_SOURCE_OUTPUT_CORKED) in pa_source_output_push()
759 pa_assert(o->thread_info.state == PA_SOURCE_OUTPUT_RUNNING); in pa_source_output_push()
761 if (pa_memblockq_push(o->thread_info.delay_memblockq, chunk) < 0) { in pa_source_output_push()
763 …pa_memblockq_seek(o->thread_info.delay_memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, true); in pa_source_output_push()
766 limit = o->process_rewind ? 0 : o->source->thread_info.max_rewind; in pa_source_output_push()
768 volume_is_norm = pa_cvolume_is_norm(&o->thread_info.soft_volume) && !o->thread_info.muted; in pa_source_output_push()
769 need_volume_factor_source = !pa_cvolume_is_norm(&o->volume_factor_source); in pa_source_output_push()
771 if (limit > 0 && o->source->monitor_of) { in pa_source_output_push()
782 latency = pa_sink_get_latency_within_thread(o->source->monitor_of, false); in pa_source_output_push()
784 n = pa_usec_to_bytes(latency, &o->source->sample_spec); in pa_source_output_push()
791 while ((length = pa_memblockq_get_length(o->thread_info.delay_memblockq)) > limit) { in pa_source_output_push()
797 pa_assert_se(pa_memblockq_peek(o->thread_info.delay_memblockq, &qchunk) >= 0); in pa_source_output_push()
808 if (o->thread_info.muted) { in pa_source_output_push()
809 pa_silence_memchunk(&qchunk, &o->source->sample_spec); in pa_source_output_push()
812 } else if (!o->thread_info.resampler && nvfs) { in pa_source_output_push()
818 pa_sw_cvolume_multiply(&v, &o->thread_info.soft_volume, &o->volume_factor_source); in pa_source_output_push()
819 pa_volume_memchunk(&qchunk, &o->source->sample_spec, &v); in pa_source_output_push()
823 pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->thread_info.soft_volume); in pa_source_output_push()
828 pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->volume_factor_source); in pa_source_output_push()
831 if (!o->thread_info.resampler) in pa_source_output_push()
832 o->push(o, &qchunk); in pa_source_output_push()
837 mbs = pa_resampler_max_block_size(o->thread_info.resampler); in pa_source_output_push()
842 pa_resampler_run(o->thread_info.resampler, &qchunk, &rchunk); in pa_source_output_push()
845 o->push(o, &rchunk); in pa_source_output_push()
852 pa_memblockq_drop(o->thread_info.delay_memblockq, qchunk.length); in pa_source_output_push()
857 void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in source sample spec */… in pa_source_output_process_rewind() argument
859 pa_source_output_assert_ref(o); in pa_source_output_process_rewind()
860 pa_source_output_assert_io_context(o); in pa_source_output_process_rewind()
861 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->thread_info.state)); in pa_source_output_process_rewind()
862 pa_assert(pa_frame_aligned(nbytes, &o->source->sample_spec)); in pa_source_output_process_rewind()
867 if (o->process_rewind) { in pa_source_output_process_rewind()
868 pa_assert(pa_memblockq_get_length(o->thread_info.delay_memblockq) == 0); in pa_source_output_process_rewind()
870 if (o->thread_info.resampler) in pa_source_output_process_rewind()
871 nbytes = pa_resampler_result(o->thread_info.resampler, nbytes); in pa_source_output_process_rewind()
876 o->process_rewind(o, nbytes); in pa_source_output_process_rewind()
878 if (o->thread_info.resampler) in pa_source_output_process_rewind()
879 pa_resampler_rewind(o->thread_info.resampler, nbytes); in pa_source_output_process_rewind()
882 … pa_memblockq_seek(o->thread_info.delay_memblockq, - ((int64_t) nbytes), PA_SEEK_RELATIVE, true); in pa_source_output_process_rewind()
886 size_t pa_source_output_get_max_rewind(pa_source_output *o) { in pa_source_output_get_max_rewind() argument
887 pa_source_output_assert_ref(o); in pa_source_output_get_max_rewind()
888 pa_source_output_assert_io_context(o); in pa_source_output_get_max_rewind()
890 …return o->thread_info.resampler ? pa_resampler_request(o->thread_info.resampler, o->source->thread… in pa_source_output_get_max_rewind()
894 void pa_source_output_update_max_rewind(pa_source_output *o, size_t nbytes /* in the source's samp… in pa_source_output_update_max_rewind() argument
895 pa_source_output_assert_ref(o); in pa_source_output_update_max_rewind()
896 pa_source_output_assert_io_context(o); in pa_source_output_update_max_rewind()
897 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->thread_info.state)); in pa_source_output_update_max_rewind()
898 pa_assert(pa_frame_aligned(nbytes, &o->source->sample_spec)); in pa_source_output_update_max_rewind()
900 if (o->update_max_rewind) in pa_source_output_update_max_rewind()
901o->update_max_rewind(o, o->thread_info.resampler ? pa_resampler_result(o->thread_info.resampler, n… in pa_source_output_update_max_rewind()
905 pa_usec_t pa_source_output_set_requested_latency_within_thread(pa_source_output *o, pa_usec_t usec)… in pa_source_output_set_requested_latency_within_thread() argument
906 pa_source_output_assert_ref(o); in pa_source_output_set_requested_latency_within_thread()
907 pa_source_output_assert_io_context(o); in pa_source_output_set_requested_latency_within_thread()
909 if (!(o->source->flags & PA_SOURCE_DYNAMIC_LATENCY)) in pa_source_output_set_requested_latency_within_thread()
910 usec = o->source->thread_info.fixed_latency; in pa_source_output_set_requested_latency_within_thread()
913 … usec = PA_CLAMP(usec, o->source->thread_info.min_latency, o->source->thread_info.max_latency); in pa_source_output_set_requested_latency_within_thread()
915 o->thread_info.requested_source_latency = usec; in pa_source_output_set_requested_latency_within_thread()
916 pa_source_invalidate_requested_latency(o->source, true); in pa_source_output_set_requested_latency_within_thread()
922 pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t usec) { in pa_source_output_set_requested_latency() argument
923 pa_source_output_assert_ref(o); in pa_source_output_set_requested_latency()
926 if (PA_SOURCE_OUTPUT_IS_LINKED(o->state) && o->source) { in pa_source_output_set_requested_latency()
927 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET… in pa_source_output_set_requested_latency()
934 if (o->source) { in pa_source_output_set_requested_latency()
935 if (!(o->source->flags & PA_SOURCE_DYNAMIC_LATENCY)) in pa_source_output_set_requested_latency()
936 usec = pa_source_get_fixed_latency(o->source); in pa_source_output_set_requested_latency()
940 pa_source_get_latency_range(o->source, &min_latency, &max_latency); in pa_source_output_set_requested_latency()
945 o->thread_info.requested_source_latency = usec; in pa_source_output_set_requested_latency()
951 pa_usec_t pa_source_output_get_requested_latency(pa_source_output *o) { in pa_source_output_get_requested_latency() argument
952 pa_source_output_assert_ref(o); in pa_source_output_get_requested_latency()
955 if (PA_SOURCE_OUTPUT_IS_LINKED(o->state) && o->source) { in pa_source_output_get_requested_latency()
957 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_GET… in pa_source_output_get_requested_latency()
964 return o->thread_info.requested_source_latency; in pa_source_output_get_requested_latency()
968 void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, bool save, bool abs… in pa_source_output_set_volume() argument
971 pa_source_output_assert_ref(o); in pa_source_output_set_volume()
973 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_set_volume()
976 pa_assert(volume->channels == 1 || pa_cvolume_compatible(volume, &o->sample_spec)); in pa_source_output_set_volume()
977 pa_assert(o->volume_writable); in pa_source_output_set_volume()
979 if (!absolute && pa_source_flat_volume_enabled(o->source)) { in pa_source_output_set_volume()
980 v = o->source->reference_volume; in pa_source_output_set_volume()
981 pa_cvolume_remap(&v, &o->source->channel_map, &o->channel_map); in pa_source_output_set_volume()
983 if (pa_cvolume_compatible(volume, &o->sample_spec)) in pa_source_output_set_volume()
988 if (!pa_cvolume_compatible(volume, &o->sample_spec)) { in pa_source_output_set_volume()
989 v = o->volume; in pa_source_output_set_volume()
994 if (pa_cvolume_equal(volume, &o->volume)) { in pa_source_output_set_volume()
995 o->save_volume = o->save_volume || save; in pa_source_output_set_volume()
999 pa_source_output_set_volume_direct(o, volume); in pa_source_output_set_volume()
1000 o->save_volume = save; in pa_source_output_set_volume()
1002 if (pa_source_flat_volume_enabled(o->source)) { in pa_source_output_set_volume()
1006 pa_source_set_volume(o->source, NULL, true, save); in pa_source_output_set_volume()
1011 set_real_ratio(o, volume); in pa_source_output_set_volume()
1014 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET… in pa_source_output_set_volume()
1018 if (o->volume_changed) in pa_source_output_set_volume()
1019 o->volume_changed(o); in pa_source_output_set_volume()
1022 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o-… in pa_source_output_set_volume()
1026 static void set_real_ratio(pa_source_output *o, const pa_cvolume *v) { in set_real_ratio() argument
1027 pa_source_output_assert_ref(o); in set_real_ratio()
1029 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in set_real_ratio()
1030 pa_assert(!v || pa_cvolume_compatible(v, &o->sample_spec)); in set_real_ratio()
1038 o->real_ratio = *v; in set_real_ratio()
1040 pa_cvolume_reset(&o->real_ratio, o->sample_spec.channels); in set_real_ratio()
1042 pa_sw_cvolume_multiply(&o->soft_volume, &o->real_ratio, &o->volume_factor); in set_real_ratio()
1047 bool pa_source_output_is_passthrough(pa_source_output *o) { in pa_source_output_is_passthrough() argument
1048 pa_source_output_assert_ref(o); in pa_source_output_is_passthrough()
1050 if (PA_UNLIKELY(!pa_format_info_is_pcm(o->format))) in pa_source_output_is_passthrough()
1053 if (PA_UNLIKELY(o->flags & PA_SOURCE_OUTPUT_PASSTHROUGH)) in pa_source_output_is_passthrough()
1060 bool pa_source_output_is_volume_readable(pa_source_output *o) { in pa_source_output_is_volume_readable() argument
1061 pa_source_output_assert_ref(o); in pa_source_output_is_volume_readable()
1064 return !pa_source_output_is_passthrough(o); in pa_source_output_is_volume_readable()
1068 pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, bool absolute) { in pa_source_output_get_volume() argument
1069 pa_source_output_assert_ref(o); in pa_source_output_get_volume()
1071 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_get_volume()
1072 pa_assert(pa_source_output_is_volume_readable(o)); in pa_source_output_get_volume()
1074 if (absolute || !pa_source_flat_volume_enabled(o->source)) in pa_source_output_get_volume()
1075 *volume = o->volume; in pa_source_output_get_volume()
1077 *volume = o->reference_ratio; in pa_source_output_get_volume()
1083 void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save) { in pa_source_output_set_mute() argument
1086 pa_source_output_assert_ref(o); in pa_source_output_set_mute()
1088 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_set_mute()
1090 old_mute = o->muted; in pa_source_output_set_mute()
1093 o->save_muted |= save; in pa_source_output_set_mute()
1097 o->muted = mute; in pa_source_output_set_mute()
1098 …pa_log_debug("The mute of source output %u changed from %s to %s.", o->index, pa_yes_no(old_mute),… in pa_source_output_set_mute()
1100 o->save_muted = save; in pa_source_output_set_mute()
1102 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET… in pa_source_output_set_mute()
1105 if (o->mute_changed) in pa_source_output_set_mute()
1106 o->mute_changed(o); in pa_source_output_set_mute()
1108 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o-… in pa_source_output_set_mute()
1109 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MUTE_CHANGED], o); in pa_source_output_set_mute()
1112 void pa_source_output_set_property(pa_source_output *o, const char *key, const char *value) { in pa_source_output_set_property() argument
1116 pa_assert(o); in pa_source_output_set_property()
1119 if (pa_proplist_contains(o->proplist, key)) { in pa_source_output_set_property()
1120 old_value = pa_xstrdup(pa_proplist_gets(o->proplist, key)); in pa_source_output_set_property()
1134 pa_proplist_sets(o->proplist, key, value); in pa_source_output_set_property()
1137 pa_proplist_unset(o->proplist, key); in pa_source_output_set_property()
1141 if (PA_SOURCE_OUTPUT_IS_LINKED(o->state)) { in pa_source_output_set_property()
1142 … pa_log_debug("Source output %u: proplist[%s]: %s -> %s", o->index, key, old_value, new_value); in pa_source_output_set_property()
1143 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED], o); in pa_source_output_set_property()
1144 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT | PA_SUBSCRIPTION_EVENT_CHANGE, in pa_source_output_set_property()
1151 void pa_source_output_set_property_arbitrary(pa_source_output *o, const char *key, const uint8_t *v… in pa_source_output_set_property_arbitrary() argument
1157 pa_assert(o); in pa_source_output_set_property_arbitrary()
1160 if (pa_proplist_get(o->proplist, key, (const void **) &old_value, &old_nbytes) >= 0) { in pa_source_output_set_property_arbitrary()
1174 pa_proplist_set(o->proplist, key, value, nbytes); in pa_source_output_set_property_arbitrary()
1177 pa_proplist_unset(o->proplist, key); in pa_source_output_set_property_arbitrary()
1181 if (PA_SOURCE_OUTPUT_IS_LINKED(o->state)) { in pa_source_output_set_property_arbitrary()
1182 …pa_log_debug("Source output %u: proplist[%s]: %s -> %s", o->index, key, old_value_str, new_value_s… in pa_source_output_set_property_arbitrary()
1183 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED], o); in pa_source_output_set_property_arbitrary()
1184 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT | PA_SUBSCRIPTION_EVENT_CHANGE, in pa_source_output_set_property_arbitrary()
1189 void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p) { in pa_source_output_update_proplist() argument
1195 pa_source_output_assert_ref(o); in pa_source_output_update_proplist()
1202 for (state = NULL; (key = pa_proplist_iterate(o->proplist, &state));) { in pa_source_output_update_proplist()
1204 pa_source_output_set_property(o, key, NULL); in pa_source_output_update_proplist()
1211 pa_source_output_set_property_arbitrary(o, key, value, nbytes); in pa_source_output_update_proplist()
1217 if (pa_proplist_contains(o->proplist, key)) in pa_source_output_update_proplist()
1221 pa_source_output_set_property_arbitrary(o, key, value, nbytes); in pa_source_output_update_proplist()
1229 void pa_source_output_cork(pa_source_output *o, bool b) { in pa_source_output_cork() argument
1230 pa_source_output_assert_ref(o); in pa_source_output_cork()
1232 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_cork()
1234 source_output_set_state(o, b ? PA_SOURCE_OUTPUT_CORKED : PA_SOURCE_OUTPUT_RUNNING); in pa_source_output_cork()
1238 int pa_source_output_set_rate(pa_source_output *o, uint32_t rate) { in pa_source_output_set_rate() argument
1239 pa_source_output_assert_ref(o); in pa_source_output_set_rate()
1241 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_set_rate()
1242 pa_return_val_if_fail(o->thread_info.resampler, -PA_ERR_BADSTATE); in pa_source_output_set_rate()
1244 if (o->sample_spec.rate == rate) in pa_source_output_set_rate()
1247 o->sample_spec.rate = rate; in pa_source_output_set_rate()
1249 …pa_asyncmsgq_post(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET_RATE, PA_UIN… in pa_source_output_set_rate()
1251 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o-… in pa_source_output_set_rate()
1256 pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o) { in pa_source_output_get_resample_method() argument
1257 pa_source_output_assert_ref(o); in pa_source_output_get_resample_method()
1260 return o->actual_resample_method; in pa_source_output_get_resample_method()
1264 bool pa_source_output_may_move(pa_source_output *o) { in pa_source_output_may_move() argument
1265 pa_source_output_assert_ref(o); in pa_source_output_may_move()
1267 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_may_move()
1269 if (o->flags & PA_SOURCE_OUTPUT_DONT_MOVE) in pa_source_output_may_move()
1272 if (o->direct_on_input) in pa_source_output_may_move()
1289 static bool is_filter_source_moving(pa_source_output *o) { in is_filter_source_moving() argument
1290 pa_source *source = o->source; in is_filter_source_moving()
1306 bool pa_source_output_may_move_to(pa_source_output *o, pa_source *dest) { in pa_source_output_may_move_to() argument
1307 pa_source_output_assert_ref(o); in pa_source_output_may_move_to()
1308 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_may_move_to()
1311 if (dest == o->source) in pa_source_output_may_move_to()
1317 if (!pa_source_output_may_move(o)) in pa_source_output_may_move_to()
1321 if (find_filter_source_output(o, dest)) { in pa_source_output_may_move_to()
1331 if (is_filter_source_moving(o)) { in pa_source_output_may_move_to()
1333 o->source->name); in pa_source_output_may_move_to()
1342 if (o->may_move_to) in pa_source_output_may_move_to()
1343 if (!o->may_move_to(o, dest)) in pa_source_output_may_move_to()
1350 int pa_source_output_start_move(pa_source_output *o) { in pa_source_output_start_move() argument
1354 pa_source_output_assert_ref(o); in pa_source_output_start_move()
1356 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_start_move()
1357 pa_assert(o->source); in pa_source_output_start_move()
1359 if (!pa_source_output_may_move(o)) in pa_source_output_start_move()
1362 if ((r = pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_START], o)) < 0) in pa_source_output_start_move()
1365 … pa_log_debug("Starting to move source output %u from '%s'", (unsigned) o->index, o->source->name); in pa_source_output_start_move()
1367 origin = o->source; in pa_source_output_start_move()
1369 pa_idxset_remove_by_data(o->source->outputs, o, NULL); in pa_source_output_start_move()
1371 if (o->state == PA_SOURCE_OUTPUT_CORKED) in pa_source_output_start_move()
1374 if (pa_source_output_is_passthrough(o)) in pa_source_output_start_move()
1375 pa_source_leave_passthrough(o->source); in pa_source_output_start_move()
1377 if (pa_source_flat_volume_enabled(o->source)) in pa_source_output_start_move()
1380 pa_source_set_volume(o->source, NULL, false, false); in pa_source_output_start_move()
1382 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_RE… in pa_source_output_start_move()
1384 pa_source_update_status(o->source); in pa_source_output_start_move()
1386 pa_cvolume_remap(&o->volume_factor_source, &o->source->channel_map, &o->channel_map); in pa_source_output_start_move()
1388 o->source = NULL; in pa_source_output_start_move()
1389 o->source_requested_by_application = false; in pa_source_output_start_move()
1391 pa_source_output_unref(o); in pa_source_output_start_move()
1399 static void update_volume_due_to_moving(pa_source_output *o, pa_source *dest) { in update_volume_due_to_moving() argument
1402 pa_assert(o); in update_volume_due_to_moving()
1404 pa_assert(o->source); /* The destination source should already be set. */ in update_volume_due_to_moving()
1406 …if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) { in update_volume_due_to_moving()
1411 root_source = pa_source_get_master(o->source); in update_volume_due_to_moving()
1416 if (pa_source_flat_volume_enabled(o->source)) { in update_volume_due_to_moving()
1432 pa_assert(pa_cvolume_is_norm(&o->real_ratio)); in update_volume_due_to_moving()
1433 pa_assert(pa_cvolume_equal(&o->soft_volume, &o->volume_factor)); in update_volume_due_to_moving()
1451 pa_cvolume_reset(&new_volume, o->volume.channels); in update_volume_due_to_moving()
1452 pa_source_output_set_volume_direct(o, &new_volume); in update_volume_due_to_moving()
1453 pa_source_output_set_reference_ratio(o, &new_volume); in update_volume_due_to_moving()
1454 pa_assert(pa_cvolume_is_norm(&o->real_ratio)); in update_volume_due_to_moving()
1455 pa_assert(pa_cvolume_equal(&o->soft_volume, &o->volume_factor)); in update_volume_due_to_moving()
1467 … pa_cvolume_remap(&new_volume, &root_source->channel_map, &o->destination_source->channel_map); in update_volume_due_to_moving()
1468 pa_source_set_reference_volume_direct(o->destination_source, &new_volume); in update_volume_due_to_moving()
1470 o->destination_source->real_volume = root_source->real_volume; in update_volume_due_to_moving()
1471 …pa_cvolume_remap(&o->destination_source->real_volume, &root_source->channel_map, &o->destination_s… in update_volume_due_to_moving()
1473 pa_assert(pa_cvolume_is_norm(&o->destination_source->soft_volume)); in update_volume_due_to_moving()
1483 PA_IDXSET_FOREACH(destination_source_output, o->destination_source->outputs, idx) in update_volume_due_to_moving()
1487 if (pa_source_flat_volume_enabled(o->source)) { in update_volume_due_to_moving()
1498 new_volume = o->source->reference_volume; in update_volume_due_to_moving()
1499 pa_cvolume_remap(&new_volume, &o->source->channel_map, &o->channel_map); in update_volume_due_to_moving()
1500 pa_sw_cvolume_multiply(&new_volume, &new_volume, &o->reference_ratio); in update_volume_due_to_moving()
1501 pa_source_output_set_volume_direct(o, &new_volume); in update_volume_due_to_moving()
1512 pa_source_output_set_volume_direct(o, &o->reference_ratio); in update_volume_due_to_moving()
1513 o->real_ratio = o->reference_ratio; in update_volume_due_to_moving()
1514 pa_sw_cvolume_multiply(&o->soft_volume, &o->real_ratio, &o->volume_factor); in update_volume_due_to_moving()
1520 if ((o->source == dest) && pa_source_flat_volume_enabled(o->source)) in update_volume_due_to_moving()
1521 pa_source_set_volume(o->source, NULL, false, o->save_volume); in update_volume_due_to_moving()
1525 int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, bool save) { in pa_source_output_finish_move() argument
1526 pa_source_output_assert_ref(o); in pa_source_output_finish_move()
1528 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_finish_move()
1529 pa_assert(!o->source); in pa_source_output_finish_move()
1532 if (!pa_source_output_may_move_to(o, dest)) in pa_source_output_finish_move()
1535 if (pa_source_output_is_passthrough(o) && !pa_source_check_format(dest, o->format)) { in pa_source_output_finish_move()
1541 pa_source_output_send_event(o, PA_STREAM_EVENT_FORMAT_LOST, p); in pa_source_output_finish_move()
1546 if (!(o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) && in pa_source_output_finish_move()
1547 !pa_sample_spec_equal(&o->sample_spec, &dest->sample_spec)) { in pa_source_output_finish_move()
1553 pa_source_reconfigure(dest, &o->sample_spec, pa_source_output_is_passthrough(o)); in pa_source_output_finish_move()
1556 if (o->moving) in pa_source_output_finish_move()
1557 o->moving(o, dest); in pa_source_output_finish_move()
1559 o->source = dest; in pa_source_output_finish_move()
1563 pa_xfree(o->preferred_source); in pa_source_output_finish_move()
1565 o->preferred_source = NULL; in pa_source_output_finish_move()
1567 o->preferred_source = pa_xstrdup(dest->name); in pa_source_output_finish_move()
1570 pa_idxset_put(o->source->outputs, pa_source_output_ref(o), NULL); in pa_source_output_finish_move()
1572 pa_cvolume_remap(&o->volume_factor_source, &o->channel_map, &o->source->channel_map); in pa_source_output_finish_move()
1574 if (o->state == PA_SOURCE_OUTPUT_CORKED) in pa_source_output_finish_move()
1575 o->source->n_corked++; in pa_source_output_finish_move()
1577 pa_source_output_update_resampler(o); in pa_source_output_finish_move()
1581 update_volume_due_to_moving(o, dest); in pa_source_output_finish_move()
1583 if (pa_source_output_is_passthrough(o)) in pa_source_output_finish_move()
1584 pa_source_enter_passthrough(o->source); in pa_source_output_finish_move()
1586 …pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_AD… in pa_source_output_finish_move()
1588 pa_log_debug("Successfully moved source output %i to %s.", o->index, dest->name); in pa_source_output_finish_move()
1591 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], o); in pa_source_output_finish_move()
1592 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o-… in pa_source_output_finish_move()
1598 void pa_source_output_fail_move(pa_source_output *o) { in pa_source_output_fail_move() argument
1600 pa_source_output_assert_ref(o); in pa_source_output_fail_move()
1602 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_fail_move()
1603 pa_assert(!o->source); in pa_source_output_fail_move()
1606 if (pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FAIL], o) == PA_HOOK_STOP) in pa_source_output_fail_move()
1610 if (o->core->rescue_streams && pa_source_output_may_move_to(o, o->core->default_source)) { in pa_source_output_fail_move()
1611 if (pa_source_output_finish_move(o, o->core->default_source, false) >= 0) in pa_source_output_fail_move()
1615 if (o->moving) in pa_source_output_fail_move()
1616 o->moving(o, NULL); in pa_source_output_fail_move()
1618 pa_source_output_kill(o); in pa_source_output_fail_move()
1622 int pa_source_output_move_to(pa_source_output *o, pa_source *dest, bool save) { in pa_source_output_move_to() argument
1625 pa_source_output_assert_ref(o); in pa_source_output_move_to()
1627 pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); in pa_source_output_move_to()
1628 pa_assert(o->source); in pa_source_output_move_to()
1631 if (dest == o->source) in pa_source_output_move_to()
1634 if (!pa_source_output_may_move_to(o, dest)) in pa_source_output_move_to()
1637 pa_source_output_ref(o); in pa_source_output_move_to()
1639 if ((r = pa_source_output_start_move(o)) < 0) { in pa_source_output_move_to()
1640 pa_source_output_unref(o); in pa_source_output_move_to()
1644 if ((r = pa_source_output_finish_move(o, dest, save)) < 0) { in pa_source_output_move_to()
1645 pa_source_output_fail_move(o); in pa_source_output_move_to()
1646 pa_source_output_unref(o); in pa_source_output_move_to()
1650 pa_source_output_unref(o); in pa_source_output_move_to()
1656 void pa_source_output_set_state_within_thread(pa_source_output *o, pa_source_output_state_t state) { in pa_source_output_set_state_within_thread() argument
1657 pa_source_output_assert_ref(o); in pa_source_output_set_state_within_thread()
1659 if (state == o->thread_info.state) in pa_source_output_set_state_within_thread()
1662 if (o->state_change) in pa_source_output_set_state_within_thread()
1663 o->state_change(o, state); in pa_source_output_set_state_within_thread()
1665 o->thread_info.state = state; in pa_source_output_set_state_within_thread()
1670 pa_source_output *o = PA_SOURCE_OUTPUT(mo); in pa_source_output_process_msg() local
1671 pa_source_output_assert_ref(o); in pa_source_output_process_msg()
1678 …r[0] += pa_bytes_to_usec(pa_memblockq_get_length(o->thread_info.delay_memblockq), &o->source->samp… in pa_source_output_process_msg()
1679 r[1] += pa_source_get_latency_within_thread(o->source, false); in pa_source_output_process_msg()
1686 o->thread_info.sample_spec.rate = PA_PTR_TO_UINT(userdata); in pa_source_output_process_msg()
1687 pa_resampler_set_output_rate(o->thread_info.resampler, PA_PTR_TO_UINT(userdata)); in pa_source_output_process_msg()
1692 pa_source_output_set_state_within_thread(o, PA_PTR_TO_UINT(userdata)); in pa_source_output_process_msg()
1699 *usec = pa_source_output_set_requested_latency_within_thread(o, *usec); in pa_source_output_process_msg()
1707 *r = o->thread_info.requested_source_latency; in pa_source_output_process_msg()
1712 if (!pa_cvolume_equal(&o->thread_info.soft_volume, &o->soft_volume)) { in pa_source_output_process_msg()
1713 o->thread_info.soft_volume = o->soft_volume; in pa_source_output_process_msg()
1718 if (o->thread_info.muted != o->muted) { in pa_source_output_process_msg()
1719 o->thread_info.muted = o->muted; in pa_source_output_process_msg()
1728 void pa_source_output_send_event(pa_source_output *o, const char *event, pa_proplist *data) { in pa_source_output_send_event() argument
1732 pa_source_output_assert_ref(o); in pa_source_output_send_event()
1736 if (!o->send_event) in pa_source_output_send_event()
1742 hook_data.source_output = o; in pa_source_output_send_event()
1746 if (pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_SEND_EVENT], &hook_data) < 0) in pa_source_output_send_event()
1749 o->send_event(o, event, data); in pa_source_output_send_event()
1759 int pa_source_output_update_resampler(pa_source_output *o) { in pa_source_output_update_resampler() argument
1763 pa_source_output_assert_ref(o); in pa_source_output_update_resampler()
1766 if (o->thread_info.resampler && in pa_source_output_update_resampler()
1767 …pa_sample_spec_equal(pa_resampler_input_sample_spec(o->thread_info.resampler), &o->source->sample_… in pa_source_output_update_resampler()
1768 …pa_channel_map_equal(pa_resampler_input_channel_map(o->thread_info.resampler), &o->source->channel… in pa_source_output_update_resampler()
1770 new_resampler = o->thread_info.resampler; in pa_source_output_update_resampler()
1772 else if (!pa_source_output_is_passthrough(o) && in pa_source_output_update_resampler()
1773 ((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) || in pa_source_output_update_resampler()
1774 !pa_sample_spec_equal(&o->sample_spec, &o->source->sample_spec) || in pa_source_output_update_resampler()
1775 !pa_channel_map_equal(&o->channel_map, &o->source->channel_map))) { in pa_source_output_update_resampler()
1777 new_resampler = pa_resampler_new(o->core->mempool, in pa_source_output_update_resampler()
1778 &o->source->sample_spec, &o->source->channel_map, in pa_source_output_update_resampler()
1779 &o->sample_spec, &o->channel_map, in pa_source_output_update_resampler()
1780 o->core->lfe_crossover_freq, in pa_source_output_update_resampler()
1781 o->requested_resample_method, in pa_source_output_update_resampler()
1782 … ((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) | in pa_source_output_update_resampler()
1783 … ((o->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) | in pa_source_output_update_resampler()
1784 …(o->core->disable_remixing || (o->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) | in pa_source_output_update_resampler()
1785 … (o->core->remixing_use_all_sink_channels ? 0 : PA_RESAMPLER_NO_FILL_SINK) | in pa_source_output_update_resampler()
1786 … (o->core->remixing_produce_lfe ? PA_RESAMPLER_PRODUCE_LFE : 0) | in pa_source_output_update_resampler()
1787 … (o->core->remixing_consume_lfe ? PA_RESAMPLER_CONSUME_LFE : 0)); in pa_source_output_update_resampler()
1796 if (new_resampler == o->thread_info.resampler) in pa_source_output_update_resampler()
1799 if (o->thread_info.resampler) in pa_source_output_update_resampler()
1800 pa_resampler_free(o->thread_info.resampler); in pa_source_output_update_resampler()
1802 o->thread_info.resampler = new_resampler; in pa_source_output_update_resampler()
1804 pa_memblockq_free(o->thread_info.delay_memblockq); in pa_source_output_update_resampler()
1806 memblockq_name = pa_sprintf_malloc("source output delay_memblockq [%u]", o->index); in pa_source_output_update_resampler()
1807 o->thread_info.delay_memblockq = pa_memblockq_new( in pa_source_output_update_resampler()
1812 &o->source->sample_spec, in pa_source_output_update_resampler()
1816 &o->source->silence); in pa_source_output_update_resampler()
1819o->actual_resample_method = new_resampler ? pa_resampler_get_method(new_resampler) : PA_RESAMPLER_… in pa_source_output_update_resampler()
1821 pa_log_debug("Updated resampler for source output %d", o->index); in pa_source_output_update_resampler()
1827 void pa_source_output_attach(pa_source_output *o) { in pa_source_output_attach() argument
1828 pa_assert(o); in pa_source_output_attach()
1829 pa_assert(!o->thread_info.attached); in pa_source_output_attach()
1831 o->thread_info.attached = true; in pa_source_output_attach()
1833 if (o->attach) in pa_source_output_attach()
1834 o->attach(o); in pa_source_output_attach()
1838 void pa_source_output_detach(pa_source_output *o) { in pa_source_output_detach() argument
1839 pa_assert(o); in pa_source_output_detach()
1841 if (!o->thread_info.attached) in pa_source_output_detach()
1844 o->thread_info.attached = false; in pa_source_output_detach()
1846 if (o->detach) in pa_source_output_detach()
1847 o->detach(o); in pa_source_output_detach()
1851 void pa_source_output_set_volume_direct(pa_source_output *o, const pa_cvolume *volume) { in pa_source_output_set_volume_direct() argument
1856 pa_assert(o); in pa_source_output_set_volume_direct()
1859 old_volume = o->volume; in pa_source_output_set_volume_direct()
1864 o->volume = *volume; in pa_source_output_set_volume_direct()
1865 pa_log_debug("The volume of source output %u changed from %s to %s.", o->index, in pa_source_output_set_volume_direct()
1866 …pa_cvolume_snprint_verbose(old_volume_str, sizeof(old_volume_str), &old_volume, &o->channel_map, t… in pa_source_output_set_volume_direct()
1867 …pa_cvolume_snprint_verbose(new_volume_str, sizeof(new_volume_str), volume, &o->channel_map, true)); in pa_source_output_set_volume_direct()
1869 if (o->volume_changed) in pa_source_output_set_volume_direct()
1870 o->volume_changed(o); in pa_source_output_set_volume_direct()
1872 …pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, o-… in pa_source_output_set_volume_direct()
1873 pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_VOLUME_CHANGED], o); in pa_source_output_set_volume_direct()
1877 void pa_source_output_set_reference_ratio(pa_source_output *o, const pa_cvolume *ratio) { in pa_source_output_set_reference_ratio() argument
1882 pa_assert(o); in pa_source_output_set_reference_ratio()
1885 old_ratio = o->reference_ratio; in pa_source_output_set_reference_ratio()
1890 o->reference_ratio = *ratio; in pa_source_output_set_reference_ratio()
1892 if (!PA_SOURCE_OUTPUT_IS_LINKED(o->state)) in pa_source_output_set_reference_ratio()
1895 pa_log_debug("Source output %u reference ratio changed from %s to %s.", o->index, in pa_source_output_set_reference_ratio()
1896 …pa_cvolume_snprint_verbose(old_ratio_str, sizeof(old_ratio_str), &old_ratio, &o->channel_map, true… in pa_source_output_set_reference_ratio()
1897 … pa_cvolume_snprint_verbose(new_ratio_str, sizeof(new_ratio_str), ratio, &o->channel_map, true)); in pa_source_output_set_reference_ratio()
1901 void pa_source_output_set_preferred_source(pa_source_output *o, pa_source *s) { in pa_source_output_set_preferred_source() argument
1902 pa_assert(o); in pa_source_output_set_preferred_source()
1904 pa_xfree(o->preferred_source); in pa_source_output_set_preferred_source()
1906 o->preferred_source = pa_xstrdup(s->name); in pa_source_output_set_preferred_source()
1907 pa_source_output_move_to(o, s, false); in pa_source_output_set_preferred_source()
1909 o->preferred_source = NULL; in pa_source_output_set_preferred_source()
1910 pa_source_output_move_to(o, o->core->default_source, false); in pa_source_output_set_preferred_source()