Files
obs-studio/plugins/frontend-tools/captions-mssapi.hpp
PatTheMav 1829492e6b cmake: Move frontend plugins into main plugins dir
Frontend plugins should not require being placed in the frontend
directory to be built successfully. Indeed they should only depend
on libobs and the obs-frontend-api and thus their source tree should
be able to exist anywhere (even standalone) and the plugin should still
compile successfully (just like any 3rd party plugin).

Thus moving those plugins into the main plugin directory ensures that
they don't require on any "special sauce" within the source tree to
compile.
2026-06-05 16:00:18 -04:00

48 lines
984 B
C++

#pragma once
#include "captions-handler.hpp"
#include "captions-mssapi-stream.hpp"
#include <util/windows/HRError.hpp>
#include <util/windows/ComPtr.hpp>
#include <util/windows/WinHandle.hpp>
#include <util/windows/CoTaskMemPtr.hpp>
#include <util/threading.h>
#include <util/platform.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
#include <sphelper.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <obs.hpp>
#include <thread>
class mssapi_captions : public captions_handler {
friend class CaptionStream;
ComPtr<CaptionStream> audio;
ComPtr<ISpObjectToken> token;
ComPtr<ISpRecoGrammar> grammar;
ComPtr<ISpRecognizer> recognizer;
ComPtr<ISpRecoContext> context;
HANDLE notify;
WinHandle stop;
std::thread t;
bool started = false;
void main_thread();
public:
mssapi_captions(captions_cb callback, const std::string &lang);
virtual ~mssapi_captions();
virtual void pcm_data(const void *data, size_t frames) override;
};