Revision 3b4d96fa

View differences:

libavcodec/flacdec.c
482 482

  
483 483
static int decode_frame(FLACContext *s, int alloc_data_size)
484 484
{
485
    int blocksize_code, sample_rate_code, sample_size_code, i, crc8;
485
    int bs_code, sr_code, bps_code, i, crc8;
486 486
    int ch_mode, bps, blocksize, samplerate;
487 487
    GetBitContext *gb = &s->gb;
488 488

  
489
    blocksize_code = get_bits(gb, 4);
489
    bs_code = get_bits(gb, 4);
490 490

  
491
    sample_rate_code = get_bits(gb, 4);
491
    sr_code = get_bits(gb, 4);
492 492

  
493 493
    ch_mode = get_bits(gb, 4); /* channel assignment */
494 494
    if (ch_mode < FLAC_MAX_CHANNELS && s->channels == ch_mode+1) {
......
499 499
        return -1;
500 500
    }
501 501

  
502
    sample_size_code = get_bits(gb, 3);
503
    if (sample_size_code == 0)
502
    bps_code = get_bits(gb, 3);
503
    if (bps_code == 0)
504 504
        bps= s->bps;
505
    else if ((sample_size_code != 3) && (sample_size_code != 7))
506
        bps = sample_size_table[sample_size_code];
505
    else if ((bps_code != 3) && (bps_code != 7))
506
        bps = sample_size_table[bps_code];
507 507
    else {
508 508
        av_log(s->avctx, AV_LOG_ERROR, "invalid sample size code (%d)\n",
509
               sample_size_code);
509
               bps_code);
510 510
        return -1;
511 511
    }
512 512
    if (bps > 16) {
......
530 530
        return -1;
531 531
    }
532 532

  
533
    if (blocksize_code == 0) {
533
    if (bs_code == 0) {
534 534
        av_log(s->avctx, AV_LOG_ERROR, "reserved blocksize code: 0\n");
535 535
        return -1;
536
    } else if (blocksize_code == 6)
536
    } else if (bs_code == 6)
537 537
        blocksize = get_bits(gb, 8)+1;
538
    else if (blocksize_code == 7)
538
    else if (bs_code == 7)
539 539
        blocksize = get_bits(gb, 16)+1;
540 540
    else
541
        blocksize = ff_flac_blocksize_table[blocksize_code];
541
        blocksize = ff_flac_blocksize_table[bs_code];
542 542

  
543 543
    if (blocksize > s->max_blocksize) {
544 544
        av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", blocksize,
......
549 549
    if (blocksize * s->channels * (s->is32 ? 4 : 2) > alloc_data_size)
550 550
        return -1;
551 551

  
552
    if (sample_rate_code == 0)
552
    if (sr_code == 0)
553 553
        samplerate= s->samplerate;
554
    else if (sample_rate_code < 12)
555
        samplerate = ff_flac_sample_rate_table[sample_rate_code];
556
    else if (sample_rate_code == 12)
554
    else if (sr_code < 12)
555
        samplerate = ff_flac_sample_rate_table[sr_code];
556
    else if (sr_code == 12)
557 557
        samplerate = get_bits(gb, 8) * 1000;
558
    else if (sample_rate_code == 13)
558
    else if (sr_code == 13)
559 559
        samplerate = get_bits(gb, 16);
560
    else if (sample_rate_code == 14)
560
    else if (sr_code == 14)
561 561
        samplerate = get_bits(gb, 16) * 10;
562 562
    else {
563 563
        av_log(s->avctx, AV_LOG_ERROR, "illegal sample rate code %d\n",
564
               sample_rate_code);
564
               sr_code);
565 565
        return -1;
566 566
    }
567 567

  

Also available in: Unified diff