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

Blu-ray I/O class. More...

#include <blurayio.h>

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

Public Member Functions

 BlurayIO ()
 Create BlurayIO object. More...
 
virtual ~BlurayIO ()
 Free BlurayIO 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

BLURAYm_bd
 Blu-ray disk handle. More...
 
bool m_is_eof
 true if at end of virtual file More...
 
int m_errno
 Last errno. More...
 
size_t m_rest_size
 Rest bytes in buffer. More...
 
size_t m_rest_pos
 Position in buffer. More...
 
int64_t m_cur_pos
 Current position in virtual file. More...
 
int64_t m_start_pos
 Start offset in bytes. More...
 
int64_t m_end_pos
 End offset in bytes (not including this byte) More...
 
bool m_full_title
 If true, ignore m_chapter_no and provide full track. More...
 
uint32_t m_title_idx
 Track index (track number - 1) More...
 
unsigned m_chapter_idx
 Chapter index (chapter number - 1) More...
 
unsigned m_angle_idx
 Selected angle index (angle number -1) More...
 
std::array< uint8_t, 192 *1024 > m_data
 Buffer for readio() data. More...
 
int64_t m_duration
 Track/chapter duration, in AV_TIME_BASE fractional seconds. 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

Blu-ray I/O class.

Definition at line 50 of file blurayio.h.

Constructor & Destructor Documentation

◆ BlurayIO()

BlurayIO::BlurayIO ( )
explicit

Create BlurayIO object.

Definition at line 39 of file blurayio.cc.

References m_data.

◆ ~BlurayIO()

BlurayIO::~BlurayIO ( )
virtual

Free BlurayIO object.

Definition at line 57 of file blurayio.cc.

References pvt_close().

Member Function Documentation

◆ bufsize()

size_t BlurayIO::bufsize ( ) const
overridevirtual

Get the ideal buffer size.

Returns
Return the ideal buffer size.

Implements FileIO.

Definition at line 67 of file blurayio.cc.

References m_data.

◆ closeio()

void BlurayIO::closeio ( )
overridevirtual

Close virtual file.

Implements FileIO.

Definition at line 301 of file blurayio.cc.

References pvt_close().

◆ duration()

int64_t BlurayIO::duration ( ) const
overridevirtual

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

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

Implements FileIO.

Definition at line 236 of file blurayio.cc.

References m_duration.

◆ eof()

bool BlurayIO::eof ( ) const
overridevirtual

Check if at end of file.

Returns
Returns true if at end of file.

Implements FileIO.

Definition at line 296 of file blurayio.cc.

References m_cur_pos, and m_end_pos.

◆ error()

int BlurayIO::error ( ) const
overridevirtual

Get last error.

Returns
errno value of last error.

Implements FileIO.

Definition at line 231 of file blurayio.cc.

References m_errno.

◆ openio()

int BlurayIO::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 72 of file blurayio.cc.

References Logging::debug(), Logging::error(), m_angle_idx, VIRTUALFILE::BLURAY_CHAPTER::m_angle_no, m_bd, VIRTUALFILE::m_bluray, m_chapter_idx, VIRTUALFILE::BLURAY_CHAPTER::m_chapter_no, m_duration, VIRTUALFILE::m_duration, m_end_pos, m_full_title, VIRTUALFILE::m_full_title, m_rest_pos, m_rest_size, m_start_pos, m_title_idx, VIRTUALFILE::BLURAY_CHAPTER::m_title_no, FileIO::path(), FileIO::set_virtualfile(), FileIO::virtualfile(), and Logging::warning().

◆ pvt_close()

void BlurayIO::pvt_close ( )
private

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

Definition at line 306 of file blurayio.cc.

References m_bd.

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

◆ readio()

size_t BlurayIO::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 but errno not set. error() will return 0 if at EOF.

Implements FileIO.

Definition at line 171 of file blurayio.cc.

References Logging::error(), m_bd, m_cur_pos, m_data, m_end_pos, m_rest_pos, m_rest_size, FileIO::path(), and size().

◆ seek()

int BlurayIO::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 251 of file blurayio.cc.

References m_bd, m_cur_pos, m_end_pos, and m_start_pos.

◆ size()

size_t BlurayIO::size ( ) const
overridevirtual

Get the file size.

Returns
Returns the file size.

Implements FileIO.

Definition at line 241 of file blurayio.cc.

References m_end_pos, and m_start_pos.

Referenced by readio().

◆ tell()

size_t BlurayIO::tell ( ) const
overridevirtual

Get current read position.

Returns
Gets the current read position.

Implements FileIO.

Definition at line 246 of file blurayio.cc.

References m_bd, and m_start_pos.

◆ type()

VIRTUALTYPE BlurayIO::type ( ) const
overridevirtual

Get type of the virtual file.

Returns
Returns the type of the virtual file.

Implements FileIO.

Definition at line 62 of file blurayio.cc.

References BLURAY.

Member Data Documentation

◆ m_angle_idx

unsigned BlurayIO::m_angle_idx
protected

Selected angle index (angle number -1)

Definition at line 156 of file blurayio.h.

Referenced by openio().

◆ m_bd

BLURAY* BlurayIO::m_bd
protected

Blu-ray disk handle.

Definition at line 143 of file blurayio.h.

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

◆ m_chapter_idx

unsigned BlurayIO::m_chapter_idx
protected

Chapter index (chapter number - 1)

Definition at line 155 of file blurayio.h.

Referenced by openio().

◆ m_cur_pos

int64_t BlurayIO::m_cur_pos
protected

Current position in virtual file.

Definition at line 149 of file blurayio.h.

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

◆ m_data

std::array<uint8_t, 192 * 1024> BlurayIO::m_data
protected

Buffer for readio() data.

Definition at line 158 of file blurayio.h.

Referenced by BlurayIO(), bufsize(), and readio().

◆ m_duration

int64_t BlurayIO::m_duration
protected

Track/chapter duration, in AV_TIME_BASE fractional seconds.

Definition at line 160 of file blurayio.h.

Referenced by duration(), and openio().

◆ m_end_pos

int64_t BlurayIO::m_end_pos
protected

End offset in bytes (not including this byte)

Definition at line 151 of file blurayio.h.

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

◆ m_errno

int BlurayIO::m_errno
protected

Last errno.

Definition at line 146 of file blurayio.h.

Referenced by error().

◆ m_full_title

bool BlurayIO::m_full_title
protected

If true, ignore m_chapter_no and provide full track.

Definition at line 153 of file blurayio.h.

Referenced by openio().

◆ m_is_eof

bool BlurayIO::m_is_eof
protected

true if at end of virtual file

Definition at line 145 of file blurayio.h.

◆ m_rest_pos

size_t BlurayIO::m_rest_pos
protected

Position in buffer.

Definition at line 148 of file blurayio.h.

Referenced by openio(), and readio().

◆ m_rest_size

size_t BlurayIO::m_rest_size
protected

Rest bytes in buffer.

Definition at line 147 of file blurayio.h.

Referenced by openio(), and readio().

◆ m_start_pos

int64_t BlurayIO::m_start_pos
protected

Start offset in bytes.

Definition at line 150 of file blurayio.h.

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

◆ m_title_idx

uint32_t BlurayIO::m_title_idx
protected

Track index (track number - 1)

Definition at line 154 of file blurayio.h.

Referenced by openio().


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