From patchwork Fri Mar 6 13:35:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 18072 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 60E2844B371 for ; Fri, 6 Mar 2020 15:35:34 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3C07068AFA8; Fri, 6 Mar 2020 15:35:34 +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 D433E68AF1A for ; Fri, 6 Mar 2020 15:35:27 +0200 (EET) Received: from NeoZeo.klima.uni-bremen.de (unknown [134.102.43.210]) by btbn.de (Postfix) with ESMTPSA id 7A36F17AA58; Fri, 6 Mar 2020 14:35:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1583501726; bh=aHmpD7F+yDLKuxR2mKJQgHic8wBH8hM9poa5Oy4MX08=; h=From:To:Cc:Subject:Date; b=qmbxHSf1FLKGN8DyueISOIxvHjbq2bVvc87pGia7C7sgFf+/VCj22od3JBfEi+G+Q ZQCUkgLbOL2LjbCKl12fcnFwydXUcOLVx2jEeXdinv0V//Rcq2CjndZAfFJsyiuVLG t0F1vH7R9/clq2ekpHYGS47jQuf9xeY6IvfChbdPLufqrfcl8pZ2KupSu3pEtYjHZw EzSQruUbSJWHEFnbxeYPYirmpzEdT/6h5FRnOwXwRbqYfP/4P3KC0NCXGlLBw+Sl48 B4oLCt7RCsXH8jf0dQnUaRIS9fe2K6E+FALgZ4zqu2za1zfvtBbTuf7ZmjVh4aMUGe l/fGMwO5L8W9Q== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Fri, 6 Mar 2020 14:35:13 +0100 Message-Id: <20200306133513.21478-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] ffmpeg: default hwaccel_output_format to cuda when hwaccel is cuvid 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This ensures old commandlines using -hwaccel cuvid don't break due to the recent removal of the the cuvid-specific hwaccel bringup. --- fftools/ffmpeg_opt.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 1b721c4954..c8fe263730 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -816,6 +816,20 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) ist->top_field_first = -1; MATCH_PER_STREAM_OPT(top_field_first, i, ist->top_field_first, ic, st); + MATCH_PER_STREAM_OPT(hwaccel_output_formats, str, + hwaccel_output_format, ic, st); + if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "cuvid")) { + ist->hwaccel_output_format = AV_PIX_FMT_CUDA; + } else if (hwaccel_output_format) { + ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format); + if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) { + av_log(NULL, AV_LOG_FATAL, "Unrecognised hwaccel output " + "format: %s", hwaccel_output_format); + } + } else { + ist->hwaccel_output_format = AV_PIX_FMT_NONE; + } + MATCH_PER_STREAM_OPT(hwaccels, str, hwaccel, ic, st); if (hwaccel) { // The NVDEC hwaccels use a CUDA device, so remap the name here. @@ -868,18 +882,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) exit_program(1); } - MATCH_PER_STREAM_OPT(hwaccel_output_formats, str, - hwaccel_output_format, ic, st); - if (hwaccel_output_format) { - ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format); - if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) { - av_log(NULL, AV_LOG_FATAL, "Unrecognised hwaccel output " - "format: %s", hwaccel_output_format); - } - } else { - ist->hwaccel_output_format = AV_PIX_FMT_NONE; - } - ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE; break;