aboutsummaryrefslogtreecommitdiff
path: root/src/capture/capture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/capture/capture.c')
-rw-r--r--src/capture/capture.c70
1 files changed, 32 insertions, 38 deletions
diff --git a/src/capture/capture.c b/src/capture/capture.c
index eea0d1d..bc95300 100644
--- a/src/capture/capture.c
+++ b/src/capture/capture.c
@@ -1,59 +1,53 @@
#include "../../include/capture/capture.h"
-#include <stdio.h>
+#include <assert.h>
-int gsr_capture_start(gsr_capture *cap, AVCodecContext *video_codec_context) {
- if(cap->started)
- return -1;
-
- int res = cap->start(cap, video_codec_context);
+int gsr_capture_start(gsr_capture *cap, gsr_capture_metadata *capture_metadata) {
+ assert(!cap->started);
+ int res = cap->start(cap, capture_metadata);
if(res == 0)
cap->started = true;
return res;
}
-void gsr_capture_tick(gsr_capture *cap, AVCodecContext *video_codec_context, AVFrame **frame) {
- if(!cap->started) {
- fprintf(stderr, "gsr error: gsp_capture_tick failed: the gsr capture has not been started\n");
- return;
- }
-
+void gsr_capture_tick(gsr_capture *cap) {
+ assert(cap->started);
if(cap->tick)
- cap->tick(cap, video_codec_context, frame);
+ cap->tick(cap);
}
-bool gsr_capture_should_stop(gsr_capture *cap, bool *err) {
- if(!cap->started) {
- fprintf(stderr, "gsr error: gsr_capture_should_stop failed: the gsr capture has not been started\n");
- return false;
- }
+void gsr_capture_on_event(gsr_capture *cap, gsr_egl *egl) {
+ if(cap->on_event)
+ cap->on_event(cap, egl);
+}
- if(!cap->should_stop)
+bool gsr_capture_should_stop(gsr_capture *cap, bool *err) {
+ assert(cap->started);
+ if(cap->should_stop)
+ return cap->should_stop(cap, err);
+ else
return false;
-
- return cap->should_stop(cap, err);
}
-int gsr_capture_capture(gsr_capture *cap, AVFrame *frame) {
- if(!cap->started) {
- fprintf(stderr, "gsr error: gsr_capture_capture failed: the gsr capture has not been started\n");
- return -1;
- }
- return cap->capture(cap, frame);
+int gsr_capture_capture(gsr_capture *cap, gsr_capture_metadata *capture_metadata, gsr_color_conversion *color_conversion) {
+ assert(cap->started);
+ return cap->capture(cap, capture_metadata, color_conversion);
}
-void gsr_capture_end(gsr_capture *cap, AVFrame *frame) {
- if(!cap->started) {
- fprintf(stderr, "gsr error: gsr_capture_end failed: the gsr capture has not been started\n");
- return;
- }
-
- if(!cap->capture_end)
- return;
+bool gsr_capture_uses_external_image(gsr_capture *cap) {
+ if(cap->uses_external_image)
+ return cap->uses_external_image(cap);
+ else
+ return false;
+}
- cap->capture_end(cap, frame);
+bool gsr_capture_set_hdr_metadata(gsr_capture *cap, AVMasteringDisplayMetadata *mastering_display_metadata, AVContentLightMetadata *light_metadata) {
+ if(cap->set_hdr_metadata)
+ return cap->set_hdr_metadata(cap, mastering_display_metadata, light_metadata);
+ else
+ return false;
}
-void gsr_capture_destroy(gsr_capture *cap, AVCodecContext *video_codec_context) {
- cap->destroy(cap, video_codec_context);
+void gsr_capture_destroy(gsr_capture *cap) {
+ cap->destroy(cap);
}