Move frame swapping logic to frame.c

Expose frames_offer_decoded_frame() and frames_consume_rendered_frame()
so that callers are not exposed to frame swapping (between the decoding
and rendering frames) details.
This commit is contained in:
Romain Vimont
2018-02-08 19:23:24 +01:00
parent 0d7f050389
commit 629c296207
4 changed files with 58 additions and 27 deletions

View File

@@ -22,6 +22,15 @@ struct frames {
SDL_bool frames_init(struct frames *frames);
void frames_destroy(struct frames *frames);
void frames_swap(struct frames *frames);
// set the decoder frame as ready for rendering
// this function locks frames->mutex during its execution
// returns true if the previous frame had been consumed
SDL_bool frames_offer_decoded_frame(struct frames *frames);
// mark the rendering frame as consumed and return it
// MUST be called with frames->mutex locked!!!
// the caller is expected to render the returned frame to some texture before
// unlocking frames->mutex
const AVFrame *frames_consume_rendered_frame(struct frames *frames);
#endif