libobs: Add deinterlacing API functions

Adds deinterlacing API functions.  Both standard and 2x variants are
supported.  Deinterlacing is set via obs_source_set_deinterlace_mode and
obs_source_set_deinterlace_field_order.

This was implemented in to the core itself because deinterlacing should
happen before effect filters are processed, but after async filters are
processed.  If this were added as a filter, there is the possibility
that a different filter is processed before deinterlacing, which could
mess with the result.  It was also a bit easier to implement this way
due to the fact that that deinterlacing may need to have access to the
previous async frame.

Effects were split in to separate files to reduce load time (especially
for yadif shaders which take a significant amount of time to compile).
This commit is contained in:
jp9000
2016-03-15 20:39:36 -07:00
parent 11d9a8f3e4
commit 07c644c581
15 changed files with 1025 additions and 5 deletions

View File

@@ -1412,6 +1412,8 @@ static obs_source_t *obs_load_source_type(obs_data_t *source_data)
int64_t sync;
uint32_t flags;
uint32_t mixers;
int di_order;
int di_mode;
source = obs_source_create(id, name, settings, hotkeys);
@@ -1455,6 +1457,14 @@ static obs_source_t *obs_load_source_type(obs_data_t *source_data)
obs_source_set_push_to_talk_delay(source,
obs_data_get_int(source_data, "push-to-talk-delay"));
di_mode = (int)obs_data_get_int(source_data, "deinterlace_mode");
obs_source_set_deinterlace_mode(source,
(enum obs_deinterlace_mode)di_mode);
di_order = (int)obs_data_get_int(source_data, "deinterlace_field_order");
obs_source_set_deinterlace_field_order(source,
(enum obs_deinterlace_field_order)di_order);
if (filters) {
size_t count = obs_data_array_count(filters);
@@ -1551,6 +1561,9 @@ obs_data_t *obs_save_source(obs_source_t *source)
uint64_t ptm_delay = obs_source_get_push_to_mute_delay(source);
bool push_to_talk= obs_source_push_to_talk_enabled(source);
uint64_t ptt_delay = obs_source_get_push_to_talk_delay(source);
int di_mode = (int)obs_source_get_deinterlace_mode(source);
int di_order =
(int)obs_source_get_deinterlace_field_order(source);
obs_source_save(source);
hotkeys = obs_hotkeys_save_source(source);
@@ -1575,6 +1588,8 @@ obs_data_t *obs_save_source(obs_source_t *source)
obs_data_set_bool (source_data, "push-to-talk", push_to_talk);
obs_data_set_int (source_data, "push-to-talk-delay", ptt_delay);
obs_data_set_obj (source_data, "hotkeys", hotkey_data);
obs_data_set_int (source_data, "deinterlace_mode", di_mode);
obs_data_set_int (source_data, "deinterlace_field_order", di_order);
if (source->info.type == OBS_SOURCE_TYPE_TRANSITION)
obs_transition_save(source, source_data);