From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E0C4B4A751 for ; Fri, 5 Apr 2024 16:50:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E811F68C72F; Fri, 5 Apr 2024 19:50:20 +0300 (EEST) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2BCE68C72F for ; Fri, 5 Apr 2024 19:50:14 +0300 (EEST) Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2a2f007a33dso1363963a91.0 for ; Fri, 05 Apr 2024 09:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712335812; x=1712940612; darn=ffmpeg.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=F5mphNFHLi4ZbY6MS6kUaBzNHPe50qkq24bwzI/BtHI=; b=T4hj+xaYBZIhy+4cuJmPEiiC6jPtzKWOz8XK5i5B76cg1FfJ9/C8jSGeXKsqJk9pId Cw56SnTzTVZ8f8fZqaVfMNfjks3iYoANaAngzKhvZwPxxvkV/P3TcUhv2Ir6/TGSatyV 0P6hvQVpBa8lpPQERTCUBweSI6ydRmaCJ1kMd/gesH1WQe7ttZzTUqm1HB8RHQpPu3zN t2mjgPKLnxzWbxbHmiBMNaowKM/4m8NYy+W8wuBx27C1CWLChkKzgRvPJgkZOFnMbhbT w455AgSs96ZicP/hGcDInmWDIUVKk4kb1ot0MYjBYKA2CxocZxrZIdv6UxrQQg7dnv5g 1WTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712335812; x=1712940612; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F5mphNFHLi4ZbY6MS6kUaBzNHPe50qkq24bwzI/BtHI=; b=D1cuBPQ+3PFnORYXO31No8yVgLj0Zi5lBXUZ8/0HaV0Rv4i+1Jc8f+DOqrWT3Rl9wq 2kl4bvAziNf3NbB1VQ9m4+Lq/e/nhqgXbroQXClUnnnvyxv8EcF5edA39+axMo+hep6o 2+r2OqEYQDOknyPWZqgRh8AdWeR24g/+xhHDPNl12eOPbnZj4PQCoCnCOYKrRI4dwxe5 pHCfnP1LwAkrT+VD5TolTo9wyIFWvAy8VjP/b/fBk2IfDiD3d12Jw6CzkTewgKla62Og yYQZKTq9Chtp6qaFrcPpKd/Esf+mZchEKcA2wXRLpFYxfqwG9v0sKer1oAqF8fix+2eZ 0TpA== X-Gm-Message-State: AOJu0Yzy41ussqw4BlvinuEe3J+Tx/i0XMkCmQ6ivdXM9IzL485wQbpT ab8Q8iTT7eR26Oewugesxr7zbe/PdyusctBnQgM7La7SSzCNzk/W9CP5nma8EekvzVVP0HOWIXw btzRh/tcIpN2KH0Y9Uz+UXMOx9fIZ2SWt X-Google-Smtp-Source: AGHT+IHQgUb49T1kJswC2yjVpdpSzRfqkDUOu46WnvKLTymxLDrIS0pf35sEI5d1lKy7RhzZq9DZX1o+5xJcWHUZbEQ= X-Received: by 2002:a17:90a:d702:b0:2a2:fa92:b37e with SMTP id y2-20020a17090ad70200b002a2fa92b37emr1924413pju.1.1712335812506; Fri, 05 Apr 2024 09:50:12 -0700 (PDT) MIME-Version: 1.0 References: <20240405161212.26167-1-anton@khirnov.net> <20240405161212.26167-11-anton@khirnov.net> In-Reply-To: <20240405161212.26167-11-anton@khirnov.net> From: Dennis Mungai Date: Fri, 5 Apr 2024 19:50:00 +0300 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH 11/31] fftools/ffmpeg_filter: stop accessing encoder AVCodecContext 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 5 Apr 2024, 19:14 Anton Khirnov, wrote: > Pass all the necessary value through OutputFilterOptions. > > Will allow decoupling filtering from encoding in future commits. > --- > fftools/ffmpeg.h | 7 +++++++ > fftools/ffmpeg_filter.c | 22 +++++++++++----------- > fftools/ffmpeg_mux_init.c | 6 ++++++ > 3 files changed, 24 insertions(+), 11 deletions(-) > > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h > index d0e896dbe7..598ca2fa96 100644 > --- a/fftools/ffmpeg.h > +++ b/fftools/ffmpeg.h > @@ -282,6 +282,13 @@ typedef struct OutputFilterOptions { > > // A combination of OFilterFlags. > unsigned flags; > + > + int format; > + int width; > + int height; > + > + int sample_rate; > + AVChannelLayout ch_layout; > } OutputFilterOptions; > > typedef struct InputFilter { > diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c > index 5661dc960a..3c25d2ed65 100644 > --- a/fftools/ffmpeg_filter.c > +++ b/fftools/ffmpeg_filter.c > @@ -782,12 +782,12 @@ int ofilter_bind_ost(OutputFilter *ofilter, > OutputStream *ost, > ofp->ts_offset = opts->ts_offset; > ofp->enc_timebase = opts->output_tb; > > - switch (ost->enc_ctx->codec_type) { > + switch (ofilter->type) { > case AVMEDIA_TYPE_VIDEO: > - ofp->width = ost->enc_ctx->width; > - ofp->height = ost->enc_ctx->height; > - if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) { > - ofp->format = ost->enc_ctx->pix_fmt; > + ofp->width = opts->width; > + ofp->height = opts->height; > + if (opts->format != AV_PIX_FMT_NONE) { > + ofp->format = opts->format; > } else if (opts->pix_fmts) > ofp->formats = opts->pix_fmts; > else if (opts->enc) > @@ -812,19 +812,19 @@ int ofilter_bind_ost(OutputFilter *ofilter, > OutputStream *ost, > > break; > case AVMEDIA_TYPE_AUDIO: > - if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) { > - ofp->format = ost->enc_ctx->sample_fmt; > + if (opts->format != AV_SAMPLE_FMT_NONE) { > + ofp->format = opts->format; > } else if (opts->enc) { > ofp->formats = opts->enc->sample_fmts; > } > - if (ost->enc_ctx->sample_rate) { > - ofp->sample_rate = ost->enc_ctx->sample_rate; > + if (opts->sample_rate) { > + ofp->sample_rate = opts->sample_rate; > } else if (opts->enc) { > ofp->sample_rates = opts->enc->supported_samplerates; > } > - if (ost->enc_ctx->ch_layout.nb_channels) { > + if (opts->ch_layout.nb_channels) { > int ret = set_channel_layout(ofp, opts->enc ? > opts->enc->ch_layouts : NULL, > - &ost->enc_ctx->ch_layout); > + &opts->ch_layout); > if (ret < 0) > return ret; > } else if (opts->enc) { > diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c > index 04642f5c8b..b031cc59d2 100644 > --- a/fftools/ffmpeg_mux_init.c > +++ b/fftools/ffmpeg_mux_init.c > @@ -1378,6 +1378,12 @@ static int ost_add(Muxer *mux, const OptionsContext > *o, enum AVMediaType type, > (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) { > OutputFilterOptions opts = { > .enc = enc, > + .format = (type == AVMEDIA_TYPE_VIDEO) ? > + ost->enc_ctx->pix_fmt : > ost->enc_ctx->sample_fmt, > + .width = ost->enc_ctx->width, > + .height = ost->enc_ctx->height, > + .sample_rate = ost->enc_ctx->sample_rate, > + .ch_layout = ost->enc_ctx->ch_layout, > .output_tb = enc_tb, > .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ? > 0 : mux->of.start_time, > -- > 2.43.0 > Does this imply that down the line, with this and additional patchsets, that FFmpeg can handle tasks such as stream copy and filtering in the same invocation? > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".