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

Function fill_frame_props

libavcodec/decode.c:563–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561#endif
562
563static int fill_frame_props(const AVCodecContext *avctx, AVFrame *frame)
564{
565 int ret;
566
567 if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
568 frame->color_primaries = avctx->color_primaries;
569 if (frame->color_trc == AVCOL_TRC_UNSPECIFIED)
570 frame->color_trc = avctx->color_trc;
571 if (frame->colorspace == AVCOL_SPC_UNSPECIFIED)
572 frame->colorspace = avctx->colorspace;
573 if (frame->color_range == AVCOL_RANGE_UNSPECIFIED)
574 frame->color_range = avctx->color_range;
575 if (frame->chroma_location == AVCHROMA_LOC_UNSPECIFIED)
576 frame->chroma_location = avctx->chroma_sample_location;
577 if (frame->alpha_mode == AVALPHA_MODE_UNSPECIFIED)
578 frame->alpha_mode = avctx->alpha_mode;
579
580 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
581 if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
582 if (frame->format == AV_PIX_FMT_NONE) frame->format = avctx->pix_fmt;
583 } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
584 if (frame->format == AV_SAMPLE_FMT_NONE)
585 frame->format = avctx->sample_fmt;
586 if (!frame->ch_layout.nb_channels) {
587 ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout);
588 if (ret < 0)
589 return ret;
590 }
591 if (!frame->sample_rate)
592 frame->sample_rate = avctx->sample_rate;
593 }
594
595 return 0;
596}
597
598static int decode_simple_receive_frame(AVCodecContext *avctx, AVFrame *frame)
599{

Callers 2

ff_decode_frame_propsFunction · 0.85

Calls 1

av_channel_layout_copyFunction · 0.85

Tested by

no test coverage detected