Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/streamlabs' into fix_build_upmerged
Browse files Browse the repository at this point in the history
  • Loading branch information
summeroff committed Jan 7, 2025
2 parents 8f4935a + 23015d6 commit cdc615f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 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
2 changes: 1 addition & 1 deletion libobs/obs-source-transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ bool obs_transition_audio_render_do(obs_source_t *transition, uint64_t *ts_out,
if (!transition_valid(transition, "obs_transition_audio_render"))
return false;

blog(LOG_INFO, "[AUDIO_CANVAS] obs_transition_audio_render_do started");
//blog(LOG_INFO, "[AUDIO_CANVAS] obs_transition_audio_render_do started");
lock_transition(transition);

sources[0] = transition->transition_sources[0];
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
1 change: 1 addition & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,6 @@ add_subdirectory(obs-filters)
add_subdirectory(obs-transitions)
add_subdirectory(rtmp-services)
add_subdirectory(text-freetype2)
add_subdirectory(obs-ndi)
#add_subdirectory(aja)
add_subdirectory(obs-webrtc)
9 changes: 5 additions & 4 deletions plugins/obs-qsv11/QSV_Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,17 @@ void qsv_encoder_version(unsigned short *major, unsigned short *minor)
}

qsv_t *qsv_encoder_open(qsv_param_t *pParams, enum qsv_codec codec,
bool useTexAlloc)
bool useTexAlloc, obs_encoder_t *encoder)
{
QSV_Encoder_Internal *pEncoder =
new QSV_Encoder_Internal(ver, useTexAlloc);
mfxStatus sts = pEncoder->Open(pParams, codec);
if (sts != MFX_ERR_NONE) {

#define WARN_ERR_IMPL(err, str, err_name) \
case err: \
do_log(LOG_WARNING, str " (" err_name ")"); \
#define WARN_ERR_IMPL(err, str, err_name) \
case err: \
obs_encoder_set_last_error(encoder, str " (" err_name ")"); \
do_log(LOG_WARNING, str " (" err_name ")"); \
break;
#define WARN_ERR(err, str) WARN_ERR_IMPL(err, str, #err)

Expand Down
4 changes: 3 additions & 1 deletion plugins/obs-qsv11/QSV_Encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <obs.h>
#include "common_utils.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -157,7 +158,8 @@ int qsv_param_default_preset(qsv_param_t *, const char *preset,
const char *tune);
int qsv_encoder_reconfig(qsv_t *, qsv_param_t *);
void qsv_encoder_version(unsigned short *major, unsigned short *minor);
qsv_t *qsv_encoder_open(qsv_param_t *, enum qsv_codec codec, bool useTexAlloc);
qsv_t *qsv_encoder_open(qsv_param_t *, enum qsv_codec codec, bool useTexAlloc,
obs_encoder_t *encoder);
void qsv_encoder_add_roi(qsv_t *, const struct obs_encoder_roi *roi);
void qsv_encoder_clear_roi(qsv_t *pContext);
int qsv_encoder_encode(qsv_t *, uint64_t, uint8_t *, uint8_t *, uint32_t,
Expand Down
4 changes: 2 additions & 2 deletions plugins/obs-qsv11/obs-qsv11.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,8 @@ static void *obs_qsv_create(enum qsv_codec codec, obs_data_t *settings,

if (update_settings(obsqsv, settings)) {
pthread_mutex_lock(&g_QsvLock);
obsqsv->context =
qsv_encoder_open(&obsqsv->params, codec, useTexAlloc);
obsqsv->context = qsv_encoder_open(&obsqsv->params, codec,
useTexAlloc, encoder);
pthread_mutex_unlock(&g_QsvLock);

if (obsqsv->context == NULL)
Expand Down

0 comments on commit cdc615f

Please sign in to comment.