[mythtv-commits] Ticket #3666: DVD speed setting only works when using media monitoring

MythTV mythtv at cvs.mythtv.org
Mon Jul 2 12:28:33 UTC 2007


#3666: DVD speed setting only works when using media monitoring
-----------------------+----------------------------------------------------
 Reporter:  anonymous  |        Owner:  ijr    
     Type:  defect     |       Status:  new    
 Priority:  minor      |    Milestone:  unknown
Component:  mythtv     |      Version:  head   
 Severity:  medium     |   Resolution:         
  Mlocked:  0          |  
-----------------------+----------------------------------------------------

Comment(by nigel):

 Untested quick patch for this, and #3662:
 {{{
 % svn diff
 Index: mythmediamonitor.h
 ===================================================================
 --- mythmediamonitor.h  (revision 13796)
 +++ mythmediamonitor.h  (working copy)
 @@ -97,7 +97,12 @@
      QValueList<MythMediaDevice*> m_RemovedDevices;
      QMap<MythMediaDevice*, int>  m_UseCount;

 -    bool                         m_Active;
 +    /// List of devices/mountpoints that the user doesn't want to
 monitor:
 +    QStringList                  m_IgnoreList;
 +
 +    bool                         m_Active;    ///> After
 StartMonitoring()
 +    bool                         m_SendEvent; ///> Should we postEvent()?
 +
      MonitorThread                *m_Thread;
      unsigned long                m_MonitorPollingInterval;
      bool                         m_AllowEject;
 Index: mediamonitor-darwin.cpp
 ===================================================================
 --- mediamonitor-darwin.cpp     (revision 13796)
 +++ mediamonitor-darwin.cpp     (working copy)
 @@ -489,9 +489,16 @@
      /// Devices on Mac OS X don't change status the way Linux ones do,
      /// so we need a different way to inform plugins that a new drive
      /// is available. I think this leaks a little memory?
 -    QApplication::postEvent((QObject*)gContext->GetMainWindow(),
 -                            new MediaEvent(MEDIASTAT_USEABLE, pDevice));
 +    if (m_SendEvent)
 +        QApplication::postEvent((QObject*)gContext->GetMainWindow(),
 +                                new MediaEvent(MEDIASTAT_USEABLE,
 pDevice));

 +
 +    // If the user doesn't want this device to be monitored, stop now:
 +    if (m_IgnoreList.contains(pDevice->getMountPath()) ||
 +        m_IgnoreList.contains(pDevice->getDevicePath()) )
 +        return false;
 +
      m_Devices.push_back( pDevice );
      m_UseCount[pDevice] = 0;

 Index: mythmediamonitor.cpp
 ===================================================================
 --- mythmediamonitor.cpp        (revision 13796)
 +++ mythmediamonitor.cpp        (working copy)
 @@ -251,11 +251,29 @@
      }
  }

 +/**
 + * \brief    Lookup some settings, and do OS-specific stuff in sub-
 classes
 + *
 + * \warning  If the user changes the MonitorDrives or IgnoreDevices
 settings,
 + *           it will have no effect until the frontend is restarted.
 + */
  MediaMonitor::MediaMonitor(QObject* par, unsigned long interval,
                             bool allowEject)
      : QObject(par), m_Active(false), m_Thread(NULL),
        m_MonitorPollingInterval(interval), m_AllowEject(allowEject)
  {
 +    // Devices are now always monitored,
 +    // but by default we don't send status changed events:
 +    m_SendEvent = gContext->GetNumSetting("MonitorDrives");
 +
 +
 +    // User can specify that some devices are not monitored
 +    QString ignore = gContext->GetSetting("IgnoreDevices", "");
 +
 +    if (ignore.length())
 +        m_IgnoreList = QStringList::split(',', ignore);
 +    else
 +        m_IgnoreList = QStringList::QStringList();  // Force empty list
  }

  MediaMonitor::~MediaMonitor()
 @@ -479,7 +497,7 @@
                                        MythMediaDevice* pMedia)
  {
      // If we're not active then ignore signal.
 -    if (!m_Active)
 +    if (!m_Active || !m_SendEvent)
          return;

      VERBOSE(VB_IMPORTANT, QString("Media status changed...  New status
 is: %1 "
 Index: mediamonitor-unix.cpp
 ===================================================================
 --- mediamonitor-unix.cpp       (revision 13796)
 +++ mediamonitor-unix.cpp       (working copy)
 @@ -290,7 +290,9 @@
      device->setDeviceModel(desc);
  }

 -// Given a media deivce add it to our collection.
 +/**
 + * Given a media device, add it to our collection
 + */
  bool MediaMonitorUnix::AddDevice(MythMediaDevice* pDevice)
  {
      if ( ! pDevice )
 @@ -299,6 +301,11 @@
          return false;
      }

 +    // If the user doesn't want this device to be monitored, stop now:
 +    if (m_IgnoreList.contains(pDevice->getMountPath()) ||
 +        m_IgnoreList.contains(pDevice->getDevicePath()) )
 +        return false;
 +
      dev_t new_rdev;
      struct stat sb;

 Index: mediamonitor-windows.cpp
 ===================================================================
 --- mediamonitor-windows.cpp    (revision 13796)
 +++ mediamonitor-windows.cpp    (working copy)
 @@ -48,6 +48,24 @@
  }


 +bool MediaMonitorWindows::AddDevice(MythMediaDevice* pDevice)
 +{
 +    if (! pDevice)
 +    {
 +        VERBOSE(VB_IMPORTANT, "Error - MediaMonitor::AddDevice(null)");
 +        return false;
 +    }
 +
 +    // If the user doesn't want this device to be monitored, stop now:
 +    if (m_IgnoreList.contains(pDevice->getDevicePath()))
 +        return false;
 +
 +    m_Devices.push_back(pDevice);
 +    m_UseCount[pDevice] = 0;
 +
 +    return true;
 +}
 +
  QStringList MediaMonitorWindows::GetCDROMBlockDevices()
  {
      QStringList  list;
 }}}

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/3666#comment:1>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list