Base class for I/O.
More...
#include <fileio.h>
|
| | FileIO () |
| | Create FileIO object.
|
| |
|
virtual | ~FileIO ()=default |
| | Free FileIO object.
|
| |
| virtual VIRTUALTYPE | type () const =0 |
| | Get type of the virtual file.
|
| |
| virtual size_t | bufsize () const =0 |
| | Get the ideal buffer size.
|
| |
| virtual int | openio (LPVIRTUALFILE virtualfile)=0 |
| | Open a virtual file.
|
| |
| virtual size_t | readio (void *data, size_t size)=0 |
| | Read data from a file.
|
| |
| virtual int | error () const =0 |
| | Get last error.
|
| |
| virtual int64_t | duration () const =0 |
| | Get the duration of the file, in AV_TIME_BASE fractional seconds.
|
| |
| virtual size_t | size () const =0 |
| | Get the file size.
|
| |
| virtual size_t | tell () const =0 |
| | Get current read position.
|
| |
| virtual int | seek (int64_t offset, int whence)=0 |
| | Seek to position in file.
|
| |
| virtual bool | eof () const =0 |
| | Check if at end of file.
|
| |
| virtual void | closeio ()=0 |
| | Close virtual file.
|
| |
| 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)
|
| |
Base class for I/O.
Definition at line 259 of file fileio.h.
◆ FileIO()
◆ alloc()
◆ bufsize()
| virtual size_t FileIO::bufsize |
( |
| ) |
const |
|
pure virtual |
◆ closeio()
| virtual void FileIO::closeio |
( |
| ) |
|
|
pure virtual |
◆ duration()
| virtual int64_t FileIO::duration |
( |
| ) |
const |
|
pure virtual |
Get the duration of the file, in AV_TIME_BASE fractional seconds.
This is only possible for file formats that are aware of the play time. May be AV_NOPTS_VALUE if the time is not known.
Implemented in BlurayIO, Buffer, DiskIO, DvdIO, and VcdIO.
◆ eof()
| virtual bool FileIO::eof |
( |
| ) |
const |
|
pure virtual |
◆ error()
| virtual int FileIO::error |
( |
| ) |
const |
|
pure virtual |
◆ filename()
| const std::string & FileIO::filename |
( |
| ) |
const |
◆ openio()
Open a virtual file.
- Parameters
-
| [in] | virtualfile | - LPCVIRTUALFILE of file to open. |
- Returns
- Upon successful completion, openio() returns 0.
On error, a nonzero value is returned and errno is set to indicate the error.
Implemented in BlurayIO, Buffer, DiskIO, DvdIO, and VcdIO.
◆ path()
| const std::string & FileIO::path |
( |
| ) |
const |
◆ readio()
| virtual size_t FileIO::readio |
( |
void * |
data, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
Read data from a file.
- Parameters
-
| [out] | data | - A buffer to store read bytes in. It must be large enough to hold up to size bytes. |
| [in] | size | - The 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 the end of the file, 0 may be returned but errno is not set. error() will return 0 if at EOF.
Implemented in BlurayIO, Buffer, DiskIO, DvdIO, and VcdIO.
Referenced by FFmpeg_Transcoder::input_read().
◆ seek()
| virtual int FileIO::seek |
( |
int64_t |
offset, |
|
|
int |
whence |
|
) |
| |
|
pure virtual |
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.
Implemented in BlurayIO, Buffer, DiskIO, DvdIO, and VcdIO.
Referenced by FFmpeg_Transcoder::seek().
◆ set_virtualfile()
◆ size()
| virtual size_t FileIO::size |
( |
| ) |
const |
|
pure virtual |
◆ tell()
| virtual size_t FileIO::tell |
( |
| ) |
const |
|
pure virtual |
◆ type()
◆ virtualfile()
Get virtual file object.
- Returns
- Current virtual file object or nullptr if unset.
Definition at line 113 of file fileio.cc.
References m_virtualfile.
Referenced by FFmpeg_Transcoder::encode_finish(), Buffer::have_frame(), Buffer::init(), BlurayIO::openio(), Buffer::openio(), DiskIO::openio(), DvdIO::openio(), VcdIO::openio(), Buffer::read_frame(), set_virtualfile(), and Buffer::write_frame().
◆ m_path
| std::string FileIO::m_path |
|
private |
◆ m_virtualfile
The documentation for this class was generated from the following files: