Changeset 5535:051e141134da in roaraudio


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

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/stream.h

    r5381 r5535  
    6161int roar_stream_new     (struct roar_stream * s, unsigned int rate, unsigned int channels, unsigned int bits, unsigned int codec) _LIBROAR_ATTR_NONNULL_ALL; 
    6262 
     63int roar_stream_new_by_info (struct roar_stream * s, const struct roar_audio_info * info) _LIBROAR_STREAM_STDATTRS; 
     64 
    6365int roar_stream_set_rel_id(struct roar_stream * s, int id) _LIBROAR_ATTR_NONNULL_ALL; 
    6466int roar_stream_get_rel_id(struct roar_stream * s) _LIBROAR_STREAM_STDATTRS; 
  • include/roaraudio/stream.h

    r5381 r5535  
    156156 
    157157 struct roar_audio_info info; 
    158  
    159 /* 
    160  int    datalen; 
    161  char * database; 
    162  int    offset; 
    163  char * dataoff; 
    164 */ 
    165158}; 
    166159 
  • 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.