Lines Matching defs:source

7              module-virtual-source.c
59 _("source_name=<name for the source> "
60 "source_properties=<properties for the source> "
61 "source_master=<name of source to filter> "
149 #define IS_ACTIVE(u) (((u)->source->state == PA_SOURCE_RUNNING) && \
152 /* This module creates a new (virtual) source and sink.
158 * echo canceled data is then pushed onto the new source.
160 * Both source and sink masters have their own threads to push/pull data
161 * respectively. We however perform all our actions in the source IO thread.
162 * To do this we send all played samples to the source IO thread where they
220 /* to wakeup the source I/O thread */
224 pa_source *source;
354 pa_asyncmsgq_send(u->source_output->source->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_LATENCY_SNAPSHOT, &latency_snapshot, 0, NULL);
399 /* Called from source I/O thread context */
407 /* The source is _put() before the source output is, so let's
409 * source output is first shut down, the source second. */
410 if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state) ||
418 /* Get the latency of the master source */
419 pa_source_get_latency_within_thread(u->source_output->source, true) +
420 /* Add the latency internal to our source output on top */
421 pa_bytes_to_usec(pa_memblockq_get_length(u->source_output->thread_info.delay_memblockq), &u->source_output->source->sample_spec) +
422 /* and the buffering we do on the source */
423 pa_bytes_to_usec(u->source_output_blocksize, &u->source_output->source->sample_spec);
431 u->thread_info.current_volume = u->source->reference_volume;
484 /* restart timer when both sink and source are active */
509 /* restart timer when both sink and source are active */
510 if ((u->source->state == PA_SOURCE_RUNNING) && u->adjust_time)
539 /* Called from source I/O thread context */
547 if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state) ||
677 /* Called from source I/O thread context. */
698 pa_log("Playback too far ahead (%lld), drop source %lld", (long long) diff_time, (long long) diff);
706 /* Called from source I/O thread context. */
714 /* 1. Get sink input latency snapshot, might cause buffers to be sent to source thread */
719 /* 3. Now get the source output latency snapshot */
735 * Called from source I/O thread context.
797 cchunk.memblock = pa_memblock_new(u->source->core->mempool, cchunk.length);
817 pa_source_post(u->source, &cchunk);
829 * Called from source I/O thread context. */
856 cchunk.memblock = pa_memblock_new(u->source->core->mempool, cchunk.length);
878 /* drop consumed source samples */
892 /* forward the (echo-canceled) data to the virtual source */
893 pa_source_post(u->source, &cchunk);
898 /* Called from source I/O thread context. */
908 if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state))
934 /* Okay, skip cancellation for skipped source samples if needed. */
938 * We do this because the source data is coming at a fixed rate, which
946 pa_source_post(u->source, &rchunk);
1000 /* let source thread handle the chunk. pass the sample count as well so that
1001 * the source IO thread can update the right variables. */
1009 /* Called from source I/O thread context. */
1017 /* If the source is not yet linked, there is nothing to rewind */
1018 if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state))
1021 pa_source_process_rewind(u->source, nbytes);
1052 /* Called from source I/O thread context. */
1058 latency = pa_source_get_latency_within_thread(u->source_output->source, false);
1076 /* Called from source I/O thread context. */
1086 if (u->source_output->source->thread_info.state == PA_SOURCE_RUNNING)
1099 if (PA_SOURCE_IS_OPENED(u->source_output->source->thread_info.state))
1174 /* Called from source I/O thread context. */
1183 pa_source_set_max_rewind_within_thread(u->source, nbytes);
1211 /* Called from source I/O thread context. */
1219 latency = pa_source_get_requested_latency_within_thread(o->source);
1238 /* Called from source I/O thread context. */
1246 (long long) o->source->thread_info.min_latency,
1247 (long long) o->source->thread_info.max_latency);
1249 pa_source_set_latency_range_within_thread(u->source, o->source->thread_info.min_latency, o->source->thread_info.max_latency);
1265 /* Called from source I/O thread context. */
1273 (long long) o->source->thread_info.fixed_latency);
1275 pa_source_set_fixed_latency_within_thread(u->source, o->source->thread_info.fixed_latency);
1278 /* Called from source I/O thread context. */
1286 pa_source_set_rtpoll(u->source, o->source->thread_info.rtpoll);
1287 pa_source_set_latency_range_within_thread(u->source, o->source->thread_info.min_latency, o->source->thread_info.max_latency);
1288 pa_source_set_fixed_latency_within_thread(u->source, o->source->thread_info.fixed_latency);
1289 pa_source_set_max_rewind_within_thread(u->source, pa_source_output_get_max_rewind(o));
1293 if (PA_SOURCE_IS_LINKED(u->source->thread_info.state))
1294 pa_source_attach_within_thread(u->source);
1297 o->source->thread_info.rtpoll,
1336 /* Called from source I/O thread context. */
1344 if (PA_SOURCE_IS_LINKED(u->source->thread_info.state))
1345 pa_source_detach_within_thread(u->source);
1346 pa_source_set_rtpoll(u->source, NULL);
1376 /* Called from source I/O thread context except when cork() is called without valid source. */
1406 /* The order here matters! We first kill the source so that streams can
1407 * properly be moved away while the source output is still connected to
1410 pa_source_unlink(u->source);
1416 pa_source_unref(u->source);
1417 u->source = NULL;
1462 return (u->source != dest) && (u->sink != dest->monitor_of);
1489 pa_source_set_asyncmsgq(u->source, dest->asyncmsgq);
1490 pa_source_update_flags(u->source, PA_SOURCE_LATENCY|PA_SOURCE_DYNAMIC_LATENCY, dest->flags);
1492 pa_source_set_asyncmsgq(u->source, NULL);
1495 PA_IDXSET_FOREACH(output, u->source->outputs, idx) {
1497 output->moving(output, u->source);
1514 pa_source_update_proplist(u->source, PA_UPDATE_REPLACE, pl);
1537 if (u->source_output->source) {
1538 pa_proplist_sets(pl, PA_PROP_DEVICE_MASTER_DEVICE, u->source_output->source->name);
1539 y = pa_proplist_gets(u->source_output->source->proplist, PA_PROP_DEVICE_DESCRIPTION);
1544 y ? y : u->source_output->source->name);
1582 * source's asyncmsgq, and that message queue isn't (and can't be, at least
1601 pa_cvolume_set(&vol, u->source->sample_spec.channels, v);
1602 pa_source_set_volume(u->source, &vol, true, false);
1619 /* Called by the canceller, so source I/O thread context. */
1628 /* Called by the canceller, so source I/O thread context. */
1738 pa_log("Master source not found");
1754 /* Set to true if we just want to inherit sample spec and channel map from the sink and source master */
1864 /* Create source */
1892 u->source = pa_source_new(m->core, &source_data, (source_master->flags & (PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY))
1896 if (!u->source) {
1897 pa_log("Failed to create source.");
1901 u->source->parent.process_msg = source_process_msg_cb;
1902 u->source->set_state_in_main_thread = source_set_state_in_main_thread_cb;
1903 u->source->update_requested_latency = source_update_requested_latency_cb;
1904 pa_source_set_set_mute_callback(u->source, source_set_mute_cb);
1906 pa_source_set_get_volume_callback(u->source, source_get_volume_cb);
1907 pa_source_set_set_volume_callback(u->source, source_set_volume_cb);
1908 pa_source_enable_decibel_volume(u->source, true);
1910 u->source->userdata = u;
1912 pa_source_set_asyncmsgq(u->source, source_master->asyncmsgq);
1965 /* Create source output */
1970 source_output_data.destination_source = u->source;
2002 u->source->output_from_master = u->source_output;
2091 u->thread_info.current_volume = u->source->reference_volume;
2094 blocksize_usec = pa_bytes_to_usec(u->source_blocksize, &u->source->sample_spec);
2095 if (u->source->flags & PA_SOURCE_DYNAMIC_LATENCY)
2096 pa_source_set_latency_range(u->source, blocksize_usec, blocksize_usec * MAX_LATENCY_BLOCKS);
2105 * otherwise streams might attach to the sink/source before the
2106 * sink input or source output is attached to the master. */
2111 pa_source_put(u->source);
2136 return pa_sink_linked_by(u->sink) + pa_source_linked_by(u->source);
2161 if (u->source)
2162 pa_source_unlink(u->source);
2176 if (u->source)
2177 pa_source_unref(u->source);