Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions js/module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ export declare const VideoEncoderFactory: IVideoEncoderFactory;
export declare const ServiceFactory: IServiceFactory;
export declare const SimpleStreamingFactory: ISimpleStreamingFactory;
export declare const AdvancedStreamingFactory: IAdvancedStreamingFactory;
export declare const EnhancedBroadcastingAdvancedStreamingFactory: IEnhancedBroadcastingAdvancedStreamingFactory;
export declare const EnhancedBroadcastingSimpleStreamingFactory: IEnhancedBroadcastingSimpleStreamingFactory;
export declare const DelayFactory: IDelayFactory;
export declare const ReconnectFactory: IReconnectFactory;
export declare const NetworkFactory: INetworkFactory;
Expand Down Expand Up @@ -794,7 +796,8 @@ export interface IVideoEncoderFactory {
create(id: string, name: string, settings?: ISettings): IVideoEncoder;
}
export interface IStreaming {
videoEncoder: IVideoEncoder;
// Video encoder value is only ignored in the Enhanced Broadcasting mode, otherwise it should be set
videoEncoder?: IVideoEncoder;
service: IService;
enforceServiceBitrate: boolean;
enableTwitchVOD: boolean;
Expand All @@ -803,7 +806,7 @@ export interface IStreaming {
network: INetwork;
video: IVideo;
signalHandler: (signal: EOutputSignal) => void;
start(): void;
start(): void; // throws
stop(force?: boolean): void;
droppedFrames: number;
totalFrames: number;
Expand Down Expand Up @@ -838,6 +841,26 @@ export interface IAdvancedStreamingFactory {
destroy(stream: IAdvancedStreaming): void;
legacySettings: IAdvancedStreaming;
}
export interface IEnhancedBroadcastingAdvancedStreaming extends IAdvancedStreaming {
// If set, the Enhanced Broadcasting stream will be in the Dual Output mode.
// This value should be initialized before the stream start.
additionalVideo?: IVideo,
}
export interface IEnhancedBroadcastingAdvancedStreamingFactory {
create(): IEnhancedBroadcastingAdvancedStreaming;
destroy(stream: IEnhancedBroadcastingAdvancedStreaming): void;
legacySettings: IEnhancedBroadcastingAdvancedStreaming;
}
export interface IEnhancedBroadcastingSimpleStreaming extends ISimpleStreaming {
// If set, the Enhanced Broadcasting stream will be in the Dual Output mode.
// This value should be initialized before the stream start.
additionalVideo?: IVideo,
}
export interface IEnhancedBroadcastingSimpleStreamingFactory {
create(): IEnhancedBroadcastingSimpleStreaming;
destroy(stream: IEnhancedBroadcastingSimpleStreaming): void;
legacySettings: IEnhancedBroadcastingSimpleStreaming;
}
export interface IFileOutput {
path: string;
format: ERecordingFormat;
Expand Down
10 changes: 6 additions & 4 deletions js/module.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeObs = exports.getSourcesSize = exports.createSources = exports.addItems = exports.AdvancedReplayBufferFactory = exports.SimpleReplayBufferFactory = exports.AudioEncoderFactory = exports.AdvancedRecordingFactory = exports.SimpleRecordingFactory = exports.AudioTrackFactory = exports.NetworkFactory = exports.ReconnectFactory = exports.DelayFactory = exports.AdvancedStreamingFactory = exports.SimpleStreamingFactory = exports.ServiceFactory = exports.VideoEncoderFactory = exports.IPC = exports.ModuleFactory = exports.AudioFactory = exports.Audio = exports.FaderFactory = exports.VolmeterFactory = exports.DisplayFactory = exports.TransitionFactory = exports.FilterFactory = exports.SceneFactory = exports.InputFactory = exports.VideoFactory = exports.Video = exports.Global = exports.DefaultPluginPathMac = exports.DefaultPluginDataPath = exports.DefaultPluginPath = exports.DefaultDataPath = exports.DefaultBinPath = exports.DefaultDrawPluginPath = exports.DefaultOpenGLPath = exports.DefaultD3D11Path = void 0;
exports.NodeObs = exports.getSourcesSize = exports.createSources = exports.addItems = exports.AdvancedReplayBufferFactory = exports.SimpleReplayBufferFactory = exports.AudioEncoderFactory = exports.AdvancedRecordingFactory = exports.SimpleRecordingFactory = exports.AudioTrackFactory = exports.NetworkFactory = exports.ReconnectFactory = exports.DelayFactory = exports.AdvancedStreamingFactory = exports.EnhancedBroadcastingSimpleStreamingFactory = exports.EnhancedBroadcastingAdvancedStreamingFactory = exports.SimpleStreamingFactory = exports.ServiceFactory = exports.VideoEncoderFactory = exports.IPC = exports.ModuleFactory = exports.AudioFactory = exports.Audio = exports.FaderFactory = exports.VolmeterFactory = exports.DisplayFactory = exports.TransitionFactory = exports.FilterFactory = exports.SceneFactory = exports.InputFactory = exports.VideoFactory = exports.Video = exports.Global = exports.DefaultPluginPathMac = exports.DefaultPluginDataPath = exports.DefaultPluginPath = exports.DefaultDataPath = exports.DefaultBinPath = exports.DefaultDrawPluginPath = exports.DefaultOpenGLPath = exports.DefaultD3D11Path = void 0;
const path = require("path");
const fs = require("fs");
// Mac- search for optional OSN.app bundle (Chromium requires an app bundle to find obs64 helper apps)
Expand Down Expand Up @@ -34,6 +34,8 @@ exports.VideoEncoderFactory = obs.VideoEncoder;
exports.ServiceFactory = obs.Service;
exports.SimpleStreamingFactory = obs.SimpleStreaming;
exports.AdvancedStreamingFactory = obs.AdvancedStreaming;
exports.EnhancedBroadcastingAdvancedStreamingFactory = obs.EnhancedBroadcastingAdvancedStreaming;
exports.EnhancedBroadcastingSimpleStreamingFactory = obs.EnhancedBroadcastingSimpleStreaming;
exports.DelayFactory = obs.Delay;
exports.ReconnectFactory = obs.Reconnect;
exports.NetworkFactory = obs.Network;
Expand Down Expand Up @@ -70,7 +72,7 @@ function createSources(sources) {
console.error(`[OSN] Failed to create input for source "${source.name}":`, error instanceof Error ? error.message : error);
return; // Skip the rest of this iteration if input creation fails
}

if (newSource) {
if (newSource.audioMixers) {
newSource.muted = source.muted ?? false;
Expand All @@ -80,7 +82,7 @@ function createSources(sources) {
newSource.deinterlaceMode = source.deinterlaceMode;
newSource.deinterlaceFieldOrder = source.deinterlaceFieldOrder;
items.push(newSource);

const filters = source.filters;
if (Array.isArray(filters)) {
filters.forEach(function (filter) {
Expand All @@ -90,7 +92,7 @@ function createSources(sources) {
} catch (filterError) {
console.error(`[OSN] Failed to create filter "${filter.name}" for source "${source.name}":`, filterError instanceof Error ? filterError.message : filterError);
}

if (ObsFilter) {
ObsFilter.enabled = filter.enabled ?? true;
newSource.addFilter(ObsFilter);
Expand Down
37 changes: 32 additions & 5 deletions js/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ export const VideoEncoderFactory: IVideoEncoderFactory = obs.VideoEncoder;
export const ServiceFactory: IServiceFactory = obs.Service;
export const SimpleStreamingFactory: ISimpleStreamingFactory = obs.SimpleStreaming;
export const AdvancedStreamingFactory: IAdvancedStreamingFactory = obs.AdvancedStreaming;
export const EnhancedBroadcastingAdvancedStreamingFactory: IEnhancedBroadcastingAdvancedStreamingFactory = obs.EnhancedBroadcastingAdvancedStreaming;
export const EnhancedBroadcastingSimpleStreamingFactory: IEnhancedBroadcastingSimpleStreamingFactory = obs.EnhancedBroadcastingSimpleStreaming;
export const DelayFactory: IDelayFactory = obs.Delay;
export const ReconnectFactory: IReconnectFactory = obs.Reconnect;
export const NetworkFactory: INetworkFactory = obs.Network;
Expand Down Expand Up @@ -581,12 +583,12 @@ export interface IGlobal {
readonly version: number;

/**
* Percentage of CPU being used
* Percentage of CPU being used
*/
readonly cpuPercentage: number;

/**
* Current FPS
* Current FPS
*/
readonly currentFrameRate: number;

Expand All @@ -601,7 +603,7 @@ export interface IGlobal {
readonly diskSpaceAvailable: number;

/**
* Current memory usage
* Current memory usage
*/
readonly memoryUsage: number;
}
Expand Down Expand Up @@ -1705,7 +1707,8 @@ export interface IVideoEncoderFactory {
}

export interface IStreaming {
videoEncoder: IVideoEncoder,
// Video encoder value is ignored only in the Enhanced Broadcasting mode, otherwise it should be set
videoEncoder?: IVideoEncoder,
service: IService,
enforceServiceBitrate: boolean,
enableTwitchVOD: boolean,
Expand All @@ -1714,7 +1717,7 @@ export interface IStreaming {
network: INetwork,
video: IVideo,
signalHandler: (signal: EOutputSignal) => void,
start(): void,
start(): void, // throws
stop(force?: boolean): void,
droppedFrames: number;
totalFrames: number;
Expand Down Expand Up @@ -1755,6 +1758,30 @@ export interface IAdvancedStreamingFactory {
legacySettings: IAdvancedStreaming;
}

export interface IEnhancedBroadcastingAdvancedStreaming extends IAdvancedStreaming {
// If set, the Enhanced Broadcasting stream will be in the Dual Output mode.
// This value should be initialized before the stream start.
additionalVideo?: IVideo,
}

export interface IEnhancedBroadcastingAdvancedStreamingFactory {
create(): IEnhancedBroadcastingAdvancedStreaming;
destroy(stream: IEnhancedBroadcastingAdvancedStreaming): void;
legacySettings: IEnhancedBroadcastingAdvancedStreaming;
}

export interface IEnhancedBroadcastingSimpleStreaming extends ISimpleStreaming {
// If set, the Enhanced Broadcasting stream will be in the Dual Output mode.
// This value should be initialized before the stream start.
additionalVideo?: IVideo,
}

export interface IEnhancedBroadcastingSimpleStreamingFactory {
create(): IEnhancedBroadcastingSimpleStreaming;
destroy(stream: IEnhancedBroadcastingSimpleStreaming): void;
legacySettings: IEnhancedBroadcastingSimpleStreaming;
}

export interface IFileOutput {
path: string,
format: ERecordingFormat,
Expand Down
12 changes: 10 additions & 2 deletions obs-studio-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,18 @@ SET(osn-client_SOURCES
"source/audio.cpp"
"source/streaming.hpp"
"source/streaming.cpp"
"source/simple-streaming-base.hpp"
"source/simple-streaming-base.cpp"
"source/simple-streaming.hpp"
"source/simple-streaming.cpp"
"source/advanced-streaming-base.hpp"
"source/advanced-streaming-base.cpp"
"source/advanced-streaming.hpp"
"source/advanced-streaming.cpp"
"source/enhanced-broadcasting-advanced-streaming.hpp"
"source/enhanced-broadcasting-advanced-streaming.cpp"
"source/enhanced-broadcasting-simple-streaming.hpp"
"source/enhanced-broadcasting-simple-streaming.cpp"
"source/worker-signals.hpp"
"source/delay.hpp"
"source/delay.cpp"
Expand Down Expand Up @@ -187,7 +195,7 @@ target_link_libraries(${PROJECT_NAME} ${LIBOBS_LIBRARIES})
add_definitions(-DNAPI_VERSION=7)

#Define the OSN_VERSION
add_compile_definitions(OSN_VERSION=\"$ENV{tagartifact}\")
add_compile_definitions(OSN_VERSION=\"$ENV{tagartifact}\")
set_target_properties(
obs_studio_client
PROPERTIES
Expand Down Expand Up @@ -235,5 +243,5 @@ install(
TARGETS obs_studio_client
RUNTIME DESTINATION "./" COMPONENT Runtime
LIBRARY DESTINATION "./" COMPONENT Runtime
ARCHIVE DESTINATION "./" COMPONENT Runtime
ARCHIVE DESTINATION "./" COMPONENT Runtime
)
134 changes: 134 additions & 0 deletions obs-studio-client/source/advanced-streaming-base.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/******************************************************************************
Copyright (C) 2016-2022 by Streamlabs (General Workings Inc)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

******************************************************************************/

#include "advanced-streaming-base.hpp"

Napi::Value osn::AdvancedStreamingBase::GetAudioTrack(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return info.Env().Undefined();

std::vector<ipc::value> response = conn->call_synchronous_helper("AdvancedStreaming", "GetAudioTrack", {ipc::value(this->uid)});

if (!ValidateResponse(info, response))
return info.Env().Undefined();

return Napi::Number::New(info.Env(), response[1].value_union.ui32);
}

void osn::AdvancedStreamingBase::SetAudioTrack(const Napi::CallbackInfo &info, const Napi::Value &value)
{
auto conn = GetConnection(info);
if (!conn)
return;

conn->call_synchronous_helper("AdvancedStreaming", "SetAudioTrack", {ipc::value(this->uid), ipc::value(value.ToNumber().Uint32Value())});
}

Napi::Value osn::AdvancedStreamingBase::GetTwitchTrack(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return info.Env().Undefined();

std::vector<ipc::value> response = conn->call_synchronous_helper("AdvancedStreaming", "GetTwitchTrack", {ipc::value(this->uid)});

if (!ValidateResponse(info, response))
return info.Env().Undefined();

return Napi::Number::New(info.Env(), response[1].value_union.ui32);
}

void osn::AdvancedStreamingBase::SetTwitchTrack(const Napi::CallbackInfo &info, const Napi::Value &value)
{
auto conn = GetConnection(info);
if (!conn)
return;

conn->call_synchronous_helper("AdvancedStreaming", "SetTwitchTrack", {ipc::value(this->uid), ipc::value(value.ToNumber().Uint32Value())});
}

Napi::Value osn::AdvancedStreamingBase::GetRescaling(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return info.Env().Undefined();

std::vector<ipc::value> response = conn->call_synchronous_helper("AdvancedStreaming", "GetRescaling", {ipc::value(this->uid)});

if (!ValidateResponse(info, response))
return info.Env().Undefined();

return Napi::Boolean::New(info.Env(), response[1].value_union.ui32);
}

void osn::AdvancedStreamingBase::SetRescaling(const Napi::CallbackInfo &info, const Napi::Value &value)
{
auto conn = GetConnection(info);
if (!conn)
return;

conn->call_synchronous_helper("AdvancedStreaming", "SetRescaling", {ipc::value(this->uid), ipc::value(value.ToNumber().Uint32Value())});
}

Napi::Value osn::AdvancedStreamingBase::GetOutputWidth(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return info.Env().Undefined();

std::vector<ipc::value> response = conn->call_synchronous_helper("AdvancedStreaming", "GetOutputWidth", {ipc::value(this->uid)});

if (!ValidateResponse(info, response))
return info.Env().Undefined();

return Napi::Number::New(info.Env(), response[1].value_union.ui32);
}

void osn::AdvancedStreamingBase::SetOutputWidth(const Napi::CallbackInfo &info, const Napi::Value &value)
{
auto conn = GetConnection(info);
if (!conn)
return;

conn->call_synchronous_helper("AdvancedStreaming", "SetOutputWidth", {ipc::value(this->uid), ipc::value(value.ToNumber().Uint32Value())});
}

Napi::Value osn::AdvancedStreamingBase::GetOutputHeight(const Napi::CallbackInfo &info)
{
auto conn = GetConnection(info);
if (!conn)
return info.Env().Undefined();

std::vector<ipc::value> response = conn->call_synchronous_helper("AdvancedStreaming", "GetOutputHeight", {ipc::value(this->uid)});

if (!ValidateResponse(info, response))
return info.Env().Undefined();

return Napi::Number::New(info.Env(), response[1].value_union.ui32);
}

void osn::AdvancedStreamingBase::SetOutputHeight(const Napi::CallbackInfo &info, const Napi::Value &value)
{
auto conn = GetConnection(info);
if (!conn)
return;

conn->call_synchronous_helper("AdvancedStreaming", "SetOutputHeight", {ipc::value(this->uid), ipc::value(value.ToNumber().Uint32Value())});
}
39 changes: 39 additions & 0 deletions obs-studio-client/source/advanced-streaming-base.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/******************************************************************************
Copyright (C) 2016-2022 by Streamlabs (General Workings Inc)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

******************************************************************************/

#pragma once
#include <napi.h>
#include "streaming.hpp"

namespace osn {

class AdvancedStreamingBase : public osn::Streaming {
public:
Napi::Value GetAudioTrack(const Napi::CallbackInfo &info);
void SetAudioTrack(const Napi::CallbackInfo &info, const Napi::Value &value);
Napi::Value GetTwitchTrack(const Napi::CallbackInfo &info);
void SetTwitchTrack(const Napi::CallbackInfo &info, const Napi::Value &value);
Napi::Value GetRescaling(const Napi::CallbackInfo &info);
void SetRescaling(const Napi::CallbackInfo &info, const Napi::Value &value);
Napi::Value GetOutputWidth(const Napi::CallbackInfo &info);
void SetOutputWidth(const Napi::CallbackInfo &info, const Napi::Value &value);
Napi::Value GetOutputHeight(const Napi::CallbackInfo &info);
void SetOutputHeight(const Napi::CallbackInfo &info, const Napi::Value &value);
};

}
Loading
Loading