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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user