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

Function get_format

fftools/ffmpeg_dec.c:1320–1360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1318}
1319
1320static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
1321{
1322 DecoderPriv *dp = s->opaque;
1323 const enum AVPixelFormat *p;
1324 int ret;
1325
1326 ret = multiview_setup(dp, s);
1327 if (ret < 0) {
1328 av_log(dp, AV_LOG_ERROR, "Error setting up multiview decoding: %s\n",
1329 av_err2str(ret));
1330 return AV_PIX_FMT_NONE;
1331 }
1332
1333 for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
1334 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1335 const AVCodecHWConfig *config = NULL;
1336
1337 if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
1338 break;
1339
1340 if (dp->hwaccel_id == HWACCEL_GENERIC ||
1341 dp->hwaccel_id == HWACCEL_AUTO) {
1342 for (int i = 0;; i++) {
1343 config = avcodec_get_hw_config(s->codec, i);
1344 if (!config)
1345 break;
1346 if (!(config->methods &
1347 AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))
1348 continue;
1349 if (config->pix_fmt == *p)
1350 break;
1351 }
1352 }
1353 if (config && config->device_type == dp->hwaccel_device_type) {
1354 dp->hwaccel_pix_fmt = *p;
1355 break;
1356 }
1357 }
1358
1359 return *p;
1360}
1361
1362static int get_buffer(AVCodecContext *dec_ctx, AVFrame *frame, int flags)
1363{

Callers

nothing calls this directly

Calls 4

multiview_setupFunction · 0.85
av_logFunction · 0.85
av_pix_fmt_desc_getFunction · 0.85
avcodec_get_hw_configFunction · 0.85

Tested by

no test coverage detected