Changeset 820:9e1bd17bb1f9 in roaraudio
- Timestamp:
- 09/18/08 20:32:00 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/cdrom.c
r813 r820 36 36 37 37 int roar_cdrom_open (struct roar_connection * con, struct roar_cdrom * cdrom, char * device) { 38 int flags; 39 38 40 if ( cdrom == NULL ) 39 41 return -1; … … 49 51 strncpy(cdrom->device, device, ROAR_CDROM_MAX_DEVLEN); 50 52 51 cdrom->con = con; // we do not care here if it is set or not as we can operate in local only mode53 cdrom->con = con; // we do not care here if it is set or not as we can operate in local only mode 52 54 53 cdrom->stream = -1; 54 cdrom->fh = -1; 55 cdrom->stream = -1; 56 cdrom->play_local = 1; 57 58 if ( (cdrom->fh = open(cdrom->device, O_RDONLY, 0644)) == -1 ) 59 return -1; 60 61 if ( (flags = fcntl(cdrom->fh, F_GETFL, 0)) == -1 ) { 62 close(cdrom->fh); 63 cdrom->fh = -1; 64 return -1; 65 } 66 67 flags |= FD_CLOEXEC; 68 69 if ( fcntl(cdrom->fh, F_SETFL, flags) == -1 ) { 70 close(cdrom->fh); 71 cdrom->fh = -1; 72 return -1; 73 } 55 74 56 75 return 0; … … 69 88 } 70 89 71 int roar_cdrom_stop (struct roar_cdrom * cdrom); 72 int roar_cdrom_play (struct roar_cdrom * cdrom, int track); 90 int roar_cdrom_stop (struct roar_cdrom * cdrom) { 91 int ret; 92 93 if ( cdrom == NULL ) 94 return -1; 95 96 if ( cdrom->con == NULL ) 97 return -1; 98 99 if ( cdrom->stream == -1 ) 100 return -1; 101 102 if ( (ret = roar_kick(cdrom->con, ROAR_OT_STREAM, cdrom->stream)) == -1 ) { 103 return -1; 104 } 105 106 cdrom->stream = -1; 107 108 return ret; 109 } 110 111 int roar_cdrom_play (struct roar_cdrom * cdrom, int track) { 112 if ( cdrom == NULL ) 113 return -1; 114 115 if ( cdrom->con == NULL ) 116 return -1; 117 118 if ( cdrom->stream != -1 ) { 119 if ( roar_cdrom_stop(cdrom) == -1 ) 120 return -1; 121 } 122 123 if ( cdrom->play_local ) { 124 #ifdef ROAR_HAVE_BIN_CDPARANOIA 125 return -1; 126 #else 127 return -1; 128 #endif 129 } else { 130 // no support for remote playback yet 131 return -1; 132 } 133 } 73 134 74 135 //ll
Note: See TracChangeset
for help on using the changeset viewer.