Changeset 2178:397f705a9564 in roaraudio


Ignore:
Timestamp:
07/26/09 18:01:41 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added roar_bixcoder_*() code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/transcode.c

    r2177 r2178  
    137137} 
    138138 
    139 int roar_bixcoder_init(struct roar_bixcoder * state, struct roar_audio_info * info, struct roar_vio_calls * vio); 
     139int roar_bixcoder_init(struct roar_bixcoder * state, struct roar_audio_info * info, struct roar_vio_calls * vio) { 
     140 if ( state == NULL || info == NULL || vio == NULL ) 
     141  return -1; 
     142 
     143 memset(state, 0, sizeof(struct roar_bixcoder)); 
     144 
     145 if ( roar_xcoder_init(&(state->encoder), 1, info, vio) == -1 ) 
     146  return -1; 
     147 
     148 if ( roar_xcoder_init(&(state->decoder), 0, info, vio) == -1 ) { 
     149  roar_xcoder_close(&(state->encoder)); 
     150  return -1; 
     151 } 
     152 
     153 return 0; 
     154} 
     155 
    140156int roar_bixcoder_packet_size (struct roar_bixcoder * state, int samples); 
    141 int roar_bixcoder_close       (struct roar_bixcoder * state); 
    142 int roar_bixcoder_read_packet (struct roar_bixcoder * state, void * buf, size_t len); 
    143 int roar_bixcoder_read        (struct roar_bixcoder * state, void * buf, size_t len); 
    144 int roar_bixcoder_write_packet(struct roar_bixcoder * state, void * buf, size_t len); 
    145 int roar_bixcoder_write       (struct roar_bixcoder * state, void * buf, size_t len); 
     157int roar_bixcoder_close       (struct roar_bixcoder * state) { 
     158 int ret = 0; 
     159 
     160 if ( state == NULL ) 
     161  return -1; 
     162 
     163 ret = roar_xcoder_close(&(state->encoder)); 
     164 
     165 if ( roar_xcoder_close(&(state->decoder)) == -1 ) 
     166  return -1; 
     167 
     168 return ret; 
     169} 
     170 
     171int roar_bixcoder_read_packet (struct roar_bixcoder * state, void * buf, size_t len) { 
     172 if ( state == NULL ) 
     173  return -1; 
     174 
     175 return roar_xcoder_proc_packet(&(state->decoder), buf, len); 
     176} 
     177 
     178int roar_bixcoder_read        (struct roar_bixcoder * state, void * buf, size_t len) { 
     179 if ( state == NULL ) 
     180  return -1; 
     181 
     182 return roar_xcoder_proc(&(state->decoder), buf, len); 
     183} 
     184 
     185int roar_bixcoder_write_packet(struct roar_bixcoder * state, void * buf, size_t len) { 
     186 if ( state == NULL ) 
     187  return -1; 
     188 
     189 return roar_xcoder_proc_packet(&(state->encoder), buf, len); 
     190} 
     191 
     192int roar_bixcoder_write       (struct roar_bixcoder * state, void * buf, size_t len) { 
     193 if ( state == NULL ) 
     194  return -1; 
     195 
     196 return roar_xcoder_proc(&(state->encoder), buf, len); 
     197} 
    146198 
    147199// dummy functions used by some de/encoders: 
Note: See TracChangeset for help on using the changeset viewer.