Use a callback to notify a new frame

Make the decoder independant of the SDL even mechanism, by making the
consumer register a callback on the video_buffer.
This commit is contained in:
Romain Vimont
2021-02-19 22:02:36 +01:00
parent c50b958ee4
commit fb9f9848bd
4 changed files with 59 additions and 7 deletions

View File

@@ -19,13 +19,7 @@ push_frame(struct decoder *decoder) {
&previous_frame_skipped);
if (previous_frame_skipped) {
fps_counter_add_skipped_frame(decoder->fps_counter);
// the previous EVENT_NEW_FRAME will consume this frame
return;
}
static SDL_Event new_frame_event = {
.type = EVENT_NEW_FRAME,
};
SDL_PushEvent(&new_frame_event);
}
void