Revision 6682ae42 libavcodec/flacenc.c

View differences:

libavcodec/flacenc.c
95 95
    int ch_code;
96 96
    int samplerate;
97 97
    int sr_code[2];
98
    int min_framesize;
99
    int min_encoded_framesize;
98 100
    int max_framesize;
101
    int max_encoded_framesize;
99 102
    uint32_t frame_count;
100 103
    uint64_t sample_count;
101 104
    uint8_t md5sum[16];
......
133 136
    /* streaminfo metadata block */
134 137
    put_bits(&pb, 16, s->avctx->frame_size);
135 138
    put_bits(&pb, 16, s->avctx->frame_size);
136
    put_bits(&pb, 24, 0);
139
    put_bits(&pb, 24, s->min_framesize);
137 140
    put_bits(&pb, 24, s->max_framesize);
138 141
    put_bits(&pb, 20, s->samplerate);
139 142
    put_bits(&pb, 3, s->channels-1);
......
374 377
    } else {
375 378
        s->max_framesize = 14 + (s->avctx->frame_size * s->channels * 2);
376 379
    }
380
    s->min_encoded_framesize = 0xFFFFFF;
377 381

  
378 382
    /* initialize MD5 context */
379 383
    s->md5ctx = av_malloc(av_md5_size);
......
1278 1282

  
1279 1283
    /* when the last block is reached, update the header in extradata */
1280 1284
    if (!data) {
1285
        s->min_framesize = s->min_encoded_framesize;
1286
        s->max_framesize = s->max_encoded_framesize;
1281 1287
        av_md5_final(s->md5ctx, s->md5sum);
1282 1288
        write_streaminfo(s, avctx->extradata);
1283 1289
        return 0;
......
1318 1324
    s->frame_count++;
1319 1325
    s->sample_count += avctx->frame_size;
1320 1326
    update_md5_sum(s, samples);
1327
    if (out_bytes > s->max_encoded_framesize)
1328
        s->max_encoded_framesize = out_bytes;
1329
    if (out_bytes < s->min_encoded_framesize)
1330
        s->min_encoded_framesize = out_bytes;
1321 1331

  
1322 1332
    return out_bytes;
1323 1333
}

Also available in: Unified diff