diff --git a/src/examples/video-play.c b/src/examples/video-play.c index bc63b112d..b195186d1 100644 --- a/src/examples/video-play.c +++ b/src/examples/video-play.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -397,6 +397,12 @@ static int build_format(struct data *data, struct spa_pod_builder *b, const stru return 2; } +static void do_quit(void *userdata, int signal_number) +{ + struct data *data = userdata; + pw_main_loop_quit(data->loop); +} + int main(int argc, char *argv[]) { struct data data = { 0, }; @@ -410,6 +416,9 @@ int main(int argc, char *argv[]) /* create a main loop */ data.loop = pw_main_loop_new(NULL); + pw_loop_add_signal(pw_main_loop_get_loop(data.loop), SIGINT, do_quit, &data); + pw_loop_add_signal(pw_main_loop_get_loop(data.loop), SIGTERM, do_quit, &data); + /* create a simple stream, the simple stream manages to core and remote * objects for you if you don't need to deal with them *