MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / vorbis_encode_init

Function vorbis_encode_init

libavcodec/vorbisenc.c:1274–1304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1272}
1273
1274static av_cold int vorbis_encode_init(AVCodecContext *avctx)
1275{
1276 vorbis_enc_context *venc = avctx->priv_data;
1277 int ret;
1278
1279 if (avctx->ch_layout.nb_channels != 2) {
1280 av_log(avctx, AV_LOG_ERROR, "Current FFmpeg Vorbis encoder only supports 2 channels.\n");
1281 return -1;
1282 }
1283
1284 if ((ret = create_vorbis_context(venc, avctx)) < 0)
1285 return ret;
1286
1287 avctx->bit_rate = 0;
1288 if (avctx->flags & AV_CODEC_FLAG_QSCALE)
1289 venc->quality = avctx->global_quality / (float)FF_QP2LAMBDA;
1290 else
1291 venc->quality = 8;
1292 venc->quality *= venc->quality;
1293
1294 if ((ret = put_main_header(venc, (uint8_t**)&avctx->extradata)) < 0)
1295 return ret;
1296 avctx->extradata_size = ret;
1297
1298 avctx->frame_size = 64;
1299 avctx->initial_padding = 1 << (venc->log2_blocksize[1] - 1);
1300
1301 ff_af_queue_init(avctx, &venc->afq);
1302
1303 return 0;
1304}
1305
1306const FFCodec ff_vorbis_encoder = {
1307 .p.name = "vorbis",

Callers

nothing calls this directly

Calls 4

av_logFunction · 0.85
create_vorbis_contextFunction · 0.85
put_main_headerFunction · 0.85
ff_af_queue_initFunction · 0.85

Tested by

no test coverage detected