Skip to content

Commit

Permalink
Merge pull request #618 from stream-labs/vcam-custom-sources
Browse files Browse the repository at this point in the history
Changed a little API for video mixes to be compatible with new virtua…
  • Loading branch information
summeroff authored Dec 11, 2024
2 parents 7cddd55 + f61654a commit 23015d6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
15 changes: 2 additions & 13 deletions libobs/obs-output.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,30 +888,19 @@ proc_handler_t *obs_output_get_proc_handler(const obs_output_t *output)
: NULL;
}

void obs_output_set_media(obs_output_t *output, obs_core_video_mix_t *mix,
audio_t *audio)
void obs_output_set_media(obs_output_t *output, video_t *video, audio_t *audio)
{
if (!obs_output_valid(output, "obs_output_set_media"))
return;
if (log_flag_encoded(output, __FUNCTION__, true))
return;

if (flag_video(output))
output->video = mix->video;
output->video = video;
if (flag_audio(output))
output->audio = audio;
}

void obs_output_set_video_mix(obs_output_t *output, obs_core_video_mix_t *mix,
audio_t *audio)
{
if (!obs_output_valid(output, "obs_output_set_media"))
return;

output->video = mix->video;
output->audio = audio;
}

video_t *obs_output_video(const obs_output_t *output)
{
if (!obs_output_valid(output, "obs_output_video"))
Expand Down
4 changes: 2 additions & 2 deletions libobs/obs-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ static inline void set_main_mix()
obs->video.main_mix = mix;
}

video_t *obs_view_add(obs_view_t *view, struct obs_video_info *ovi)
video_t *obs_view_add(obs_view_t *view)
{
return obs_view_add2(view, ovi);
return obs_view_add2(view, obs->video.main_mix->ovi);
}

video_t *obs_view_add2(obs_view_t *view, struct obs_video_info *ovi)
Expand Down
11 changes: 10 additions & 1 deletion libobs/obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static int obs_init_video()
if (!ovi->initialized)
continue;

if (!obs_view_add(&obs->data.main_view, ovi))
if (!obs_view_add2(&obs->data.main_view, ovi))
return OBS_VIDEO_FAIL;

if (!obs_stream_view_add(&obs->data.stream_view, ovi))
Expand Down Expand Up @@ -2727,6 +2727,15 @@ obs_core_video_mix_t *obs_video_mix_get(struct obs_video_info *ovi,
return NULL;
}

video_t *obs_video_mix_get_video(struct obs_core_video_mix *mix)
{
if (mix) {
return mix->video;
}

return NULL;
}

void obs_set_audio_rendering_mode(enum obs_audio_rendering_mode mode)
{
if (!obs)
Expand Down
8 changes: 5 additions & 3 deletions libobs/obs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ EXPORT obs_source_t *obs_view_get_source(obs_view_t *view, uint32_t channel);
EXPORT void obs_view_render(obs_view_t *view);

/** Adds a view to the main render loop */
EXPORT video_t *obs_view_add(obs_view_t *view, struct obs_video_info *ovi);
EXPORT video_t *obs_view_add(obs_view_t *view);

/** Adds a view to the main render loop */
EXPORT video_t *obs_stream_view_add(obs_view_t *view,
Expand Down Expand Up @@ -2308,8 +2308,8 @@ EXPORT proc_handler_t *obs_output_get_proc_handler(const obs_output_t *output);
* Sets the current audio/video media contexts associated with this output,
* required for non-encoded outputs. Can be null.
*/
EXPORT void obs_output_set_media(obs_output_t *output,
obs_core_video_mix_t *mix, audio_t *audio);
EXPORT void obs_output_set_media(obs_output_t *output, video_t *video,
audio_t *audio);

/** Returns the video media context associated with this output */
EXPORT video_t *obs_output_video(const obs_output_t *output);
Expand Down Expand Up @@ -2593,6 +2593,8 @@ EXPORT const char *obs_encoder_get_name(const obs_encoder_t *encoder);
EXPORT void obs_encoder_set_video_mix(obs_encoder_t *encoder,
struct obs_core_video_mix *video);

EXPORT video_t *obs_video_mix_get_video(struct obs_core_video_mix *mix);

EXPORT obs_core_video_mix_t *
obs_video_mix_get(struct obs_video_info *ovi,
enum obs_video_rendering_mode mode);
Expand Down

0 comments on commit 23015d6

Please sign in to comment.