libobs: Add encode_texture2 function to struct obs_encoder_info

And use it if non-NULL instead of encode_texture.
This commit is contained in:
Torge Matthies
2024-01-26 20:01:58 -05:00
committed by Ryan Foster
parent 3fb529c0ee
commit f81ed52ec7
3 changed files with 61 additions and 16 deletions
+18 -5
View File
@@ -69,7 +69,7 @@ static void *gpu_encode_thread(struct obs_core_video_mix *video)
for (size_t i = 0; i < encoders.num; i++) {
struct encoder_packet pkt = {0};
bool received = false;
bool success;
bool success = false;
uint32_t skip = 0;
obs_encoder_t *encoder = encoders.array[i];
@@ -125,10 +125,23 @@ static void *gpu_encode_thread(struct obs_core_video_mix *video)
else
next_key++;
success = encoder->info.encode_texture(
encoder->context.data, tf.handle,
encoder->cur_pts, lock_key, &next_key, &pkt,
&received);
if (encoder->info.encode_texture2) {
struct encoder_texture tex = {0};
tex.handle = tf.handle;
tex.tex[0] = tf.tex;
tex.tex[1] = tf.tex_uv;
tex.tex[2] = NULL;
success = encoder->info.encode_texture2(
encoder->context.data, &tex,
encoder->cur_pts, lock_key, &next_key,
&pkt, &received);
} else {
success = encoder->info.encode_texture(
encoder->context.data, tf.handle,
encoder->cur_pts, lock_key, &next_key,
&pkt, &received);
}
send_off_encoder_packet(encoder, success, received,
&pkt);