comparison libaf/af.c @ 14335:8380694ba14f

af_bits2fmt and af_str2fmt_short, also removed the extra FORMAT_BPS control in format.c
author alex
date Mon, 03 Jan 2005 18:59:16 +0000
parents 9261d7dcf5e7
children 95bb94a930a3
comparison
equal deleted inserted replaced
14334:8ba01beafb7e 14335:8380694ba14f
268 ((af->prev?af->prev->data->bps:s->input.bps) != in.bps)){ 268 ((af->prev?af->prev->data->bps:s->input.bps) != in.bps)){
269 // Create format filter 269 // Create format filter
270 if(NULL == (new = af_prepend(s,af,"format"))) 270 if(NULL == (new = af_prepend(s,af,"format")))
271 return AF_ERROR; 271 return AF_ERROR;
272 // Set output bits per sample 272 // Set output bits per sample
273 if(AF_OK != (rv = new->control(new,AF_CONTROL_FORMAT_BPS,&in.bps)) || 273 in.format |= af_bits2fmt(in.bps*8);
274 AF_OK != (rv = new->control(new,AF_CONTROL_FORMAT_FMT,&in.format))) 274 if(AF_OK != (rv = new->control(new,AF_CONTROL_FORMAT_FMT,&in.format)))
275 return rv; 275 return rv;
276 // Initialize format filter 276 // Initialize format filter
277 if(!new->prev) 277 if(!new->prev)
278 memcpy(&in,&(s->input),sizeof(af_data_t)); 278 memcpy(&in,&(s->input),sizeof(af_data_t));
279 else 279 else
442 if(strcmp(s->last->info->name,"format")) 442 if(strcmp(s->last->info->name,"format"))
443 af = af_append(s,s->last,"format"); 443 af = af_append(s,s->last,"format");
444 else 444 else
445 af = s->last; 445 af = s->last;
446 // Init the new filter 446 // Init the new filter
447 if(!af ||(AF_OK != af->control(af,AF_CONTROL_FORMAT_BPS,&(s->output.bps))) 447 s->output.format |= af_bits2fmt(s->output.bps*8);
448 || (AF_OK != af->control(af,AF_CONTROL_FORMAT_FMT,&(s->output.format)))) 448 if(!af || (AF_OK != af->control(af,AF_CONTROL_FORMAT_FMT,&(s->output.format))))
449 return -1; 449 return -1;
450 if(AF_OK != af_reinit(s,af)) 450 if(AF_OK != af_reinit(s,af))
451 return -1; 451 return -1;
452 } 452 }
453 453