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 ESMTPS id 232E74B0F7 for ; Sat, 1 Mar 2025 10:03:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 861D268DFEB; Sat, 1 Mar 2025 12:02:40 +0200 (EET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1D3A68DC5C for ; Sat, 1 Mar 2025 12:02:35 +0200 (EET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-22355618fd9so49579205ad.3; Sat, 01 Mar 2025 02:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740823354; x=1741428154; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=Yov6y+DcAQYSJcGdpTYcYvPNrNiZ8SHNlGuh4wVH0OM=; b=aKWyXeHvKCSM2laB19YterX7XZtuCuiteYlOMZJwSeoBkH4rmtMbG4FA5D2LdY8atJ zk7bjEjZTh864HUZZY4i2HFU9aZLp16IIf2bykEm7+jYVEiyNuFNIr7eThXMV5CPzrxD URX2ydLBzzLNieHTDB1Y6pNPh4MY9GjnFtkQbAJUgYyN+nPKw5BaJYb5NMi4A1r7Txga h0zs7gaYZVkUyp+3Ckj95581H0vEM0CYBbfW8d+TPZooTUV6R12fVPikzKXFvRHDaZaX wEOdcJeq3Wdsh7WOSoRxwlk2TCKxTpXyiZMqkS5EBYWc+wQU7bxhDTB2A2mgO5XmqJVQ H2BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740823354; x=1741428154; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Yov6y+DcAQYSJcGdpTYcYvPNrNiZ8SHNlGuh4wVH0OM=; b=Jxtw6AlzUyIpO6cuggF7EM1pRkPqNqxAlJ0jR4PyHZgYNCOPN7+EXTpD/Kh74TcOD1 jHKNhJbxwFWu1rb8pznj5NpnokLBon9cZ1NLSmPqoQ9mM+GkvtMsknoW6vA4807voSbn 8Kr8YJaRF4Si4pSyrKz8pUu1n0TdIrTNX4oYi7Fu2l4x0ks9xwMlebPAGprbeA/TP9Ka N6CBPj7uskBZhAriogjboAkPGTD/gRs7WcfiFR/xTniYxA/0zJm8PF1Eb0rYemb9rEiB rOKOTjCdicPHHoyhJENVh865WtMVGRObZxuQLzK3P6MgA4CXYw5WQF3utsccEyyEZdm/ 1jaA== X-Forwarded-Encrypted: i=1; AJvYcCUM3TEcIi6janhbLsURa+WN+oY5jj3PPet9RMuZmFK+bR/GXL8zEuqu68i/jtbco820fNsX2YT9vTx/sTW97GVWSX3UVKIq0QI=@ffmpeg.org X-Gm-Message-State: AOJu0YwDJu0BrHaCJ/bUMxgerYVPtuchCPOtudXb4LlcHCquoPpna1+U Ak+cppA5LngGz0uOOQUngrI4f6A9k6CLlqoZrADzb2DspHlUmP0+33BBbw== X-Gm-Gg: ASbGncuRmkDUXHTw4QibiEKe5U+vnKF0yM2gDv4CR1gbNO8CoR4IdkNShtFrAS961Xt Ne85DSFHZldX/NuccokXele59TIStMRFiKU+arj+3sO+ToD/bgSFEyBXjjrgDW/CTCaDr32xR3M dTvD+V4PhufM7eqQtfrD4s5W5SJv799Trx33kiiSBb+5KhbMtEQjZNE3Y/bVPQ7QhcmCBCr8z/s P/or+P4ULNyD5hEL8rzWuTPhJH7gDo7nFGjmulpWJU67nNasKoCmVTvk3a1IOGtCNcet1L/nwO/ 9EvVM1cUHTVxu/6rVzzxQ8qxYWyjVS1U+1DrIqmiYzvtbyVimGrJatl8KhpshDI= X-Google-Smtp-Source: AGHT+IH4i5bQ0+o2R7AEGWAYyv+xI9i+nwJNv3x593fZTnOhdxlR6DlPQpneHJsre2d1cWXnd3gKJw== X-Received: by 2002:a17:902:c951:b0:223:2630:6b82 with SMTP id d9443c01a7336-22368f72096mr109348055ad.10.1740823353972; Sat, 01 Mar 2025 02:02:33 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-223501fae0esm46052375ad.93.2025.03.01.02.02.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Mar 2025 02:02:33 -0800 (PST) From: softworkz X-Google-Original-From: softworkz Message-Id: <06174ae7efe02ed0a966117e9260f6a46835d1dd.1740823324.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Sat, 01 Mar 2025 10:02:01 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v3 4/7] fftools/ffmpeg_filter: Move some declaration to new header file 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 Cc: Soft Works , softworkz , Andreas Rheinhardt 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: From: softworkz to allow print_graph to access the information. Signed-off-by: softworkz --- fftools/ffmpeg_filter.c | 188 +------------------------------- fftools/ffmpeg_filter.h | 232 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 233 insertions(+), 187 deletions(-) create mode 100644 fftools/ffmpeg_filter.h diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 800e2a3f06..6de4e87ade 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -21,6 +21,7 @@ #include #include "ffmpeg.h" +#include "ffmpeg_filter.h" #include "libavfilter/avfilter.h" #include "libavfilter/buffersink.h" @@ -42,44 +43,6 @@ // FIXME private header, used for mid_pred() #include "libavcodec/mathops.h" -typedef struct FilterGraphPriv { - FilterGraph fg; - - // name used for logging - char log_name[32]; - - int is_simple; - // true when the filtergraph contains only meta filters - // that do not modify the frame data - int is_meta; - // source filters are present in the graph - int have_sources; - int disable_conversions; - - unsigned nb_outputs_done; - - const char *graph_desc; - - int nb_threads; - - // frame for temporarily holding output from the filtergraph - AVFrame *frame; - // frame for sending output to the encoder - AVFrame *frame_enc; - - Scheduler *sch; - unsigned sch_idx; -} FilterGraphPriv; - -static FilterGraphPriv *fgp_from_fg(FilterGraph *fg) -{ - return (FilterGraphPriv*)fg; -} - -static const FilterGraphPriv *cfgp_from_cfg(const FilterGraph *fg) -{ - return (const FilterGraphPriv*)fg; -} // data that is local to the filter thread and not visible outside of it typedef struct FilterGraphThread { @@ -102,155 +65,6 @@ typedef struct FilterGraphThread { uint8_t *eof_out; } FilterGraphThread; -typedef struct InputFilterPriv { - InputFilter ifilter; - - InputFilterOptions opts; - - int index; - - AVFilterContext *filter; - - // used to hold submitted input - AVFrame *frame; - - /* for filters that are not yet bound to an input stream, - * this stores the input linklabel, if any */ - uint8_t *linklabel; - - // filter data type - enum AVMediaType type; - // source data type: AVMEDIA_TYPE_SUBTITLE for sub2video, - // same as type otherwise - enum AVMediaType type_src; - - int eof; - int bound; - - // parameters configured for this input - int format; - - int width, height; - AVRational sample_aspect_ratio; - enum AVColorSpace color_space; - enum AVColorRange color_range; - - int sample_rate; - AVChannelLayout ch_layout; - - AVRational time_base; - - AVFrameSideData **side_data; - int nb_side_data; - - AVFifo *frame_queue; - - AVBufferRef *hw_frames_ctx; - - int displaymatrix_present; - int displaymatrix_applied; - int32_t displaymatrix[9]; - - int downmixinfo_present; - AVDownmixInfo downmixinfo; - - struct { - AVFrame *frame; - - int64_t last_pts; - int64_t end_pts; - - ///< marks if sub2video_update should force an initialization - unsigned int initialize; - } sub2video; -} InputFilterPriv; - -static InputFilterPriv *ifp_from_ifilter(InputFilter *ifilter) -{ - return (InputFilterPriv*)ifilter; -} - -typedef struct FPSConvContext { - AVFrame *last_frame; - /* number of frames emitted by the video-encoding sync code */ - int64_t frame_number; - /* history of nb_frames_prev, i.e. the number of times the - * previous frame was duplicated by vsync code in recent - * do_video_out() calls */ - int64_t frames_prev_hist[3]; - - uint64_t dup_warning; - - int last_dropped; - int dropped_keyframe; - - enum VideoSyncMethod vsync_method; - - AVRational framerate; - AVRational framerate_max; - const AVRational *framerate_supported; - int framerate_clip; -} FPSConvContext; - -typedef struct OutputFilterPriv { - OutputFilter ofilter; - - int index; - - void *log_parent; - char log_name[32]; - - char *name; - - AVFilterContext *filter; - - /* desired output stream properties */ - int format; - int width, height; - int sample_rate; - AVChannelLayout ch_layout; - enum AVColorSpace color_space; - enum AVColorRange color_range; - - AVFrameSideData **side_data; - int nb_side_data; - - // time base in which the output is sent to our downstream - // does not need to match the filtersink's timebase - AVRational tb_out; - // at least one frame with the above timebase was sent - // to our downstream, so it cannot change anymore - int tb_out_locked; - - AVRational sample_aspect_ratio; - - AVDictionary *sws_opts; - AVDictionary *swr_opts; - - // those are only set if no format is specified and the encoder gives us multiple options - // They point directly to the relevant lists of the encoder. - const int *formats; - const AVChannelLayout *ch_layouts; - const int *sample_rates; - const enum AVColorSpace *color_spaces; - const enum AVColorRange *color_ranges; - - AVRational enc_timebase; - int64_t trim_start_us; - int64_t trim_duration_us; - // offset for output timestamps, in AV_TIME_BASE_Q - int64_t ts_offset; - int64_t next_pts; - FPSConvContext fps; - - unsigned flags; -} OutputFilterPriv; - -static OutputFilterPriv *ofp_from_ofilter(OutputFilter *ofilter) -{ - return (OutputFilterPriv*)ofilter; -} - typedef struct FilterCommand { char *target; char *command; diff --git a/fftools/ffmpeg_filter.h b/fftools/ffmpeg_filter.h new file mode 100644 index 0000000000..628d272bcd --- /dev/null +++ b/fftools/ffmpeg_filter.h @@ -0,0 +1,232 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FFTOOLS_FFMPEG_FILTER_H +#define FFTOOLS_FFMPEG_FILTER_H + +#include "ffmpeg.h" + +#include + +#include "ffmpeg_sched.h" +#include "sync_queue.h" + +#include "libavfilter/avfilter.h" + +#include "libavutil/avutil.h" +#include "libavutil/dict.h" +#include "libavutil/fifo.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" +#include "libavutil/bprint.h" +#include "libavutil/channel_layout.h" +#include "libavutil/downmix_info.h" + +typedef struct FilterGraphPriv { + FilterGraph fg; + + // name used for logging + char log_name[32]; + + int is_simple; + // true when the filtergraph contains only meta filters + // that do not modify the frame data + int is_meta; + // source filters are present in the graph + int have_sources; + int disable_conversions; + + unsigned nb_outputs_done; + + const char *graph_desc; + + int nb_threads; + + // frame for temporarily holding output from the filtergraph + AVFrame *frame; + // frame for sending output to the encoder + AVFrame *frame_enc; + + Scheduler *sch; + unsigned sch_idx; + + AVBPrint graph_print_buf; + +} FilterGraphPriv; + +static FilterGraphPriv *fgp_from_fg(FilterGraph *fg) +{ + return (FilterGraphPriv*)fg; +} + +static const FilterGraphPriv *cfgp_from_cfg(const FilterGraph *fg) +{ + return (const FilterGraphPriv*)fg; +} + +typedef struct InputFilterPriv { + InputFilter ifilter; + + InputFilterOptions opts; + + int index; + + AVFilterContext *filter; + + // used to hold submitted input + AVFrame *frame; + + /* for filters that are not yet bound to an input stream, + * this stores the input linklabel, if any */ + uint8_t *linklabel; + + // filter data type + enum AVMediaType type; + // source data type: AVMEDIA_TYPE_SUBTITLE for sub2video, + // same as type otherwise + enum AVMediaType type_src; + + int eof; + int bound; + + // parameters configured for this input + int format; + + int width, height; + AVRational sample_aspect_ratio; + enum AVColorSpace color_space; + enum AVColorRange color_range; + + int sample_rate; + AVChannelLayout ch_layout; + + AVRational time_base; + + AVFrameSideData **side_data; + int nb_side_data; + + AVFifo *frame_queue; + + AVBufferRef *hw_frames_ctx; + + int displaymatrix_present; + int displaymatrix_applied; + int32_t displaymatrix[9]; + + int downmixinfo_present; + AVDownmixInfo downmixinfo; + + struct { + AVFrame *frame; + + int64_t last_pts; + int64_t end_pts; + + ///< marks if sub2video_update should force an initialization + unsigned int initialize; + } sub2video; +} InputFilterPriv; + +static InputFilterPriv *ifp_from_ifilter(InputFilter *ifilter) +{ + return (InputFilterPriv*)ifilter; +} + +typedef struct FPSConvContext { + AVFrame *last_frame; + /* number of frames emitted by the video-encoding sync code */ + int64_t frame_number; + /* history of nb_frames_prev, i.e. the number of times the + * previous frame was duplicated by vsync code in recent + * do_video_out() calls */ + int64_t frames_prev_hist[3]; + + uint64_t dup_warning; + + int last_dropped; + int dropped_keyframe; + + enum VideoSyncMethod vsync_method; + + AVRational framerate; + AVRational framerate_max; + const AVRational *framerate_supported; + int framerate_clip; +} FPSConvContext; + + +typedef struct OutputFilterPriv { + OutputFilter ofilter; + + int index; + + void *log_parent; + char log_name[32]; + + char *name; + + AVFilterContext *filter; + + /* desired output stream properties */ + int format; + int width, height; + int sample_rate; + AVChannelLayout ch_layout; + enum AVColorSpace color_space; + enum AVColorRange color_range; + + AVFrameSideData **side_data; + int nb_side_data; + + // time base in which the output is sent to our downstream + // does not need to match the filtersink's timebase + AVRational tb_out; + // at least one frame with the above timebase was sent + // to our downstream, so it cannot change anymore + int tb_out_locked; + + AVRational sample_aspect_ratio; + + AVDictionary *sws_opts; + AVDictionary *swr_opts; + + // those are only set if no format is specified and the encoder gives us multiple options + // They point directly to the relevant lists of the encoder. + const int *formats; + const AVChannelLayout *ch_layouts; + const int *sample_rates; + const enum AVColorSpace *color_spaces; + const enum AVColorRange *color_ranges; + + AVRational enc_timebase; + int64_t trim_start_us; + int64_t trim_duration_us; + // offset for output timestamps, in AV_TIME_BASE_Q + int64_t ts_offset; + int64_t next_pts; + FPSConvContext fps; + + unsigned flags; +} OutputFilterPriv; + +static OutputFilterPriv *ofp_from_ofilter(OutputFilter *ofilter) +{ + return (OutputFilterPriv*)ofilter; +} + +#endif /* FFTOOLS_FFMPEG_FILTER_H */ -- ffmpeg-codebot _______________________________________________ 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".