This commit is contained in:
恍兮惚兮 2024-11-15 03:50:32 +08:00
parent ec1e74ce41
commit 09c0ffc54b
4 changed files with 25 additions and 10 deletions

View File

@ -37,7 +37,7 @@ add_subdirectory(winsharedutils)
add_subdirectory(hookmagpie) add_subdirectory(hookmagpie)
add_subdirectory(shareddllproxy) add_subdirectory(shareddllproxy)
add_subdirectory(LunaOCR) add_subdirectory(LunaOCR)
if(NOT WINXP)
add_subdirectory(winrtutils) add_subdirectory(winrtutils)
if(NOT WINXP)
add_subdirectory(wcocr) add_subdirectory(wcocr)
endif() endif()

View File

@ -1,3 +1,11 @@
enum class Directional
{
H,
V,
Auto
};
#ifndef WINXP #ifndef WINXP
#include <onnxruntime/core/session/onnxruntime_cxx_api.h> #include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
@ -7,13 +15,6 @@
typedef std::vector<cv::Point> TextBox; typedef std::vector<cv::Point> TextBox;
typedef std::string TextLine; typedef std::string TextLine;
typedef std::pair<TextBox, TextLine> TextBlock; typedef std::pair<TextBox, TextLine> TextBlock;
enum class Directional
{
H,
V,
Auto
};
struct ScaleParam struct ScaleParam
{ {
int srcWidth; int srcWidth;
@ -704,7 +705,8 @@ std::vector<TextBlock> OcrLite::detect_internal(cv::Mat &src, cv::Rect &originRe
return textBlocks; return textBlocks;
} }
#else
struct OcrLite;
#endif #endif
struct ocrpoints struct ocrpoints
{ {

View File

@ -12,7 +12,9 @@ generate_product_version(
add_library(winrtutils MODULE winrtsnapshot.cpp winrtocr.cpp livecaptions.cpp ${versioninfo}) add_library(winrtutils MODULE winrtsnapshot.cpp winrtocr.cpp livecaptions.cpp ${versioninfo})
target_precompile_headers(winrtutils REUSE_FROM pch) target_precompile_headers(winrtutils REUSE_FROM pch)
if(NOT WINXP)
target_link_libraries(winrtutils wil) target_link_libraries(winrtutils wil)
endif()
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set_target_properties(winrtutils PROPERTIES OUTPUT_NAME "winrtutils64") set_target_properties(winrtutils PROPERTIES OUTPUT_NAME "winrtutils64")
else() else()

View File

@ -1,3 +1,4 @@
#ifndef WINXP
// https://github.com/corbamico/get-livecaptions-cpp/ // https://github.com/corbamico/get-livecaptions-cpp/
#include <sdkddkver.h> #include <sdkddkver.h>
#include <windows.h> #include <windows.h>
@ -60,8 +61,10 @@ public:
return FindWindowW(L"LiveCaptionsDesktopWindow", nullptr) != NULL; return FindWindowW(L"LiveCaptionsDesktopWindow", nullptr) != NULL;
} }
}; };
#endif
DECLARE_API HANDLE livecaption_start(void (*cb)(const wchar_t *)) DECLARE_API HANDLE livecaption_start(void (*cb)(const wchar_t *))
{ {
#ifndef WINXP
auto mutex = CreateSemaphoreW(NULL, 0, 1, NULL); auto mutex = CreateSemaphoreW(NULL, 0, 1, NULL);
auto flag = new int{1}; auto flag = new int{1};
std::thread([=]() std::thread([=]()
@ -90,13 +93,21 @@ DECLARE_API HANDLE livecaption_start(void (*cb)(const wchar_t *))
delete flag; }) delete flag; })
.detach(); .detach();
return mutex; return mutex;
#else
return NULL;
#endif
} }
DECLARE_API void livecaption_stop(HANDLE m) DECLARE_API void livecaption_stop(HANDLE m)
{ {
#ifndef WINXP
ReleaseSemaphore(m, 1, NULL); ReleaseSemaphore(m, 1, NULL);
#endif
} }
DECLARE_API bool livecaption_isrunning() DECLARE_API bool livecaption_isrunning()
{ {
#ifndef WINXP
return Engine::is_livecaption_running(); return Engine::is_livecaption_running();
#else
return false;
#endif
} }