aboutsummaryrefslogtreecommitdiff
path: root/src/encoder/video/video.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-05 01:59:04 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-05 10:33:47 +0200
commitb9fa7f2fa25ee37c87077bce468c95e48fce5c18 (patch)
tree3aff293110d8405e8057edb9c757f6e630c22de2 /src/encoder/video/video.c
parent62d61fda12e3774fee6b671e44fb89bd2ef8da8c (diff)
Separate video encoding method from capture method
With this instead of kms_cuda/kms_vaapi/kms_software and xcomposite_cuda/xcomposite_vaapi/xcomposite_software there is now only kms and xcomposite.
Diffstat (limited to 'src/encoder/video/video.c')
-rw-r--r--src/encoder/video/video.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/encoder/video/video.c b/src/encoder/video/video.c
new file mode 100644
index 0000000..9b0def0
--- /dev/null
+++ b/src/encoder/video/video.c
@@ -0,0 +1,26 @@
+#include "../../../include/encoder/video/video.h"
+#include <assert.h>
+
+bool gsr_video_encoder_start(gsr_video_encoder *encoder, AVCodecContext *video_codec_context, AVFrame *frame) {
+ assert(!encoder->started);
+ bool res = encoder->start(encoder, video_codec_context, frame);
+ if(res)
+ encoder->started = true;
+ return res;
+}
+
+void gsr_video_encoder_copy_textures_to_frame(gsr_video_encoder *encoder, AVFrame *frame) {
+ assert(encoder->started);
+ if(encoder->copy_textures_to_frame)
+ encoder->copy_textures_to_frame(encoder, frame);
+}
+
+void gsr_video_encoder_get_textures(gsr_video_encoder *encoder, unsigned int *textures, int *num_textures, gsr_destination_color *destination_color) {
+ assert(encoder->started);
+ encoder->get_textures(encoder, textures, num_textures, destination_color);
+}
+
+void gsr_video_encoder_destroy(gsr_video_encoder *encoder, AVCodecContext *video_codec_context) {
+ assert(encoder->started);
+ encoder->destroy(encoder, video_codec_context);
+}