adtf_file_library
0.13.2
|
#include <indexedfilereader_v110.h>
Public Member Functions | |
IndexedFileReaderV110 () | |
~IndexedFileReaderV110 () | |
void | attach (utils5ext::File *file, const a_util::filesystem::Path &file_name, int cache_size=-1, uint32_t flags=0) |
void | close () |
void | reset () |
int64_t | getCurrentPos (int time_format) const |
int64_t | setCurrentPos (int64_t position, int time_format) |
int64_t | getChunkIndexForIndexPos (int64_t index_pos) const |
int64_t | getChunkIndexForIndexPos () const |
int64_t | seek (int64_t position, int time_format, uint32_t flags=0) |
void | queryChunkInfo (ChunkHeader **chunk_header) |
void | readChunk (void **data) |
void | skipChunk () |
void | readNextChunk (ChunkHeader **chunk_header, void **data) |
void | skipChunkInfo () |
void | readNextChunkInfo (ChunkHeader **chunk_header) |
int64_t | getFilePos () const |
int64_t | getChunkCount () const |
int64_t | getIndexCount () const |
timestamp_t | getDuration () const |
uint32_t | getVersionId () const |
bool | findExtension (const std::string &identifier, FileExtension **extension_info, void **data) const |
void | getExtension (int index, FileExtension **extension_info, void **data) const |
![]() | |
IndexedFileV110 () | |
~IndexedFileV110 () | |
void | close () |
void | setDescription (const std::string &description) |
std::string | getDescription () const |
void | setDateTime (const a_util::datetime::DateTime *date_time) |
void | getDateTime (a_util::datetime::DateTime *date_time) const |
int | getExtensionCount () const |
bool | findExtension (const std::string &identifier, FileExtension **extension_info, void **data) const |
void | getExtension (int index, FileExtension **extension_info, void **data) const |
void | appendExtension (const std::string &identifier, const void *data, int data_size, uint32_t type_id=0, uint32_t version_id=0) |
void | appendExtension (const void *data, const FileExtension *extension_info) |
void | freeExtensions () |
void | getHeader (FileHeader **file_header) const |
Protected Member Functions | |
void | initialize () |
void | readFileHeader () |
void | readFileHeaderExt () |
void | readIndexTable () |
int64_t | lookupChunkRef (int64_t position, int time_format) |
void | readCurrentChunkHeader () |
void | readCurrentChunkData () |
void | setEOF () |
void | readDataBlock (void *buffer, long buffer_size) |
void | checkFilePtr () |
void | allocReadBuffers () |
void | freeReadBuffers () |
![]() | |
void | initialize () |
void | allocBuffer (int size) |
void | freeBuffer () |
void | appendIndex (uint64_t pos, timestamp_t time_stamp) |
void | allocIndexBlock (int count=-1) |
void | freeIndexTable () |
void | allocHeader () |
void | freeHeader () |
void | allocExtensionPage (utils5ext::FileSize size, void **data) |
void | allocCache (int size) |
void | freeCache () |
void * | getCacheAddr () |
int | getSectorSize (const a_util::filesystem::Path &filename) const |
void * | internalMalloc (int size) |
void | internalFree (void *memory) |
Protected Attributes | |
uint32_t | _flags |
internal flags | |
IndexedFileV110::ChunkRef * | _index_table |
index table | |
int | _index_table_size |
index table size (amount of entries) | |
int64_t | _end_of_data_marker |
end of data marker | |
bool | _file_pos_invalid |
validation state of file position | |
IndexedFileV110::ChunkHeader * | _current_chunk |
current chunk header pointer | |
void * | _current_chunk_data |
current chank data size in bytes | |
bool | _header_valid |
validation state of chunk header | |
bool | _data_valid |
validation state of chunk data | |
bool | _prefetched |
prefechted state of chunk | |
int64_t | _chunk_index |
current chunk index | |
int64_t | _index_table_index |
current index table index position | |
bool | _compatibility_v100 |
reader in compatibility state | |
void * | _delegate |
delegate object for compatibility | |
IndexedFileV110::FileExtension | _extension_info_v100 |
compatibility file extension | |
![]() | |
int | _sector_size |
current sector size in bytes | |
utils5ext::File * | _file |
the file pointer | |
FilePos | _file_pos |
current file pos | |
uint8_t * | _buffer |
current data buffer reference | |
int | _buffer_size |
current data buffer size in bytes | |
IndexBlockItem * | _index_blocks |
indexed table reference | |
IndexBlockItem * | _active_index_block |
current index block | |
FileHeader * | _file_header |
file header | |
FileExtensionList | _extensions |
file extension references | |
void * | _cache |
current cache buffer | |
int | _cache_size |
current cache size | |
bool | _write_mode |
writing or reading mode | |
Class for reading indexed file in version 110
ifhd::v110::IndexedFileReaderV110::IndexedFileReaderV110 | ( | ) |
Default constructor.
ifhd::v110::IndexedFileReaderV110::~IndexedFileReaderV110 | ( | ) |
Destructor.
|
protected |
allocate the internal reader buffers
void ifhd::v110::IndexedFileReaderV110::attach | ( | utils5ext::File * | file, |
const a_util::filesystem::Path & | file_name, | ||
int | cache_size = -1 , |
||
uint32_t | flags = 0 |
||
) |
This function attaches a dat-file for reading
file | [in] the file where |
file_name | [in] the filename of the file to be attached |
cache_size | [in] cache size; <=0: use system file caching (=default) |
flags | [in] additional flags |
|
protected |
file pointer check
void ifhd::v110::IndexedFileReaderV110::close | ( | ) |
Closes all
bool ifhd::v110::IndexedFileReaderV110::findExtension | ( | const std::string & | identifier, |
FileExtension ** | extension_info, | ||
void ** | data | ||
) | const |
Finds an extension with a specific identifier.
identifier | [in] The identifier of the extension |
extension_info | [out] The extension info data. |
data | [out] The extension data. |
|
protected |
free the internal reader buffers
int64_t ifhd::v110::IndexedFileReaderV110::getChunkCount | ( | ) | const |
Returns the number of chunks of the current file
int64_t ifhd::v110::IndexedFileReaderV110::getChunkIndexForIndexPos | ( | ) | const |
Get the current index position.
int64_t ifhd::v110::IndexedFileReaderV110::getChunkIndexForIndexPos | ( | int64_t | index_pos | ) | const |
Returns the chunk index of an entry in the index table.
index_pos | [in] The index of the entry in the index table. |
int64_t ifhd::v110::IndexedFileReaderV110::getCurrentPos | ( | int | time_format | ) | const |
Returns the current file position (Index or TimeStamp)
time_format | [in] Format of position (TF_ChunkTime / TF_ChunkIndex); |
timestamp_t ifhd::v110::IndexedFileReaderV110::getDuration | ( | ) | const |
Returns the duration of the current file [microsec]
void ifhd::v110::IndexedFileReaderV110::getExtension | ( | int | index, |
FileExtension ** | extension_info, | ||
void ** | data | ||
) | const |
Get an extension with a specific index.
index | [in] The index of the extension. |
extension_info | [out] The extension info data. |
data | [out] The extension data. |
int64_t ifhd::v110::IndexedFileReaderV110::getFilePos | ( | ) | const |
Returns the current index of the IndexTable
int64_t ifhd::v110::IndexedFileReaderV110::getIndexCount | ( | ) | const |
Get the amount of indexes in the file.
uint32_t ifhd::v110::IndexedFileReaderV110::getVersionId | ( | ) | const |
Returns the Version ID of the current file
|
protected |
internal initialize
|
protected |
Lookup for index table entry by time or by
position | Position (time or index) |
time_format | Time format flag (ifhd::v10::IndexedFileV110::tf_chunk_index or ifhd::v110::IndexedFileV110::tf_chunk_time) |
void ifhd::v110::IndexedFileReaderV110::queryChunkInfo | ( | ChunkHeader ** | chunk_header | ) |
Returns the current ChunkInfo from IndexTable
chunk_header | [out] Current chunk info struct |
void ifhd::v110::IndexedFileReaderV110::readChunk | ( | void ** | data | ) |
Reads and returns the next Chunk and increments the IndexTable index
data | [out] Current chunk data |
|
protected |
read the current chunk data
|
protected |
read the current chunk header
|
protected |
read a data block into the given buffer
buffer | Pointer to buffer |
buffer_size | Size of buffer in bytes |
|
protected |
read the file header
|
protected |
read the file header extension
|
protected |
read the index table
void ifhd::v110::IndexedFileReaderV110::readNextChunk | ( | ChunkHeader ** | chunk_header, |
void ** | data | ||
) |
Reads and returns the next Chunk and ChunkInfo struct and increments the IndexTable index
chunk_header | [out] Current chunk info |
data | [out] Current chunk data |
void ifhd::v110::IndexedFileReaderV110::readNextChunkInfo | ( | ChunkHeader ** | chunk_header | ) |
Reads the next chunk info
chunk_header | [out] Will point to the chunk info. |
void ifhd::v110::IndexedFileReaderV110::reset | ( | ) |
Resets the file to the beginning of data
int64_t ifhd::v110::IndexedFileReaderV110::seek | ( | int64_t | position, |
int | time_format, | ||
uint32_t | flags = 0 |
||
) |
Sets the file position to the Chunk of index and returns the respective ChunkInfo
position | the new file position |
time_format | the format of position |
flags | a SeekFlags value |
int64_t ifhd::v110::IndexedFileReaderV110::setCurrentPos | ( | int64_t | position, |
int | time_format | ||
) |
Sets the file position by Index or by TimeStamp
position | [in] New file position |
time_format | [in] Format of position (TF_ChunkTime / TF_ChunkIndex); |
|
protected |
set end of file state to EOF.
void ifhd::v110::IndexedFileReaderV110::skipChunk | ( | ) |
Skips the next Chunk by incrementing the IndexTable index and setting the new FilePosition
void ifhd::v110::IndexedFileReaderV110::skipChunkInfo | ( | ) |
Skips the next chunk info