Lines Matching refs:avctx

120 static av_cold int svc_encode_close(AVCodecContext *avctx)
122 SVCContext *s = avctx->priv_data;
127 av_log(avctx, AV_LOG_WARNING, "%d frames skipped\n", s->skipped);
131 static av_cold int svc_encode_init(AVCodecContext *avctx)
133 SVCContext *s = avctx->priv_data;
140 if ((err = ff_libopenh264_check_version(avctx)) < 0)
144 av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n");
157 (*s->encoder)->SetOption(s->encoder, ENCODER_OPTION_TRACE_CALLBACK_CONTEXT, &avctx);
161 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
162 param.fMaxFrameRate = av_q2d(avctx->framerate);
164 if (avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
165 av_log(avctx, AV_LOG_ERROR,
169 param.fMaxFrameRate = 1.0 / av_q2d(avctx->time_base) / FFMAX(avctx->ticks_per_frame, 1);
171 param.iPicWidth = avctx->width;
172 param.iPicHeight = avctx->height;
173 param.iTargetBitrate = avctx->bit_rate > 0 ? avctx->bit_rate : TARGET_BITRATE_DEFAULT;
174 param.iMaxBitrate = FFMAX(avctx->rc_max_rate, avctx->bit_rate);
176 if (avctx->qmax >= 0)
177 param.iMaxQp = av_clip(avctx->qmax, 1, 51);
178 if (avctx->qmin >= 0)
179 param.iMinQp = av_clip(avctx->qmin, 1, param.iMaxQp);
188 if (avctx->gop_size >= 0)
189 param.uiIntraPeriod = avctx->gop_size;
198 param.iMultipleThreadIdc = avctx->thread_count;
202 FF_PROFILE_UNKNOWN != avctx->profile)
203 switch (avctx->profile) {
207 s->profile = avctx->profile;
210 av_log(avctx, AV_LOG_WARNING,
211 "Unsupported avctx->profile: %d.\n", avctx->profile);
225 av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
230 av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
238 av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
244 av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
257 if (avctx->sample_aspect_ratio.num && avctx->sample_aspect_ratio.den) {
275 av_reduce(&num, &den, avctx->sample_aspect_ratio.num,
276 avctx->sample_aspect_ratio.den, 65535);
296 if ((avctx->slices > 1) && (s->max_nal_size)) {
297 av_log(avctx, AV_LOG_ERROR,
299 avctx->slices, s->max_nal_size);
303 if (avctx->slices > 1)
311 param.sSpatialLayers[0].sSliceArgument.uiSliceNum = avctx->slices;
314 param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = avctx->slices;
316 if (avctx->slices == 0 && s->slice_mode == SM_FIXEDSLCNUM_SLICE)
317 av_log(avctx, AV_LOG_WARNING, "Slice count will be set automatically\n");
328 av_log(avctx, AV_LOG_ERROR, "Invalid -max_nal_size, "
336 if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) {
338 param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
341 if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED ||
342 avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
343 avctx->color_trc != AVCOL_TRC_UNSPECIFIED) {
348 if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
349 param.sSpatialLayers[0].uiColorMatrix = avctx->colorspace;
350 if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
351 param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
352 if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
353 param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
357 av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
361 if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
367 avctx->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
368 if (!avctx->extradata)
370 avctx->extradata_size = size;
371 memcpy(avctx->extradata, fbi.sLayerInfo[0].pBsBuf, size);
374 props = ff_add_cpb_side_data(avctx);
383 static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
386 SVCContext *s = avctx->priv_data;
399 sp.iPicWidth = avctx->width;
400 sp.iPicHeight = avctx->height;
408 av_log(avctx, AV_LOG_ERROR, "EncodeFrame failed\n");
413 av_log(avctx, AV_LOG_DEBUG, "frame skipped\n");
421 if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)
429 av_log(avctx, AV_LOG_DEBUG, "%d slices\n", fbi.sLayerInfo[fbi.iLayerNum - 1].iNalCount);
431 if ((ret = ff_get_encode_buffer(avctx, avpkt, size, 0)))