From patchwork Mon Nov 2 13:17:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23334 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 5AB5C44AEB1 for ; Mon, 2 Nov 2020 15:17:38 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F72268B603; Mon, 2 Nov 2020 15:17:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E35C568AE7C for ; Mon, 2 Nov 2020 15:17:29 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 7844529665F for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id v4HzniLDJoK4 for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id CA1D629665C for ; Mon, 2 Nov 2020 14:17:27 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id DF5EC20E01A3; Mon, 2 Nov 2020 14:17:20 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Nov 2020 14:17:12 +0100 Message-Id: <20201102131717.4959-1-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] tools/enum_options: fix build and add to Makefile 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- Makefile | 3 +++ tools/Makefile | 2 +- tools/enum_options.c | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index c8b548d126..977ad69965 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,9 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS) tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) + +tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS) +tools/enum_options$(EXESUF): $(FF_DEP_LIBS) tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS) tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS) diff --git a/tools/Makefile b/tools/Makefile index 48fa131eeb..82baa8eadb 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -TOOLS = qt-faststart trasher uncoded_frame +TOOLS = enum_options qt-faststart trasher uncoded_frame TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs TOOLS-$(CONFIG_ZLIB) += cws2fws diff --git a/tools/enum_options.c b/tools/enum_options.c index 548e427b7a..bedebd4c67 100644 --- a/tools/enum_options.c +++ b/tools/enum_options.c @@ -40,14 +40,14 @@ static void print_option(const AVClass *class, const AVOption *o) { printf("@item -%s @var{", o->name); switch (o->type) { - case FF_OPT_TYPE_BINARY: printf("hexadecimal string"); break; - case FF_OPT_TYPE_STRING: printf("string"); break; - case FF_OPT_TYPE_INT: - case FF_OPT_TYPE_INT64: printf("integer"); break; - case FF_OPT_TYPE_FLOAT: - case FF_OPT_TYPE_DOUBLE: printf("float"); break; - case FF_OPT_TYPE_RATIONAL: printf("rational number"); break; - case FF_OPT_TYPE_FLAGS: printf("flags"); break; + case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break; + case AV_OPT_TYPE_STRING: printf("string"); break; + case AV_OPT_TYPE_INT: + case AV_OPT_TYPE_INT64: printf("integer"); break; + case AV_OPT_TYPE_FLOAT: + case AV_OPT_TYPE_DOUBLE: printf("float"); break; + case AV_OPT_TYPE_RATIONAL: printf("rational number"); break; + case AV_OPT_TYPE_FLAGS: printf("flags"); break; default: printf("value"); break; } printf("} (@emph{"); @@ -68,8 +68,8 @@ static void print_option(const AVClass *class, const AVOption *o) const AVOption *u = NULL; printf("\nPossible values:\n@table @samp\n"); - while ((u = av_next_option(&class, u))) - if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit)) + while ((u = av_opt_next(&class, u))) + if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit)) printf("@item %s\n%s\n", u->name, u->help ? u->help : ""); printf("@end table\n"); } @@ -80,8 +80,8 @@ static void show_opts(const AVClass *class) const AVOption *o = NULL; printf("@table @option\n"); - while ((o = av_next_option(&class, o))) - if (o->type != FF_OPT_TYPE_CONST) + while ((o = av_opt_next(&class, o))) + if (o->type != AV_OPT_TYPE_CONST) print_option(class, o); printf("@end table\n"); } @@ -114,7 +114,7 @@ static void show_format_opts(void) static void show_codec_opts(void) { void *iter = NULL; - AVCodec *c = NULL; + const AVCodec *c; printf("@section Generic codec AVOptions\n"); show_opts(avcodec_get_class()); From patchwork Mon Nov 2 13:17:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23331 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 BAF4A44AEB1 for ; Mon, 2 Nov 2020 15:17:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C1BD68B5C2; Mon, 2 Nov 2020 15:17:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9D02068AB33 for ; Mon, 2 Nov 2020 15:17:29 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id EC97B296660 for ; Mon, 2 Nov 2020 14:17:28 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id PM-HnG0u32KH for ; Mon, 2 Nov 2020 14:17:28 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id CD14929665F for ; Mon, 2 Nov 2020 14:17:27 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 4287F20E01A6; Mon, 2 Nov 2020 14:17:20 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Nov 2020 14:17:13 +0100 Message-Id: <20201102131717.4959-2-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102131717.4959-1-anton@khirnov.net> References: <20201102131717.4959-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] lavfi/lavfutils: switch to the new decoding API 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/lavfutils.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index a2085ed5ef..f8f8415c80 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -31,7 +31,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], AVCodecContext *codec_ctx = NULL; AVCodecParameters *par; AVFrame *frame = NULL; - int frame_decoded, ret = 0; + int ret = 0; AVPacket pkt; AVDictionary *opt=NULL; @@ -86,12 +86,16 @@ int ff_load_image(uint8_t *data[4], int linesize[4], goto end; } - ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt); + ret = avcodec_send_packet(codec_ctx, &pkt); av_packet_unref(&pkt); - if (ret < 0 || !frame_decoded) { + if (ret < 0) { + av_log(log_ctx, AV_LOG_ERROR, "Error submitting a packet to decoder\n"); + goto end; + } + + ret = avcodec_receive_frame(codec_ctx, frame); + if (ret < 0) { av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n"); - if (ret >= 0) - ret = -1; goto end; } From patchwork Mon Nov 2 13:17:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23333 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 6782A44AEB1 for ; Mon, 2 Nov 2020 15:17:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 571C968B5F3; Mon, 2 Nov 2020 15:17:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DAD5E68AB33 for ; Mon, 2 Nov 2020 15:17:29 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 6EEED296652 for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id hz5o8yggLugM for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id CC18029665E for ; Mon, 2 Nov 2020 14:17:27 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 69B6B20E01A2; Mon, 2 Nov 2020 14:17:20 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Nov 2020 14:17:14 +0100 Message-Id: <20201102131717.4959-3-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102131717.4959-1-anton@khirnov.net> References: <20201102131717.4959-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] lavu: add missing stddef.h includes for size_t. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavutil/hash.c | 2 ++ libavutil/hash.h | 1 + libavutil/murmur3.c | 2 ++ libavutil/murmur3.h | 1 + libavutil/ripemd.c | 1 + libavutil/ripemd.h | 1 + 6 files changed, 8 insertions(+) diff --git a/libavutil/hash.c b/libavutil/hash.c index 75edb6db78..d626c31181 100644 --- a/libavutil/hash.c +++ b/libavutil/hash.c @@ -17,6 +17,8 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include #include #include "hash.h" diff --git a/libavutil/hash.h b/libavutil/hash.h index 7693e6bf0d..af4719e423 100644 --- a/libavutil/hash.h +++ b/libavutil/hash.h @@ -27,6 +27,7 @@ #ifndef AVUTIL_HASH_H #define AVUTIL_HASH_H +#include #include #include "version.h" diff --git a/libavutil/murmur3.c b/libavutil/murmur3.c index 7961752515..3e85c3c94f 100644 --- a/libavutil/murmur3.c +++ b/libavutil/murmur3.c @@ -17,6 +17,8 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include #include #include "mem.h" #include "intreadwrite.h" diff --git a/libavutil/murmur3.h b/libavutil/murmur3.h index 1b09175c1e..b3b3a07de2 100644 --- a/libavutil/murmur3.h +++ b/libavutil/murmur3.h @@ -27,6 +27,7 @@ #ifndef AVUTIL_MURMUR3_H #define AVUTIL_MURMUR3_H +#include #include #include "version.h" diff --git a/libavutil/ripemd.c b/libavutil/ripemd.c index 4f1c4ea899..89d69cc23d 100644 --- a/libavutil/ripemd.c +++ b/libavutil/ripemd.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include "attributes.h" diff --git a/libavutil/ripemd.h b/libavutil/ripemd.h index 0db6858ff3..921aa66684 100644 --- a/libavutil/ripemd.h +++ b/libavutil/ripemd.h @@ -28,6 +28,7 @@ #ifndef AVUTIL_RIPEMD_H #define AVUTIL_RIPEMD_H +#include #include #include "attributes.h" From patchwork Mon Nov 2 13:17:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23332 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 C988844AEB1 for ; Mon, 2 Nov 2020 15:17:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B659A68B5C6; Mon, 2 Nov 2020 15:17:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A597868AE7C for ; Mon, 2 Nov 2020 15:17:29 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 113AA296661 for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id tlO1Z-AAY1Yx for ; Mon, 2 Nov 2020 14:17:28 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id B9E4A296652 for ; Mon, 2 Nov 2020 14:17:27 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 7CDF720E01A4; Mon, 2 Nov 2020 14:17:21 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Nov 2020 14:17:15 +0100 Message-Id: <20201102131717.4959-4-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102131717.4959-1-anton@khirnov.net> References: <20201102131717.4959-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] doc/examples/transcoding: stop constantly allocating AVFrames 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Allocate just one and reuse it. --- doc/examples/transcoding.c | 60 ++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index e48837cbd2..4a45717bea 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -41,12 +41,16 @@ typedef struct FilteringContext { AVFilterContext *buffersink_ctx; AVFilterContext *buffersrc_ctx; AVFilterGraph *filter_graph; + + AVFrame *filtered_frame; } FilteringContext; static FilteringContext *filter_ctx; typedef struct StreamContext { AVCodecContext *dec_ctx; AVCodecContext *enc_ctx; + + AVFrame *dec_frame; } StreamContext; static StreamContext *stream_ctx; @@ -102,6 +106,10 @@ static int open_input_file(const char *filename) } } stream_ctx[i].dec_ctx = codec_ctx; + + stream_ctx[i].dec_frame = av_frame_alloc(); + if (!stream_ctx[i].dec_frame) + return AVERROR(ENOMEM); } av_dump_format(ifmt_ctx, 0, filename, 0); @@ -398,6 +406,10 @@ static int init_filters(void) stream_ctx[i].enc_ctx, filter_spec); if (ret) return ret; + + filter_ctx[i].filtered_frame = av_frame_alloc(); + if (!filter_ctx[i].filtered_frame) + return AVERROR(ENOMEM); } return 0; } @@ -420,7 +432,6 @@ static int encode_write_frame(AVFrame *filt_frame, unsigned int stream_index, in av_init_packet(&enc_pkt); ret = enc_func(stream_ctx[stream_index].enc_ctx, &enc_pkt, filt_frame, got_frame); - av_frame_free(&filt_frame); if (ret < 0) return ret; if (!(*got_frame)) @@ -440,12 +451,12 @@ static int encode_write_frame(AVFrame *filt_frame, unsigned int stream_index, in static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) { + FilteringContext *filter = &filter_ctx[stream_index]; int ret; - AVFrame *filt_frame; av_log(NULL, AV_LOG_INFO, "Pushing decoded frame to filters\n"); /* push the decoded frame into the filtergraph */ - ret = av_buffersrc_add_frame_flags(filter_ctx[stream_index].buffersrc_ctx, + ret = av_buffersrc_add_frame_flags(filter->buffersrc_ctx, frame, 0); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); @@ -454,14 +465,9 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) /* pull filtered frames from the filtergraph */ while (1) { - filt_frame = av_frame_alloc(); - if (!filt_frame) { - ret = AVERROR(ENOMEM); - break; - } av_log(NULL, AV_LOG_INFO, "Pulling filtered frame from filters\n"); - ret = av_buffersink_get_frame(filter_ctx[stream_index].buffersink_ctx, - filt_frame); + ret = av_buffersink_get_frame(filter->buffersink_ctx, + filter->filtered_frame); if (ret < 0) { /* if no more frames for output - returns AVERROR(EAGAIN) * if flushed and no more frames for output - returns AVERROR_EOF @@ -469,12 +475,12 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) */ if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) ret = 0; - av_frame_free(&filt_frame); break; } - filt_frame->pict_type = AV_PICTURE_TYPE_NONE; - ret = encode_write_frame(filt_frame, stream_index, NULL); + filter->filtered_frame->pict_type = AV_PICTURE_TYPE_NONE; + ret = encode_write_frame(filter->filtered_frame, stream_index, NULL); + av_frame_unref(filter->filtered_frame); if (ret < 0) break; } @@ -506,7 +512,6 @@ int main(int argc, char **argv) { int ret; AVPacket packet = { .data = NULL, .size = 0 }; - AVFrame *frame = NULL; enum AVMediaType type; unsigned int stream_index; unsigned int i; @@ -535,33 +540,27 @@ int main(int argc, char **argv) stream_index); if (filter_ctx[stream_index].filter_graph) { + StreamContext *stream = &stream_ctx[stream_index]; + av_log(NULL, AV_LOG_DEBUG, "Going to reencode&filter the frame\n"); - frame = av_frame_alloc(); - if (!frame) { - ret = AVERROR(ENOMEM); - break; - } + av_packet_rescale_ts(&packet, ifmt_ctx->streams[stream_index]->time_base, - stream_ctx[stream_index].dec_ctx->time_base); + stream->dec_ctx->time_base); dec_func = (type == AVMEDIA_TYPE_VIDEO) ? avcodec_decode_video2 : avcodec_decode_audio4; - ret = dec_func(stream_ctx[stream_index].dec_ctx, frame, + ret = dec_func(stream->dec_ctx, stream->dec_frame, &got_frame, &packet); if (ret < 0) { - av_frame_free(&frame); av_log(NULL, AV_LOG_ERROR, "Decoding failed\n"); break; } if (got_frame) { - frame->pts = frame->best_effort_timestamp; - ret = filter_encode_write_frame(frame, stream_index); - av_frame_free(&frame); + stream->dec_frame->pts = stream->dec_frame->best_effort_timestamp; + ret = filter_encode_write_frame(stream->dec_frame, stream_index); if (ret < 0) goto end; - } else { - av_frame_free(&frame); } } else { /* remux this frame without reencoding */ @@ -598,13 +597,16 @@ int main(int argc, char **argv) av_write_trailer(ofmt_ctx); end: av_packet_unref(&packet); - av_frame_free(&frame); for (i = 0; i < ifmt_ctx->nb_streams; i++) { avcodec_free_context(&stream_ctx[i].dec_ctx); if (ofmt_ctx && ofmt_ctx->nb_streams > i && ofmt_ctx->streams[i] && stream_ctx[i].enc_ctx) avcodec_free_context(&stream_ctx[i].enc_ctx); - if (filter_ctx && filter_ctx[i].filter_graph) + if (filter_ctx && filter_ctx[i].filter_graph) { avfilter_graph_free(&filter_ctx[i].filter_graph); + av_frame_free(&filter_ctx[i].filtered_frame); + } + + av_frame_free(&stream_ctx[i].dec_frame); } av_free(filter_ctx); av_free(stream_ctx); From patchwork Mon Nov 2 13:17:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23335 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 2AA2544AEB1 for ; Mon, 2 Nov 2020 15:17:39 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1378168B60D; Mon, 2 Nov 2020 15:17:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3B0D6688178 for ; Mon, 2 Nov 2020 15:17:30 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id C375B29665C for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id MLzQx3du8plf for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id CB19429665D for ; Mon, 2 Nov 2020 14:17:27 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 1636620E0047; Mon, 2 Nov 2020 14:17:21 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Nov 2020 14:17:16 +0100 Message-Id: <20201102131717.4959-5-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102131717.4959-1-anton@khirnov.net> References: <20201102131717.4959-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] doc/examples/transcoding: switch to the new encoding API 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- doc/examples/transcoding.c | 75 +++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index 4a45717bea..5aff08c135 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -414,38 +414,40 @@ static int init_filters(void) return 0; } -static int encode_write_frame(AVFrame *filt_frame, unsigned int stream_index, int *got_frame) { +static int encode_write_frame(AVFrame *filt_frame, unsigned int stream_index) +{ + StreamContext *stream = &stream_ctx[stream_index]; int ret; - int got_frame_local; AVPacket enc_pkt; - int (*enc_func)(AVCodecContext *, AVPacket *, const AVFrame *, int *) = - (ifmt_ctx->streams[stream_index]->codecpar->codec_type == - AVMEDIA_TYPE_VIDEO) ? avcodec_encode_video2 : avcodec_encode_audio2; - - if (!got_frame) - got_frame = &got_frame_local; av_log(NULL, AV_LOG_INFO, "Encoding frame\n"); /* encode filtered frame */ enc_pkt.data = NULL; enc_pkt.size = 0; av_init_packet(&enc_pkt); - ret = enc_func(stream_ctx[stream_index].enc_ctx, &enc_pkt, - filt_frame, got_frame); + + ret = avcodec_send_frame(stream->enc_ctx, filt_frame); + if (ret < 0) return ret; - if (!(*got_frame)) - return 0; - /* prepare packet for muxing */ - enc_pkt.stream_index = stream_index; - av_packet_rescale_ts(&enc_pkt, - stream_ctx[stream_index].enc_ctx->time_base, - ofmt_ctx->streams[stream_index]->time_base); + while (ret >= 0) { + ret = avcodec_receive_packet(stream->enc_ctx, &enc_pkt); + + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + return 0; + + /* prepare packet for muxing */ + enc_pkt.stream_index = stream_index; + av_packet_rescale_ts(&enc_pkt, + stream->enc_ctx->time_base, + ofmt_ctx->streams[stream_index]->time_base); + + av_log(NULL, AV_LOG_DEBUG, "Muxing frame\n"); + /* mux encoded frame */ + ret = av_interleaved_write_frame(ofmt_ctx, &enc_pkt); + } - av_log(NULL, AV_LOG_DEBUG, "Muxing frame\n"); - /* mux encoded frame */ - ret = av_interleaved_write_frame(ofmt_ctx, &enc_pkt); return ret; } @@ -479,7 +481,7 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) } filter->filtered_frame->pict_type = AV_PICTURE_TYPE_NONE; - ret = encode_write_frame(filter->filtered_frame, stream_index, NULL); + ret = encode_write_frame(filter->filtered_frame, stream_index); av_frame_unref(filter->filtered_frame); if (ret < 0) break; @@ -490,33 +492,20 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) static int flush_encoder(unsigned int stream_index) { - int ret; - int got_frame; - if (!(stream_ctx[stream_index].enc_ctx->codec->capabilities & AV_CODEC_CAP_DELAY)) return 0; - while (1) { - av_log(NULL, AV_LOG_INFO, "Flushing stream #%u encoder\n", stream_index); - ret = encode_write_frame(NULL, stream_index, &got_frame); - if (ret < 0) - break; - if (!got_frame) - return 0; - } - return ret; + av_log(NULL, AV_LOG_INFO, "Flushing stream #%u encoder\n", stream_index); + return encode_write_frame(NULL, stream_index); } int main(int argc, char **argv) { int ret; AVPacket packet = { .data = NULL, .size = 0 }; - enum AVMediaType type; unsigned int stream_index; unsigned int i; - int got_frame; - int (*dec_func)(AVCodecContext *, AVFrame *, int *, const AVPacket *); if (argc != 3) { av_log(NULL, AV_LOG_ERROR, "Usage: %s \n", argv[0]); @@ -535,7 +524,6 @@ int main(int argc, char **argv) if ((ret = av_read_frame(ifmt_ctx, &packet)) < 0) break; stream_index = packet.stream_index; - type = ifmt_ctx->streams[packet.stream_index]->codecpar->codec_type; av_log(NULL, AV_LOG_DEBUG, "Demuxer gave frame of stream_index %u\n", stream_index); @@ -547,16 +535,19 @@ int main(int argc, char **argv) av_packet_rescale_ts(&packet, ifmt_ctx->streams[stream_index]->time_base, stream->dec_ctx->time_base); - dec_func = (type == AVMEDIA_TYPE_VIDEO) ? avcodec_decode_video2 : - avcodec_decode_audio4; - ret = dec_func(stream->dec_ctx, stream->dec_frame, - &got_frame, &packet); + ret = avcodec_send_packet(stream->dec_ctx, &packet); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Decoding failed\n"); break; } - if (got_frame) { + while (ret >= 0) { + ret = avcodec_receive_frame(stream->dec_ctx, stream->dec_frame); + if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) + break; + else if (ret < 0) + goto end; + stream->dec_frame->pts = stream->dec_frame->best_effort_timestamp; ret = filter_encode_write_frame(stream->dec_frame, stream_index); if (ret < 0) From patchwork Mon Nov 2 13:17:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23336 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 DAB5B44AEB1 for ; Mon, 2 Nov 2020 15:17:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BF79F68B5FB; Mon, 2 Nov 2020 15:17:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 10D3568AE7C for ; Mon, 2 Nov 2020 15:17:35 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id DBA9129665D for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 7bTDDx2nAIrw for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 13CCE296662 for ; Mon, 2 Nov 2020 14:17:29 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 9111C20E01A5; Mon, 2 Nov 2020 14:17:21 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Nov 2020 14:17:17 +0100 Message-Id: <20201102131717.4959-6-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201102131717.4959-1-anton@khirnov.net> References: <20201102131717.4959-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] lavfi/src_movie: switch to new decoding API 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/src_movie.c | 170 +++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 88 deletions(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index ab12c34f4a..b53f811846 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -51,7 +51,6 @@ typedef struct MovieStream { AVStream *st; AVCodecContext *codec_ctx; - int done; int64_t discontinuity_threshold; int64_t last_pts; } MovieStream; @@ -70,7 +69,6 @@ typedef struct MovieContext { int64_t ts_offset; AVFormatContext *format_ctx; - int eof; AVPacket pkt; int max_stream_index; /**< max stream # actually used for output */ @@ -172,7 +170,6 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st) if (ret < 0) return ret; - st->codec_ctx->refcounted_frames = 1; st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx); if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { @@ -451,103 +448,70 @@ static int rewind_file(AVFilterContext *ctx) for (i = 0; i < ctx->nb_outputs; i++) { avcodec_flush_buffers(movie->st[i].codec_ctx); - movie->st[i].done = 0; } - movie->eof = 0; return 0; } +static int movie_decode_packet(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + AVPacket *pkt = &movie->pkt; + int pkt_out_id, ret; + + /* read a new packet from input stream */ + av_packet_unref(pkt); + ret = av_read_frame(movie->format_ctx, pkt); + if (ret == AVERROR_EOF) { + /* EOF -> set all decoders for flushing */ + for (int i = 0; i < ctx->nb_outputs; i++) { + ret = avcodec_send_packet(movie->st[i].codec_ctx, NULL); + if (ret < 0 && ret != AVERROR_EOF) + return ret; + } + + return 0; + } else if (ret < 0) + return ret; + + /* send the packet to its decoder, if any */ + pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 : + movie->out_index[pkt->stream_index]; + if (pkt_out_id >= 0) + ret = avcodec_send_packet(movie->st[pkt_out_id].codec_ctx, pkt); + av_packet_unref(pkt); + + return ret; +} + /** * Try to push a frame to the requested output. * * @param ctx filter context * @param out_id number of output where a frame is wanted; - * if the frame is read from file, used to set the return value; - * if the codec is being flushed, flush the corresponding stream - * @return 1 if a frame was pushed on the requested output, - * 0 if another attempt is possible, - * <0 AVERROR code + * @return 0 if a frame was pushed on the requested output, + * AVERROR(EAGAIN) if the decoder requires more input + * AVERROR(EOF) if the decoder has been completely flushed + * <0 AVERROR code */ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) { - MovieContext *movie = ctx->priv; - AVPacket *pkt = &movie->pkt; - enum AVMediaType frame_type; - MovieStream *st; - int ret, got_frame = 0, pkt_out_id; - AVFilterLink *outlink; + MovieContext *movie = ctx->priv; + MovieStream *st = &movie->st[out_id]; + AVFilterLink *outlink = ctx->outputs[out_id]; AVFrame *frame; - - if (!pkt->size) { - if (movie->eof) { - if (movie->st[out_id].done) { - if (movie->loop_count != 1) { - ret = rewind_file(ctx); - if (ret < 0) - return ret; - movie->loop_count -= movie->loop_count > 1; - av_log(ctx, AV_LOG_VERBOSE, "Stream finished, looping.\n"); - return 0; /* retry */ - } - return AVERROR_EOF; - } - pkt->stream_index = movie->st[out_id].st->index; - /* packet is already ready for flushing */ - } else { - ret = av_read_frame(movie->format_ctx, pkt); - if (ret < 0) { - if (ret == AVERROR_EOF) { - movie->eof = 1; - return 0; /* start flushing */ - } - return ret; - } - } - } - - pkt_out_id = pkt->stream_index > movie->max_stream_index ? -1 : - movie->out_index[pkt->stream_index]; - if (pkt_out_id < 0) { - av_packet_unref(pkt); - return 0; - } - st = &movie->st[pkt_out_id]; - outlink = ctx->outputs[pkt_out_id]; + int ret; frame = av_frame_alloc(); if (!frame) return AVERROR(ENOMEM); - frame_type = st->st->codecpar->codec_type; - switch (frame_type) { - case AVMEDIA_TYPE_VIDEO: - ret = avcodec_decode_video2(st->codec_ctx, frame, &got_frame, pkt); - break; - case AVMEDIA_TYPE_AUDIO: - ret = avcodec_decode_audio4(st->codec_ctx, frame, &got_frame, pkt); - break; - default: - ret = AVERROR(ENOSYS); - break; - } + ret = avcodec_receive_frame(st->codec_ctx, frame); if (ret < 0) { - av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret)); - av_frame_free(&frame); - av_packet_unref(pkt); - return 0; - } - if (!ret || st->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) - ret = pkt->size; - - pkt->data += ret; - pkt->size -= ret; - if (pkt->size <= 0) - av_packet_unref(pkt); - if (!got_frame) { - if (!ret) - st->done = 1; + if (ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) + av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret)); + av_frame_free(&frame); - return 0; + return ret; } frame->pts = frame->best_effort_timestamp; @@ -558,7 +522,7 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) if (st->last_pts != AV_NOPTS_VALUE) { int64_t diff = frame->pts - st->last_pts; if (diff < 0 || diff > st->discontinuity_threshold) { - av_log(ctx, AV_LOG_VERBOSE, "Discontinuity in stream:%d diff:%"PRId64"\n", pkt_out_id, diff); + av_log(ctx, AV_LOG_VERBOSE, "Discontinuity in stream:%d diff:%"PRId64"\n", out_id, diff); movie->ts_offset += av_rescale_q_rnd(-diff, outlink->time_base, AV_TIME_BASE_Q, AV_ROUND_UP); frame->pts -= diff; } @@ -567,7 +531,8 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) st->last_pts = frame->pts; } ff_dlog(ctx, "movie_push_frame(): file:'%s' %s\n", movie->file_name, - describe_frame_to_str((char[1024]){0}, 1024, frame, frame_type, outlink)); + describe_frame_to_str((char[1024]){0}, 1024, frame, + st->st->codecpar->codec_type, outlink)); if (st->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (frame->format != outlink->format) { @@ -583,19 +548,49 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) if (ret < 0) return ret; - return pkt_out_id == out_id; + return 0; } static int movie_request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; + MovieContext *movie = ctx->priv; unsigned out_id = FF_OUTLINK_IDX(outlink); - int ret; while (1) { - ret = movie_push_frame(ctx, out_id); - if (ret) - return FFMIN(ret, 0); + int got_eagain = 0, got_eof = 0; + int ret = 0; + + /* check all decoders for available output */ + for (int i = 0; i < ctx->nb_outputs; i++) { + ret = movie_push_frame(ctx, i); + if (ret == AVERROR(EAGAIN)) + got_eagain++; + else if (ret == AVERROR_EOF) + got_eof++; + else if (ret < 0) + return ret; + else if (i == out_id) + return 0; + } + + if (got_eagain) { + /* all decoders require more input -> read a new packet */ + ret = movie_decode_packet(ctx); + if (ret < 0) + return ret; + } else if (got_eof) { + /* all decoders flushed */ + if (movie->loop_count != 1) { + ret = rewind_file(ctx); + if (ret < 0) + return ret; + movie->loop_count -= movie->loop_count > 1; + av_log(ctx, AV_LOG_VERBOSE, "Stream finished, looping.\n"); + continue; + } + return AVERROR_EOF; + } } } @@ -619,7 +614,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar for (i = 0; i < ctx->nb_outputs; i++) { avcodec_flush_buffers(movie->st[i].codec_ctx); - movie->st[i].done = 0; } return ret; } else if (!strcmp(cmd, "get_duration")) {