-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <obs-module.h> | ||
#include "plugin-macros.generated.h" | ||
#include "ptz-http-backend.hpp" | ||
|
||
ptz_http_backend::ptz_http_backend() | ||
{ | ||
// TODO: Implement | ||
|
||
pthread_t thread; | ||
pthread_create(&thread, NULL, ptz_http_backend::thread_main, (void*)this); | ||
pthread_detach(thread); | ||
} | ||
|
||
ptz_http_backend::~ptz_http_backend() | ||
{ | ||
// TODO: Implement | ||
} | ||
|
||
void *ptz_http_backend::thread_main(void *data) | ||
{ | ||
auto *visca = (ptz_http_backend*)data; | ||
visca->add_ref(); | ||
visca->thread_loop(); | ||
visca->release(); | ||
return NULL; | ||
} | ||
|
||
void ptz_http_backend::thread_loop() | ||
{ | ||
// TODO: Implement | ||
} | ||
|
||
void ptz_http_backend::set_config(struct obs_data *data) | ||
{ | ||
// TODO: Implement | ||
} | ||
|
||
void ptz_http_backend::set_pantilt_speed(int pan, int tilt) | ||
{ | ||
pan_next = pan; | ||
tilt_next = tilt; | ||
|
||
// TODO: Implement | ||
} | ||
|
||
void ptz_http_backend::set_zoom_speed(int zoom) | ||
{ | ||
zoom_next = zoom; | ||
|
||
// TODO: Implement | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <atomic> | ||
#include <mutex> | ||
#include "ptz-backend.hpp" | ||
|
||
class ptz_http_backend : public ptz_backend | ||
{ | ||
std::mutex mutex; | ||
struct obs_data *data; | ||
std::atomic<bool> data_changed; | ||
std::atomic<bool> preset_changed; | ||
std::atomic<int> pan_next, tilt_next, zoom_next; | ||
|
||
static void *thread_main(void *); | ||
void thread_loop(); | ||
|
||
public: | ||
ptz_http_backend(); | ||
~ptz_http_backend() override; | ||
|
||
void set_config(struct obs_data *data) override; | ||
|
||
void set_pantilt_speed(int pan, int tilt) override; | ||
void set_zoom_speed(int zoom) override; | ||
void recall_preset(int) override { } | ||
int get_zoom() override { | ||
// TODO: Implement if available | ||
return 0; | ||
} | ||
}; |