FFmpegfs Fuse Multi Media Filesystem 2.16
|
DVD I/O class. More...
#include <dvdio.h>
Public Member Functions | |
DvdIO () | |
Create DvdIO object. More... | |
virtual | ~DvdIO () |
Free DvdIO 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 | |
dvd_reader_t * | m_dvd |
DVD reader handle. More... | |
dvd_file_t * | m_dvd_title |
DVD title handle. More... | |
ifo_handle_t * | m_vmg_file |
DVD video manager handle. More... | |
ifo_handle_t * | m_vts_file |
DVD video title stream handle. More... | |
pgc_t * | m_cur_pgc |
Current program chain. More... | |
int | m_start_cell |
Start cell. More... | |
int | m_end_cell |
End cell (of title) More... | |
int | m_cur_cell |
Current cell. More... | |
int | m_next_cell |
Next cell to be processed. More... | |
bool | m_goto_next_cell |
If logc needs to go to next cell before next read. More... | |
unsigned int | m_cur_block |
Current processing block. More... | |
bool | m_is_eof |
true if at "end of file", i.e, end of chapter or title More... | |
int | m_errno |
errno of last operation More... | |
size_t | m_rest_size |
Rest bytes in buffer. More... | |
size_t | m_rest_pos |
Position in buffer. More... | |
size_t | m_cur_pos |
Current position in virtual file. More... | |
bool | m_full_title |
If true, ignore m_chapter_no and provide full track. More... | |
int | m_title_idx |
Track index (track number - 1) More... | |
int | m_chapter_idx |
Chapter index (chapter number - 1) More... | |
int | m_angle_idx |
Selected angle index (angle number -1) More... | |
std::array< unsigned char, 1024 *DVD_VIDEO_LB_LEN > | m_data |
Buffer for readio() data. More... | |
std::array< unsigned char, 1024 *DVD_VIDEO_LB_LEN > | m_buffer |
Buffer for data extracted from VOB file. More... | |
int64_t | m_duration |
Track/chapter duration, in AV_TIME_BASE fractional seconds. More... | |
size_t | m_size |
Size of virtual file. More... | |
Private Types | |
enum class | DSITYPE { CONTINUE , EOF_CHAPTER , EOF_TITLE } |
Type of a DSI block. More... | |
Private Member Functions | |
void | pvt_close () |
Close virtual file. Non-virtual version to be safely called from constructor/destructor. More... | |
bool | is_nav_pack (const unsigned char *buffer) const |
Do a rough check if this is really a navigation packet. More... | |
bool | get_packet_size (const uint8_t *p, size_t peek, size_t *size) const |
return the size of the next packet More... | |
int | get_pes_id (const uint8_t *buffer, size_t size) const |
return the id of a Packetized Elementary Stream (PES) (should be valid) More... | |
size_t | demux_pes (uint8_t *out, const uint8_t *in, size_t len) const |
Extract only the interesting portion of the VOB input stream. More... | |
DSITYPE | handle_DSI (void *_dsi_pack, size_t *cur_output_size, unsigned int *next_block, uint8_t *data) |
Handle DSI (Data Search Information) packet. More... | |
void | next_cell () |
Goto next DVD cell. More... | |
void | rewind () |
Rewind to start of stream. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from FileIO | |
static std::shared_ptr< FileIO > | alloc (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... | |
|
strongprivate |
|
explicit |
|
virtual |
|
overridevirtual |
|
overridevirtual |
Close virtual file.
Implements FileIO.
Definition at line 797 of file dvdio.cc.
References pvt_close().
|
private |
Extract only the interesting portion of the VOB input stream.
[out] | out | - Stream stripped from unnessessary data |
[in] | in | - Input raw stream |
[in] | len | - Length of input raw stream |
Definition at line 388 of file dvdio.cc.
References get_packet_size(), get_pes_id(), PS_STREAM_ID, PS_STREAM_ID_AUDIO, PS_STREAM_ID_END_STREAM, PS_STREAM_ID_MAP, PS_STREAM_ID_PACK_HEADER, and PS_STREAM_ID_SYSTEM_HEADER.
Referenced by readio().
|
overridevirtual |
Get the duration of the file, in AV_TIME_BASE fractional seconds.
Implements FileIO.
Definition at line 706 of file dvdio.cc.
References m_duration.
|
overridevirtual |
|
overridevirtual |
|
private |
return the size of the next packet
[in] | p | - Buffer with PES data. |
[in] | peek | - How many bytes to peek. |
[in] | size | - Size of the next packet |
Definition at line 236 of file dvdio.cc.
References PS_STREAM_ID, PS_STREAM_ID_DIRECTORY, PS_STREAM_ID_END_STREAM, PS_STREAM_ID_MAP, PS_STREAM_ID_PACK_HEADER, PS_STREAM_ID_SYSTEM_HEADER, and size().
Referenced by demux_pes().
|
private |
return the id of a Packetized Elementary Stream (PES) (should be valid)
[in] | buffer | - Buffer with PES data. |
[in] | size | - Size of buffer. |
Definition at line 284 of file dvdio.cc.
References PS_STREAM_ID, PS_STREAM_ID_EXTENDED, PS_STREAM_ID_PRIVATE_STREAM1, and size().
Referenced by demux_pes().
|
private |
Handle DSI (Data Search Information) packet.
[out] | _dsi_pack | - buffer with DSI packet. |
[out] | cur_output_size | - Net size of packet. |
[out] | next_block | - Address of next VOBU (Video Object Unit). |
[out] | data | - Data extracted from DSI packet. |
Definition at line 439 of file dvdio.cc.
References CONTINUE, EOF_CHAPTER, EOF_TITLE, m_angle_idx, m_cur_block, m_cur_cell, m_cur_pgc, m_end_cell, m_next_cell, and next_cell().
Referenced by readio().
|
private |
|
private |
Goto next DVD cell.
Definition at line 530 of file dvdio.cc.
References m_angle_idx, m_cur_cell, m_cur_pgc, and m_next_cell.
Referenced by handle_DSI(), and readio().
|
overridevirtual |
Open a virtual file.
[in] | virtualfile | - LPCVIRTUALFILE of file to open |
Implements FileIO.
Definition at line 85 of file dvdio.cc.
References Logging::debug(), eof(), Logging::error(), m_angle_idx, VIRTUALFILE::DVD_CHAPTER::m_angle_no, m_chapter_idx, VIRTUALFILE::DVD_CHAPTER::m_chapter_no, m_cur_pgc, m_duration, VIRTUALFILE::m_duration, m_dvd, VIRTUALFILE::m_dvd, m_dvd_title, m_end_cell, m_full_title, VIRTUALFILE::m_full_title, m_size, m_start_cell, m_title_idx, VIRTUALFILE::DVD_CHAPTER::m_title_no, m_vmg_file, m_vts_file, FileIO::path(), readio(), rewind(), FileIO::set_virtualfile(), Logging::trace(), and FileIO::virtualfile().
|
private |
Close virtual file. Non-virtual version to be safely called from constructor/destructor.
Definition at line 802 of file dvdio.cc.
References m_dvd, m_dvd_title, m_vmg_file, and m_vts_file.
|
overridevirtual |
Read data from file.
[out] | data | - buffer to store read bytes in. Must be large enough to hold up to size bytes. Special case: If set to nullptr as many bytes as possible are "read" (and discarded). Can be used to determine the net file size of the virtual stream. |
[in] | size | - number of bytes to read |
Implements FileIO.
Definition at line 552 of file dvdio.cc.
References CONTINUE, demux_pes(), EOF_TITLE, Logging::error(), handle_DSI(), is_nav_pack(), m_buffer, m_cur_block, m_cur_cell, m_cur_pgc, m_cur_pos, m_data, m_dvd_title, m_errno, m_full_title, m_goto_next_cell, m_is_eof, m_next_cell, m_rest_pos, m_rest_size, next_cell(), FileIO::path(), size(), and Logging::warning().
|
private |
Rewind to start of stream.
Definition at line 721 of file dvdio.cc.
References m_cur_cell, m_cur_pos, m_errno, m_goto_next_cell, m_is_eof, m_next_cell, m_rest_pos, m_rest_size, and m_start_cell.
|
overridevirtual |
Seek to position in file.
Repositions the offset of the open file to the argument offset according to the directive whence.
[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. |
Implements FileIO.
|
overridevirtual |
Get the file size.
Implements FileIO.
Definition at line 711 of file dvdio.cc.
References m_size.
Referenced by get_packet_size(), get_pes_id(), readio(), and seek().
|
overridevirtual |
|
overridevirtual |
|
protected |
Selected angle index (angle number -1)
Definition at line 225 of file dvdio.h.
Referenced by handle_DSI(), next_cell(), and openio().
|
protected |
|
protected |
|
protected |
Current processing block.
Definition at line 215 of file dvdio.h.
Referenced by handle_DSI(), and readio().
|
protected |
Current cell.
Definition at line 212 of file dvdio.h.
Referenced by handle_DSI(), next_cell(), readio(), and rewind().
|
protected |
Current program chain.
Definition at line 209 of file dvdio.h.
Referenced by handle_DSI(), next_cell(), openio(), and readio().
|
protected |
|
protected |
|
protected |
Track/chapter duration, in AV_TIME_BASE fractional seconds.
Definition at line 230 of file dvdio.h.
Referenced by duration(), and openio().
|
protected |
|
protected |
DVD title handle.
Definition at line 206 of file dvdio.h.
Referenced by openio(), pvt_close(), and readio().
|
protected |
End cell (of title)
Definition at line 211 of file dvdio.h.
Referenced by handle_DSI(), and openio().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Next cell to be processed.
Definition at line 213 of file dvdio.h.
Referenced by handle_DSI(), next_cell(), readio(), and rewind().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
DVD video manager handle.
Definition at line 207 of file dvdio.h.
Referenced by openio(), and pvt_close().
|
protected |
DVD video title stream handle.
Definition at line 208 of file dvdio.h.
Referenced by openio(), and pvt_close().