Skip to content

Commit 145567f

Browse files
committed
Add gpu scale type
1 parent 4965960 commit 145567f

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,6 @@ jobs:
7676
print "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
7777
print "commitHash=${"$(git rev-parse HEAD)"[0,9]}" >> $GITHUB_OUTPUT
7878
79-
- name: Restore Compilation Cache
80-
id: ccache-cache
81-
uses: actions/cache@v4.0.0
82-
with:
83-
path: ${{ github.workspace }}/.ccache
84-
key: macos-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
85-
restore-keys: |
86-
macos-${{ matrix.arch }}-ccache-plugin-
87-
8879
- name: Check for GitHub Labels
8980
id: seekingTesters
9081
if: ${{ github.event_name == 'pull_request' }}

source-record.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ static const char *get_encoder_id(obs_data_t *settings)
402402
return enc_id;
403403
}
404404

405+
static void (*obs_encoder_set_gpu_scale_type_func)(obs_encoder_t *encoder, enum obs_scale_type gpu_scale_type) = NULL;
406+
405407
static bool (*obs_encoder_set_frame_rate_divisor_func)(obs_encoder_t *, uint32_t) = NULL;
406408

407409
static void update_video_encoder(struct source_record_filter_context *filter, obs_data_t *settings)
@@ -426,7 +428,9 @@ static void update_video_encoder(struct source_record_filter_context *filter, ob
426428
} else {
427429
obs_encoder_set_scaled_size(filter->encoder, 0, 0);
428430
}
429-
//obs_encoder_set_gpu_scale_type(filter->encoder, (enum obs_scale_type)obs_data_get_int(settings, "scale_type"));
431+
if (obs_encoder_set_gpu_scale_type_func)
432+
obs_encoder_set_gpu_scale_type_func(filter->encoder,
433+
(enum obs_scale_type)obs_data_get_int(settings, "scale_type"));
430434
} else {
431435
obs_encoder_set_scaled_size(filter->encoder, 0, 0);
432436
}
@@ -682,7 +686,9 @@ static void update_encoder(struct source_record_filter_context *filter, obs_data
682686
} else {
683687
obs_encoder_set_scaled_size(filter->encoder, 0, 0);
684688
}
685-
//obs_encoder_set_gpu_scale_type(filter->encoder, (enum obs_scale_type)obs_data_get_int(settings, "scale_type"));
689+
if (obs_encoder_set_gpu_scale_type_func)
690+
obs_encoder_set_gpu_scale_type_func(filter->encoder,
691+
(enum obs_scale_type)obs_data_get_int(settings, "scale_type"));
686692
} else {
687693
obs_encoder_set_scaled_size(filter->encoder, 0, 0);
688694
}
@@ -1583,6 +1589,19 @@ static obs_properties_t *source_record_filter_properties(void *data)
15831589
obs_property_list_add_string(p, "1920x1080", "1920x1080");
15841590
obs_property_list_add_string(p, "2560x1440", "2560x1440");
15851591

1592+
if (obs_encoder_set_gpu_scale_type_func) {
1593+
p = obs_properties_add_list(scale, "scale_type", obs_module_text("ScaleType"), OBS_COMBO_TYPE_LIST,
1594+
OBS_COMBO_FORMAT_INT);
1595+
obs_property_list_add_int(p, obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Bilinear"),
1596+
OBS_SCALE_BILINEAR);
1597+
obs_property_list_add_int(p, obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Area"),
1598+
OBS_SCALE_AREA);
1599+
obs_property_list_add_int(p, obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Bicubic"),
1600+
OBS_SCALE_BICUBIC);
1601+
obs_property_list_add_int(p, obs_frontend_get_locale_string("Basic.Settings.Video.DownscaleFilter.Lanczos"),
1602+
OBS_SCALE_LANCZOS);
1603+
}
1604+
15861605
obs_properties_add_group(props, "scale", obs_module_text("Scale"), OBS_GROUP_CHECKABLE, scale);
15871606

15881607
if (obs_encoder_set_frame_rate_divisor_func) {
@@ -2439,6 +2458,8 @@ void obs_module_post_load(void)
24392458
if (handle) {
24402459
obs_encoder_set_frame_rate_divisor_func =
24412460
(bool (*)(obs_encoder_t *, uint32_t))os_dlsym(handle, "obs_encoder_set_frame_rate_divisor");
2461+
obs_encoder_set_gpu_scale_type_func =
2462+
(void (*)(obs_encoder_t *, enum obs_scale_type))os_dlsym(handle, "obs_encoder_set_gpu_scale_type");
24422463
os_dlclose(handle);
24432464
}
24442465
}

0 commit comments

Comments
 (0)