MythMediaDevice Class Reference

#include <mythmedia.h>

Inheritance diagram for MythMediaDevice:
MythCDROM MythHDD MythCDROMDarwin MythCDROMFreeBSD MythCDROMLinux

List of all members.

Signals

void statusChanged (MythMediaStatus 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)
MythMediaStatus 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?
MythMediaType getMediaType () const
bool isSuperMount () const
virtual MythMediaError testMedia ()
virtual bool openDevice ()
virtual bool closeDevice ()
virtual bool isSameDevice (const QString &path)
virtual void setSpeed (int speed)
virtual MythMediaStatus checkMedia ()=0
virtual MythMediaError eject (bool open_close=true)
virtual MythMediaError lock ()
virtual MythMediaError unlock ()
virtual bool performMountCmd (bool DoMount)
bool mount ()
bool unmount ()
bool isMounted (bool bVerify=true)
 Tells us if m_DevicePath is a mounted device.
bool findMountPath ()
 Try to find a mount of m_DevicePath in the mounts file.
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 (MythMediaType 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.
MythMediaType 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.
MythMediaStatus setStatus (MythMediaStatus 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.
MythMediaStatus m_Status
 The status of the media as of the.
MythMediaType m_MediaType
 last call to checkMedia. 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

Detailed Description

Definition at line 48 of file mythmedia.h.


Constructor & Destructor Documentation

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

Definition at line 67 of file mythmedia.cpp.

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

Definition at line 129 of file mythmedia.h.


Member Function Documentation

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

Definition at line 58 of file mythmedia.h.

Referenced by MediaMonitor::GetMountPath(), handleMedia(), and MediaMonitor::shouldIgnore().

void MythMediaDevice::setMountPath ( const char *  path  )  [inline]
const QString& MythMediaDevice::getDevicePath (  )  const [inline]
const QString& MythMediaDevice::getRealDevice (  )  const [inline]

Definition at line 63 of file mythmedia.h.

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

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

Definition at line 67 of file mythmedia.h.

Referenced by DevName().

void MythMediaDevice::setDeviceModel ( const char *  model  )  [inline]
MythMediaStatus MythMediaDevice::getStatus (  )  const [inline]
const QString& MythMediaDevice::getVolumeID (  )  const [inline]

Definition at line 72 of file mythmedia.h.

Referenced by DevName().

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

Definition at line 75 of file mythmedia.h.

bool MythMediaDevice::getAllowEject (  )  const [inline]

Definition at line 77 of file mythmedia.h.

bool MythMediaDevice::getLocked (  )  const [inline]

Definition at line 79 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 84 of file mythmedia.h.

Referenced by MythCDROMLinux::checkMedia(), MediaMonitor::eventFilter(), handleDVDMedia(), and handleMedia().

MythMediaType MythMediaDevice::getMediaType (  )  const [inline]
bool MythMediaDevice::isSuperMount (  )  const [inline]

Definition at line 93 of file mythmedia.h.

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

Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.

Definition at line 95 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 305 of file mythmedia.cpp.

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

Reimplemented in MythCDROMDarwin, and MythCDROMLinux.

Definition at line 316 of file mythmedia.cpp.

Referenced by MediaMonitor::SetCDSpeed().

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

Implemented in MythCDROMLinux, MythCDROM, and MythHDD.

Referenced by MediaMonitor::CheckDevices().

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

Reimplemented in MythCDROMFreeBSD, MythCDROMLinux, and MythHDD.

Definition at line 286 of file mythmedia.cpp.

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

MythMediaError MythMediaDevice::lock ( void   )  [virtual]

Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.

Definition at line 323 of file mythmedia.cpp.

MythMediaError MythMediaDevice::unlock ( void   )  [virtual]

Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.

Definition at line 336 of file mythmedia.cpp.

Referenced by MediaMonitor::AttemptEject(), and MythCDROM::onDeviceMounted().

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

Definition at line 110 of file mythmedia.cpp.

bool MythMediaDevice::mount (  )  [inline]
bool MythMediaDevice::unmount (  )  [inline]

Definition at line 107 of file mythmedia.h.

Referenced by MediaMonitor::AttemptEject(), MythCDROM::onDeviceMounted(), and setStatus().

bool MythMediaDevice::isMounted ( bool  bVerify = true  ) 
bool MythMediaDevice::findMountPath (  ) 

Try to find a mount of m_DevicePath in the mounts file.

Definition at line 353 of file mythmedia.cpp.

Referenced by MediaMonitor::GetMountPath(), isMounted(), and performMountCmd().

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

Used to register media types with extensions.

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

Definition at line 278 of file mythmedia.cpp.

void MythMediaDevice::clearData (  ) 

Definition at line 491 of file mythmedia.cpp.

Referenced by MediaMonitor::mediaStatusChanged().

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

Definition at line 503 of file mythmedia.cpp.

void MythMediaDevice::statusChanged ( MythMediaStatus  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 132 of file mythmedia.h.

Referenced by performMountCmd().

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

Override this to perform any post unmount logic.

Definition at line 140 of file mythmedia.h.

Referenced by performMountCmd().

MythMediaType MythMediaDevice::DetectMediaType ( void   )  [protected]

Returns guessed media type based on file extensions.

Definition at line 187 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 240 of file mythmedia.cpp.

Referenced by DetectMediaType().

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

Friends And Related Function Documentation

friend class MediaMonitorDarwin [friend]

Definition at line 51 of file mythmedia.h.

friend class MonitorThreadDarwin [friend]

Definition at line 52 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 116 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 117 of file mythmedia.h.

QString MythMediaDevice::m_DeviceModel [protected]

The device Manufacturer/Model. Read/write.

Definition at line 147 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 150 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 152 of file mythmedia.h.

Referenced by MythHDD::checkMedia(), DetectMediaType(), findMountPath(), 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 154 of file mythmedia.h.

Referenced by findMountPath(), and MythMediaDevice().

QString MythMediaDevice::m_VolumeID [protected]

The volume ID of the media. Read/write.

Definition at line 156 of file mythmedia.h.

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

last call to checkMedia. Read only

The type of media. Read only

Definition at line 160 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 162 of file mythmedia.h.

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

Is this media locked?. Read only.

Definition at line 163 of file mythmedia.h.

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

Is this a supermount device?. Read only.

Definition at line 164 of file mythmedia.h.

Referenced by MythMediaDevice(), and performMountCmd().

Map of extension to media type.

Definition at line 171 of file mythmedia.h.

Referenced by DetectMediaType(), and RegisterMediaExtensions().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Sat Feb 11 06:42:12 2012 for MythTV by  doxygen 1.6.3