diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-07-19 22:08:04 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-07-19 22:08:04 +0200 |
commit | 637d306a243e83c797f4a818cb0342d9af564843 (patch) | |
tree | 723d6978da05606e1972baf1230d8e44a66392e1 /src/pipewire.c | |
parent | 739fab83ba60087eb598a0fc8732c1bc7669b839 (diff) |
Stop recording when pipewire target window is closed or when pressing close in the desktop environments record button
Diffstat (limited to 'src/pipewire.c')
-rw-r--r-- | src/pipewire.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pipewire.c b/src/pipewire.c index 985a80a..1828f90 100644 --- a/src/pipewire.c +++ b/src/pipewire.c @@ -246,6 +246,14 @@ static void on_param_changed_cb(void *user_data, uint32_t id, const struct spa_p static void on_state_changed_cb(void *user_data, enum pw_stream_state old, enum pw_stream_state state, const char *error) { (void)old; gsr_pipewire *self = user_data; + if(state == PW_STREAM_STATE_STREAMING) + self->started = true; + + if(self->started && state == PW_STREAM_STATE_PAUSED) { + self->started = false; + self->stopped = true; + } + fprintf(stderr, "gsr info: pipewire: stream %p state: \"%s\" (error: %s)\n", (void*)self->stream, pw_stream_state_as_string(state), error ? error : "none"); @@ -627,3 +635,7 @@ bool gsr_pipewire_map_texture(gsr_pipewire *self, unsigned int texture_id, unsig pthread_mutex_unlock(&self->mutex); return true; } + +bool gsr_pipewire_recording_stopped(gsr_pipewire *self) { + return self->stopped; +} |