adtf_file_library
0.13.2
|
#include <indexedfilereader_v100.h>
Public Types | |
enum | { flag_none = 0x0 , flag_disable_file_system_cache = 0x1 } |
![]() | |
enum | { tf_chunk_index = 1 , tf_chunk_time = 2 } |
typedef struct ifhd::v100::IndexedFileV100::TagDateTime | DateTime |
typedef struct ifhd::v100::IndexedFileV100::TagFileHeader | FileHeader |
typedef struct ifhd::v100::IndexedFileV100::TagChunkHeader | ChunkHeader |
Public Member Functions | |
IndexedFileReaderV100 () | |
~IndexedFileReaderV100 () | |
void | attach (FileHeader *file_header, utils5ext::File *file, uint32_t flags=0) |
void | detach () |
void | reset () |
int64_t | seek (int64_t position, int time_format, uint32_t flags=0) |
int64_t | seekFlags (uint32_t flags, ChunkHeader **chunk) |
int64_t | getCurrentPos (int time_format) const |
int64_t | setCurrentPos (int64_t position, int time_format) |
void | queryChunkInfo (ChunkHeader **chunk_info) |
void | readChunk (void **data) |
void | skipChunk () |
void | readNextChunk (ChunkHeader **chunk_info, void **data) |
int64_t | getFilePos () const |
int64_t | getChunkCount () const |
int64_t | getIndexCount () const |
timestamp_t | getDuration () const |
uint32_t | getVersionId () const |
int64_t | internalGetIndex () const |
FileHeader * | internalGetFileHeader () const |
![]() | |
IndexedFileV100 () | |
~IndexedFileV100 () | |
void | close () |
void | setDescription (const std::string &description) |
std::string | getDescription () const |
void | setDateTime (const DateTime &date_time) |
DateTime | getDateTime () |
void | allocHeaderExtension (int size) |
void | freeHeaderExtension () |
void | getHeaderExtension (void **data, int *data_size) |
void | setHeaderExtension (void *data, int data_size) |
Protected Member Functions | |
void | initialize () |
void | readFileHeader () |
void | readFileHeaderExt () |
void | readIndexTable () |
![]() | |
void | initialize () |
void | allocBuffer (int size) |
void | freeBuffer () |
void | allocIndexTable (int size) |
void | freeIndexTable () |
void | appendIndex (uint64_t pos, timestamp_t time_stamp) |
void | allocIndexBlock (int count=-1) |
void | allocHeader () |
void | freeHeader () |
void | allocCache (int size) |
void | freeCache () |
void * | getCacheAddr () |
int | getSectorSize (const std::string &filename) const |
void * | internalMalloc (int size) |
void | internalFree (void *memory) |
Protected Attributes | |
uint32_t | _flags |
flag value to attach | |
ChunkHeader * | _index_table |
index table | |
int | _index_table_size |
size of index table | |
int64_t | _end_of_data_marker |
endmarker for data | |
![]() | |
bool | _attached |
File attached? | |
int | _sector_size |
Sector size. | |
utils5ext::File * | _file |
File pointer. | |
int64_t | _index |
Current index. | |
int64_t | _file_pos |
Current file position. | |
uint8_t * | _buffer |
Internal buffer. | |
int | _buffer_size |
Buffer size. | |
IndexBlockItem * | _index_blocks |
Pointer to index blocks. | |
IndexBlockItem * | _active_index_block |
Pointer to current index block. | |
FileHeader * | _file_header |
File header. | |
void * | _header_extension |
Header extension. | |
void * | _cache |
Pointer to cache. | |
int | _cache_size |
Cache size. | |
bool | _write_mode |
Write mode enabled? | |
Additional Inherited Members | |
![]() | |
typedef struct ifhd::v100::IndexedFileV100::TagIndexBlockItem | IndexBlockItem |
![]() | |
static int | _default_block_size |
Default block size. | |
static int | _default_cache_size |
Default cache size. | |
static int | _index_table_cluster_size |
Size of index table clusters. | |
Class for reading indexed file in version 100
ifhd::v100::IndexedFileReaderV100::IndexedFileReaderV100 | ( | ) |
Default constructor.
ifhd::v100::IndexedFileReaderV100::~IndexedFileReaderV100 | ( | ) |
Destructor.
void ifhd::v100::IndexedFileReaderV100::attach | ( | FileHeader * | file_header, |
utils5ext::File * | file, | ||
uint32_t | flags = 0 |
||
) |
Attaches the reader to an already opened file.
file_header | [in] The file header. |
file | [in] The file. |
flags | [in] Unused. |
void ifhd::v100::IndexedFileReaderV100::detach | ( | ) |
Detaches the reader from a file.
int64_t ifhd::v100::IndexedFileReaderV100::getChunkCount | ( | ) | const |
Returns the number of chunks of the current file
int64_t ifhd::v100::IndexedFileReaderV100::getCurrentPos | ( | int | time_format | ) | const |
Returns the current file position (Index or TimeStamp)
time_format | Format of position (TF_ChunkTime / TF_ChunkIndex); |
timestamp_t ifhd::v100::IndexedFileReaderV100::getDuration | ( | ) | const |
Returns the duration of the current file [microsec]
int64_t ifhd::v100::IndexedFileReaderV100::getFilePos | ( | ) | const |
Returns the current index of the IndexTable
int64_t ifhd::v100::IndexedFileReaderV100::getIndexCount | ( | ) | const |
Returns the number of indexes of the current file
uint32_t ifhd::v100::IndexedFileReaderV100::getVersionId | ( | ) | const |
Returns the Version ID of the current file
|
protected |
internal initialize
FileHeader* ifhd::v100::IndexedFileReaderV100::internalGetFileHeader | ( | ) | const |
get the internal file header pointer
int64_t ifhd::v100::IndexedFileReaderV100::internalGetIndex | ( | ) | const |
Get the internal current index
void ifhd::v100::IndexedFileReaderV100::queryChunkInfo | ( | ChunkHeader ** | chunk_info | ) |
Returns the current ChunkInfo from IndexTable
chunk_info | [out] Current chunk info struct |
void ifhd::v100::IndexedFileReaderV100::readChunk | ( | void ** | data | ) |
Reads and returns the next Chunk and increments the IndexTable index
data | [out] Current chunk data |
|
protected |
read the file header
|
protected |
read file header extension
|
protected |
read the index table
void ifhd::v100::IndexedFileReaderV100::readNextChunk | ( | ChunkHeader ** | chunk_info, |
void ** | data | ||
) |
Reads and returns the next Chunk and ChunkInfo struct and increments the IndexTable index
chunk_info | [out] Current chunk info |
data | [out] Current chunk data |
void ifhd::v100::IndexedFileReaderV100::reset | ( | ) |
Resets the file to the beginning of data
int64_t ifhd::v100::IndexedFileReaderV100::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 | New file position to set |
time_format | time format (time or index) |
flags | flags |
int64_t ifhd::v100::IndexedFileReaderV100::seekFlags | ( | uint32_t | flags, |
ChunkHeader ** | chunk | ||
) |
Increments the file index until seeked chunk flags found
flags | Flags for seeking |
chunk | Returns the chunk header of the next chunk with the flags (see IndexedFileV100::SeekFlags) |
int64_t ifhd::v100::IndexedFileReaderV100::setCurrentPos | ( | int64_t | position, |
int | time_format | ||
) |
Sets the file position by Index or by TimeStamp
position | New file position |
time_format | Format of position (TF_ChunkTime / TF_ChunkIndex); |
void ifhd::v100::IndexedFileReaderV100::skipChunk | ( | ) |
Skips the next Chunk by incrementing the IndexTable index and setting the new FilePosition