Revision 8f60f70d libavcodec/ac3enc.c

View differences:

libavcodec/ac3enc.c
1250 1250
}
1251 1251

  
1252 1252

  
1253
/**
1254
 * Initialize the encoder.
1255
 */
1256
static av_cold int ac3_encode_init(AVCodecContext *avctx)
1253
static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
1257 1254
{
1258 1255
    int freq = avctx->sample_rate;
1259 1256
    int bitrate = avctx->bit_rate;
1260
    AC3EncodeContext *s = avctx->priv_data;
1261
    int i, j, ch;
1262
    int bw_code;
1263

  
1264
    avctx->frame_size = AC3_FRAME_SIZE;
1265

  
1266
    ac3_common_init();
1257
    int i, j;
1267 1258

  
1268 1259
    if (!avctx->channel_layout) {
1269 1260
        av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
......
1298 1289
        return -1;
1299 1290
    s->bit_rate        = bitrate;
1300 1291
    s->frame_size_code = i << 1;
1292

  
1293
    return 0;
1294
}
1295

  
1296

  
1297
/**
1298
 * Initialize the encoder.
1299
 */
1300
static av_cold int ac3_encode_init(AVCodecContext *avctx)
1301
{
1302
    AC3EncodeContext *s = avctx->priv_data;
1303
    int ch, bw_code, ret;
1304

  
1305
    avctx->frame_size = AC3_FRAME_SIZE;
1306

  
1307
    ac3_common_init();
1308

  
1309
    ret = validate_options(avctx, s);
1310
    if (ret)
1311
        return ret;
1312

  
1301 1313
    s->frame_size_min  = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code];
1302 1314
    s->bits_written    = 0;
1303 1315
    s->samples_written = 0;

Also available in: Unified diff