Changeset 5535:051e141134da in roaraudio for libroar


Ignore:
Timestamp:
06/12/12 15:24:46 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added roar_stream_new_by_info() as well as done some related cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/stream.c

    r5463 r5535  
    8686 } 
    8787 
     88 if ( bits > ROAR_BITS_MAX ) { 
     89  roar_err_set(ROAR_ERROR_RANGE); 
     90  return -1; 
     91 } 
     92 
    8893 s->fh         = -1; 
    8994 s->id         = -1; 
     
    9398 s->dir        = ROAR_DIR_DEFAULT; 
    9499 
    95 /* 
    96  s->datalen    = 0; 
    97  s->offset     = 0; 
    98  
    99  s->database   = NULL; 
    100  s->dataoff    = NULL; 
    101 */ 
    102  
    103100 s->info.rate     = rate; 
    104101 s->info.channels = channels; 
     
    106103 s->info.codec    = codec; 
    107104 
    108  if ( bits > ROAR_BITS_MAX ) 
    109   return -1; 
     105 return 0; 
     106} 
     107 
     108int roar_stream_new_by_info (struct roar_stream * s, const struct roar_audio_info * info) { 
     109 if ( s == NULL ) { 
     110  roar_err_set(ROAR_ERROR_FAULT); 
     111  return -1; 
     112 } 
     113 
     114 if ( info->bits > ROAR_BITS_MAX ) { 
     115  roar_err_set(ROAR_ERROR_RANGE); 
     116  return -1; 
     117 } 
     118 
     119 s->fh         = -1; 
     120 s->id         = -1; 
     121 s->pos        =  0; 
     122 s->pos_rel_id = -1; 
     123 
     124 s->dir        = ROAR_DIR_DEFAULT; 
     125 
     126 s->info = *info; 
    110127 
    111128 return 0; 
Note: See TracChangeset for help on using the changeset viewer.