Skip to content

Instantly share code, notes, and snippets.

@BtbN
Created November 10, 2017 20:56
Show Gist options
  • Select an option

  • Save BtbN/0b1ca7e28487c22abce09a3b2bb34e73 to your computer and use it in GitHub Desktop.

Select an option

Save BtbN/0b1ca7e28487c22abce09a3b2bb34e73 to your computer and use it in GitHub Desktop.
stdin
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 679929cfc4..d7431bea32 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2782,11 +2782,12 @@ fail:
av_freep(&avc);
}
-static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt)
+static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, HWAccelID active_hwaccel_id)
{
int i;
for (i = 0; hwaccels[i].name; i++)
- if (hwaccels[i].pix_fmt == pix_fmt)
+ if (hwaccels[i].pix_fmt == pix_fmt &&
+ (!active_hwaccel_id || hwaccels[i].id == active_hwaccel_id))
return &hwaccels[i];
return NULL;
}
@@ -2804,9 +2805,8 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
break;
- hwaccel = get_hwaccel(*p);
+ hwaccel = get_hwaccel(*p, ist->active_hwaccel_id);
if (!hwaccel ||
- (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) ||
(ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id))
continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment