Skip to content

Commit 0f58a63

Browse files
author
eddyStreamlabs
committed
Few fixes on the module API
1 parent 2aff6bb commit 0f58a63

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

js/module.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ export interface IAudioFactory {
660660
reset(info: IAudioInfo): boolean;
661661
getGlobal(): IAudio;
662662
}
663-
export interface IModuleFactory {
663+
export interface IModuleFactory extends IFactoryTypes {
664664
open(binPath: string, dataPath: string): IModule;
665665
loadAll(): void;
666666
addPath(path: string, dataPath: string): void;

js/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ export interface IAudioFactory {
14931493
}
14941494

14951495

1496-
export interface IModuleFactory {
1496+
export interface IModuleFactory extends IFactoryTypes {
14971497
open(binPath: string, dataPath: string): IModule;
14981498
loadAll(): void;
14991499
addPath(path: string, dataPath: string): void;

obs-studio-client/source/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "transition.hpp"
3030
#include "video.hpp"
3131
#include "volmeter.hpp"
32+
#include "module.hpp"
3233

3334
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 1;
3435

@@ -47,6 +48,7 @@ void main(v8::Local<v8::Object> exports, v8::Local<v8::Value> module, void* priv
4748
osn::Fader::Register(exports);
4849
osn::VolMeter::Register(exports);
4950
osn::Video::Register(exports);
51+
osn::Module::Register(exports);
5052

5153
while (initializerFunctions.size() > 0) {
5254
initializerFunctions.front()(exports);

obs-studio-client/source/module.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Nan::Persistent<v8::FunctionTemplate> osn::Module::prototype = Nan::Persistent<v
3535
void osn::Module::Register(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target)
3636
{
3737
auto fnctemplate = Nan::New<v8::FunctionTemplate>();
38-
fnctemplate->Inherit(Nan::New<v8::FunctionTemplate>(osn::Module::prototype));
3938
fnctemplate->InstanceTemplate()->SetInternalFieldCount(1);
4039
fnctemplate->SetClassName(Nan::New<v8::String>("Module").ToLocalChecked());
4140

@@ -60,7 +59,7 @@ Nan::NAN_METHOD_RETURN_TYPE osn::Module::Open(Nan::NAN_METHOD_ARGS_TYPE info)
6059

6160
ASSERT_INFO_LENGTH(info, 2);
6261
ASSERT_GET_VALUE(info[0], bin_path);
63-
ASSERT_GET_VALUE(info[0], data_path);
62+
ASSERT_GET_VALUE(info[1], data_path);
6463

6564
auto conn = GetConnection();
6665
if (!conn)

obs-studio-server/source/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "osn-transition.hpp"
4242
#include "osn-video.hpp"
4343
#include "osn-volmeter.hpp"
44+
#include "osn-module.hpp"
4445

4546
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 1;
4647

@@ -169,6 +170,7 @@ int main(int argc, char* argv[])
169170
osn::VolMeter::Register(myServer);
170171
osn::Properties::Register(myServer);
171172
osn::Video::Register(myServer);
173+
osn::Module::Reigster(myServer);
172174
OBS_API::Register(myServer);
173175
OBS_content::Register(myServer);
174176
OBS_service::Register(myServer);

obs-studio-server/source/nodeobs_api.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ void OBS_API::OBS_API_initAPI(
435435
* 3. getenv(OBS_DATA_PATH) + /libobs <- Can be set anywhere
436436
* on the cli, in the frontend, or the backend. */
437437
obs_add_data_path((g_moduleDirectory + "/libobs/data/libobs/").c_str());
438-
slobs_plugin = appdata_path.substr(0, appdata_path.size() - 14);
439-
slobs_plugin.append("/slobs-plugin");
438+
slobs_plugin = appdata_path.substr(0, appdata_path.size() - 13);
439+
slobs_plugin.append("/slobs-plugins");
440440
obs_add_data_path((slobs_plugin + "/data/").c_str());
441441

442442
std::vector<char> userData = std::vector<char>(1024);
@@ -821,7 +821,7 @@ void OBS_API::openAllModules(void)
821821
{
822822
OBS_service::resetVideoContext(NULL);
823823

824-
std::string plugins_paths[] = {g_moduleDirectory + "/obs-plugins/64bit", g_moduleDirectory + "/obs-plugins", slobs_plugin + "/obs-plugins"};
824+
std::string plugins_paths[] = {g_moduleDirectory + "/obs-plugins/64bit", g_moduleDirectory + "/obs-plugins", slobs_plugin + "/obs-plugins/64bit"};
825825

826826
std::string plugins_data_paths[] = {
827827
g_moduleDirectory + "/data/obs-plugins", plugins_data_paths[0], slobs_plugin + "/data/obs-plugins"};

obs-studio-server/source/osn-module.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "error.hpp"
2020
#include "shared.hpp"
2121

22-
void osn::Module::Reigster(ipc::server&)
22+
void osn::Module::Reigster(ipc::server& srv)
2323
{
2424
std::shared_ptr<ipc::collection> cls = std::make_shared<ipc::collection>("Module");
2525

@@ -41,6 +41,8 @@ void osn::Module::Reigster(ipc::server&)
4141
std::make_shared<ipc::function>("GetDataPath", std::vector<ipc::type>{ipc::type::UInt64}, GetDataPath));
4242
cls->register_function(
4343
std::make_shared<ipc::function>("GetDataPath", std::vector<ipc::type>{ipc::type::UInt64}, GetDataPath));
44+
45+
srv.register_collection(cls);
4446
}
4547

4648
void osn::Module::Open(void* data, const int64_t id, const std::vector<ipc::value>& args, std::vector<ipc::value>& rval)

obs-studio-server/source/osn-module.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace osn
2424
{
2525
class Module
2626
{
27+
public:
28+
static void Reigster(ipc::server&);
29+
2730
public:
2831
class Manager : public utility::unique_object_manager<obs_module_t>
2932
{
@@ -41,8 +44,6 @@ namespace osn
4144
static Manager& GetInstance();
4245
};
4346

44-
public:
45-
static void Reigster(ipc::server&);
4647

4748
// Functions
4849
static void

0 commit comments

Comments
 (0)