From patchwork Fri Nov 10 21:20:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 5942 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp3866752jah; Fri, 10 Nov 2017 13:21:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZXbSMWi/kOkQFVBL5s4KQLaV9chmrtvAMYjHVouIDIZTYXeG/yB2wnHQz938nhDeVNVSSG X-Received: by 10.223.185.121 with SMTP id b54mr1344987wrg.264.1510348868415; Fri, 10 Nov 2017 13:21:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510348868; cv=none; d=google.com; s=arc-20160816; b=t3yc5rOS7/3m9FD4yrUtwROElhnOyLCZn1ininYQjBBj126LkeD0LdegLw6rJziBby pcYHEXJELijWxEi7xT7nPHRJXa1IL6sHewik9uO5kgazsrpwWROhs1S0nct4Wyo7xcPU 4Jvacm+KD5M1i7hdqfytYk1m52lRZQSVLVNJ94RwPot9TluG6ILNUtsaR/tPNCsnxGss 2/LlWYookpNi91t3353wwtxnLWi0NgLcfJINL4MCY/RhS8hGT+c0khtrXCIHXOA/DUWd JVc0bXz9Db/okPeol1ilHheryU2y6DI8srIG1mm6SJjD6+4QhJSsVnwC39FvYdLXgziA ZjeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=a7Kfm3XLQnKzsKYkdl4kWILrcYEBqYhEZxYgchpVzbg=; b=m0dCieHKrjyagNne/HkHDJy4WUBnvJb0JinEuQ+kb/wkQnhiYlDey4BlK63INvJFnY c9Jgj5o4aCRoqzqbfOOceEiETj+oIAsDQYS59Eo/CRfdcaDNRHF1vgZ5rnyGWrlM3ZZw ZeR2jdEgLWQk9uoEwPQkz1FPjz23lHhdDmeLCbS9NiGZnT6rPozTLEkx4iQ23klxAbOh 2jmPE+L0/+Nz7KhlgoJJl95/pHqqLINMWULUtf8cdXjBOsFxPheLTtPTQeDhkhlLYxuI sIQlySDFdhWG+dscVI47KjiCkcCOtqzmpJLO74a8SlwP4vu6pfJga9UivOVuAtfSLdna /3Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=LhJ3av/K; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z1si8965889wre.339.2017.11.10.13.21.07; Fri, 10 Nov 2017 13:21:08 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=LhJ3av/K; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 526AF689E3D; Fri, 10 Nov 2017 23:20:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0EFA86883DC for ; Fri, 10 Nov 2017 23:20:47 +0200 (EET) Received: from localhost.localdomain (unknown [IPv6:2a02:8109:43f:959c:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id 3FAA63CD47; Fri, 10 Nov 2017 22:21:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1510348860; bh=w5K9kU1pgY243Az04dyNOb+UDpmaFc1ATSbjPKEK/kI=; h=From:To:Cc:Subject:Date; b=LhJ3av/KKWc9eQ2wQYwWPPyTBwomhJxLtj0lAm47IVxFg5iWELD2d8UJDEtkftu4+ 9Hrg0TDTco8Nd3bs5Tzmnt+in0nDrKRyz1imauldPlQgYoOpgvxkWkA5zQsEIV/QPt QOHrzws2ZstnsapkF0ns8g4y+mXk3l0QkNIMrFBc= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Nov 2017 22:20:46 +0100 Message-Id: <20171110212046.6870-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.14.2 Subject: [FFmpeg-devel] [PATCH] ffmpeg: use explicitly requested hwaccel only X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" With there being two hwaccels that use the CUDA pix_fmt now, just relying on the pix_fmt to identify the selected hwaccel is not enough anymore. So this checks if the user explicitly selected a hwaccel, and only accepts that one. --- fftools/ffmpeg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 679929cfc4..d430353b56 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, enum HWAccelID selected_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 && + (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id)) return &hwaccels[i]; return NULL; } @@ -2804,7 +2805,7 @@ 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->hwaccel_id); if (!hwaccel || (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id))