Fix other ANSCV classes
This commit is contained in:
@@ -219,6 +219,14 @@ namespace ANSCENTER {
|
||||
_displayWidth = width;
|
||||
_displayHeight = height;
|
||||
}
|
||||
void ANSFILEPLAYER::SetJitterBufferMs(int ms) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
if (_playerClient) _playerClient->setJitterBufferMs(ms);
|
||||
ANS_DBG("FilePlayer_Lifecycle", "SetJitterBufferMs: ms=%d url=%s", ms, _url.c_str());
|
||||
}
|
||||
int ANSFILEPLAYER::GetJitterBufferMs() const {
|
||||
return _playerClient ? _playerClient->getJitterBufferMs() : 0;
|
||||
}
|
||||
cv::Mat ANSFILEPLAYER::GetInferenceImage() {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
return _inferenceImage;
|
||||
@@ -324,7 +332,7 @@ extern "C" __declspec(dllexport) int GetFilePlayerStrImage(ANSCENTER::ANSFILEPLA
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error getting image data from FilePlayer client: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -351,18 +359,18 @@ extern "C" __declspec(dllexport) int GetFilePlayerImage(ANSCENTER::ANSFILEPLAYER
|
||||
}
|
||||
else {
|
||||
// Return failure if there was an error in resizing the handle
|
||||
std::cerr << "Error resizing jpegImage handle: " << error << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "DSSetHandleSize failed: error=%d", (int)error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the JPEG image string is empty, return failure
|
||||
std::cerr << "No image data retrieved from FilePlayer client." << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "no image data retrieved (jpegString empty)");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error getting image data from FilePlayer client: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -371,7 +379,7 @@ extern "C" __declspec(dllexport) int GetFilePlayerImage(ANSCENTER::ANSFILEPLAYER
|
||||
}
|
||||
extern "C" __declspec(dllexport) int GetFilePlayerCVImage(ANSCENTER::ANSFILEPLAYER** Handle, int& width, int& height, int64_t& timeStamp, cv::Mat** image) {
|
||||
if (!Handle || !(*Handle) || !image) {
|
||||
std::cerr << "Error: Invalid input parameters in GetFilePlayerCVImage." << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage invalid input parameters");
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
@@ -439,15 +447,15 @@ extern "C" __declspec(dllexport) int GetFilePlayerCVImage(ANSCENTER::ANSFILEPLAY
|
||||
return 1;
|
||||
}
|
||||
catch (const cv::Exception& e) {
|
||||
std::cerr << "OpenCV exception in GetFilePlayerCVImage: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage OpenCV exception: %s", e.what());
|
||||
return -2;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Exception in GetFilePlayerCVImage: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage exception: %s", e.what());
|
||||
return -2;
|
||||
}
|
||||
catch (...) {
|
||||
std::cerr << "Unknown exception in GetFilePlayerCVImage" << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage unknown exception");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@@ -460,7 +468,7 @@ extern "C" __declspec(dllexport) int StartFilePlayer(ANSCENTER::ANSFILEPLAYER**
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error starting file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "StartFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -475,7 +483,7 @@ extern "C" __declspec(dllexport) int ReconnectFilePlayer(ANSCENTER::ANSFILEPLAYE
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error reconnecting file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "ReconnectFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -490,7 +498,7 @@ extern "C" __declspec(dllexport) int StopFilePlayer(ANSCENTER::ANSFILEPLAYER** H
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error stopping file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "StopFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -505,7 +513,7 @@ extern "C" __declspec(dllexport) int IsFilePlayerPaused(ANSCENTER::ANSFILEPLAYER
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error checking if file player is paused: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "IsFilePlayerPaused exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -520,7 +528,7 @@ extern "C" __declspec(dllexport) int IsFilePlayerRunning(ANSCENTER::ANSFILEPLAYE
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error checking if file player is running: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "IsFilePlayerRunning exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -535,7 +543,7 @@ extern "C" __declspec(dllexport) int IsFilePlayerRecording(ANSCENTER::ANSFILEPLA
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error checking if file player is recording: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "IsFilePlayerRecording exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -559,7 +567,7 @@ extern "C" __declspec(dllexport) void EnableFilePlayerAudioVolume(ANSCENTER::ANS
|
||||
(*Handle)->EnableAudio(audioStatus);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error enabling audio for file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "EnableFilePlayerAudio exception: %s", e.what());
|
||||
}
|
||||
catch (...) { }
|
||||
}
|
||||
@@ -578,7 +586,7 @@ extern "C" __declspec(dllexport) int SetBBoxFilePlayer(ANSCENTER::ANSFILEPLAYER*
|
||||
return 1;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error setting bounding box for file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Cfg", "SetBBoxFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -594,7 +602,7 @@ extern "C" __declspec(dllexport) int SetCropFlagFilePlayer(ANSCENTER::ANSFILEPLA
|
||||
return 1;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error setting crop flag for file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Cfg", "SetCropFlagFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -621,17 +629,17 @@ extern "C" __declspec(dllexport) int GetFilePlayerImage_V2(uint64_t handleVal, i
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
std::cerr << "Error resizing jpegImage handle: " << error << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "DSSetHandleSize failed: error=%d", (int)error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cerr << "No image data retrieved from FilePlayer client." << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "no image data retrieved (jpegString empty)");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error getting image data from FilePlayer client: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -704,15 +712,15 @@ extern "C" __declspec(dllexport) int GetFilePlayerCVImage_V2(uint64_t handleVal,
|
||||
return 1;
|
||||
}
|
||||
catch (const cv::Exception& e) {
|
||||
std::cerr << "OpenCV exception in GetFilePlayerCVImage_V2: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage_V2 OpenCV exception: %s", e.what());
|
||||
return -2;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Exception in GetFilePlayerCVImage_V2: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage_V2 exception: %s", e.what());
|
||||
return -2;
|
||||
}
|
||||
catch (...) {
|
||||
std::cerr << "Unknown exception in GetFilePlayerCVImage_V2" << std::endl;
|
||||
ANS_DBG("FilePlayer_GetImage", "GetFilePlayerCVImage_V2 unknown exception");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@@ -726,7 +734,7 @@ extern "C" __declspec(dllexport) int StartFilePlayer_V2(uint64_t handleVal) {
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error starting file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "StartFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -743,7 +751,7 @@ extern "C" __declspec(dllexport) int ReconnectFilePlayer_V2(uint64_t handleVal)
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error reconnecting file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "ReconnectFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -760,7 +768,7 @@ extern "C" __declspec(dllexport) int StopFilePlayer_V2(uint64_t handleVal) {
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error stopping file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "StopFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -777,7 +785,7 @@ extern "C" __declspec(dllexport) int IsFilePlayerPaused_V2(uint64_t handleVal) {
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error checking if file player is paused: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "IsFilePlayerPaused exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -794,7 +802,7 @@ extern "C" __declspec(dllexport) int IsFilePlayerRunning_V2(uint64_t handleVal)
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error checking if file player is running: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "IsFilePlayerRunning exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -811,7 +819,7 @@ extern "C" __declspec(dllexport) int IsFilePlayerRecording_V2(uint64_t handleVal
|
||||
else return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error checking if file player is recording: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "IsFilePlayerRecording exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -837,7 +845,7 @@ extern "C" __declspec(dllexport) void EnableFilePlayerAudioVolume_V2(uint64_t ha
|
||||
h->EnableAudio(audioStatus);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error enabling audio for file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Lifecycle", "EnableFilePlayerAudio exception: %s", e.what());
|
||||
}
|
||||
catch (...) { }
|
||||
}
|
||||
@@ -860,7 +868,7 @@ extern "C" __declspec(dllexport) int SetBBoxFilePlayer_V2(uint64_t handleVal, in
|
||||
return 1;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error setting bounding box for file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Cfg", "SetBBoxFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -878,7 +886,7 @@ extern "C" __declspec(dllexport) int SetCropFlagFilePlayer_V2(uint64_t handleVal
|
||||
return 1;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error setting crop flag for file player: " << e.what() << std::endl;
|
||||
ANS_DBG("FilePlayer_Cfg", "SetCropFlagFilePlayer exception: %s", e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (...) {
|
||||
@@ -892,3 +900,15 @@ extern "C" __declspec(dllexport) void SetFilePlayerDisplayResolution(ANSCENTER::
|
||||
(*Handle)->SetDisplayResolution(width, height);
|
||||
} catch (...) { }
|
||||
}
|
||||
extern "C" __declspec(dllexport) void SetFilePlayerJitterBuffer(ANSCENTER::ANSFILEPLAYER** Handle, int jitterMs) {
|
||||
if (Handle == nullptr || *Handle == nullptr) return;
|
||||
try {
|
||||
(*Handle)->SetJitterBufferMs(jitterMs);
|
||||
} catch (...) { }
|
||||
}
|
||||
extern "C" __declspec(dllexport) int GetFilePlayerJitterBuffer(ANSCENTER::ANSFILEPLAYER** Handle) {
|
||||
if (Handle == nullptr || *Handle == nullptr) return -1;
|
||||
try {
|
||||
return (*Handle)->GetJitterBufferMs();
|
||||
} catch (...) { return -1; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user