A simple wrapper class that will open a file and allow easy reading/writing of DTSC data from/to it.
More...
#include <dtsc.h>
|
| File () |
|
| File () |
|
| File (const File &rhs) |
|
| File (const File &rhs) |
|
| File (std::string filename, bool create=false) |
| Open a filename for DTSC reading/writing. More...
|
|
| File (std::string filename, bool create=false) |
|
| ~File () |
| Close the file if open. More...
|
|
| ~File () |
|
long long int | addHeader (std::string &header) |
|
long long int | addHeader (std::string &header) |
| Adds the given string as a new header to the end of the file. More...
|
|
bool | atKeyframe () |
|
bool | atKeyframe () |
|
long int | getBytePos () |
|
long int | getBytePos () |
|
long int | getBytePosEOF () |
|
long int | getBytePosEOF () |
|
long long int | getLastReadPos () |
| Returns the byte positon of the start of the last packet that was read. More...
|
|
long long int | getLastReadPos () |
|
Meta & | getMeta () |
| Returns the header metadata for this file as JSON::Value. More...
|
|
Meta & | getMeta () |
|
DTSC::Packet & | getPacket () |
| Returns the internal buffer of the last read packet in raw binary format. More...
|
|
DTSC::Packet & | getPacket () |
|
| operator bool () const |
|
| operator bool () const |
|
File & | operator= (const File &rhs) |
|
File & | operator= (const File &rhs) |
|
void | parseNext () |
|
void | parseNext () |
|
bool | reachedEOF () |
|
bool | reachedEOF () |
|
void | rewritePacket (std::string &newPacket, int bytePos) |
|
void | rewritePacket (std::string &newPacket, int bytePos) |
|
bool | seek_bpos (int bpos) |
|
bool | seek_bpos (int bpos) |
|
bool | seek_time (unsigned int ms) |
| Attempts to seek to the given time in ms within the file. More...
|
|
bool | seek_time (unsigned int ms) |
|
bool | seek_time (unsigned int ms, unsigned int trackNo, bool forceSeek=false) |
|
bool | seek_time (unsigned int ms, unsigned int trackNo, bool forceSeek=false) |
|
void | seekNext () |
|
void | seekNext () |
| Reads the packet available at the current file position. More...
|
|
void | selectTracks (std::set< unsigned long > &tracks) |
|
void | selectTracks (std::set< unsigned long > &tracks) |
|
bool | writeHeader (std::string &header, bool force=false) |
| (Re)writes the given string to the header area if the size is the same as the existing header. More...
|
|
bool | writeHeader (std::string &header, bool force=false) |
|
void | writePacket (std::string &newPacket) |
|
void | writePacket (std::string &newPacket) |
|
void | writePacket (JSON::Value &newPacket) |
|
void | writePacket (JSON::Value &newPacket) |
|
A simple wrapper class that will open a file and allow easy reading/writing of DTSC data from/to it.
DTSC::File::File |
( |
const File & |
rhs | ) |
|
DTSC::File::File |
( |
std::string |
filename, |
|
|
bool |
create = false |
|
) |
| |
Open a filename for DTSC reading/writing.
If create is true and file does not exist, attempt to create.
DTSC::File::File |
( |
const File & |
rhs | ) |
|
DTSC::File::File |
( |
std::string |
filename, |
|
|
bool |
create = false |
|
) |
| |
long long int DTSC::File::addHeader |
( |
std::string & |
header | ) |
|
Adds the given string as a new header to the end of the file.
- Returns
- The positon the header was written at, or 0 on failure.
long long int DTSC::File::addHeader |
( |
std::string & |
header | ) |
|
bool DTSC::File::atKeyframe |
( |
| ) |
|
bool DTSC::File::atKeyframe |
( |
| ) |
|
long int DTSC::File::getBytePos |
( |
| ) |
|
long int DTSC::File::getBytePos |
( |
| ) |
|
long int DTSC::File::getBytePosEOF |
( |
| ) |
|
long int DTSC::File::getBytePosEOF |
( |
| ) |
|
long long int DTSC::File::getLastReadPos |
( |
| ) |
|
long long int DTSC::File::getLastReadPos |
( |
| ) |
|
Returns the byte positon of the start of the last packet that was read.
Returns the header metadata for this file as JSON::Value.
Meta& DTSC::File::getMeta |
( |
| ) |
|
Returns the internal buffer of the last read packet in raw binary format.
DTSC::File::operator bool |
( |
| ) |
const |
DTSC::File::operator bool |
( |
| ) |
const |
File& DTSC::File::operator= |
( |
const File & |
rhs | ) |
|
void DTSC::File::parseNext |
( |
| ) |
|
void DTSC::File::parseNext |
( |
| ) |
|
bool DTSC::File::reachedEOF |
( |
| ) |
|
bool DTSC::File::reachedEOF |
( |
| ) |
|
void DTSC::File::readHeader |
( |
int |
pos | ) |
|
|
private |
Reads the header at the given file position.
If the packet could not be read for any reason, the reason is printed. Reading the header means the file position is moved to after the header.
void DTSC::File::readHeader |
( |
int |
pos | ) |
|
|
private |
void DTSC::File::rewritePacket |
( |
std::string & |
newPacket, |
|
|
int |
bytePos |
|
) |
| |
void DTSC::File::rewritePacket |
( |
std::string & |
newPacket, |
|
|
int |
bytePos |
|
) |
| |
bool DTSC::File::seek_bpos |
( |
int |
bpos | ) |
|
bool DTSC::File::seek_bpos |
( |
int |
bpos | ) |
|
bool DTSC::File::seek_time |
( |
unsigned int |
ms | ) |
|
bool DTSC::File::seek_time |
( |
unsigned int |
ms | ) |
|
Attempts to seek to the given time in ms within the file.
Returns true if successful, false otherwise.
bool DTSC::File::seek_time |
( |
unsigned int |
ms, |
|
|
unsigned int |
trackNo, |
|
|
bool |
forceSeek = false |
|
) |
| |
bool DTSC::File::seek_time |
( |
unsigned int |
ms, |
|
|
unsigned int |
trackNo, |
|
|
bool |
forceSeek = false |
|
) |
| |
void DTSC::File::seekNext |
( |
| ) |
|
void DTSC::File::seekNext |
( |
| ) |
|
Reads the packet available at the current file position.
If the packet could not be read for any reason, the reason is printed. Reading the packet means the file position is increased to the next packet.
void DTSC::File::selectTracks |
( |
std::set< unsigned long > & |
tracks | ) |
|
void DTSC::File::selectTracks |
( |
std::set< unsigned long > & |
tracks | ) |
|
bool DTSC::File::writeHeader |
( |
std::string & |
header, |
|
|
bool |
force = false |
|
) |
| |
(Re)writes the given string to the header area if the size is the same as the existing header.
Forces a write if force is set to true.
bool DTSC::File::writeHeader |
( |
std::string & |
header, |
|
|
bool |
force = false |
|
) |
| |
void DTSC::File::writePacket |
( |
std::string & |
newPacket | ) |
|
void DTSC::File::writePacket |
( |
std::string & |
newPacket | ) |
|
void DTSC::File::writePacket |
( |
JSON::Value & |
newPacket | ) |
|
void DTSC::File::writePacket |
( |
JSON::Value & |
newPacket | ) |
|
void * DTSC::File::buffer |
|
private |
int DTSC::File::currframe |
|
private |
long long int DTSC::File::currtime |
|
private |
long int DTSC::File::endPos |
|
private |
unsigned long DTSC::File::headerSize |
|
private |
long long int DTSC::File::lastreadpos |
|
private |
Meta DTSC::File::metadata |
|
private |
std::set< unsigned long > DTSC::File::selectedTracks |
|
private |
std::map< unsigned int, std::string > DTSC::File::trackMapping |
|
private |
The documentation for this class was generated from the following files: