Index: totem-disc.c
===================================================================
RCS file: /cvs/gnome/totem/src/plparse/totem-disc.c,v
retrieving revision 1.17
diff -u -r1.17 totem-disc.c
--- totem-disc.c	13 Mar 2005 13:37:57 -0000	1.17
+++ totem-disc.c	20 May 2005 23:36:59 -0000
@@ -142,36 +142,35 @@
 	      GError     **error)
 {
   CdCache *cache;
-  char *mountpoint = NULL, *device;
+  char *mountpoint = NULL, *device, *local;
   GnomeVFSVolumeMonitor *mon;
   GnomeVFSDrive *drive = NULL;
   GList *list, *or;
   gboolean is_dir;
 
   if (g_str_has_prefix (dev, "file://") != FALSE)
-    device = g_filename_from_uri (dev, NULL, NULL);
+    local = g_filename_from_uri (dev, NULL, NULL);
   else
-    device = g_strdup (dev);
+    local = g_strdup (dev);
 
-  if (device == NULL)
-    return NULL;
+  g_assert (local != NULL);
 
-  is_dir = g_file_test (device, G_FILE_TEST_IS_DIR);
+  is_dir = g_file_test (local, G_FILE_TEST_IS_DIR);
 
   if (is_dir) {
     cache = g_new0 (CdCache, 1);
-    cache->mountpoint = device;
+    cache->mountpoint = local;
     cache->fd = -1;
     cache->is_media = FALSE;
 
     return cache;
   }
 
-  g_free (device);
-
   /* retrieve mountpoint (/etc/fstab). We could also use HAL for this,
    * I think (gnome-volume-manager does that). */
-  if (!(device = get_device (dev, error)))
+  device = get_device (local, error);
+  g_free (local);
+  if (!device)
     return NULL;
   mon = gnome_vfs_get_volume_monitor ();
   for (or = list = gnome_vfs_volume_monitor_get_connected_drives (mon);
@@ -497,6 +496,22 @@
   return MEDIA_TYPE_DATA;
 }
 
+static char *
+totem_cd_mrl_from_type (const char *scheme, const char *dir)
+{
+  char *retval;
+
+  if (g_str_has_prefix (dir, "file://") != FALSE) {
+    char *local;
+    local = g_filename_from_uri (dir, NULL, NULL);
+    retval = g_strdup_printf ("%s://%s", scheme, local);
+    g_free (local);
+  } else {
+    retval = g_strdup_printf ("%s://%s", scheme, dir);
+  }
+  return retval;
+}
+
 MediaType
 totem_cd_detect_type_from_dir (const char *dir, char **url, GError **error)
 {
@@ -523,23 +538,9 @@
   }
 
   if (type == MEDIA_TYPE_DVD) {
-    if (g_str_has_prefix (dir, "file://") != FALSE) {
-      char *local;
-      local = g_filename_from_uri (dir, NULL, NULL);
-      *url = g_strdup_printf ("dvd://%s", local);
-      g_free (local);
-    } else {
-      *url = g_strdup_printf ("dvd://%s", dir);
-    }
+    *url = totem_cd_mrl_from_type ("dvd", dir);
   } else if (type == MEDIA_TYPE_VCD) {
-    if (g_str_has_prefix (dir, "file://") != FALSE) {
-      char *local;
-      local = g_filename_from_uri (dir, NULL, NULL);
-      *url = g_strdup_printf ("vcd://%s", local);
-      g_free (local);
-    } else {
-      *url = g_strdup_printf ("vcd://%s", dir);
-    }
+    *url = totem_cd_mrl_from_type ("vcd", dir);
   }
 
   return type;
@@ -554,7 +555,9 @@
 
   if (!(cache = cd_cache_new (device, error)))
     return MEDIA_TYPE_ERROR;
-  if ((type = cd_cache_disc_is_cdda (cache, error)) == MEDIA_TYPE_DATA &&
+
+  type = cd_cache_disc_is_cdda (cache, error);
+  if ((type == MEDIA_TYPE_DATA || type == MEDIA_TYPE_ERROR) &&
       (type = cd_cache_disc_is_vcd (cache, error)) == MEDIA_TYPE_DATA &&
       (type = cd_cache_disc_is_dvd (cache, error)) == MEDIA_TYPE_DATA) {
     /* crap, nothing found */
@@ -562,6 +565,26 @@
   cd_cache_free (cache);
 
   return type;
+}
+
+MediaType
+totem_cd_detect_type_with_url (const char  *device,
+			       char       **url,
+			       GError     **error)
+{
+  MediaType type;
+
+  type = totem_cd_detect_type (device, error);
+  switch (type) {
+  case MEDIA_TYPE_DVD:
+    *url = totem_cd_mrl_from_type ("dvd", device);
+    return type;
+  case MEDIA_TYPE_VCD:
+    *url = totem_cd_mrl_from_type ("vcd", device);
+    return type;
+  default:
+    return type;
+  }
 }
 
 const char *
Index: totem-disc.h
===================================================================
RCS file: /cvs/gnome/totem/src/plparse/totem-disc.h,v
retrieving revision 1.5
diff -u -r1.5 totem-disc.h
--- totem-disc.h	30 Dec 2004 20:25:33 -0000	1.5
+++ totem-disc.h	20 May 2005 23:36:59 -0000
@@ -36,6 +36,9 @@
 
 MediaType	totem_cd_detect_type	(const char *device,
 					 GError     **error);
+MediaType	totem_cd_detect_type_with_url (const char  *device,
+					       char       **url,
+					       GError     **error);
 MediaType	totem_cd_detect_type_from_dir (const char *dir,
 					 char      **url, 
 					 GError    **error);
Index: totem-pl-parser.c
===================================================================
RCS file: /cvs/gnome/totem/src/plparse/totem-pl-parser.c,v
retrieving revision 1.66
diff -u -r1.66 totem-pl-parser.c
--- totem-pl-parser.c	7 May 2005 17:35:13 -0000	1.66
+++ totem-pl-parser.c	20 May 2005 23:37:01 -0000
@@ -1029,6 +1029,23 @@
 }
 
 static TotemPlParserResult
+totem_pl_parser_add_block (TotemPlParser *parser, const char *url, gpointer data)
+{
+	MediaType type;
+	char *media_url;
+
+	type = totem_cd_detect_type_with_url (url, &media_url, NULL);
+	if (type == MEDIA_TYPE_DATA || media_url == NULL)
+		return TOTEM_PL_PARSER_RESULT_UNHANDLED;
+	else if (type == MEDIA_TYPE_ERROR)
+		return TOTEM_PL_PARSER_RESULT_ERROR;
+
+	totem_pl_parser_add_one_url (parser, media_url, NULL);
+	g_free (media_url);
+	return TOTEM_PL_PARSER_RESULT_SUCCESS;
+}
+
+static TotemPlParserResult
 totem_pl_parser_add_asx (TotemPlParser *parser, const char *url, gpointer data)
 {
 	xmlDocPtr doc;
@@ -1340,6 +1357,7 @@
 	{ "x-directory/normal", totem_pl_parser_add_directory },
 	{ "video/x-ms-wvx", totem_pl_parser_add_asx },
 	{ "audio/x-ms-wax", totem_pl_parser_add_asx },
+	{ "x-special/device-block", totem_pl_parser_add_block },
 };
 
 /* These ones are "dual" types, might be a video, might be a parser */
