From patchwork Sat Mar 7 12:27:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 18077 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 95CD644AF24 for ; Sat, 7 Mar 2020 14:27:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 73D1568ADDC; Sat, 7 Mar 2020 14:27:26 +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 A9D5D68A6E7 for ; Sat, 7 Mar 2020 14:27:20 +0200 (EET) Received: from Kryux.fritz.box (200116b8640fa6004c075d5abd3a5b1d.dip.versatel-1u1.de [IPv6:2001:16b8:640f:a600:4c07:5d5a:bd3a:5b1d]) by btbn.de (Postfix) with ESMTPSA id 2CFEF1DF078; Sat, 7 Mar 2020 13:27:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1583584040; bh=ig7M1XhM45fQSGxrZ6YocUacBLkW05ydjpJZHS/HG6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a7gqdjn5/s1d1pySwYJDs6U7LNHjd0qj9cvA6v216sb8utwGgqVqy8vxKiiwRu53R Told5/Mxm2ATOuWZcOYPOYS+4wEX/p4TaorXLuF1Q32qrUfk69zUHAmubr78WhM0hZ 5GpEYD5WvPJzGgJ6/Agc3SZZ3fGUd69Qm3G5mjziuqOd+1KQz3+CEGvnz/AiWAJogu 3p7vL/DZe1tuaNW7G48K91XqhlE69JUhbxZgaybf0jGZWI7rEMlPu74s/WTUTtcH5S 22su0ORKgvw4Pf9o16K4zQ1WnpUYpX/lx6f/ttq4kx1uw87EIa+OwvW8zQDWJHqA7v 2OLukwO4bnl/Q== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 Mar 2020 13:27:04 +0100 Message-Id: <20200307122704.27410-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200306133513.21478-1-timo@rothenpieler.org> References: <20200306133513.21478-1-timo@rothenpieler.org> 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 | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 1b721c4954..043919faeb 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -817,6 +817,25 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) MATCH_PER_STREAM_OPT(top_field_first, i, ist->top_field_first, ic, st); MATCH_PER_STREAM_OPT(hwaccels, str, hwaccel, ic, st); + MATCH_PER_STREAM_OPT(hwaccel_output_formats, str, + hwaccel_output_format, ic, st); + + if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "cuvid")) { + av_log(NULL, AV_LOG_WARNING, + "WARNING: defaulting hwaccel_output_format to cuda for compatibility " + "with old commandlines. This behaviour is DEPRECATED and will be removed " + "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n"); + 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; + } + if (hwaccel) { // The NVDEC hwaccels use a CUDA device, so remap the name here. if (!strcmp(hwaccel, "nvdec") || !strcmp(hwaccel, "cuvid")) @@ -868,18 +887,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;