Revision c7d89948 libavcodec/g726.c

View differences:

libavcodec/g726.c
334 334
    if (avctx->codec->decode)
335 335
        avctx->sample_fmt = SAMPLE_FMT_S16;
336 336

  
337
    /* select a frame size that will end on a byte boundary and have a size of
338
       approximately 1024 bytes */
339
    if (avctx->codec->encode)
340
        avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[index];
341

  
337 342
    return 0;
338 343
}
339 344

  
......
350 355
    G726Context *c = avctx->priv_data;
351 356
    const short *samples = data;
352 357
    PutBitContext pb;
358
    int i;
353 359

  
354 360
    init_put_bits(&pb, dst, 1024*1024);
355 361

  
356
    for (; buf_size; buf_size--)
362
    for (i = 0; i < avctx->frame_size; i++)
357 363
        put_bits(&pb, c->code_size, g726_encode(c, *samples++));
358 364

  
359 365
    flush_put_bits(&pb);
......
394 400
    g726_encode_frame,
395 401
    g726_close,
396 402
    NULL,
403
    .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
397 404
    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
398 405
    .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
399 406
};

Also available in: Unified diff