Skip to content
Permalink
Browse files

ffmpeg: use explicitly requested hwaccel only

  • Loading branch information
BtbN committed Nov 10, 2017
1 parent 20725f2 commit f57a5e68ab346c930a0f9e446785176c2c2850f5
Showing with 4 additions and 4 deletions.
  1. +4 −4 fftools/ffmpeg.c
@@ -2782,11 +2782,12 @@ static void print_sdp(void)
av_freep(&avc);
}

static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt)
static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, enum 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;

0 comments on commit f57a5e6

Please sign in to comment.