~ubuntu-branches/ubuntu/intrepid/kdemultimedia/intrepid-updates

« back to all changes in this revision

Viewing changes to libkcompactdisc/wmlib/cdda.c

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2008-07-12 13:07:42 UTC
  • mfrom: (1.2.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080712130742-rpptq2hakyn2y0zj
Tags: 4:4.0.98-0ubuntu1
* New upstream release candidate
* Bump Standards-Version to 3.8.0
* -dbg depends kdemultimedia

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
   if we read 15 frames(8820 samples), we get in each block, data for 1/5 sec */
42
42
#define COUNT_CDDA_FRAMES_PER_BLOCK 15
43
43
 
44
 
/* Only Linux and Sun define the number of blocks explicity; assume all
 
44
/* Only Linux and Sun define the number of blocks explicitly; assume all
45
45
   other systems are like Linux and have 10 blocks.
46
46
*/
47
47
#ifndef COUNT_CDDA_BLOCKS
250
250
        }
251
251
 
252
252
        i = 0;
253
 
        pthread_mutex_lock(&blks_mutex[i]);
 
253
        (void) pthread_mutex_lock(&blks_mutex[i]);
254
254
        wakeup = 1;
255
255
 
256
256
        while(d->command == WM_CDM_PLAYING) {
265
265
            }
266
266
 
267
267
            j = get_next_block(i);
268
 
            pthread_mutex_lock(&blks_mutex[j]);
 
268
            (void) pthread_mutex_lock(&blks_mutex[j]);
269
269
 
270
270
            if(wakeup) {
271
271
                wakeup = 0;
272
272
                pthread_cond_signal(&wakeup_audio);
273
273
            }
274
274
 
275
 
            pthread_mutex_unlock(&blks_mutex[i]);
 
275
            (void) pthread_mutex_unlock(&blks_mutex[i]);
276
276
            /* audio can start here */
277
277
 
278
278
            i = j;
279
279
        }
280
280
 
281
 
        pthread_mutex_unlock(&blks_mutex[i]);
 
281
        (void) pthread_mutex_unlock(&blks_mutex[i]);
282
282
    }
283
283
 
284
284
    return 0;
292
292
    while (d->blocks) {
293
293
        if(d->command != WM_CDM_PLAYING) {
294
294
            i = 0;
295
 
            pthread_mutex_lock(&blks_mutex[i]);
 
295
            (void) pthread_mutex_lock(&blks_mutex[i]);
296
296
            pthread_cond_wait(&wakeup_audio, &blks_mutex[i]);
297
297
        } else {
298
298
            i = get_next_block(i);
299
 
            pthread_mutex_lock(&blks_mutex[i]);
 
299
            (void) pthread_mutex_lock(&blks_mutex[i]);
300
300
        }
301
301
 
302
302
        if (oops->wmaudio_play(&blks[i])) {
313
313
        if ((d->status = blks[i].status) == WM_CDM_TRACK_DONE)
314
314
            d->command = WM_CDM_STOPPED;
315
315
 
316
 
        pthread_mutex_unlock(&blks_mutex[i]);
 
316
        (void) pthread_mutex_unlock(&blks_mutex[i]);
317
317
    }
318
318
 
319
319
    return 0;
325
325
int wm_cdda_init(struct wm_drive *d)
326
326
{
327
327
        int ret = 0;
328
 
        
 
328
 
329
329
        if (d->cddax) {
330
330
                wm_cdda_destroy(d);
331
 
        
 
331
 
332
332
                wm_susleep(1000);
333
333
                d->blocks = 0;
334
334
                wm_susleep(1000);
335
335
        }
336
 
        
 
336
 
337
337
        memset(blks, 0, sizeof(blks));
338
 
        
 
338
 
339
339
        d->blocks = blks;
340
340
        d->frames_at_once = COUNT_CDDA_FRAMES_PER_BLOCK;
341
341
        d->numblocks = COUNT_CDDA_BLOCKS;
348
348
                return ret;
349
349
 
350
350
        wm_scsi_set_speed(d, 4);
351
 
        
 
351
 
352
352
        oops = setup_soundsystem(d->soundsystem, d->sounddevice, d->ctldevice);
353
353
        if (!oops) {
354
354
                ERRORLOG("cdda: setup_soundsystem failed\n");
355
355
                gen_cdda_close(d);
356
356
                return -1;
357
357
        }
358
 
        
 
358
 
359
359
        if(pthread_create(&thread_read, NULL, cdda_fct_read, d)) {
360
360
                ERRORLOG("error by create pthread");
361
361
                oops->wmaudio_close();