stream: add functions to get the assigned data loop

This commit is contained in:
Wim Taymans 2024-04-22 16:32:03 +02:00
parent c3d4abd7f1
commit 64695a8611
4 changed files with 23 additions and 1 deletions

View file

@ -1956,6 +1956,13 @@ uint64_t pw_filter_get_nsec(struct pw_filter *filter)
return SPA_TIMESPEC_TO_NSEC(&ts);
}
SPA_EXPORT
struct pw_loop *pw_filter_get_data_loop(struct pw_filter *filter)
{
struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this);
return impl->data_loop;
}
SPA_EXPORT
struct pw_buffer *pw_filter_dequeue_buffer(void *port_data)
{

View file

@ -219,6 +219,10 @@ int pw_filter_get_time(struct pw_filter *filter, struct pw_time *time);
* the nsec value in the spa_io_position. Since 1.1.0 */
uint64_t pw_filter_get_nsec(struct pw_filter *filter);
/** Get the data loop that is doing the processing of this filter. This loop
* is assigned after pw_filter_connect(). * Since 1.1.0 */
struct pw_loop *pw_filter_get_data_loop(struct pw_filter *filter);
/** Get a buffer that can be filled for output ports or consumed
* for input ports. */
struct pw_buffer *pw_filter_dequeue_buffer(void *port_data);

View file

@ -2369,6 +2369,13 @@ uint64_t pw_stream_get_nsec(struct pw_stream *stream)
return SPA_TIMESPEC_TO_NSEC(&ts);
}
SPA_EXPORT
struct pw_loop *pw_stream_get_data_loop(struct pw_stream *stream)
{
struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
return impl->data_loop;
}
static int
do_trigger_deprecated(struct spa_loop *loop,
bool async, uint32_t seq, const void *data, size_t size, void *user_data)

View file

@ -447,7 +447,7 @@ pw_stream_new(struct pw_core *core, /**< a \ref pw_core */
struct pw_properties *props /**< stream properties, ownership is taken */);
struct pw_stream *
pw_stream_new_simple(struct pw_loop *loop, /**< a \ref pw_loop to use */
pw_stream_new_simple(struct pw_loop *loop, /**< a \ref pw_loop to use as the main loop */
const char *name, /**< a stream media name */
struct pw_properties *props,/**< stream properties, ownership is taken */
const struct pw_stream_events *events, /**< stream events */
@ -536,6 +536,10 @@ int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t
* the pw_time_now value. Since 1.1.0 */
uint64_t pw_stream_get_nsec(struct pw_stream *stream);
/** Get the data loop that is doing the processing of this stream. This loop
* is assigned after pw_stream_connect(). * Since 1.1.0 */
struct pw_loop *pw_stream_get_data_loop(struct pw_stream *stream);
/** Query the time on the stream, deprecated since 0.3.50,
* use pw_stream_get_time_n() to get the fields added since 0.3.50. */
SPA_DEPRECATED