Revision 1328d433 libavcodec/vmdav.c

View differences:

libavcodec/vmdav.c
475 475
static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
476 476
    const uint8_t *buf, int silence, int data_size)
477 477
{
478
    int bytes_decoded = 0;
479 478
    int i;
480 479

  
481 480
//    if (silence)
482 481
//        av_log(s->avctx, AV_LOG_INFO, "silent block!\n");
483
    if (s->channels == 2) {
484 482

  
485
        /* stereo handling */
486 483
        if (silence) {
487 484
            memset(data, 0, data_size * 2);
488 485
        } else {
489 486
            if (s->bits == 16)
490
                vmdaudio_decode_audio(s, data, buf, data_size, 1);
487
                vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2);
491 488
            else {
492 489
                /* copy the data but convert it to signed */
493 490
                for (i = 0; i < data_size; i++){
......
496 493
                }
497 494
            }
498 495
        }
499
    } else {
500
        bytes_decoded = data_size * 2;
501

  
502
        /* mono handling */
503
        if (silence) {
504
            memset(data, 0, data_size * 2);
505
        } else {
506
            if (s->bits == 16) {
507
                vmdaudio_decode_audio(s, data, buf, data_size, 0);
508
            } else {
509
                /* copy the data but convert it to signed */
510
                for (i = 0; i < data_size; i++){
511
                    *data++ = buf[i] + 0x80;
512
                    *data++ = buf[i] + 0x80;
513
                }
514
            }
515
        }
516
    }
517 496

  
518 497
    return data_size * 2;
519 498
}

Also available in: Unified diff