MythMediaDevice Class Reference

#include <mythmedia.h>

Inheritance diagram for MythMediaDevice:

MythCDROM MythHDD MythCDROMFreeBSD MythCDROMLinux

List of all members.


Detailed Description

Definition at line 44 of file mythmedia.h.


Signals

void statusChanged (MediaStatus oldStatus, MythMediaDevice *pMedia)

Public Member Functions

 MythMediaDevice (QObject *par, const char *DevicePath, bool SuperMount, bool AllowEject)
const QString & getMountPath () const
void setMountPath (const char *path)
const QString & getDevicePath () const
const QString & getRealDevice () const
const QString & getDeviceModel () const
void setDeviceModel (const char *model)
MediaStatus getStatus () const
const QString & getVolumeID () const
void setVolumeID (const char *vol)
const QString & getKeyID () const
bool getAllowEject () const
bool getLocked () const
bool isDeviceOpen () const
bool isUsable () const
 Is this device "ready", for a plugin to access?
MediaType getMediaType () const
bool isSuperMount () const
virtual MediaError testMedia ()
virtual bool openDevice ()
virtual bool closeDevice ()
virtual bool isSameDevice (const QString &path)
virtual void setSpeed (int speed)
virtual MediaStatus checkMedia ()=0
virtual MediaError eject (bool open_close=true)
virtual MediaError lock ()
virtual MediaError unlock ()
virtual bool performMountCmd (bool DoMount)
bool mount ()
bool unmount ()
bool isMounted (bool bVerify=false)
 Tells us if m_DevicePath is a mounted device.
void RegisterMediaExtensions (uint mediatype, const QString &extensions)
 Used to register media types with extensions.
void clearData ()
const char * MediaTypeString ()

Static Public Member Functions

static const char * MediaTypeString (MediaType type)

Static Public Attributes

static const char * MediaStatusStrings []
static const char * MediaErrorStrings []

Protected Member Functions

virtual ~MythMediaDevice ()
virtual void onDeviceMounted (void)
 Override this to perform any post mount logic.
virtual void onDeviceUnmounted ()
 Override this to perform any post unmount logic.
MediaType DetectMediaType (void)
 Returns guessed media type based on file extensions.
bool ScanMediaType (const QString &directory, ext_cnt_t &counts)
 Recursively scan directories and create an associative array with the number of times we've seen each extension.
MediaStatus setStatus (MediaStatus newStat, bool CloseIt=false)

Protected Attributes

QString m_DeviceModel
 The device Manufacturer/Model. Read/write.
QString m_DevicePath
 The path to this media's device.
QString m_KeyID
 KeyID of the media.
QString m_MountPath
 The path to this media's mount point.
QString m_RealDevice
 If m_DevicePath is a symlink, its target.
QString m_VolumeID
 The volume ID of the media. Read/write.
MediaStatus m_Status
 The status of the media as of the last call to checkMedia.
MediaType m_MediaType
 The type of media. Read only.
bool m_AllowEject
 Allow the user to eject the media?. Read only.
bool m_Locked
 Is this media locked?. Read only.
bool m_SuperMount
 Is this a supermount device?. Read only.
int m_DeviceHandle
 A file handle for opening and closing the device, ioctls(), et c.

Private Attributes

ext_to_media_t m_ext_to_media
 Map of extension to media type.

Friends

class MediaMonitorDarwin
class MonitorThreadDarwin

Constructor & Destructor Documentation

MythMediaDevice::MythMediaDevice ( QObject *  par,
const char *  DevicePath,
bool  SuperMount,
bool  AllowEject 
)

Definition at line 54 of file mythmedia.cpp.

virtual MythMediaDevice::~MythMediaDevice (  )  [inline, protected, virtual]

Definition at line 123 of file mythmedia.h.


Member Function Documentation

const QString& MythMediaDevice::getMountPath (  )  const [inline]

void MythMediaDevice::setMountPath ( const char *  path  )  [inline]

const QString& MythMediaDevice::getDevicePath (  )  const [inline]

const QString& MythMediaDevice::getRealDevice (  )  const [inline]

Definition at line 59 of file mythmedia.h.

Referenced by LookupModel(), and MediaMonitor::shouldIgnore().

const QString& MythMediaDevice::getDeviceModel (  )  const [inline]

Definition at line 63 of file mythmedia.h.

Referenced by DevName().

void MythMediaDevice::setDeviceModel ( const char *  model  )  [inline]

MediaStatus MythMediaDevice::getStatus (  )  const [inline]

const QString& MythMediaDevice::getVolumeID (  )  const [inline]

Definition at line 68 of file mythmedia.h.

Referenced by DevName().

void MythMediaDevice::setVolumeID ( const char *  vol  )  [inline]

const QString& MythMediaDevice::getKeyID (  )  const [inline]

Definition at line 71 of file mythmedia.h.

bool MythMediaDevice::getAllowEject (  )  const [inline]

Definition at line 73 of file mythmedia.h.

bool MythMediaDevice::getLocked (  )  const [inline]

Definition at line 75 of file mythmedia.h.

bool MythMediaDevice::isDeviceOpen (  )  const

bool MythMediaDevice::isUsable (  )  const [inline]

Is this device "ready", for a plugin to access?

Definition at line 80 of file mythmedia.h.

Referenced by MythCDROMLinux::checkMedia(), MythMainWindow::customEvent(), handleDVDMedia(), handleMedia(), and handleVCDMedia().

MediaType MythMediaDevice::getMediaType (  )  const [inline]

Definition at line 87 of file mythmedia.h.

Referenced by MythMainWindow::customEvent().

bool MythMediaDevice::isSuperMount (  )  const [inline]

Definition at line 89 of file mythmedia.h.

virtual MediaError MythMediaDevice::testMedia ( void   )  [inline, virtual]

Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.

Definition at line 91 of file mythmedia.h.

Referenced by MediaMonitorUnix::AddDevice().

bool MythMediaDevice::openDevice (  )  [virtual]

bool MythMediaDevice::closeDevice (  )  [virtual]

bool MythMediaDevice::isSameDevice ( const QString &  path  )  [virtual]

Reimplemented in MythCDROMLinux.

Definition at line 289 of file mythmedia.cpp.

void MythMediaDevice::setSpeed ( int  speed  )  [virtual]

Reimplemented in MythCDROMLinux.

Definition at line 300 of file mythmedia.cpp.

Referenced by MediaMonitor::SetCDSpeed().

virtual MediaStatus MythMediaDevice::checkMedia (  )  [pure virtual]

Implemented in MythCDROMLinux, MythCDROM, and MythHDD.

Referenced by MediaMonitor::CheckDevices().

MediaError MythMediaDevice::eject ( bool  open_close = true  )  [virtual]

Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.

Definition at line 270 of file mythmedia.cpp.

Referenced by MediaMonitor::ChooseAndEjectMedia(), and Ripper::ejectCD().

MediaError MythMediaDevice::lock ( void   )  [virtual]

Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.

Definition at line 307 of file mythmedia.cpp.

Referenced by MythCDROMLinux::lock(), and MythCDROMFreeBSD::lock().

MediaError MythMediaDevice::unlock ( void   )  [virtual]

bool MythMediaDevice::performMountCmd ( bool  DoMount  )  [virtual]

Definition at line 101 of file mythmedia.cpp.

bool MythMediaDevice::mount (  )  [inline]

bool MythMediaDevice::unmount (  )  [inline]

bool MythMediaDevice::isMounted ( bool  bVerify = false  ) 

void MythMediaDevice::RegisterMediaExtensions ( uint  mediatype,
const QString &  extensions 
)

Used to register media types with extensions.

Parameters:
mediatype MediaType flag.
extensions Comma separated list of extensions like 'mp3,ogg,flac'.

Definition at line 262 of file mythmedia.cpp.

void MythMediaDevice::clearData (  ) 

Definition at line 455 of file mythmedia.cpp.

Referenced by MediaMonitor::mediaStatusChanged().

const char * MythMediaDevice::MediaTypeString (  ) 

const char * MythMediaDevice::MediaTypeString ( MediaType  type  )  [static]

Definition at line 467 of file mythmedia.cpp.

void MythMediaDevice::statusChanged ( MediaStatus  oldStatus,
MythMediaDevice pMedia 
) [signal]

Referenced by setStatus().

virtual void MythMediaDevice::onDeviceMounted ( void   )  [inline, protected, virtual]

Override this to perform any post mount logic.

Reimplemented in MythCDROM.

Definition at line 126 of file mythmedia.h.

Referenced by MythCDROM::onDeviceMounted(), and performMountCmd().

virtual void MythMediaDevice::onDeviceUnmounted (  )  [inline, protected, virtual]

Override this to perform any post unmount logic.

Definition at line 134 of file mythmedia.h.

Referenced by performMountCmd().

MediaType MythMediaDevice::DetectMediaType ( void   )  [protected]

Returns guessed media type based on file extensions.

Definition at line 173 of file mythmedia.cpp.

bool MythMediaDevice::ScanMediaType ( const QString &  directory,
ext_cnt_t counts 
) [protected]

Recursively scan directories and create an associative array with the number of times we've seen each extension.

Definition at line 225 of file mythmedia.cpp.

Referenced by DetectMediaType().

MediaStatus MythMediaDevice::setStatus ( MediaStatus  newStat,
bool  CloseIt = false 
) [protected]


Friends And Related Function Documentation

friend class MediaMonitorDarwin [friend]

Definition at line 47 of file mythmedia.h.

friend class MonitorThreadDarwin [friend]

Definition at line 48 of file mythmedia.h.


Member Data Documentation

const char * MythMediaDevice::MediaStatusStrings [static]

Initial value:

{
    "MEDIASTAT_ERROR",
    "MEDIASTAT_UNKNOWN",
    "MEDIASTAT_UNPLUGGED",
    "MEDIASTAT_OPEN",
    "MEDIASTAT_NODISK",
    "MEDIASTAT_UNFORMATTED",
    "MEDIASTAT_USEABLE",
    "MEDIASTAT_NOTMOUNTED",
    "MEDIASTAT_MOUNTED"
}

Definition at line 110 of file mythmedia.h.

Referenced by MythCDROMLinux::checkMedia(), and MediaMonitor::mediaStatusChanged().

const char * MythMediaDevice::MediaErrorStrings [static]

Initial value:

{
    "MEDIAERR_OK",
    "MEDIAERR_FAILED",
    "MEDIAERR_UNSUPPORTED"
}

Definition at line 111 of file mythmedia.h.

QString MythMediaDevice::m_DeviceModel [protected]

The device Manufacturer/Model. Read/write.

Definition at line 141 of file mythmedia.h.

QString MythMediaDevice::m_DevicePath [protected]

QString MythMediaDevice::m_KeyID [protected]

KeyID of the media.

Read only (For ISO9660, volumeid + creation_date)

Definition at line 144 of file mythmedia.h.

Referenced by MythCDROMLinux::checkMedia(), and clearData().

QString MythMediaDevice::m_MountPath [protected]

The path to this media's mount point.

(e.g. /mnt/cdrom) Read/write

Definition at line 146 of file mythmedia.h.

Referenced by MythHDD::checkMedia(), DetectMediaType(), isMounted(), and MythCDROM::onDeviceMounted().

QString MythMediaDevice::m_RealDevice [protected]

If m_DevicePath is a symlink, its target.

(e.g. /dev/hdc) Read only

Definition at line 148 of file mythmedia.h.

Referenced by isMounted(), and MythMediaDevice().

QString MythMediaDevice::m_VolumeID [protected]

The volume ID of the media. Read/write.

Definition at line 150 of file mythmedia.h.

Referenced by MythHDD::checkMedia(), MythCDROMLinux::checkMedia(), and clearData().

The status of the media as of the last call to checkMedia.

Read only

Definition at line 152 of file mythmedia.h.

Referenced by MythHDD::checkMedia(), MythCDROMLinux::checkMedia(), isMounted(), MythHDD::MythHDD(), MythMediaDevice(), MythCDROM::onDeviceMounted(), performMountCmd(), and setStatus().

The type of media. Read only.

Definition at line 154 of file mythmedia.h.

Referenced by MythCDROMLinux::checkMedia(), clearData(), MediaTypeString(), MythHDD::MythHDD(), MythMediaDevice(), and MythCDROM::onDeviceMounted().

Allow the user to eject the media?. Read only.

Definition at line 156 of file mythmedia.h.

Referenced by MythCDROMLinux::checkMedia(), MythMediaDevice(), and MythCDROM::onDeviceMounted().

Is this media locked?. Read only.

Definition at line 157 of file mythmedia.h.

Referenced by lock(), MythMediaDevice(), and unlock().

Is this a supermount device?. Read only.

Definition at line 158 of file mythmedia.h.

Referenced by MythMediaDevice(), and performMountCmd().

Map of extension to media type.

Definition at line 165 of file mythmedia.h.

Referenced by DetectMediaType(), and RegisterMediaExtensions().


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

Generated on Sat Dec 18 05:16:08 2010 for MythTV by  doxygen 1.5.5