Revision fd146758 libavcodec/vmdav.c

View differences:

libavcodec/vmdav.c
47 47
#include "avcodec.h"
48 48
#include "dsputil.h"
49 49

  
50
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
51
#define fprintf(...) {} 
52

  
53 50
#define VMD_HEADER_SIZE 0x330
54 51
#define PALETTE_COUNT 256
55 52

  
......
245 242
                    }
246 243
                } while (ofs < frame_width);
247 244
                if (ofs > frame_width) {
248
                    printf (" VMD video: offset > width (%d > %d)\n",
245
                    av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
249 246
                        ofs, frame_width);
250 247
                    break;
251 248
                }
......
283 280
                    }
284 281
                } while (ofs < frame_width);
285 282
                if (ofs > frame_width) {
286
                    printf (" VMD video: offset > width (%d > %d)\n",
283
                    av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
287 284
                        ofs, frame_width);
288 285
                }
289 286
                dp += s->frame.linesize[0];
......
311 308

  
312 309
    /* make sure the VMD header made it */
313 310
    if (s->avctx->extradata_size != VMD_HEADER_SIZE) {
314
        printf("  VMD video: expected extradata size of %d\n", 
311
        av_log(s->avctx, AV_LOG_ERROR, "VMD video: expected extradata size of %d\n", 
315 312
            VMD_HEADER_SIZE);
316 313
        return -1;
317 314
    }
......
350 347

  
351 348
    s->frame.reference = 1;
352 349
    if (avctx->get_buffer(avctx, &s->frame)) {
353
        printf ("  VMD Video: get_buffer() failed\n");
350
        av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
354 351
        return -1;
355 352
    }
356 353

  
......
389 386
 */
390 387

  
391 388
typedef struct VmdAudioContext {
389
    AVCodecContext *avctx;
392 390
    int channels;
393 391
    int bits;
394 392
    int block_align;
......
403 401
    VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;
404 402
    int i;
405 403

  
404
    s->avctx = avctx;
406 405
    s->channels = avctx->channels;
407 406
    s->bits = avctx->bits_per_sample;
408 407
    s->block_align = avctx->block_align;
409 408

  
410
printf ("  %d channels, %d bits/sample, block align = %d, sample rate = %d\n",
411
  s->channels, s->bits, s->block_align, avctx->sample_rate);
409
    av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n",
410
	    s->channels, s->bits, s->block_align, avctx->sample_rate);
412 411

  
413 412
    /* set up the steps8 and steps16 tables */
414 413
    for (i = 0; i < 8; i++) {
......
465 464
    int bytes_decoded = 0;
466 465
    int i;
467 466

  
468
if (silence)
469
  printf (" silent block!\n");
467
    if (silence)
468
	av_log(s->avctx, AV_LOG_INFO, "silent block!\n");
470 469
    if (s->channels == 2) {
471 470

  
472 471
        /* stereo handling */
......
520 519
    unsigned char *p = buf + 16;
521 520
    unsigned char *p_end = buf + buf_size;
522 521

  
523
printf ("    processing audio frame with %d bytes\n", buf_size);
524 522
    if (buf_size < 16)
525 523
        return buf_size;
526 524

  
......
529 527
        /* the chunk contains audio */
530 528
        *data_size = vmdaudio_loadsound(s, output_samples, p, 0);
531 529
    } else if (buf[6] == 2) {
532
printf ("  hey! audio case #2\n");
533 530
        /* the chunk contains audio and silence mixed together */
534 531
        sound_flags = LE_32(p);
535 532
        p += 4;
......
549 546
            sound_flags >>= 1;
550 547
        }
551 548
    } else if (buf[6] == 3) {
552
printf ("  hey! audio case #3\n");
553 549
        /* silent chunk */
554 550
        *data_size = vmdaudio_loadsound(s, output_samples, p, 1);
555 551
    }
556 552

  
557
printf ("      final sample count = %d, byte count = %d\n", (*data_size) / 2,
558
  *data_size);
559 553
    return buf_size;
560 554
}
561 555

  

Also available in: Unified diff