+ ret = hwaccel_decode_init(s);
+ if (ret < 0) {
+ if (ist->hwaccel_id == HWACCEL_GENERIC) {
+ av_log(NULL, AV_LOG_FATAL,
+ "%s hwaccel requested for input stream #%d:%d, "
+ "but cannot be initialized.\n",
+ av_hwdevice_get_type_name(config->device_type),
+ ist->file_index, ist->st->index);
+ return AV_PIX_FMT_NONE;
+ }
+ continue;
+ }
+ } else {
+ const HWAccel *hwaccel = NULL;
+ int i;
+ for (i = 0; hwaccels[i].name; i++) {
+ if (hwaccels[i].pix_fmt == *p) {
+ hwaccel = &hwaccels[i];
+ break;
+ }
+ }
+ if (!hwaccel) {
+ // No hwaccel supporting this pixfmt.
+ continue;
+ }
+ if (hwaccel->id != ist->hwaccel_id) {
+ // Does not match requested hwaccel.
+ continue;
+ }
+
+ ret = hwaccel->init(s);
+ if (ret < 0) {