yolobs-studio/UI/frontend-plugins/frontend-tools/captions-mssapi.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
984 B
C++
Raw Permalink Normal View History

2017-06-29 19:01:10 +00:00
#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>
2018-02-19 19:54:37 +00:00
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
2017-06-29 19:01:10 +00:00
#include <sphelper.h>
2018-02-19 19:54:37 +00:00
#ifdef _MSC_VER
#pragma warning(pop)
#endif
2017-06-29 19:01:10 +00:00
#include <obs.hpp>
#include <thread>
class mssapi_captions : public captions_handler {
friend class CaptionStream;
2019-09-22 21:19:10 +00:00
ComPtr<CaptionStream> audio;
2017-06-29 19:01:10 +00:00
ComPtr<ISpObjectToken> token;
ComPtr<ISpRecoGrammar> grammar;
2019-09-22 21:19:10 +00:00
ComPtr<ISpRecognizer> recognizer;
2017-06-29 19:01:10 +00:00
ComPtr<ISpRecoContext> context;
2019-09-22 21:19:10 +00:00
HANDLE notify;
WinHandle stop;
std::thread t;
bool started = false;
2017-06-29 19:01:10 +00:00
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;
};