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

Function load_input_picture

libavcodec/mpegvideo_enc.c:1285–1423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1283}
1284
1285static int load_input_picture(MPVMainEncContext *const m, const AVFrame *pic_arg)
1286{
1287 MPVEncContext *const s = &m->s;
1288 MPVPicture *pic = NULL;
1289 int64_t pts;
1290 int display_picture_number = 0, ret;
1291 int encoding_delay = m->max_b_frames ? m->max_b_frames
1292 : (s->c.low_delay ? 0 : 1);
1293 int flush_offset = 1;
1294 int direct = 1;
1295
1296 av_assert1(!m->input_picture[0]);
1297
1298 if (pic_arg) {
1299 pts = pic_arg->pts;
1300 display_picture_number = m->input_picture_number++;
1301
1302 if (pts != AV_NOPTS_VALUE) {
1303 if (m->user_specified_pts != AV_NOPTS_VALUE) {
1304 int64_t last = m->user_specified_pts;
1305
1306 if (pts <= last) {
1307 av_log(s->c.avctx, AV_LOG_ERROR,
1308 "Invalid pts (%"PRId64") <= last (%"PRId64")\n",
1309 pts, last);
1310 return AVERROR(EINVAL);
1311 }
1312
1313 if (!s->c.low_delay && display_picture_number == 1)
1314 m->dts_delta = pts - last;
1315 }
1316 m->user_specified_pts = pts;
1317 } else {
1318 if (m->user_specified_pts != AV_NOPTS_VALUE) {
1319 m->user_specified_pts =
1320 pts = m->user_specified_pts + 1;
1321 av_log(s->c.avctx, AV_LOG_INFO,
1322 "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n",
1323 pts);
1324 } else {
1325 pts = display_picture_number;
1326 }
1327 }
1328
1329 if (pic_arg->linesize[0] != s->c.linesize ||
1330 pic_arg->linesize[1] != s->c.uvlinesize ||
1331 pic_arg->linesize[2] != s->c.uvlinesize)
1332 direct = 0;
1333 if ((s->c.width & 15) || (s->c.height & 15))
1334 direct = 0;
1335 if (((intptr_t)(pic_arg->data[0])) & (STRIDE_ALIGN-1))
1336 direct = 0;
1337 if (s->c.linesize & (STRIDE_ALIGN-1))
1338 direct = 0;
1339
1340 ff_dlog(s->c.avctx, "%d %d %td %td\n", pic_arg->linesize[0],
1341 pic_arg->linesize[1], s->c.linesize, s->c.uvlinesize);
1342

Callers 1

ff_mpv_encode_pictureFunction · 0.85

Calls 5

av_logFunction · 0.85
av_refstruct_pool_getFunction · 0.85
av_frame_refFunction · 0.85
prepare_pictureFunction · 0.85
av_refstruct_unrefFunction · 0.85

Tested by

no test coverage detected