examples: update video-src examples

So that hey use pw_stream_drive() to start the graph.
This commit is contained in:
Wim Taymans 2021-08-06 13:55:43 +02:00
parent 9831f62927
commit 23d3b10be4
3 changed files with 31 additions and 9 deletions

View file

@ -82,8 +82,8 @@ static void draw_elipse(uint32_t *dst, int width, int height, uint32_t color)
}
}
/* called on timeout and we should push a new buffer in the queue */
static void on_timeout(void *userdata, uint64_t expirations)
/* called when we should push a new buffer in the queue */
static void on_process(void *userdata)
{
struct data *data = userdata;
struct pw_buffer *b;
@ -180,6 +180,14 @@ static void on_timeout(void *userdata, uint64_t expirations)
pw_stream_queue_buffer(data->stream, b);
}
/* called on timeout and we should start the graph */
static void on_timeout(void *userdata, uint64_t expirations)
{
struct data *data = userdata;
pw_log_trace("timeout");
pw_stream_drive(data->stream);
}
/* when the stream is STREAMING, start the timer at 40ms intervals
* to produce and push a frame. In other states we PAUSE the timer. */
static void on_stream_state_changed(void *_data, enum pw_stream_state old, enum pw_stream_state state,
@ -358,6 +366,7 @@ on_stream_param_changed(void *_data, uint32_t id, const struct spa_pod *param)
static const struct pw_stream_events stream_events = {
PW_VERSION_STREAM_EVENTS,
.process = on_process,
.state_changed = on_stream_state_changed,
.param_changed = on_stream_param_changed,
.add_buffer = on_stream_add_buffer,