QtlMovie 1.12 (A specialized FFmpeg front-end)
QtsDvdMedia Class Reference

Description of a DVD media. More...

Inheritance diagram for QtsDvdMedia:

Signals

void closed ()
 Emitted when the DVD media is closed. More...
 
void newMedia (const QString &volumeId)
 Emitted when a new DVD media is open. More...
 

Public Member Functions

 QtsDvdMedia (const QString &fileName=QString(), QtlLogger *log=0, QObject *parent=0, bool useMaxReadSpeed=false)
 Constructor. More...
 
 ~QtsDvdMedia ()
 Destructor. More...
 
QList< QtsDvdFilePtrallFiles () const
 Get the list of all files on the DVD media. More...
 
void close ()
 Close a DVD media. More...
 
QString deviceName () const
 Get the device name of the DVD reader containing the DVD media. More...
 
bool isEncrypted () const
 Check if the DVD media is encrypted. More...
 
bool isOpen () const
 Check if a DVD media was successfully open. More...
 
bool loadAllEncryptionKeys ()
 Load all encryption keys into the cache of libdvdcss. More...
 
QtlLoggerlog () const
 Get the message logger. More...
 
int nextSector () const
 Get the position of the next sector to read. More...
 
bool openFromDevice (const QString &deviceName, bool useMaxReadSpeed=false)
 Open and load the description of a DVD media starting from its device name. More...
 
bool openFromFile (const QString &fileName, bool useMaxReadSpeed=false)
 Open and load the description of a DVD media starting from a file on the DVD. More...
 
int readSectors (void *buffer, int count, int position=-1, Qts::BadSectorPolicy badSectorPolicy=Qts::SkipBadSectors)
 Read a given number of sectors from the DVD media. More...
 
QtsDvdDirectory rootDirectory () const
 Get a description of the root directory. More...
 
QString rootName () const
 Get the root directory name of the DVD (ie mount point). More...
 
QtsDvdFile searchFile (const QString &fileName, Qt::CaseSensitivity cs=Qt::CaseInsensitive) const
 Locate a file in the DVD. More...
 
bool seekSector (int position)
 Set the position of the next sector to read. More...
 
QString volumeId () const
 Get the volume identifier of the DVD. More...
 
int volumeSizeInSectors () const
 Get the volume size (in sectors) of the DVD. More...
 
int vtsCount () const
 Get the number of Video Title Sets (VTS) on the DVD. More...
 
QtsDvdFile vtsInformationFile (int vtsNumber) const
 Get the description of a Video Title Set information file on the DVD. More...
 
QString vtsInformationFileName (int vtsNumber) const
 Build the full path name of a Video Title Set information file on the DVD. More...
 
QtsDvdFile vtsVideoFile (int vtsNumber, int vobIndex) const
 Get the description of a Video Title Set video file on the DVD. More...
 
QString vtsVideoFileName (int vtsNumber, int vobIndex) const
 Build the full path name of a Video Title Set video file on the DVD. More...
 

Static Public Member Functions

static int vtsInformationFileNumber (const QString &fileName)
 Check if a file name matches a Video Title Set information file (VTS_nn_0.IFO). More...
 

Private Member Functions

bool readDirectoryStructure (QtsDvdDirectory &dir, int depth, bool inRoot, bool inVideoTs)
 Read the file structure under the specified directory. More...
 

Private Attributes

QList< QtsDvdFilePtr_allFiles
 List of all files on DVD. More...
 
QList< QtsDvdFilePtr >::ConstIterator _currentFile
 File area where _nextSector is. More...
 
QString _deviceName
 DVD device name. More...
 
struct dvdcss_s * _dvdcss
 Handle to libdvdcss (don't include dvdcss.h in this .h). More...
 
bool _isOpen
 Is fully open and ready. More...
 
QtlLogger_log
 Where to log errors. More...
 
int _nextSector
 Next sector to read. More...
 
QtlNullLogger _nullLog
 Dummy null logger if none specified by caller. More...
 
QtsDvdDirectory _rootDirectory
 Description of root directory. More...
 
QString _rootName
 DVD root directory (ie. mount point). More...
 
QString _volumeId
 Volume identifier. More...
 
int _volumeSize
 Volume size in sectors. More...
 
int _vtsCount
 Number of video title sets. More...
 

Detailed Description

Description of a DVD media.

Constructor & Destructor Documentation

◆ QtsDvdMedia()

QtsDvdMedia::QtsDvdMedia ( const QString &  fileName = QString(),
QtlLogger log = 0,
QObject *  parent = 0,
bool  useMaxReadSpeed = false 
)

Constructor.

Parameters
[in]fileNameName of a file or directory anywhere on the DVD media.
[in]logWhere to log errors.
[in]parentOptional parent widget.
[in]useMaxReadSpeedIf true, try to set the DVD reader to maximum speed.

◆ ~QtsDvdMedia()

QtsDvdMedia::~QtsDvdMedia ( )

Destructor.

Member Function Documentation

◆ log()

QtlLogger* QtsDvdMedia::log ( ) const
inline

Get the message logger.

Returns
The message logger, nevel null.

◆ openFromFile()

bool QtsDvdMedia::openFromFile ( const QString &  fileName,
bool  useMaxReadSpeed = false 
)

Open and load the description of a DVD media starting from a file on the DVD.

The description of the file structure is also loaded.

Parameters
[in]fileNameName of a file or directory anywhere on the DVD media.
[in]useMaxReadSpeedIf true, try to set the DVD reader to maximum speed.
Returns
True on success, false on error.

◆ openFromDevice()

bool QtsDvdMedia::openFromDevice ( const QString &  deviceName,
bool  useMaxReadSpeed = false 
)

Open and load the description of a DVD media starting from its device name.

Parameters
[in]deviceNameName of the device containing the DVD media.
[in]useMaxReadSpeedIf true, try to set the DVD reader to maximum speed.
Returns
True on success, false on error.

◆ close()

void QtsDvdMedia::close ( )

Close a DVD media.

◆ isOpen()

bool QtsDvdMedia::isOpen ( ) const
inline

Check if a DVD media was successfully open.

Returns
True if this object contains a valid DVD description, false otherwise.

◆ isEncrypted()

bool QtsDvdMedia::isEncrypted ( ) const

Check if the DVD media is encrypted.

Returns
True if the DVD media is encrypted.

◆ rootName()

QString QtsDvdMedia::rootName ( ) const
inline

Get the root directory name of the DVD (ie mount point).

This information is only available if the DVD was open using a constructor or openFromFile().

Returns
The root directory name of the DVD or an empty string if no DVD reader was found or if the DVD was open using openFromDevice().

◆ deviceName()

QString QtsDvdMedia::deviceName ( ) const
inline

Get the device name of the DVD reader containing the DVD media.

Returns
The device name or an empty string if no DVD reader was found.

◆ volumeId()

QString QtsDvdMedia::volumeId ( ) const
inline

Get the volume identifier of the DVD.

Returns
DVD volume identifier, empty if not on a DVD media.

◆ volumeSizeInSectors()

int QtsDvdMedia::volumeSizeInSectors ( ) const
inline

Get the volume size (in sectors) of the DVD.

Returns
DVD volume size (in sectors).

◆ seekSector()

bool QtsDvdMedia::seekSector ( int  position)

Set the position of the next sector to read.

Parameters
[in]positionIndex of the next sector to read. Valid values are in the range 0 to volumeSizeInSectors()-1.
Returns
True on success, false on error.

◆ nextSector()

int QtsDvdMedia::nextSector ( ) const
inline

Get the position of the next sector to read.

Returns
Sector number.

◆ readSectors()

int QtsDvdMedia::readSectors ( void *  buffer,
int  count,
int  position = -1,
Qts::BadSectorPolicy  badSectorPolicy = Qts::SkipBadSectors 
)

Read a given number of sectors from the DVD media.

Parameters
[out]bufferWhere to read sectors into. Must be at least as large as 2048 x count bytes.
[in]countNumber of sectors to read.
[in]positionIndex of the sector where to seek first. Read at current sector if negative. Valid values are in the range 0 to volumeSizeInSectors()-1.
[in]badSectorPolicyHow to handle bad sectors.
Returns
Number of sectors read. Always read as many sectors as possible. If the returned value is less than count, then either an error or the end of media occured. Specifically, if the returned value is 0 then the end of media was already reached and if the returned value is negative then there was an error before anything could be read.
See also
BadSectorPolicy

◆ vtsCount()

int QtsDvdMedia::vtsCount ( ) const
inline

Get the number of Video Title Sets (VTS) on the DVD.

Returns
The number of Video Title Sets (VTS) on the DVD.

◆ rootDirectory()

QtsDvdDirectory QtsDvdMedia::rootDirectory ( ) const
inline

Get a description of the root directory.

Can be used to describe the complete file system on DVD.

Returns
A description of the root directory.

◆ searchFile()

QtsDvdFile QtsDvdMedia::searchFile ( const QString &  fileName,
Qt::CaseSensitivity  cs = Qt::CaseInsensitive 
) const

Locate a file in the DVD.

Parameters
[in]fileNameName of the file to locate. It the absolute path name of the file starts with the mount point of the DVD, then only the relative part is used. Otherwise, the fileName must be a path relative to the DVD root directory.
[in]csCase sensitivity when looking for file names.
Returns
Description of the file. Return an invalid file if not found.

◆ vtsInformationFileName()

QString QtsDvdMedia::vtsInformationFileName ( int  vtsNumber) const

Build the full path name of a Video Title Set information file on the DVD.

Parameters
[in]vtsNumberVTS number. It is not necessary that the VTS exists.
Returns
The path name of the corresponding .IFO file. It the DVD is open, return a full file path. If the DVD is not open, return the file path relative to the DVD root.

◆ vtsVideoFileName()

QString QtsDvdMedia::vtsVideoFileName ( int  vtsNumber,
int  vobIndex 
) const

Build the full path name of a Video Title Set video file on the DVD.

Parameters
[in]vtsNumberVTS number. It is not necessary that the VTS exists.
[in]vobIndexIndex of the VOB file, starting at 1.
Returns
The path name of the corresponding .VOB file. It the DVD is open, return a full file path. If the DVD is not open, return the file path relative to the DVD root.

◆ vtsInformationFile()

QtsDvdFile QtsDvdMedia::vtsInformationFile ( int  vtsNumber) const

Get the description of a Video Title Set information file on the DVD.

Parameters
[in]vtsNumberVTS number.
Returns
Description of the file. Return an invalid file if not found.

◆ vtsVideoFile()

QtsDvdFile QtsDvdMedia::vtsVideoFile ( int  vtsNumber,
int  vobIndex 
) const

Get the description of a Video Title Set video file on the DVD.

Parameters
[in]vtsNumberVTS number.
[in]vobIndexIndex of the VOB file, starting at 1.
Returns
Description of the file. Return an invalid file if not found.

◆ vtsInformationFileNumber()

int QtsDvdMedia::vtsInformationFileNumber ( const QString &  fileName)
static

Check if a file name matches a Video Title Set information file (VTS_nn_0.IFO).

Parameters
[in]fileNameFile name.
Returns
The VTS number ("nn") or -1 if the file is not a valid VTS IFO.

◆ allFiles()

QList<QtsDvdFilePtr> QtsDvdMedia::allFiles ( ) const
inline

Get the list of all files on the DVD media.

The list is sorted by physical placement of files on the media. Non-file space (meta-data, directories, unused space) is represented by "place holders", ie. QtsDvdFile with an empty file name.

Returns
The list of all files on the DVD media.

◆ loadAllEncryptionKeys()

bool QtsDvdMedia::loadAllEncryptionKeys ( )

Load all encryption keys into the cache of libdvdcss.

Returns
True on success, false on error.

◆ newMedia

void QtsDvdMedia::newMedia ( const QString &  volumeId)
signal

Emitted when a new DVD media is open.

Parameters
[in]volumeIdVolume identifier of the new media.

◆ closed

void QtsDvdMedia::closed ( )
signal

Emitted when the DVD media is closed.

◆ readDirectoryStructure()

bool QtsDvdMedia::readDirectoryStructure ( QtsDvdDirectory dir,
int  depth,
bool  inRoot,
bool  inVideoTs 
)
private

Read the file structure under the specified directory.

Parameters
[in,out]dirA directory to update.
[in]depthDepth in the file system.
[in]inRootTrue when dir is the root directory of the DVD.
[in]inVideoTsTrue when dir is VIDEO_TS.
Returns
True on success, false on error.

Member Data Documentation

◆ _nullLog

QtlNullLogger QtsDvdMedia::_nullLog
private

Dummy null logger if none specified by caller.

◆ _log

QtlLogger* QtsDvdMedia::_log
private

Where to log errors.

◆ _isOpen

bool QtsDvdMedia::_isOpen
private

Is fully open and ready.

◆ _deviceName

QString QtsDvdMedia::_deviceName
private

DVD device name.

◆ _rootName

QString QtsDvdMedia::_rootName
private

DVD root directory (ie. mount point).

◆ _volumeId

QString QtsDvdMedia::_volumeId
private

Volume identifier.

◆ _volumeSize

int QtsDvdMedia::_volumeSize
private

Volume size in sectors.

◆ _vtsCount

int QtsDvdMedia::_vtsCount
private

Number of video title sets.

◆ _dvdcss

struct dvdcss_s* QtsDvdMedia::_dvdcss
private

Handle to libdvdcss (don't include dvdcss.h in this .h).

◆ _nextSector

int QtsDvdMedia::_nextSector
private

Next sector to read.

◆ _rootDirectory

QtsDvdDirectory QtsDvdMedia::_rootDirectory
private

Description of root directory.

◆ _allFiles

QList<QtsDvdFilePtr> QtsDvdMedia::_allFiles
private

List of all files on DVD.

◆ _currentFile

QList<QtsDvdFilePtr>::ConstIterator QtsDvdMedia::_currentFile
private

File area where _nextSector is.


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