diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index 9a65bcf46..763f19ba4 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -506,6 +506,7 @@ static int impl_send_command(void *object, const struct spa_command *command) switch (SPA_NODE_COMMAND_ID(command)) { case SPA_NODE_COMMAND_Suspend: + case SPA_NODE_COMMAND_Flush: case SPA_NODE_COMMAND_Pause: pw_loop_invoke(impl->context->main_loop, NULL, 0, NULL, 0, false, impl); @@ -521,10 +522,9 @@ static int impl_send_command(void *object, const struct spa_command *command) } break; default: - pw_log_warn("%p: unhandled node command %d", filter, - SPA_NODE_COMMAND_ID(command)); break; } + pw_filter_emit_command(filter, command); return 0; } diff --git a/src/pipewire/filter.h b/src/pipewire/filter.h index eea9487a4..801763c29 100644 --- a/src/pipewire/filter.h +++ b/src/pipewire/filter.h @@ -76,7 +76,7 @@ struct pw_buffer { /** Events for a filter. These events are always called from the mainloop * unless explicitly documented otherwise. */ struct pw_filter_events { -#define PW_VERSION_FILTER_EVENTS 0 +#define PW_VERSION_FILTER_EVENTS 1 uint32_t version; void (*destroy) (void *data); @@ -103,6 +103,9 @@ struct pw_filter_events { /** The filter is drained */ void (*drained) (void *data); + + /** A command notify, Since 0.3.39:1 */ + void (*command) (void *data, const struct spa_command *command); }; /** Convert a filter state to a readable string */ diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 2bf5a6c7f..4ad7c538b 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -1003,6 +1003,7 @@ struct pw_core { #define pw_stream_emit_process(s) pw_stream_emit(s, process, 0) #define pw_stream_emit_drained(s) pw_stream_emit(s, drained,0) #define pw_stream_emit_control_info(s,i,c) pw_stream_emit(s, control_info, 0, i, c) +#define pw_stream_emit_command(s,c) pw_stream_emit(s, command,1,c) struct pw_stream { @@ -1038,6 +1039,7 @@ struct pw_stream { #define pw_filter_emit_remove_buffer(s,p,b) pw_filter_emit(s, remove_buffer, 0, p, b) #define pw_filter_emit_process(s,p) pw_filter_emit(s, process, 0, p) #define pw_filter_emit_drained(s) pw_filter_emit(s, drained, 0) +#define pw_filter_emit_command(s,c) pw_filter_emit(s, command, 1, c) struct pw_filter {