eGrabber Recorder Reference
24.06.0.14
|
Go to the documentation of this file.
3 #ifndef ERECORDERLIBRARY_H
4 #define ERECORDERLIBRARY_H
7 #include "internal/dynamicLibrary.h"
8 #include "internal/defaultPath.h"
14 #ifndef ERECORDERLIBRARY_WITH_PROGRESS_REPORT
15 #if __cplusplus >= 201103L
16 #define ERECORDERLIBRARY_WITH_PROGRESS_REPORT 1
18 #define ERECORDERLIBRARY_WITH_PROGRESS_REPORT 0
22 #if ERECORDERLIBRARY_WITH_PROGRESS_REPORT
31 namespace EGrabberRecorder {
248 #if __cplusplus >= 201103L
263 operator bool()
const;
283 size_t exportImages(
const std::string &path,
size_t count, uint32_t exportPixelFormat = 0);
285 void startChapter(
const std::string &name =
"",
const std::string &info =
"");
287 #if ERECORDERLIBRARY_WITH_PROGRESS_REPORT
293 Progress getProgress()
const;
301 #if ERECORDERLIBRARY_WITH_PROGRESS_REPORT
303 std::atomic<Progress> currentProgress;
304 std::atomic<bool> abortFlag;
315 , initLib(reinterpret_cast<FnRecorderInitLib>(dynlib.getSymbol(
"RecorderInitLib")))
316 , closeLib(reinterpret_cast<FnRecorderCloseLib>(dynlib.getSymbol(
"RecorderCloseLib")))
317 ,
open(reinterpret_cast<FnRecorderOpen>(dynlib.getSymbol(
"RecorderOpen")))
318 ,
close(reinterpret_cast<FnRecorderClose>(dynlib.getSymbol(
"RecorderClose")))
319 ,
setParameterString(reinterpret_cast<FnRecorderSetParameterString>(dynlib.getSymbol(
"RecorderSetParameterString")))
320 ,
getParameterString(reinterpret_cast<FnRecorderGetParameterString>(dynlib.getSymbol(
"RecorderGetParameterString")))
321 ,
setParameterInteger(reinterpret_cast<FnRecorderSetParameterInteger>(dynlib.getSymbol(
"RecorderSetParameterInteger")))
322 ,
getParameterInteger(reinterpret_cast<FnRecorderGetParameterInteger>(dynlib.getSymbol(
"RecorderGetParameterInteger")))
323 ,
read(reinterpret_cast<FnRecorderRead>(dynlib.getSymbol(
"RecorderRead")))
324 ,
write(reinterpret_cast<FnRecorderWrite>(dynlib.getSymbol(
"RecorderWrite")))
325 ,
exportImages(reinterpret_cast<FnRecorderExport>(dynlib.getSymbol(
"RecorderExport")))
326 ,
startChapter(reinterpret_cast<FnRecorderStartChapter>(dynlib.getSymbol(
"RecorderStartChapter"))) {
346 return Recorder(*
this, handle, closeMode);
350 std::string path(Internal::getDefaultLibraryPath());
352 throw std::runtime_error(
"No default recorder library path");
358 Internal::DynamicLibrary dynlib;
359 FnRecorderInitLib initLib;
360 FnRecorderCloseLib closeLib;
445 std::stringstream ss;
446 ss <<
"RecorderError(RECORDER_STATUS=" <<
status <<
")";
453 : std::runtime_error(description)
457 #define EGRABBER_RECORDER_ERROR_CTOR(error, status) \
458 inline error::error(): RecorderError(status, #error){}
493 #if __cplusplus >= 201103L
495 : recorderLibrary(other.recorderLibrary)
496 , handle(other.handle)
497 , closeMode(other.closeMode)
499 , currentProgress(other.currentProgress.load())
500 , abortFlag(other.abortFlag.load())
507 if (&other ==
this) {
511 std::swap(recorderLibrary, other.recorderLibrary);
512 std::swap(handle, other.handle);
513 std::swap(closeMode, other.closeMode);
515 #if ERECORDERLIBRARY_WITH_PROGRESS_REPORT
516 currentProgress = other.currentProgress.load();
517 abortFlag = other.abortFlag.load();
526 : recorderLibrary(&recorderLibrary)
528 , closeMode(closeMode)
530 , currentProgress({0, 0,
false})
549 inline Recorder::operator bool()
const {
553 std::vector<char> value(128);
554 size_t size = value.size();
562 return (size) ? std::string(&value[0]) : std::string();
579 size_t size = bufferSize;
586 std::vector<char> data(size ? size : 1);
592 #if ERECORDERLIBRARY_WITH_PROGRESS_REPORT
604 #if ERECORDERLIBRARY_WITH_PROGRESS_REPORT
605 inline int Recorder::progressCallback(
void *context,
RECORDER_PROGRESS_STATE state,
size_t index,
size_t count) {
609 recorder->currentProgress.store({0, 0,
true});
610 recorder->abortFlag.store(
false);
612 recorder->currentProgress.store({index, count,
true});
613 if (recorder->abortFlag.load()) {
617 Progress finished(recorder->currentProgress.load());
618 finished.working =
false;
619 recorder->currentProgress.store(finished);
624 inline Recorder::Progress Recorder::getProgress()
const {
625 return currentProgress.load();
627 inline void Recorder::abort() {
628 abortFlag.store(
true);
@ RECORDER_STATUS_PARAMETER_IS_READ_ONLY
The recorder parameter is read-only.
Definition: ERecorder.h:51
Unsupported database version error (RECORDER_STATUS_UNSUPPORTED_DATABASE_VERSION)
Definition: EGrabberRecorder.h:126
Index out of range error (RECORDER_STATUS_INDEX_OUT_OF_RANGE)
Definition: EGrabberRecorder.h:108
End of data error (RECORDER_STATUS_END_OF_DATA)
Definition: EGrabberRecorder.h:162
@ RECORDER_STATUS_CHAPTER_NAME_ALREADY_USED
The chapter name is already used.
Definition: ERecorder.h:75
unsigned int RECORDER_CLOSE_MODE
Definition: ERecorder.h:133
@ RECORDER_CLOSE_MODE_TRIM
trim the recorder container size when closing the recorder
Definition: ERecorder.h:129
unsigned int RECORDER_PARAMETER
Definition: ERecorder.h:119
No license (RECORDER_STATUS_NO_LICENSE)
Definition: EGrabberRecorder.h:186
@ RECORDER_STATUS_INVALID_CHAPTER_CHARACTER
The chapter name has an invalid character.
Definition: ERecorder.h:73
@ RECORDER_STATUS_LICENSE_MANAGER_ERROR
An error occurred in the licenser manager, please contact Euresys support.
Definition: ERecorder.h:67
Invalid index size error (RECORDER_STATUS_INVALID_INDEX_SIZE)
Definition: EGrabberRecorder.h:120
Invalid parameter type error (RECORDER_STATUS_INVALID_PARAMETER_TYPE)
Definition: EGrabberRecorder.h:60
@ RECORDER_PROGRESS_STATE_STARTING
An operation is starting, index and count are not set.
Definition: ERecorder.h:136
@ RECORDER_STATUS_UNKNOWN_PARAMETER
The recorder parameter is unknown.
Definition: ERecorder.h:47
Data file full error (RECORDER_STATUS_DATA_FILE_FULL)
Definition: EGrabberRecorder.h:96
A Recorder library object that loads and unloads the Recorder Library and exposes its low-level funct...
Definition: EGrabberRecorder.h:311
size_t exportImages(const std::string &path, size_t count, uint32_t exportPixelFormat=0)
FnRecorderSetParameterInteger setParameterInteger
Definition: EGrabberRecorder.h:366
Buffer too small error (RECORDER_STATUS_BUFFER_TOO_SMALL)
Definition: EGrabberRecorder.h:72
System error RECORDER_STATUS_SYSTEM_ERROR.
Definition: EGrabberRecorder.h:84
Unknown error (RECORDER_STATUS_UNKNOWN_ERROR)
Definition: EGrabberRecorder.h:48
Parameter read-only error (RECORDER_STATUS_PARAMETER_IS_READ_ONLY)
Definition: EGrabberRecorder.h:78
@ RECORDER_STATUS_INVALID_LENGTH_WRITTEN
Some data was not completely written to disk (partial write)
Definition: ERecorder.h:61
A Recorder error (RECORDER_STATUS)
Definition: EGrabberRecorder.h:40
@ RECORDER_STATUS_INVALID_PARAMETER_VALUE
The recorder parameter value is invalid.
Definition: ERecorder.h:49
Definition: ERecorder.h:80
Invalid index data error (RECORDER_STATUS_INVALID_INDEX_DATA)
Definition: EGrabberRecorder.h:114
Unknown parameter error (RECORDER_STATUS_UNKNOWN_PARAMETER)
Definition: EGrabberRecorder.h:54
@ RECORDER_PROGRESS_STATE_ONGOING
An operation is ongoing, index and count are set according to the current progress.
Definition: ERecorder.h:137
Resource in use error (RECORDER_STATUS_RESOURCE_IN_USE)
Definition: EGrabberRecorder.h:156
@ RECORDER_STATUS_ABORTED
The current operation has been aborted by the user.
Definition: ERecorder.h:71
#define ERECORDERLIBRARY_WITH_PROGRESS_REPORT
Definition: EGrabberRecorder.h:18
@ RECORDER_STATUS_RESOURCE_IN_USE
The resource is already in use.
Definition: ERecorder.h:63
@ RECORDER_STATUS_BUFFER_TOO_SMALL
The destination buffer is too small.
Definition: ERecorder.h:50
unsigned int RECORDER_PROGRESS_STATE
Definition: ERecorder.h:140
void initLibrary()
Definition: EGrabberRecorder.h:333
int RECORDER_STATUS
Definition: ERecorder.h:78
static void check(RECORDER_STATUS status)
The chapter name conflicts with a reserved name.
Definition: EGrabberRecorder.h:222
FnRecorderClose close
Definition: EGrabberRecorder.h:363
FnRecorderGetParameterString getParameterString
Definition: EGrabberRecorder.h:365
@ RECORDER_STATUS_INVALID_DATA_SIZE
A read operation returned an invalid size (partial read or invalid data file size)
Definition: ERecorder.h:72
@ RECORDER_STATUS_OK
The operation completed successfully.
Definition: ERecorder.h:44
Recorder(const Recorder &)
static std::string getDefaultPath()
Definition: EGrabberRecorder.h:349
@ RECORDER_STATUS_INVALID_HANDLE
The record handle is invalid.
Definition: ERecorder.h:62
std::string getParameterString(RECORDER_PARAMETER parameter)
get a recorder parameter (RecorderGetParameterString)
void close()
close the recorder using the mode defined when the recorder was created (RecorderClose)
Header file for Euresys Recorder Library.
FnRecorderSetParameterString setParameterString
Definition: EGrabberRecorder.h:364
virtual ~Recorder()
close a recorder using the mode defined when the recorder was created (RecorderClose)
std::vector< char > read(RECORDER_BUFFER_INFO *info=0)
@ RECORDER_STATUS_NOT_INITIALIZED
The recorder library is not initialized.
Definition: ERecorder.h:45
@ RECORDER_STATUS_IMAGE_CONVERSION_ERROR
An image conversion error has occurred.
Definition: ERecorder.h:69
@ RECORDER_STATUS_INVALID_CONTAINER_PATH
The specified container path is invalid.
Definition: ERecorder.h:53
void write(const RECORDER_BUFFER_INFO *info, const void *buffer)
write to the container synchronously (RecorderWrite)
Image conversion error (RECORDER_STATUS_IMAGE_CONVERSION_ERROR)
Definition: EGrabberRecorder.h:192
Invalid length written error (RECORDER_STATUS_INVALID_LENGTH_WRITTEN)
Definition: EGrabberRecorder.h:138
void setParameterString(RECORDER_PARAMETER parameter, const std::string &value)
set a recorder parameter (RecorderSetParameterString)
@ RECORDER_STATUS_UNSUPPORTED_IMAGE_FORMAT
The image format is not supported by the export file.
Definition: ERecorder.h:70
void closeLibrary()
Definition: EGrabberRecorder.h:337
A Recorder object that encapsulates a recorder handle (RECORDER_HANDLE) and exposes higher level reco...
Definition: EGrabberRecorder.h:246
FnRecorderOpen open
Definition: EGrabberRecorder.h:362
Not initialized error (RECORDER_STATUS_NOT_INITIALIZED)
Definition: EGrabberRecorder.h:144
FnRecorderExport exportImages
Definition: EGrabberRecorder.h:370
@ RECORDER_PROGRESS_STATE_ENDING
An operation is ending (successfully or not), index and count are not set.
Definition: ERecorder.h:138
Recorder & operator=(const Recorder &)
License Manager error (RECORDER_STATUS_LICENSE_MANAGER_ERROR)
Definition: EGrabberRecorder.h:180
size_t read(RECORDER_BUFFER_INFO *info, void *buffer, size_t bufferSize)
No container in path (RECORDER_STATUS_NO_CONTAINER)
Definition: EGrabberRecorder.h:174
UnsupportedDatabaseVersion()
@ RECORDER_STATUS_SYSTEM_ERROR
A system error has occurred.
Definition: ERecorder.h:52
unsigned int RECORDER_OPEN_MODE
Definition: ERecorder.h:126
@ RECORDER_STATUS_INVALID_PARAMETER_TYPE
The recorder parameter type is invalid.
Definition: ERecorder.h:48
Operation not allowed error (RECORDER_STATUS_OPERATION_NOT_ALLOWED)
Definition: EGrabberRecorder.h:102
InvalidChapterCharacter()
int64_t getParameterInteger(RECORDER_PARAMETER parameter)
get a recorder parameter (RecorderGetParameterInteger)
RECORDER_STATUS status
Definition: EGrabberRecorder.h:42
void startChapter(const std::string &name="", const std::string &info="")
FnRecorderRead read
Definition: EGrabberRecorder.h:368
Definition: EGrabberRecorder.h:30
@ RECORDER_STATUS_CHAPTER_NAME_TOO_LONG
The chapter name is too long.
Definition: ERecorder.h:76
@ RECORDER_STATUS_NO_CONTAINER
The path does not contain a container and read only access is required.
Definition: ERecorder.h:65
void close(RECORDER_CLOSE_MODE closeMode)
close the recorder using the given close mode (RecorderClose)
@ RECORDER_STATUS_UNKNOWN_ERROR
An unknown error has occurred.
Definition: ERecorder.h:46
@ RECORDER_STATUS_OPERATION_NOT_ALLOWED
The operation is not allowed by the recorder open mode.
Definition: ERecorder.h:55
The chapter name is already used.
Definition: EGrabberRecorder.h:228
@ RECORDER_STATUS_END_OF_DATA
There is no more record to read in the container.
Definition: ERecorder.h:64
The chapter name is too long.
Definition: EGrabberRecorder.h:234
Invalid parameter value error (RECORDER_STATUS_INVALID_PARAMETER_VALUE)
Definition: EGrabberRecorder.h:66
Recorder openRecorder(const std::string &path, RECORDER_OPEN_MODE mode, RECORDER_CLOSE_MODE closeMode=RECORDER_CLOSE_MODE_TRIM, uint32_t *fileVersion=0)
Open a recorder and return a Recorder object that wraps the opened recorder handle.
Definition: EGrabberRecorder.h:342
@ RECORDER_STATUS_INVALID_INDEX_DATA
The internal meta-data of the current record is invalid (partial read)
Definition: ERecorder.h:57
@ RECORDER_STATUS_INVALID_INDEX_HEADER
The internal meta-data header of the container is invalid.
Definition: ERecorder.h:60
@ RECORDER_STATUS_NO_LICENSE
There is no valid license for this library, please contact Euresys support.
Definition: ERecorder.h:68
void * RECORDER_HANDLE
Definition: ERecorder.h:95
Invalid data size on reading.
Definition: EGrabberRecorder.h:210
struct Euresys::EGrabberRecorder::S_RECORDER_BUFFER_INFO RECORDER_BUFFER_INFO
Invalid argument error (RECORDER_STATUS_INVALID_ARGUMENT)
Definition: EGrabberRecorder.h:168
@ RECORDER_STATUS_INVALID_INDEX_SIZE
The internal meta-data size of the container is invalid (partial read or invalid meta-data file size)
Definition: ERecorder.h:58
Operation aborted by the user (thrown by Recorder::exportImages)
Definition: EGrabberRecorder.h:204
@ RECORDER_STATUS_DATA_FILE_FULL
The container data file is full.
Definition: ERecorder.h:54
RecorderLibrary(const std::string &path=getDefaultPath())
Definition: EGrabberRecorder.h:313
@ RECORDER_STATUS_UNSUPPORTED_DATABASE_VERSION
The given container is not supported by the recorder library.
Definition: ERecorder.h:59
An invalid character was used in the chapter name.
Definition: EGrabberRecorder.h:216
FnRecorderStartChapter startChapter
Definition: EGrabberRecorder.h:371
RecorderError(RECORDER_STATUS status, const std::string &description)
Invalid handle error (RECORDER_STATUS_INVALID_HANDLE)
Definition: EGrabberRecorder.h:150
virtual ~RecorderLibrary()
Definition: EGrabberRecorder.h:329
void setParameterInteger(RECORDER_PARAMETER parameter, int64_t value)
set a recorder parameter (RecorderSetParameterInteger)
FnRecorderWrite write
Definition: EGrabberRecorder.h:369
@ RECORDER_STATUS_INVALID_ARGUMENT
A given argument is invalid.
Definition: ERecorder.h:66
@ RECORDER_STATUS_RESERVED_CHAPTER_NAME
The chapter name conflicts with a reserved name.
Definition: ERecorder.h:74
@ RECORDER_STATUS_INDEX_OUT_OF_RANGE
The RECORDER_PARAMETER_RECORD_INDEX value is out of range.
Definition: ERecorder.h:56
Invalid storage path error (RECORDER_STATUS_INVALID_CONTAINER_PATH)
Definition: EGrabberRecorder.h:90
FnRecorderGetParameterInteger getParameterInteger
Definition: EGrabberRecorder.h:367