From patchwork Mon May 14 12:17:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 8955 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp53152jad; Mon, 14 May 2018 05:18:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrU1GhSOVVZ9TZYnY4puVikDvikZh/CuahDxb4HoPT1hAMEeRg3tOMPcKfhsGBKEkibjNmT X-Received: by 2002:a1c:1c85:: with SMTP id c127-v6mr5440364wmc.69.1526300313674; Mon, 14 May 2018 05:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526300313; cv=none; d=google.com; s=arc-20160816; b=q3wWz6agTBqBDeIvxGqKGQ10zdpi71IvH/bXMuD3XVRATx3awKE/Jwhmp6oHhR8JJX 3DOm6oAtnbfYxilKSUKVqVtF9eP16I5a4jzt8zzY4geNhgWr0VjIMZW7F4xDUOUQOH0f KuiQCNJFY0HLIuil0aYuc2n6FSMSc5EdnfbOR/xJ8pfuqPtZWiHE9KwpkkuNEccqMRjX /CZiuldvGSiJlQFc16EPjXFvatPQqYggsMk6U9D5l+BBCx1tJ7dhnK+cznxNtZFUhzqy azDaOBW0oV9tDpZQtP4lnIHhrY3EGGjZ72ijkP4Bew3cfO4u2HMnafFnHd6KT0WZh0Xg EsiA== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=/iEUp/QmmsAjeLv+5gxNIgr474Yn7HQUXGC7J6MxaJY=; b=LQ1fRcFERQOo7cFIGxJcQRTcssitiaIg6uL5A0Mb5um+nVzL4RATv64Afhg9Ueh3gx U3kVurMowXHRUvFVN+u8y9r51nIOuPo+mPaQ3hS+ivcwrLQCmh1csDmOS38AuIwhlu0T MKx/vVoDLm+ozMEqhLnD5Rny8VjU0lsJrLE+kc470P6dHGcL65Af/twMWe+EhR/zPb2J kZNszMPAbvegrpjYseTFhwb1kaGUitadPqeu2PmHMQXHaH3yRzEgSHkJ2qKAaWNI8SLo cbUNIr2Du//ECJpO1gU49fL2+AOSjd5gJp8TjeW/6FoYEj2dfhHQPx0pE/W5gvYRMTX5 7xqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=r4/yjwAO; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p17-v6si7989394wrj.253.2018.05.14.05.18.32; Mon, 14 May 2018 05:18:33 -0700 (PDT) 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=@foxmail.com header.s=s201512 header.b=r4/yjwAO; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 09DED6809EC; Mon, 14 May 2018 15:17:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg298.qq.com (smtpbg298.qq.com [184.105.67.102]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7AB196802D7 for ; Mon, 14 May 2018 15:17:46 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1526300300; bh=B2WYJkWdJG4IzSC4rvPeGxxG2+7GdojG24L7gdFFIGQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=r4/yjwAOp9GDyWoNcWYyFwzHpwm4qBEPE70bv/YA3N4GJmD4ouEZ5+Muew3bbW1g0 z1GUWOOEiBMX8scdo78RBgjt54/6QsgfaD3xrPErUVPa8hgUgDzgZtc0vgJM1rhxvq J2u+G842zqSUZSn6bttMZ17AEJEIZUJTsCrfYoSs= X-QQ-mid: esmtp23t1526300296t2140k9dw Received: from localhost.localdomain (unknown [119.145.5.45]) by esmtp4.qq.com (ESMTP) with id ; Mon, 14 May 2018 20:18:13 +0800 (CST) X-QQ-SSF: 01000000000000F0F61000000000001 X-QQ-FEAT: hYUaOVmq4W87yGQsdS884lOdRTLPhyj/UF4lm0cvax5WFpCEkk+cHOsKXGbgp yByhTiC/gMQKRqJY+JPdFeAIUnYSDneVVGn+kvWcLudrq0MTzCPL4zQHu8goYIAwd67RLDG qlEuXCR9VtA69J1P/rfcPx/bXsC2Rsad2x0Ok7aN9+f9m/e+06h66Sp3pa7REPk/RNs7mEw rvNIRsz9QavpmxRGEiz8i2LCplZG97jgKlXAeM6iA1wkK2hSqY/iF4TyOAu92XJjd8bRVzJ pjJXtVMT9RlvRS3DgN/4rVXin/V8F5RARTrA== X-QQ-GoodBg: 0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 May 2018 20:17:59 +0800 Message-Id: <20180514121802.14519-2-quinkblack@foxmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180514121802.14519-1-quinkblack@foxmail.com> References: <20180514121802.14519-1-quinkblack@foxmail.com> X-QQ-SENDSIZE: 520 X-QQ-FName: BDB346A3268B45008E31679D077544DB X-QQ-LocalIP: 10.208.130.95 Subject: [FFmpeg-devel] [PATCH 2/5] examples/filtering_video: drop an always true condition 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: Zhao Zhili MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Zhao Zhili --- doc/examples/filtering_video.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c index 225dccc..170a675 100644 --- a/doc/examples/filtering_video.c +++ b/doc/examples/filtering_video.c @@ -248,27 +248,25 @@ int main(int argc, char **argv) goto end; } - if (ret >= 0) { - frame->pts = frame->best_effort_timestamp; + frame->pts = frame->best_effort_timestamp; - /* push the decoded frame into the filtergraph */ - if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) { - av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); + /* push the decoded frame into the filtergraph */ + if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) { + av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); + break; + } + + /* pull filtered frames from the filtergraph */ + while (1) { + ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) break; - } - - /* pull filtered frames from the filtergraph */ - while (1) { - ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); - if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) - break; - if (ret < 0) - goto end; - display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base); - av_frame_unref(filt_frame); - } - av_frame_unref(frame); + if (ret < 0) + goto end; + display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base); + av_frame_unref(filt_frame); } + av_frame_unref(frame); } } else { av_packet_unref(&packet);