From patchwork Wed May 17 10:20:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 41674 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp1079130pzb; Wed, 17 May 2023 03:23:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7X851hnqWSCyP5HP98qi7ihHgPSZgU9iOM8UBXJMGgTB9FvneaWCZ78IFsd33EnaePdv+Y X-Received: by 2002:a17:906:ef09:b0:95e:d3f5:3d47 with SMTP id f9-20020a170906ef0900b0095ed3f53d47mr34936969ejs.48.1684319013552; Wed, 17 May 2023 03:23:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684319013; cv=none; d=google.com; s=arc-20160816; b=n6T8E/vGXMzuQXVkxcIqokjSk5/Jxd2Q3gNBLYODju95ZpDDeRAmcKYUwT2FiSn1Kt od8XJRlQbWRTR4CZ7u5t9bsC71p5ZYbIEq/tIYsIPrJC51cFUv0NdNFtN6lKvl2SvEsG AneysCbfkaPdDv0rCwNoUY1wNjSJpQmXoNANpw/HoTg2pcfN1lXFJM286adFeoce+jj5 Qqq17Qbha0gygt5pj+kYgrwn5zQmXQnJhVGL4cZ1oCuKHrJj4CmY8hI2EqleHoyaxHAe vNKOTSZLCKJ3zuykLIv8S0OMMb3fqbgYhv+ioEbn6TF8xuLibJ9AZtD3oN4Kby7aWkFE LzrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=V8H9IWA+4dtWzUdb3qdnVSN0HfBCo4HG+LvidMZEtpQ=; b=OI+E80iB8uNRgLWSyU3ke6KeN0LySEYIQp82IlvfE920NZec1mByaOJ/T7dVpBsop1 /B9ZP2FvlqeIA1S4/qGHoOJYFwwS2IM48N27pwiVD1h2wb3g2NHncUJFOYsBS37QeCzG uPhOVisX5dTu2W2AAVWh2xgCSML8Hv2xR8dzmHqtel3DTG8AlPyasIh60cnASMCtvEWU OHmmMKRNlt4MuVMvugz7EbnFfJy/g47AnuujfEnrlVViAkMjx+ZDSeBu4jOT3LPh1GJB 9tRM60NDqzIHXuoYulgwI0nnfIE4eHzzcknfWsdMpA95m5oZLnhiGX33H7gojSkxlv7e qX0g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b26-20020aa7d49a000000b0050bcd68af88si926980edr.441.2023.05.17.03.23.33; Wed, 17 May 2023 03:23: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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9A7A568C1A9; Wed, 17 May 2023 13:21:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A9D1E68C144 for ; Wed, 17 May 2023 13:20:57 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D1205240D03 for ; Wed, 17 May 2023 12:20:56 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id C-4TkkPs11WN for ; Wed, 17 May 2023 12:20:56 +0200 (CEST) Received: from libav.khirnov.net (libav.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.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 49033240D1E for ; Wed, 17 May 2023 12:20:46 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3276F3A1AF0 for ; Wed, 17 May 2023 12:20:40 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 May 2023 12:20:11 +0200 Message-Id: <20230517102029.541-18-anton@khirnov.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230517102029.541-1-anton@khirnov.net> References: <20230517102029.541-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/36] fftools/ffmpeg_filter: move InputFilter.type to private data X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 6svn4Q1U58ra It is not accessed outside of ffmpeg_filter. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c33e537faa..04c41a5311 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -281,7 +281,6 @@ typedef struct InputFilter { AVFilterContext *filter; struct FilterGraph *graph; uint8_t *name; - enum AVMediaType type; // AVMEDIA_TYPE_SUBTITLE for sub2video } InputFilter; typedef struct OutputFilter { diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index e6e9e00985..5656fa87df 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -60,6 +60,9 @@ typedef struct InputFilterPriv { // used to hold submitted input AVFrame *frame; + // AVMEDIA_TYPE_SUBTITLE for sub2video + enum AVMediaType type; + int eof; // parameters configured for this input @@ -264,6 +267,7 @@ static InputFilter *ifilter_alloc(FilterGraph *fg, InputStream *ist) ifp->format = -1; ifp->fallback.format = -1; ifp->ist = ist; + ifp->type = ist->st->codecpar->codec_type; ifp->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW); if (!ifp->frame_queue) @@ -440,8 +444,6 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) av_assert0(ist); ifilter = ifilter_alloc(fg, ist); - - ifilter->type = ist->st->codecpar->codec_type; ifilter->name = describe_filter_link(fg, in, 1); ret = ist_filter_add(ist, ifilter, 0); @@ -1457,8 +1459,8 @@ int ifilter_has_all_input_formats(FilterGraph *fg) int i; for (i = 0; i < fg->nb_inputs; i++) { InputFilterPriv *ifp = ifp_from_ifilter(fg->inputs[i]); - if (ifp->format < 0 && (fg->inputs[i]->type == AVMEDIA_TYPE_AUDIO || - fg->inputs[i]->type == AVMEDIA_TYPE_VIDEO)) + if (ifp->format < 0 && (ifp->type == AVMEDIA_TYPE_AUDIO || + ifp->type == AVMEDIA_TYPE_VIDEO)) return 0; } return 1; @@ -1562,7 +1564,7 @@ int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb) } } - if (ifp->format < 0 && (ifilter->type == AVMEDIA_TYPE_AUDIO || ifilter->type == AVMEDIA_TYPE_VIDEO)) { + if (ifp->format < 0 && (ifp->type == AVMEDIA_TYPE_AUDIO || ifp->type == AVMEDIA_TYPE_VIDEO)) { av_log(NULL, AV_LOG_ERROR, "Cannot determine format of input stream %d:%d after EOF\n", ifp->ist->file_index, ifp->ist->st->index);