From patchwork Mon Jun 8 08:58:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 20199 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 53577441387 for ; Mon, 8 Jun 2020 12:03:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 363CB68B199; Mon, 8 Jun 2020 12:03:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3EACC68B05E for ; Mon, 8 Jun 2020 12:03:02 +0300 (EEST) IronPort-SDR: phB1YCgnJHPcINrYo2Zs66S4RcKxpNNPS8j9pgAqW9mMqQFJH+mspHqeTzyN6CRRBQgdKQAhyd LBrEthKOqq7w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2020 02:02:59 -0700 IronPort-SDR: 4XNI+ypXRfmE2TVc3ztb6zbjlp/GmUsNBK7qGYb/AfXzMDoeYmov8UbjfLhoKBcl10uj2I0Xcs +hUp4syQEQgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,487,1583222400"; d="scan'208";a="472625290" Received: from icl-dev.sh.intel.com ([10.239.158.73]) by fmsmga005.fm.intel.com with ESMTP; 08 Jun 2020 02:02:58 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Jun 2020 16:58:04 +0800 Message-Id: <1591606685-4450-2-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591606685-4450-1-git-send-email-linjie.fu@intel.com> References: <1591606685-4450-1-git-send-email-linjie.fu@intel.com> Subject: [FFmpeg-devel] [PATCH 2/3] fftools/ffmpeg: check caps of encoders for encoding 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 resolution changing 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 2e9448e..5859781 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1056,6 +1056,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];