libobs: Add source output flag OBS_SOURCE_DO_NOT_DUPLICATE
Certain types of sources (display captures, game captures, audio device captures, video device captures) should not be duplicated. This capability flag hints that the source prefers references over full duplication.
This commit is contained in:
parent
56dc605497
commit
cd97ce2a17
@ -115,6 +115,15 @@ enum obs_source_type {
|
||||
*/
|
||||
#define OBS_SOURCE_COMPOSITE (1<<6)
|
||||
|
||||
/**
|
||||
* Source should not be fully duplicated
|
||||
*
|
||||
* When this is used, specifies that the source should not be fully duplicated,
|
||||
* and should prefer to duplicate via holding references rather than full
|
||||
* duplication.
|
||||
*/
|
||||
#define OBS_SOURCE_DO_NOT_DUPLICATE (1<<7)
|
||||
|
||||
/** @} */
|
||||
|
||||
typedef void (*obs_source_enum_proc_t)(obs_source_t *parent,
|
||||
|
@ -166,7 +166,8 @@ bool obs_module_load(void)
|
||||
struct obs_source_info info = {};
|
||||
info.id = "decklink-input";
|
||||
info.type = OBS_SOURCE_TYPE_INPUT;
|
||||
info.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO;
|
||||
info.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE;
|
||||
info.create = decklink_create;
|
||||
info.destroy = decklink_destroy;
|
||||
info.get_defaults = decklink_get_defaults;
|
||||
|
@ -475,7 +475,8 @@ struct obs_source_info xshm_input = {
|
||||
.id = "xshm_input",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO |
|
||||
OBS_SOURCE_CUSTOM_DRAW,
|
||||
OBS_SOURCE_CUSTOM_DRAW |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = xshm_getname,
|
||||
.create = xshm_create,
|
||||
.destroy = xshm_destroy,
|
||||
|
@ -517,7 +517,8 @@ static void *pulse_create(obs_data_t *settings, obs_source_t *source)
|
||||
struct obs_source_info pulse_input_capture = {
|
||||
.id = "pulse_input_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_AUDIO,
|
||||
.output_flags = OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = pulse_input_getname,
|
||||
.create = pulse_create,
|
||||
.destroy = pulse_destroy,
|
||||
@ -529,7 +530,8 @@ struct obs_source_info pulse_input_capture = {
|
||||
struct obs_source_info pulse_output_capture = {
|
||||
.id = "pulse_output_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_AUDIO,
|
||||
.output_flags = OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = pulse_output_getname,
|
||||
.create = pulse_create,
|
||||
.destroy = pulse_destroy,
|
||||
|
@ -979,7 +979,8 @@ static void *v4l2_create(obs_data_t *settings, obs_source_t *source)
|
||||
struct obs_source_info v4l2_input = {
|
||||
.id = "v4l2_input",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_ASYNC_VIDEO,
|
||||
.output_flags = OBS_SOURCE_ASYNC_VIDEO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = v4l2_getname,
|
||||
.create = v4l2_create,
|
||||
.destroy = v4l2_destroy,
|
||||
|
@ -2181,7 +2181,8 @@ bool obs_module_load(void)
|
||||
obs_source_info av_capture_info = {
|
||||
.id = "av_capture_input",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_ASYNC_VIDEO,
|
||||
.output_flags = OBS_SOURCE_ASYNC_VIDEO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = av_capture_getname,
|
||||
.create = av_capture_create,
|
||||
.destroy = av_capture_destroy,
|
||||
|
@ -783,7 +783,8 @@ static obs_properties_t *coreaudio_output_properties(void *unused)
|
||||
struct obs_source_info coreaudio_input_capture_info = {
|
||||
.id = "coreaudio_input_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_AUDIO,
|
||||
.output_flags = OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = coreaudio_input_getname,
|
||||
.create = coreaudio_create_input_capture,
|
||||
.destroy = coreaudio_destroy,
|
||||
@ -795,7 +796,8 @@ struct obs_source_info coreaudio_input_capture_info = {
|
||||
struct obs_source_info coreaudio_output_capture_info = {
|
||||
.id = "coreaudio_output_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_AUDIO,
|
||||
.output_flags = OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = coreaudio_output_getname,
|
||||
.create = coreaudio_create_output_capture,
|
||||
.destroy = coreaudio_destroy,
|
||||
|
@ -657,7 +657,8 @@ struct obs_source_info display_capture_info = {
|
||||
.create = display_capture_create,
|
||||
.destroy = display_capture_destroy,
|
||||
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.video_tick = display_capture_video_tick,
|
||||
.video_render = display_capture_video_render,
|
||||
|
||||
|
@ -1275,7 +1275,8 @@ static void syphon_update(void *data, obs_data_t *settings)
|
||||
struct obs_source_info syphon_info = {
|
||||
.id = "syphon-input",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = syphon_get_name,
|
||||
.create = syphon_create,
|
||||
.destroy = syphon_destroy,
|
||||
|
@ -639,7 +639,8 @@ static void ffmpeg_source_deactivate(void *data)
|
||||
struct obs_source_info ffmpeg_source = {
|
||||
.id = "ffmpeg_source",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO,
|
||||
.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = ffmpeg_source_getname,
|
||||
.create = ffmpeg_source_create,
|
||||
.destroy = ffmpeg_source_destroy,
|
||||
|
@ -283,7 +283,8 @@ static obs_properties_t *duplicator_capture_properties(void *unused)
|
||||
struct obs_source_info duplicator_capture_info = {
|
||||
.id = "monitor_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = duplicator_capture_getname,
|
||||
.create = duplicator_capture_create,
|
||||
.destroy = duplicator_capture_destroy,
|
||||
|
@ -1589,7 +1589,8 @@ static obs_properties_t *game_capture_properties(void *data)
|
||||
struct obs_source_info game_capture_info = {
|
||||
.id = "game_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = game_capture_name,
|
||||
.create = game_capture_create,
|
||||
.destroy = game_capture_destroy,
|
||||
|
@ -232,7 +232,8 @@ static obs_properties_t *monitor_capture_properties(void *unused)
|
||||
struct obs_source_info monitor_capture_info = {
|
||||
.id = "monitor_capture",
|
||||
.type = OBS_SOURCE_TYPE_INPUT,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,
|
||||
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE,
|
||||
.get_name = monitor_capture_getname,
|
||||
.create = monitor_capture_create,
|
||||
.destroy = monitor_capture_destroy,
|
||||
|
@ -1820,7 +1820,8 @@ void RegisterDShowSource()
|
||||
info.type = OBS_SOURCE_TYPE_INPUT;
|
||||
info.output_flags = OBS_SOURCE_VIDEO |
|
||||
OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_ASYNC;
|
||||
OBS_SOURCE_ASYNC |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE;
|
||||
info.get_name = GetDShowInputName;
|
||||
info.create = CreateDShowInput;
|
||||
info.destroy = DestroyDShowInput;
|
||||
|
@ -572,7 +572,8 @@ void RegisterWASAPIInput()
|
||||
obs_source_info info = {};
|
||||
info.id = "wasapi_input_capture";
|
||||
info.type = OBS_SOURCE_TYPE_INPUT;
|
||||
info.output_flags = OBS_SOURCE_AUDIO;
|
||||
info.output_flags = OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE;
|
||||
info.get_name = GetWASAPIInputName;
|
||||
info.create = CreateWASAPIInput;
|
||||
info.destroy = DestroyWASAPISource;
|
||||
@ -587,7 +588,8 @@ void RegisterWASAPIOutput()
|
||||
obs_source_info info = {};
|
||||
info.id = "wasapi_output_capture";
|
||||
info.type = OBS_SOURCE_TYPE_INPUT;
|
||||
info.output_flags = OBS_SOURCE_AUDIO;
|
||||
info.output_flags = OBS_SOURCE_AUDIO |
|
||||
OBS_SOURCE_DO_NOT_DUPLICATE;
|
||||
info.get_name = GetWASAPIOutputName;
|
||||
info.create = CreateWASAPIOutput;
|
||||
info.destroy = DestroyWASAPISource;
|
||||
|
Loading…
x
Reference in New Issue
Block a user