[mythtv] [PATCH] MythVideo & Mediamonitoring (suite)

Leo Weppelman leo at wau.mis.ah.nl
Wed Jun 16 08:36:13 EDT 2004


Xavier,

On Sun, Jun 13, 2004 at 06:57:50PM +0200, Xavier Hervy wrote:
> Ok i send to patch the first is for mythtv :
> - fix bug about lock drive
> - get volumeid from iso9660

I have been playing with these 2 patches a little. Inserted is a dvd
with a movie (UNBREAKABLE).
With your patches I see the following:
  2004-06-16 13:54:59 mythfrontend version: 0.15.20040528-1 www.mythtv.org
  2004-06-16 13:54:59 Enabled verbose msgs : important general
  2004-06-16 13:55:06 Registering Internal as a media playback plugin.
  2004-06-16 13:55:06 Registering MythDVD DVD Media Handler as a media handler
  2004-06-16 13:55:06 Registering MythDVD VCD Media Handler as a media handler
  2004-06-16 13:55:07 Registering MythVideo CD/DVD DATA Media Handler as a
                      media handler
  2004-06-16 13:55:10 Mediamonitor: Adding /dev/cdrom
  2004-06-16 13:55:10 Starting media monitor.
  2004-06-16 13:57:04 Media status changed...  New status is: MEDIASTAT_OPEN
                      old status was MEDIASTAT_NOTMOUNTED
  VolumeID UNBREAKABLE                     
  2004-06-16 13:57:25 Executing '/bin/mount /dev/cdrom'
  mount: /dev/cdrom already mounted or /cdrom busy
  2004-06-16 13:57:25 Failed to /bin/mount /dev/cdrom.
  2004-06-16 13:57:25 Media status changed...  New status is:
                      MEDIASTAT_NOTMOUNTED old status was MEDIASTAT_OPEN

So, the VolumeID is OK. But the mount fails. I saw that your patch 
removes the close at the start of MythMediaDevice::performMountCmd().
When I put that back, the mount succeeds...

There is another nit I'd like to make to the media handler. On the inserted
DVD, the directory '/video_ts' is all in lowercase while the mediahandler
expects it in uppercase. I suspect that difference is caused by the way
the dvd is created. Can you (or someone else) check if I am the only one
seeing this? The following patch accepts both:


Index: mythcdrom.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcdrom.cpp,v
retrieving revision 1.7
diff -u -r1.7 mythcdrom.cpp
--- mythcdrom.cpp	4 Jun 2004 02:31:22 -0000	1.7
+++ mythcdrom.cpp	16 Jun 2004 12:16:06 -0000
@@ -14,8 +14,10 @@
 // end for testing
 
 #ifndef PATHTO_DVD_DETECT
-#define PATHTO_DVD_DETECT "/VIDEO_TS"
+#define PATHTO_DVD_DETECT "/VIDEO_TS" , "/video_ts"
 #endif
+static char *Dvd_detect_strings[] = { PATHTO_DVD_DETECT };
+
 
 #ifndef PATHTO_VCD_DETECT
 #define PATHTO_VCD_DETECT "/vcd"
@@ -54,20 +56,24 @@
 
 void MythCDROM::onDeviceMounted()
 {
+    unsigned i;
     QString DetectPath;
-    DetectPath.sprintf("%s%s", (const char*)m_MountPath, PATHTO_DVD_DETECT);
-    VERBOSE(VB_ALL, QString("Looking for: '%1'").arg(DetectPath));
-
     struct stat sbuf;
-    if (stat(DetectPath, &sbuf) == 0)
-    {
-        VERBOSE(VB_GENERAL, "Probable DVD detected.");
-        m_MediaType = MEDIATYPE_DVD;
-        // HACK make it possible to eject a DVD by unmounting it
-        performMountCmd(false);
-        m_Status = MEDIASTAT_USEABLE; 
+
+    for (i = 0; i < sizeof(Dvd_detect_strings)/sizeof(char*); i++) {
+        DetectPath.sprintf("%s%s", (const char*)m_MountPath,
+                                              Dvd_detect_strings[i]);
+        VERBOSE(VB_ALL, QString("Looking for: '%1'").arg(DetectPath));
+        if (stat(DetectPath, &sbuf) == 0)
+        {
+            VERBOSE(VB_GENERAL, "Probable DVD detected.");
+            m_MediaType = MEDIATYPE_DVD;
+            // HACK make it possible to eject a DVD by unmounting it
+            performMountCmd(false);
+            m_Status = MEDIASTAT_USEABLE; 
+	    break;
+        }
     }
-    
     DetectPath.sprintf("%s%s", (const char*)m_MountPath, PATHTO_VCD_DETECT);
     VERBOSE(VB_ALL, QString("Looking for: '%1'").arg(DetectPath));


More information about the mythtv-dev mailing list