examples: pause timer in PAUSED

This commit is contained in:
Wim Taymans 2020-01-03 09:33:20 +01:00
parent df519ee3b3
commit 73cc2e054c
4 changed files with 8 additions and 12 deletions

View file

@ -47,7 +47,6 @@ struct data {
SDL_Texture *texture;
struct pw_main_loop *loop;
struct spa_source *timer;
struct pw_context *context;
struct pw_core *core;

View file

@ -234,7 +234,6 @@ static const struct pw_filter_events filter_events = {
int main(int argc, char *argv[])
{
struct data data = { 0, };
const struct spa_pod *params[1];
pw_init(&argc, &argv);
@ -276,10 +275,8 @@ int main(int argc, char *argv[])
return -1;
}
/* build the extra parameters to connect with. To connect, we can provide
* a list of supported formats. We use a builder that writes the param
* object to the stack. */
/* Make a new DSP port. This will automatically set up the right
* parameters for the port */
data.in_port = pw_filter_add_port(data.filter,
PW_DIRECTION_INPUT,
PW_FILTER_PORT_FLAG_MAP_BUFFERS,
@ -288,7 +285,7 @@ int main(int argc, char *argv[])
PW_KEY_FORMAT_DSP, "32 bit float RGBA video",
PW_KEY_PORT_NAME, "input",
NULL),
params, 1);
NULL, 0);
pw_filter_connect(data.filter,
0,

View file

@ -190,6 +190,8 @@ static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum
switch (state) {
case PW_STREAM_STATE_PAUSED:
printf("node id: %d\n", pw_stream_get_node_id(data->stream));
pw_loop_update_timer(pw_main_loop_get_loop(data->loop),
data->timer, NULL, NULL, false);
break;
case PW_STREAM_STATE_STREAMING:
{
@ -205,8 +207,6 @@ static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum
break;
}
default:
pw_loop_update_timer(pw_main_loop_get_loop(data->loop),
data->timer, NULL, NULL, false);
break;
}
}

View file

@ -192,6 +192,8 @@ static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum
case PW_STREAM_STATE_PAUSED:
printf("node id: %d\n", pw_stream_get_node_id(data->stream));
pw_loop_update_timer(pw_main_loop_get_loop(data->loop),
data->timer, NULL, NULL, false);
break;
case PW_STREAM_STATE_STREAMING:
{
@ -207,8 +209,6 @@ static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum
break;
}
default:
pw_loop_update_timer(pw_main_loop_get_loop(data->loop),
data->timer, NULL, NULL, false);
break;
}
}