comparison amr.c @ 1825:231a6c19e28f libavcodec

av_log()
author michael
date Mon, 23 Feb 2004 15:59:21 +0000
parents ff0b3acd5b22
children 4d91a9342d95
comparison
equal deleted inserted replaced
1824:2e4581d6ba94 1825:231a6c19e28f
139 s->reset_flag=0; 139 s->reset_flag=0;
140 s->reset_flag_old=1; 140 s->reset_flag_old=1;
141 141
142 if(Speech_Decode_Frame_init(&s->speech_decoder_state, "Decoder")) 142 if(Speech_Decode_Frame_init(&s->speech_decoder_state, "Decoder"))
143 { 143 {
144 printf("Speech_Decode_Frame_init error\n"); 144 av_log(avctx, AV_LOG_ERROR, "Speech_Decode_Frame_init error\n");
145 return -1; 145 return -1;
146 } 146 }
147 return 0; 147 return 0;
148 } 148 }
149 149
159 159
160 if(avctx->sample_rate!=8000) 160 if(avctx->sample_rate!=8000)
161 { 161 {
162 if(avctx->debug) 162 if(avctx->debug)
163 { 163 {
164 fprintf(stderr, "Only 8000Hz sample rate supported\n"); 164 av_log(avctx, AV_LOG_DEBUG, "Only 8000Hz sample rate supported\n");
165 } 165 }
166 return -1; 166 return -1;
167 } 167 }
168 168
169 if(avctx->channels!=1) 169 if(avctx->channels!=1)
170 { 170 {
171 if(avctx->debug) 171 if(avctx->debug)
172 { 172 {
173 fprintf(stderr, "Only mono supported\n"); 173 av_log(avctx, AV_LOG_DEBUG, "Only mono supported\n");
174 } 174 }
175 return -1; 175 return -1;
176 } 176 }
177 177
178 avctx->frame_size=160; 178 avctx->frame_size=160;
180 180
181 if(Speech_Encode_Frame_init(&s->enstate, 0, "encoder") || sid_sync_init (&s->sidstate)) 181 if(Speech_Encode_Frame_init(&s->enstate, 0, "encoder") || sid_sync_init (&s->sidstate))
182 { 182 {
183 if(avctx->debug) 183 if(avctx->debug)
184 { 184 {
185 fprintf(stderr, "Speech_Encode_Frame_init error\n"); 185 av_log(avctx, AV_LOG_DEBUG, "Speech_Encode_Frame_init error\n");
186 } 186 }
187 return -1; 187 return -1;
188 } 188 }
189 189
190 s->enc_bitrate=getBitrateMode(avctx->bit_rate); 190 s->enc_bitrate=getBitrateMode(avctx->bit_rate);
342 AMRContext *s = avctx->priv_data; 342 AMRContext *s = avctx->priv_data;
343 s->frameCount=0; 343 s->frameCount=0;
344 s->decState=Decoder_Interface_init(); 344 s->decState=Decoder_Interface_init();
345 if(!s->decState) 345 if(!s->decState)
346 { 346 {
347 printf("Decoder_Interface_init error\r\n"); 347 av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
348 return -1; 348 return -1;
349 } 349 }
350 return 0; 350 return 0;
351 } 351 }
352 352
357 357
358 if(avctx->sample_rate!=8000) 358 if(avctx->sample_rate!=8000)
359 { 359 {
360 if(avctx->debug) 360 if(avctx->debug)
361 { 361 {
362 fprintf(stderr, "Only 8000Hz sample rate supported\n"); 362 av_log(avctx, AV_LOG_DEBUG, "Only 8000Hz sample rate supported\n");
363 } 363 }
364 return -1; 364 return -1;
365 } 365 }
366 366
367 if(avctx->channels!=1) 367 if(avctx->channels!=1)
368 { 368 {
369 if(avctx->debug) 369 if(avctx->debug)
370 { 370 {
371 fprintf(stderr, "Only mono supported\n"); 371 av_log(avctx, AV_LOG_DEBUG, "Only mono supported\n");
372 } 372 }
373 return -1; 373 return -1;
374 } 374 }
375 375
376 avctx->frame_size=160; 376 avctx->frame_size=160;
379 s->enstate=Encoder_Interface_init(0); 379 s->enstate=Encoder_Interface_init(0);
380 if(!s->enstate) 380 if(!s->enstate)
381 { 381 {
382 if(avctx->debug) 382 if(avctx->debug)
383 { 383 {
384 fprintf(stderr, "Encoder_Interface_init error\n"); 384 av_log(avctx, AV_LOG_DEBUG, "Encoder_Interface_init error\n");
385 } 385 }
386 return -1; 386 return -1;
387 } 387 }
388 388
389 s->enc_bitrate=getBitrateMode(avctx->bit_rate); 389 s->enc_bitrate=getBitrateMode(avctx->bit_rate);
541 541
542 if(avctx->sample_rate!=16000) 542 if(avctx->sample_rate!=16000)
543 { 543 {
544 if(avctx->debug) 544 if(avctx->debug)
545 { 545 {
546 fprintf(stderr, "Only 16000Hz sample rate supported\n"); 546 av_log(avctx, AV_LOG_DEBUG, "Only 16000Hz sample rate supported\n");
547 } 547 }
548 return -1; 548 return -1;
549 } 549 }
550 550
551 if(avctx->channels!=1) 551 if(avctx->channels!=1)
552 { 552 {
553 if(avctx->debug) 553 if(avctx->debug)
554 { 554 {
555 fprintf(stderr, "Only mono supported\n"); 555 av_log(avctx, AV_LOG_DEBUG, "Only mono supported\n");
556 } 556 }
557 return -1; 557 return -1;
558 } 558 }
559 559
560 avctx->frame_size=320; 560 avctx->frame_size=320;