MythTV  master
MythTV Media Manager
Collaboration diagram for MythTV Media Manager:

The MythTV Media Manager is a thread in the frontend which looks for any changes to removable media, and sends events to any Frontend Plugins which are interested in that media.

At startup, it creates a list of MythMediaDevice objects (currently MythHDD or MythCDROM and its subclasses) for each removable device configured on the system. A runtime loop then monitors each of these via its checkMedia() method.

When any of these devices change status, a MediaEvent object is created. If the device has a status which is usable, the window jumps to the main menu (to allow the registered jump to work correctly), and the event is dispatched to the relevant plugin's registered media handler. If the device status is unusable (e.g. ejected), the plugin's media handler is called directly (so it can "forget" about this device).

The following tables show typical status transitions for CD/DVD and USB flash drive devices:

      CD/DVD                     USB/FireWire HDD
State        Action           State         Action
NODISK                        NODISK
             eject                          attach
OPEN                          USEABLE
       insert disk, close                   detach
USEABLE                       UNPLUGGED