FFmpegfs Fuse Multi Media Filesystem 2.16
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
DiskIO Class Reference

Disk file I/O class. More...

#include <diskio.h>

Inheritance diagram for DiskIO:
Inheritance graph
[legend]
Collaboration diagram for DiskIO:
Collaboration graph
[legend]

Public Member Functions

virtual VIRTUALTYPE type () const override
 Get type of the virtual file. More...
 
virtual size_t bufsize () const override
 Get the ideal buffer size. More...
 
virtual int openio (LPVIRTUALFILE virtualfile) override
 Open a file. More...
 
virtual size_t readio (void *data, size_t size) override
 Read data from file. More...
 
virtual int error () const override
 Get last error. More...
 
virtual int64_t duration () const override
 Get the duration of the file, in AV_TIME_BASE fractional seconds. More...
 
virtual size_t size () const override
 Get the file size. More...
 
virtual size_t tell () const override
 Get current read position. More...
 
virtual int seek (int64_t offset, int whence) override
 Seek to position in file. More...
 
virtual bool eof () const override
 Check if at end of file. More...
 
virtual void closeio () override
 Close virtual file. More...
 
- Public Member Functions inherited from FileIO
 FileIO ()
 Create FileIO object. More...
 
virtual ~FileIO ()=default
 Free FileIO object.
 
virtual VIRTUALTYPE type () const =0
 Get type of the virtual file. More...
 
virtual size_t bufsize () const =0
 Get the ideal buffer size. More...
 
virtual int openio (LPVIRTUALFILE virtualfile)=0
 Open a virtual file. More...
 
virtual size_t readio (void *data, size_t size)=0
 Read data from a file. More...
 
virtual int error () const =0
 Get last error. More...
 
virtual int64_t duration () const =0
 Get the duration of the file, in AV_TIME_BASE fractional seconds. More...
 
virtual size_t size () const =0
 Get the file size. More...
 
virtual size_t tell () const =0
 Get current read position. More...
 
virtual int seek (int64_t offset, int whence)=0
 Seek to position in file. More...
 
virtual bool eof () const =0
 Check if at end of file. More...
 
virtual void closeio ()=0
 Close virtual file. More...
 
LPVIRTUALFILE virtualfile ()
 Get virtual file object. More...
 
const std::string & filename () const
 Get source filename. More...
 
const std::string & path () const
 Path to source file (without file name) More...
 

Protected Attributes

FILE * m_fpi
 File pointer to source media. More...
 

Private Member Functions

void pvt_close ()
 Close virtual file. Non-virtual version to be safely called from constructor/destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from FileIO
static std::shared_ptr< FileIOalloc (VIRTUALTYPE type)
 Allocate the correct object for type(). More...
 
- Protected Member Functions inherited from FileIO
void set_virtualfile (LPVIRTUALFILE virtualfile)
 Set the virtual file object. More...
 

Detailed Description

Disk file I/O class.

Definition at line 41 of file diskio.h.

Constructor & Destructor Documentation

◆ DiskIO()

DiskIO::DiskIO ( )
explicit

Definition at line 37 of file diskio.cc.

◆ ~DiskIO()

DiskIO::~DiskIO ( )
virtual

Definition at line 43 of file diskio.cc.

Member Function Documentation

◆ 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()

void DiskIO::closeio ( )
overridevirtual

Close virtual file.

Implements FileIO.

Definition at line 119 of file diskio.cc.

References pvt_close().

◆ 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()

int DiskIO::openio ( LPVIRTUALFILE  virtualfile)
overridevirtual

Open a file.

Parameters
[in]virtualfile- LPCVIRTUALFILE of file to open
Returns
Upon successful completion, openio() returns 0.
On error, an nonzero value is returned and errno is set to indicate the error.

Implements FileIO.

Definition at line 58 of file diskio.cc.

References Logging::debug(), m_fpi, VIRTUALFILE::m_origfile, FileIO::set_virtualfile(), and FileIO::virtualfile().

◆ 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()

VIRTUALTYPE DiskIO::type ( ) const
overridevirtual

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.

Member Data Documentation

◆ m_fpi

FILE* DiskIO::m_fpi
protected

File pointer to source media.

Definition at line 125 of file diskio.h.

Referenced by eof(), error(), openio(), pvt_close(), readio(), seek(), size(), and tell().


The documentation for this class was generated from the following files: