Lines Matching refs:cdrom
65 static int CheckInit(int check_cdrom, SDL_CD **cdrom) in CheckInit() argument
70 if ( check_cdrom && (*cdrom == NULL) ) { in CheckInit()
71 *cdrom = default_cdrom; in CheckInit()
72 if ( *cdrom == NULL ) { in CheckInit()
109 struct SDL_CD *cdrom; in SDL_CDOpen() local
118 cdrom = (SDL_CD *)SDL_malloc(sizeof(*cdrom)); in SDL_CDOpen()
119 if ( cdrom == NULL ) { in SDL_CDOpen()
123 SDL_memset(cdrom, 0, sizeof(*cdrom)); in SDL_CDOpen()
124 cdrom->id = SDL_CDcaps.Open(drive); in SDL_CDOpen()
125 if ( cdrom->id < 0 ) { in SDL_CDOpen()
126 SDL_free(cdrom); in SDL_CDOpen()
129 default_cdrom = cdrom; in SDL_CDOpen()
130 return(cdrom); in SDL_CDOpen()
133 CDstatus SDL_CDStatus(SDL_CD *cdrom) in SDL_CDStatus() argument
140 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDStatus()
145 cdrom->numtracks = 0; in SDL_CDStatus()
146 cdrom->cur_track = 0; in SDL_CDStatus()
147 cdrom->cur_frame = 0; in SDL_CDStatus()
148 status = SDL_CDcaps.Status(cdrom, &i); in SDL_CDStatus()
150 cdrom->status = status; in SDL_CDStatus()
154 if ( SDL_CDcaps.GetTOC(cdrom) < 0 ) { in SDL_CDStatus()
159 for ( i=1; cdrom->track[i].offset <= position; ++i ) { in SDL_CDStatus()
164 position, i-1, cdrom->track[i-1].offset); in SDL_CDStatus()
166 cdrom->cur_track = i-1; in SDL_CDStatus()
167 position -= cdrom->track[cdrom->cur_track].offset; in SDL_CDStatus()
168 cdrom->cur_frame = position; in SDL_CDStatus()
174 int SDL_CDPlayTracks(SDL_CD *cdrom, in SDL_CDPlayTracks() argument
181 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDPlayTracks()
186 if ( (strack < 0) || (strack >= cdrom->numtracks) ) { in SDL_CDPlayTracks()
191 etrack = cdrom->numtracks; in SDL_CDPlayTracks()
201 if ( etrack > cdrom->numtracks ) { in SDL_CDPlayTracks()
208 (cdrom->track[strack].type == SDL_DATA_TRACK) ) { in SDL_CDPlayTracks()
211 if ( sframe >= (int)cdrom->track[strack].length ) { in SDL_CDPlayTracks()
216 (cdrom->track[etrack-1].type == SDL_DATA_TRACK) ) { in SDL_CDPlayTracks()
219 if ( eframe > (int)cdrom->track[etrack].length ) { in SDL_CDPlayTracks()
225 start = (cdrom->track[strack].offset+sframe); in SDL_CDPlayTracks()
226 length = (cdrom->track[etrack].offset+eframe)-start; in SDL_CDPlayTracks()
239 return(SDL_CDcaps.Play(cdrom, start, length)); in SDL_CDPlayTracks()
242 int SDL_CDPlay(SDL_CD *cdrom, int sframe, int length) in SDL_CDPlay() argument
245 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDPlay()
249 return(SDL_CDcaps.Play(cdrom, sframe, length)); in SDL_CDPlay()
252 int SDL_CDPause(SDL_CD *cdrom) in SDL_CDPause() argument
258 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDPause()
262 status = SDL_CDcaps.Status(cdrom, NULL); in SDL_CDPause()
265 retval = SDL_CDcaps.Pause(cdrom); in SDL_CDPause()
274 int SDL_CDResume(SDL_CD *cdrom) in SDL_CDResume() argument
280 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDResume()
284 status = SDL_CDcaps.Status(cdrom, NULL); in SDL_CDResume()
287 retval = SDL_CDcaps.Resume(cdrom); in SDL_CDResume()
295 int SDL_CDStop(SDL_CD *cdrom) in SDL_CDStop() argument
301 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDStop()
305 status = SDL_CDcaps.Status(cdrom, NULL); in SDL_CDStop()
309 retval = SDL_CDcaps.Stop(cdrom); in SDL_CDStop()
317 int SDL_CDEject(SDL_CD *cdrom) in SDL_CDEject() argument
320 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDEject()
323 return(SDL_CDcaps.Eject(cdrom)); in SDL_CDEject()
326 void SDL_CDClose(SDL_CD *cdrom) in SDL_CDClose() argument
329 if ( ! CheckInit(1, &cdrom) ) { in SDL_CDClose()
332 SDL_CDcaps.Close(cdrom); in SDL_CDClose()
333 SDL_free(cdrom); in SDL_CDClose()