Search
lxdream.org :: lxdream/src/gdrom/gdrom.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.c
changeset 709:18c39a8e504c
prev695:2bb59940ff35
next736:a02d1475ccfd
author nkeynes
date Wed Jun 25 10:40:45 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change Commit OSX CD-ROM driver work-in-progress
file annotate diff log raw
1.1 --- a/src/gdrom/gdrom.c Sun Jun 22 03:58:24 2008 +0000
1.2 +++ b/src/gdrom/gdrom.c Wed Jun 25 10:40:45 2008 +0000
1.3 @@ -46,18 +46,40 @@
1.4 "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };
1.5 uint32_t gdrom_sector_size[] = { 0, 2048, 2336, 2048, 2324, 2352, 2336, 2352, 2352 };
1.6
1.7 -gdrom_disc_t gdrom_image_open( const gchar *filename )
1.8 +gdrom_disc_t gdrom_image_open( const gchar *inFilename )
1.9 {
1.10 + const gchar *filename = inFilename;
1.11 const gchar *ext = strrchr(filename, '.');
1.12 gdrom_disc_t disc = NULL;
1.13 -
1.14 - int fd = open( filename, O_RDONLY | O_NONBLOCK );
1.15 + int fd;
1.16 FILE *f;
1.17 int i;
1.18 gdrom_image_class_t extclz = NULL;
1.19
1.20 + // Check for a url-style filename.
1.21 + char *lizard_lips = strstr( filename, "://" );
1.22 + if( lizard_lips != NULL ) {
1.23 + gchar *path = lizard_lips + 3;
1.24 + int method_len = (lizard_lips-filename);
1.25 + gchar method[method_len + 1];
1.26 + memcpy( method, filename, method_len );
1.27 + method[method_len] = '\0';
1.28 +
1.29 + if( strcasecmp( method, "file" ) == 0 ) {
1.30 + filename = path;
1.31 + } else if( strcasecmp( method, "dvd" ) == 0 ||
1.32 + strcasecmp( method, "cd" ) == 0 ||
1.33 + strcasecmp( method, "cdrom" ) ) {
1.34 + return cdrom_open_device( method, path );
1.35 + } else {
1.36 + ERROR( "Unrecognized URL method '%s' in filename '%s'", method, filename );
1.37 + return NULL;
1.38 + }
1.39 + }
1.40 +
1.41 + fd = open( filename, O_RDONLY | O_NONBLOCK );
1.42 if( fd == -1 ) {
1.43 - return NULL;
1.44 + return NULL;
1.45 }
1.46
1.47 f = fdopen(fd, "ro");
.