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

Function ff_decode_frame_props

libavcodec/decode.c:1573–1616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1571}
1572
1573int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
1574{
1575 int ret;
1576
1577 ret = side_data_map(frame, avctx->coded_side_data, avctx->nb_coded_side_data,
1578 ff_sd_global_map);
1579 if (ret < 0)
1580 return ret;
1581
1582 for (int i = 0; i < avctx->nb_decoded_side_data; i++) {
1583 const AVFrameSideData *src = avctx->decoded_side_data[i];
1584 if (av_frame_get_side_data(frame, src->type))
1585 continue;
1586 ret = av_frame_side_data_clone(&frame->side_data, &frame->nb_side_data, src, 0);
1587 if (ret < 0)
1588 return ret;
1589 }
1590
1591 if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
1592 const AVPacket *pkt = avctx->internal->last_pkt_props;
1593
1594 ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt);
1595 if (ret < 0)
1596 return ret;
1597 }
1598
1599 ret = fill_frame_props(avctx, frame);
1600 if (ret < 0)
1601 return ret;
1602
1603 switch (avctx->codec->type) {
1604 case AVMEDIA_TYPE_VIDEO:
1605 if (frame->width && frame->height &&
1606 av_image_check_sar(frame->width, frame->height,
1607 frame->sample_aspect_ratio) < 0) {
1608 av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
1609 frame->sample_aspect_ratio.num,
1610 frame->sample_aspect_ratio.den);
1611 frame->sample_aspect_ratio = (AVRational){ 0, 1 };
1612 }
1613 break;
1614 }
1615 return 0;
1616}
1617
1618static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
1619{

Callers 13

ff_h263_decode_frameFunction · 0.85
libdav1d.cFile · 0.85
ffmal_copy_frameFunction · 0.85
ff_get_bufferFunction · 0.85
reget_buffer_internalFunction · 0.85
cuvid_output_frameFunction · 0.85
vpx_decodeFunction · 0.85
wrapped_avframe_decodeFunction · 0.85
oh_decode_wrap_hw_bufferFunction · 0.85
qtrle_decode_frameFunction · 0.85

Calls 8

side_data_mapFunction · 0.85
av_frame_get_side_dataFunction · 0.85
av_frame_side_data_cloneFunction · 0.85
ffcodecFunction · 0.85
fill_frame_propsFunction · 0.85
av_image_check_sarFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected