Disk file I/O class.
More...
#include <diskio.h>
|
| virtual VIRTUALTYPE | type () const override |
| | Get type of the virtual file.
|
| |
| virtual size_t | bufsize () const override |
| | Get the ideal buffer size.
|
| |
| virtual int | openio (LPVIRTUALFILE virtualfile) override |
| | Open a file.
|
| |
| virtual size_t | readio (void *data, size_t size) override |
| | Read data from file.
|
| |
| virtual int | error () const override |
| | Get last error.
|
| |
| virtual int64_t | duration () const override |
| | Get the duration of the file, in AV_TIME_BASE fractional seconds.
|
| |
| virtual size_t | size () const override |
| | Get the file size.
|
| |
| virtual size_t | tell () const override |
| | Get current read position.
|
| |
| virtual int | seek (int64_t offset, int whence) override |
| | Seek to position in file.
|
| |
| virtual bool | eof () const override |
| | Check if at end of file.
|
| |
| virtual void | closeio () override |
| | Close virtual file.
|
| |
| | FileIO () |
| | Create FileIO object.
|
| |
|
virtual | ~FileIO ()=default |
| | Free FileIO object.
|
| |
| LPVIRTUALFILE | virtualfile () |
| | Get virtual file object.
|
| |
| const std::string & | filename () const |
| | Get source filename.
|
| |
| const std::string & | path () const |
| | Path to source file (without file name)
|
| |
|
| FILE * | m_fpi |
| | File pointer to source media.
|
| |
|
| void | pvt_close () |
| | Close virtual file. Non-virtual version to be safely called from constructor/destructor.
|
| |
Disk file I/O class.
Definition at line 41 of file diskio.h.
◆ DiskIO()
◆ ~DiskIO()
◆ bufsize()
| size_t DiskIO::bufsize |
( |
| ) |
const |
|
overridevirtual |
Get the ideal buffer size.
- Returns
- Return the ideal buffer size.
Implements FileIO.
Definition at line 53 of file diskio.cc.
◆ closeio()
◆ duration()
| int64_t DiskIO::duration |
( |
| ) |
const |
|
overridevirtual |
Get the duration of the file, in AV_TIME_BASE fractional seconds.
Not applicable to generic disk files, always returns AV_NOPTS_VALUE.
Implements FileIO.
Definition at line 86 of file diskio.cc.
◆ eof()
| bool DiskIO::eof |
( |
| ) |
const |
|
overridevirtual |
Check if at end of file.
- Returns
- Returns true if at end of file.
Implements FileIO.
Definition at line 114 of file diskio.cc.
References m_fpi.
◆ error()
| int DiskIO::error |
( |
| ) |
const |
|
overridevirtual |
Get last error.
- Returns
- errno value of last error.
Implements FileIO.
Definition at line 81 of file diskio.cc.
References m_fpi.
◆ openio()
◆ pvt_close()
| void DiskIO::pvt_close |
( |
| ) |
|
|
private |
Close virtual file. Non-virtual version to be safely called from constructor/destructor.
Definition at line 124 of file diskio.cc.
References m_fpi.
Referenced by closeio().
◆ readio()
| size_t DiskIO::readio |
( |
void * |
data, |
|
|
size_t |
size |
|
) |
| |
|
overridevirtual |
Read data from file.
- Parameters
-
| [out] | data | - buffer to store read bytes in. Must be large enough to hold up to size bytes. |
| [in] | size | - number of bytes to read |
- Returns
- Upon successful completion, readio() returns the number of bytes read.
This may be less than size.
On error, the value 0 is returned and errno is set to indicate the error.
If at end of file, 0 may be returned by errno not set. error() will return 0 if at EOF.
Implements FileIO.
Definition at line 76 of file diskio.cc.
References m_fpi, and size().
◆ seek()
| int DiskIO::seek |
( |
int64_t |
offset, |
|
|
int |
whence |
|
) |
| |
|
overridevirtual |
Seek to position in file.
Repositions the offset of the open file to the argument offset according to the directive whence.
- Parameters
-
| [in] | offset | - offset in bytes |
| [in] | whence | - how to seek:
SEEK_SET: The offset is set to offset bytes.
SEEK_CUR: The offset is set to its current location plus offset bytes.
SEEK_END: The offset is set to the size of the file plus offset bytes. |
- Returns
- Upon successful completion, seek() returns the resulting offset location as measured in bytes from the beginning of the file.
On error, the value -1 is returned and errno is set to indicate the error.
Implements FileIO.
Definition at line 109 of file diskio.cc.
References m_fpi.
◆ size()
| size_t DiskIO::size |
( |
| ) |
const |
|
overridevirtual |
Get the file size.
- Returns
- Returns the file size.
Implements FileIO.
Definition at line 91 of file diskio.cc.
References m_fpi.
Referenced by readio().
◆ tell()
| size_t DiskIO::tell |
( |
| ) |
const |
|
overridevirtual |
Get current read position.
- Returns
- Gets the current read position.
Implements FileIO.
Definition at line 104 of file diskio.cc.
References m_fpi.
◆ type()
Get type of the virtual file.
- Returns
- Returns the type of the virtual file.
Implements FileIO.
Definition at line 48 of file diskio.cc.
References DISK.
◆ m_fpi
The documentation for this class was generated from the following files: