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

Function hwaccel_init

libavcodec/decode.c:1163–1196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1161}
1162
1163static int hwaccel_init(AVCodecContext *avctx,
1164 const FFHWAccel *hwaccel)
1165{
1166 int err;
1167
1168 if (hwaccel->p.capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL &&
1169 avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
1170 av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
1171 hwaccel->p.name);
1172 return AVERROR_PATCHWELCOME;
1173 }
1174
1175 if (!avctx->internal->hwaccel_priv_data && hwaccel->priv_data_size) {
1176 avctx->internal->hwaccel_priv_data =
1177 av_mallocz(hwaccel->priv_data_size);
1178 if (!avctx->internal->hwaccel_priv_data)
1179 return AVERROR(ENOMEM);
1180 }
1181
1182 avctx->hwaccel = &hwaccel->p;
1183 if (hwaccel->init) {
1184 err = hwaccel->init(avctx);
1185 if (err < 0) {
1186 av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: "
1187 "hwaccel initialisation returned error.\n",
1188 av_get_pix_fmt_name(hwaccel->p.pix_fmt));
1189 av_freep(&avctx->internal->hwaccel_priv_data);
1190 avctx->hwaccel = NULL;
1191 return err;
1192 }
1193 }
1194
1195 return 0;
1196}
1197
1198void ff_hwaccel_uninit(AVCodecContext *avctx)
1199{

Callers 1

ff_get_formatFunction · 0.85

Calls 4

av_logFunction · 0.85
av_get_pix_fmt_nameFunction · 0.85
av_freepFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected