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

Video CD and Super Video CD I/O class. More...

#include <vcdio.h>

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

Public Member Functions

 VcdIO ()
 Create VcdIO object. More...
 
virtual ~VcdIO ()
 Free VcdIO object. More...
 
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 virtual 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...
 
bool m_full_title
 If true, ignore m_chapter_no and provide full track. More...
 
int m_track_no
 Track number (1..) More...
 
int m_chapter_no
 Chapter number (1..) More...
 
uint64_t m_start_pos
 Start offset in bytes. More...
 
uint64_t m_end_pos
 End offset in bytes (not including this byte) 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

Video CD and Super Video CD I/O class.

Definition at line 45 of file vcdio.h.

Constructor & Destructor Documentation

◆ VcdIO()

VcdIO::VcdIO ( )
explicit

Create VcdIO object.

Definition at line 41 of file vcdio.cc.

◆ ~VcdIO()

VcdIO::~VcdIO ( )
virtual

Free VcdIO object.

Close file pointers

Definition at line 52 of file vcdio.cc.

References pvt_close().

Member Function Documentation

◆ bufsize()

size_t VcdIO::bufsize ( ) const
overridevirtual

Get the ideal buffer size.

Returns
Return the ideal buffer size.

Implements FileIO.

Definition at line 62 of file vcdio.cc.

◆ closeio()

void VcdIO::closeio ( )
overridevirtual

Close virtual file.

Implements FileIO.

Definition at line 198 of file vcdio.cc.

References pvt_close().

◆ duration()

int64_t VcdIO::duration ( ) const
overridevirtual

Get the duration of the file, in AV_TIME_BASE fractional seconds.

Returns
Could work for VCD, but always returns AV_NOPTS_VALUE.
Todo:
Implement duration of video CD chapters

Implements FileIO.

Definition at line 124 of file vcdio.cc.

◆ eof()

bool VcdIO::eof ( ) const
overridevirtual

Check if at end of file.

Returns
Returns true if at end of file.

Implements FileIO.

Definition at line 193 of file vcdio.cc.

References m_end_pos, and m_fpi.

◆ error()

int VcdIO::error ( ) const
overridevirtual

Get last error.

Returns
errno value of last error.

Implements FileIO.

Definition at line 119 of file vcdio.cc.

References m_fpi.

◆ openio()

int VcdIO::openio ( LPVIRTUALFILE  virtualfile)
overridevirtual

Open a virtual 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 67 of file vcdio.cc.

References Logging::info(), VCDUTILS::locate_video(), VIRTUALFILE::VCD_CHAPTER::m_chapter_no, m_chapter_no, VIRTUALFILE::VCD_CHAPTER::m_end_pos, m_end_pos, m_fpi, VIRTUALFILE::m_full_title, m_full_title, VIRTUALFILE::VCD_CHAPTER::m_start_pos, m_start_pos, VIRTUALFILE::VCD_CHAPTER::m_track_no, m_track_no, VIRTUALFILE::m_vcd, FileIO::path(), seek(), FileIO::set_virtualfile(), size(), and FileIO::virtualfile().

◆ pvt_close()

void VcdIO::pvt_close ( )
private

Close virtual file. Non-virtual version to be safely called from constructor/destructor.

Definition at line 203 of file vcdio.cc.

References m_fpi.

Referenced by closeio(), and ~VcdIO().

◆ readio()

size_t VcdIO::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 104 of file vcdio.cc.

References m_end_pos, m_fpi, and size().

◆ seek()

int VcdIO::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 152 of file vcdio.cc.

References m_end_pos, m_fpi, and m_start_pos.

Referenced by openio().

◆ size()

size_t VcdIO::size ( ) const
overridevirtual

Get the file size.

Returns
Returns the file size.

Implements FileIO.

Definition at line 129 of file vcdio.cc.

References m_end_pos, m_fpi, and m_start_pos.

Referenced by openio(), and readio().

◆ tell()

size_t VcdIO::tell ( ) const
overridevirtual

Get current read position.

Returns
Gets the current read position.

Implements FileIO.

Definition at line 147 of file vcdio.cc.

References m_fpi, and m_start_pos.

◆ type()

VIRTUALTYPE VcdIO::type ( ) const
overridevirtual

Get type of the virtual file.

Returns
Returns the type of the virtual file.

Implements FileIO.

Definition at line 57 of file vcdio.cc.

References VCD.

Member Data Documentation

◆ m_chapter_no

int VcdIO::m_chapter_no
protected

Chapter number (1..)

Definition at line 145 of file vcdio.h.

Referenced by openio().

◆ m_end_pos

uint64_t VcdIO::m_end_pos
protected

End offset in bytes (not including this byte)

Definition at line 148 of file vcdio.h.

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

◆ m_fpi

FILE* VcdIO::m_fpi
protected

File pointer to source media.

Definition at line 141 of file vcdio.h.

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

◆ m_full_title

bool VcdIO::m_full_title
protected

If true, ignore m_chapter_no and provide full track.

Definition at line 143 of file vcdio.h.

Referenced by openio().

◆ m_start_pos

uint64_t VcdIO::m_start_pos
protected

Start offset in bytes.

Definition at line 147 of file vcdio.h.

Referenced by openio(), seek(), size(), and tell().

◆ m_track_no

int VcdIO::m_track_no
protected

Track number (1..)

Definition at line 144 of file vcdio.h.

Referenced by openio().


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