Skip to content

Commit

Permalink
update replay filter instead of replacing it
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Jun 13, 2018
1 parent 6c8a1e3 commit cc0f8e5
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions replay-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,22 @@ static void replay_source_update(void *data, obs_data_t *settings)
const char *source_name = obs_data_get_string(settings, "source");

if (context->source_name){
obs_source_t *s = obs_get_source_by_name(context->source_name);
if(s){
context->source_filter = NULL;
obs_source_enum_filters(s, EnumFilter, data);
if(context->source_filter)
{
obs_source_filter_remove(s,context->source_filter);
if(strcmp(context->source_name, source_name) != 0){
obs_source_t *s = obs_get_source_by_name(context->source_name);
if(s){
do{
context->source_filter = NULL;
obs_source_enum_filters(s, EnumFilter, data);
if(context->source_filter)
{
obs_source_filter_remove(s,context->source_filter);
}
}while(context->source_filter);
obs_source_release(s);
}
obs_source_release(s);
bfree(context->source_name);
context->source_name = bstrdup(source_name);
}
bfree(context->source_name);
context->source_name = bstrdup(source_name);
}else{
context->source_name = bstrdup(source_name);
}
Expand All @@ -89,10 +93,17 @@ static void replay_source_update(void *data, obs_data_t *settings)
obs_source_t *s = obs_get_source_by_name(context->source_name);
if(!s)
return;

context->source_filter = obs_source_create_private(REPLAY_FILTER_ID,obs_source_get_name(context->source), settings);
if(context->source_filter){
obs_source_filter_add(s,context->source_filter);

context->source_filter = NULL;
obs_source_enum_filters(s, EnumFilter, data);
if(!context->source_filter)
{
context->source_filter = obs_source_create_private(REPLAY_FILTER_ID,obs_source_get_name(context->source), settings);
if(context->source_filter){
obs_source_filter_add(s,context->source_filter);
}
}else{
obs_source_update(context->source_filter,settings);
}

obs_source_release(s);
Expand Down

0 comments on commit cc0f8e5

Please sign in to comment.