From patchwork Thu Feb 27 16:14:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 17939 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 70A04449E99 for ; Thu, 27 Feb 2020 18:17:57 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4E88768B756; Thu, 27 Feb 2020 18:17:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B694368B754 for ; Thu, 27 Feb 2020 18:17:50 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2020 08:17:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,492,1574150400"; d="scan'208";a="242092412" Received: from icl-dev.sh.intel.com ([10.239.158.73]) by orsmga006.jf.intel.com with ESMTP; 27 Feb 2020 08:17:47 -0800 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Fri, 28 Feb 2020 00:14:03 +0800 Message-Id: <1582820043-22426-1-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH 3/3] fftools/ffmpeg: check caps of encoders for encoding frame with variable dimension 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: Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This ensures that an encoder is able to cope with input frames with changing resolution only if it declares the capability of AV_CODEC_CAP_VARIABLE_DIMENSIONS. Signed-off-by: Linjie Fu --- fftools/ffmpeg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index e5fbd47..5c4cf03 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1068,6 +1068,15 @@ static void do_video_out(OutputFile *of, InputStream *ist = NULL; AVFilterContext *filter = ost->filter->filter; + if (next_picture && (enc->width != next_picture->width || + enc->height != next_picture->height)) { + if (!(enc->codec->capabilities & AV_CODEC_CAP_VARIABLE_DIMENSIONS)) { + av_log(NULL, AV_LOG_ERROR, "Variable dimension encoding " + "is not supported by %s.\n", enc->codec->name); + goto error; + } + } + if (ost->source_index >= 0) ist = input_streams[ost->source_index];