Wrap SDL thread functions into scrcpy-specific API
The goal is to expose a consistent API for system tools, and paves the way to make the "core" independant of SDL in the future.
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <SDL2/SDL_mutex.h>
|
||||
|
||||
#include "fps_counter.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
// forward declarations
|
||||
typedef struct AVFrame AVFrame;
|
||||
@@ -14,10 +14,10 @@ typedef struct AVFrame AVFrame;
|
||||
struct video_buffer {
|
||||
AVFrame *decoding_frame;
|
||||
AVFrame *rendering_frame;
|
||||
SDL_mutex *mutex;
|
||||
sc_mutex mutex;
|
||||
bool render_expired_frames;
|
||||
bool interrupted;
|
||||
SDL_cond *rendering_frame_consumed_cond;
|
||||
sc_cond rendering_frame_consumed_cond;
|
||||
bool rendering_frame_consumed;
|
||||
struct fps_counter *fps_counter;
|
||||
};
|
||||
@@ -30,16 +30,16 @@ void
|
||||
video_buffer_destroy(struct video_buffer *vb);
|
||||
|
||||
// set the decoded frame as ready for rendering
|
||||
// this function locks frames->mutex during its execution
|
||||
// this function locks vb->mutex during its execution
|
||||
// the output flag is set to report whether the previous frame has been skipped
|
||||
void
|
||||
video_buffer_offer_decoded_frame(struct video_buffer *vb,
|
||||
bool *previous_frame_skipped);
|
||||
|
||||
// mark the rendering frame as consumed and return it
|
||||
// MUST be called with frames->mutex locked!!!
|
||||
// MUST be called with vb->mutex locked!!!
|
||||
// the caller is expected to render the returned frame to some texture before
|
||||
// unlocking frames->mutex
|
||||
// unlocking vb->mutex
|
||||
const AVFrame *
|
||||
video_buffer_consume_rendered_frame(struct video_buffer *vb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user