Changeset 824:1d4fa470c517 in roaraudio for libroar/cdrom.c


Ignore:
Timestamp:
09/19/08 00:08:43 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

remeber pid of playing process, kill on stop, stop on close

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/cdrom.c

    r822 r824  
    3434 
    3535#include "libroar.h" 
     36#include <sys/types.h> 
     37#include <signal.h> 
    3638 
    3739#define ROAR_CDROM_ERROR_NORETURN(format, args...) ROAR_ERR(format, ## args); _exit(3) 
     
    124126 cdrom->stream     = -1; 
    125127 cdrom->play_local =  1; 
     128 cdrom->player     = -1; 
    126129 
    127130 if ( (cdrom->fh = open(cdrom->device, O_RDONLY, 0644)) == -1 ) 
     
    149152  return -1; 
    150153 
     154 roar_cdrom_stop(cdrom); // stop on close 
     155 
    151156 if ( cdrom->fh != -1 ) 
    152157  close(cdrom->fh); 
     
    173178 } 
    174179 
     180 if ( cdrom->player != -1 ) 
     181  kill(cdrom->player, SIGINT); 
     182 
     183 cdrom->player = -1; 
    175184 cdrom->stream = -1; 
    176185 
     
    199208  } 
    200209 
    201   if ( roar_cdrom_run_cdparanoia(cdrom->fh, stream_fh, track, NULL) != -1 ) { 
     210  if ( (cdrom->player = roar_cdrom_run_cdparanoia(cdrom->fh, stream_fh, track, NULL)) != -1 ) { 
     211   cdrom->stream = stream->id; 
    202212   return 0; 
    203213  } 
Note: See TracChangeset for help on using the changeset viewer.