Skip to content

Commit

Permalink
Few fixes on the module API
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyStreamlabs committed Oct 30, 2018
1 parent 2aff6bb commit 0f58a63
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js/module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ export interface IAudioFactory {
reset(info: IAudioInfo): boolean;
getGlobal(): IAudio;
}
export interface IModuleFactory {
export interface IModuleFactory extends IFactoryTypes {
open(binPath: string, dataPath: string): IModule;
loadAll(): void;
addPath(path: string, dataPath: string): void;
Expand Down
2 changes: 1 addition & 1 deletion js/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ export interface IAudioFactory {
}


export interface IModuleFactory {
export interface IModuleFactory extends IFactoryTypes {
open(binPath: string, dataPath: string): IModule;
loadAll(): void;
addPath(path: string, dataPath: string): void;
Expand Down
2 changes: 2 additions & 0 deletions obs-studio-client/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "transition.hpp"
#include "video.hpp"
#include "volmeter.hpp"
#include "module.hpp"

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

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

while (initializerFunctions.size() > 0) {
initializerFunctions.front()(exports);
Expand Down
3 changes: 1 addition & 2 deletions obs-studio-client/source/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Nan::Persistent<v8::FunctionTemplate> osn::Module::prototype = Nan::Persistent<v
void osn::Module::Register(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target)
{
auto fnctemplate = Nan::New<v8::FunctionTemplate>();
fnctemplate->Inherit(Nan::New<v8::FunctionTemplate>(osn::Module::prototype));
fnctemplate->InstanceTemplate()->SetInternalFieldCount(1);
fnctemplate->SetClassName(Nan::New<v8::String>("Module").ToLocalChecked());

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

ASSERT_INFO_LENGTH(info, 2);
ASSERT_GET_VALUE(info[0], bin_path);
ASSERT_GET_VALUE(info[0], data_path);
ASSERT_GET_VALUE(info[1], data_path);

auto conn = GetConnection();
if (!conn)
Expand Down
2 changes: 2 additions & 0 deletions obs-studio-server/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "osn-transition.hpp"
#include "osn-video.hpp"
#include "osn-volmeter.hpp"
#include "osn-module.hpp"

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

Expand Down Expand Up @@ -169,6 +170,7 @@ int main(int argc, char* argv[])
osn::VolMeter::Register(myServer);
osn::Properties::Register(myServer);
osn::Video::Register(myServer);
osn::Module::Reigster(myServer);
OBS_API::Register(myServer);
OBS_content::Register(myServer);
OBS_service::Register(myServer);
Expand Down
6 changes: 3 additions & 3 deletions obs-studio-server/source/nodeobs_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ void OBS_API::OBS_API_initAPI(
* 3. getenv(OBS_DATA_PATH) + /libobs <- Can be set anywhere
* on the cli, in the frontend, or the backend. */
obs_add_data_path((g_moduleDirectory + "/libobs/data/libobs/").c_str());
slobs_plugin = appdata_path.substr(0, appdata_path.size() - 14);
slobs_plugin.append("/slobs-plugin");
slobs_plugin = appdata_path.substr(0, appdata_path.size() - 13);
slobs_plugin.append("/slobs-plugins");
obs_add_data_path((slobs_plugin + "/data/").c_str());

std::vector<char> userData = std::vector<char>(1024);
Expand Down Expand Up @@ -821,7 +821,7 @@ void OBS_API::openAllModules(void)
{
OBS_service::resetVideoContext(NULL);

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

std::string plugins_data_paths[] = {
g_moduleDirectory + "/data/obs-plugins", plugins_data_paths[0], slobs_plugin + "/data/obs-plugins"};
Expand Down
4 changes: 3 additions & 1 deletion obs-studio-server/source/osn-module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "error.hpp"
#include "shared.hpp"

void osn::Module::Reigster(ipc::server&)
void osn::Module::Reigster(ipc::server& srv)
{
std::shared_ptr<ipc::collection> cls = std::make_shared<ipc::collection>("Module");

Expand All @@ -41,6 +41,8 @@ void osn::Module::Reigster(ipc::server&)
std::make_shared<ipc::function>("GetDataPath", std::vector<ipc::type>{ipc::type::UInt64}, GetDataPath));
cls->register_function(
std::make_shared<ipc::function>("GetDataPath", std::vector<ipc::type>{ipc::type::UInt64}, GetDataPath));

srv.register_collection(cls);
}

void osn::Module::Open(void* data, const int64_t id, const std::vector<ipc::value>& args, std::vector<ipc::value>& rval)
Expand Down
5 changes: 3 additions & 2 deletions obs-studio-server/source/osn-module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace osn
{
class Module
{
public:
static void Reigster(ipc::server&);

public:
class Manager : public utility::unique_object_manager<obs_module_t>
{
Expand All @@ -41,8 +44,6 @@ namespace osn
static Manager& GetInstance();
};

public:
static void Reigster(ipc::server&);

// Functions
static void
Expand Down

0 comments on commit 0f58a63

Please sign in to comment.