From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E732A4D890 for <ffmpegdev@gitmailbox.com>; Sun, 20 Apr 2025 23:00:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1A24268A2A9; Mon, 21 Apr 2025 01:59:58 +0300 (EEST) Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D0F2868A120 for <ffmpeg-devel@ffmpeg.org>; Mon, 21 Apr 2025 01:59:55 +0300 (EEST) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-7376e311086so4716973b3a.3 for <ffmpeg-devel@ffmpeg.org>; Sun, 20 Apr 2025 15:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745189994; x=1745794794; 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=sglrCbRDozOqVbhWpTY7pcB9NXOxG8GLwt4N1N5AD1I=; b=JO+XxkbDgVoscrlAihwPuCh6oPGgNhf/yqpGPaUh6T5MTRD0S8tXHaNyCj1Ut+NyFu 5yUWuKlzHyRGWDsusaAPTM6E/fxHiNRXVOf1o1CZnc4k94V7c8Bs6se/7PT87E8Y0MqJ GawPJL/O0jxyniyOEiGu7rzfbl63ckY+OFYHAvjx5bnHz47u13p+NHIEbbJLH2FlYmLX SToYNqvUPZOw86Kxv+/iMCzGRTK8N7y+QLoQG+kqNBadqbrLb1vtT1iEvX/rPbZVsofc cdYH6q3DNH0nhaSv3tEq7bkZvZLVlkltsfE7Ij0JXSMgCJNNd0OJmIoqXWCvCJoUu8um tG9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745189994; x=1745794794; 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=sglrCbRDozOqVbhWpTY7pcB9NXOxG8GLwt4N1N5AD1I=; b=j0KfZKXG5uV0+U6JATNjZlL6U47OEj/DXzJRJzt7yYHPyixTX0heQjYGA9W7mwyOya UO4l7ypYclamHHcVLaUlY/7ZkJbuZQIuUld4F0D8FZ1w/k/j+sGB05iw3kwsLHwWMkUE M2GXxA8Eu2JrVGOO9Ft1HR/4KQLdvIye8Zu690aFl0a+Ns4mbbpmAnsWAWcBpKkZHBS3 OMpH391iw4VvgRm9QhMIAzxe7fNMcq1HZHd4SyY45DE9hX1tY2z00iu8k8RJ5V/Xe12r qCvfldN1YF98UVF7LWLFKNS+8c9Z1Z+DEcprBAJou22J3PZfO/eJz91kXMGmLdt71Wn6 GPJw== X-Gm-Message-State: AOJu0YxNfHY30wLVJtg6N3zv2hUWgMJPheUw+C7RW5zu3cENssh1rM9f lzOpxZXgHe3HasaJuI4Gfp8JE1o/o+pvDBeEkjfHMiUN/DkNhmVmTBpcYg== X-Gm-Gg: ASbGncvQCj40AiHZogJDd2daKdc5Y+2vt1rDUtYK2+CynBuof21IFJbY7AhVdNgeRrr nbL/n9s4pVY4QLd6UJs5VZn9nowOmD8gfwxUSL7bbyVmx94Bv8qmIiU4fz2otGHhcyC7oMdOZ1H nVzsw28m97tZ80302g3Gvq5cHvj6wVSt5Kq3y8kkkPxEDwxmnTlaprrv42U2YHBHvrAIZrcPU2h u5G3gjFFPpafjAG+Yv6E1WK77PxIaZmKh4EKWiTM2hY7FSSuu9ZBTluTNhZ28asFeJ/bTl6LueL XqWbTU3MyZbMz6mgUeUsReEMDT7k6XOIdkjlTdufYpFVvqZ747Mfk2kLeZKeymiOzuD6+Q== X-Google-Smtp-Source: AGHT+IHqdYmlRx0GSv80XfnzuLIapY5qbwjcl6mA5m446QMHbYAnJm5ytMKm7ubMYkPryXA1intICA== X-Received: by 2002:a05:6a21:9987:b0:1f5:9024:324f with SMTP id adf61e73a8af0-203cbd27ac2mr16201091637.31.1745189993951; Sun, 20 Apr 2025 15:59:53 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b0db157ed7fsm4536071a12.75.2025.04.20.15.59.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Apr 2025 15:59:53 -0700 (PDT) From: softworkz <ffmpegagent@gmail.com> X-Google-Original-From: softworkz <softworkz@hotmail.com> Message-Id: <28aeb7180d4a769ff5a5a23b6f19702d95f08977.1745189955.git.ffmpegagent@gmail.com> In-Reply-To: <pull.66.v4.ffstaging.FFmpeg.1745189954.ffmpegagent@gmail.com> References: <pull.66.v3.ffstaging.FFmpeg.1744945024.ffmpegagent@gmail.com> <pull.66.v4.ffstaging.FFmpeg.1745189954.ffmpegagent@gmail.com> Date: Sun, 20 Apr 2025 22:59:09 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v4 06/11] 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 <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: softworkz <softworkz@hotmail.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/28aeb7180d4a769ff5a5a23b6f19702d95f08977.1745189955.git.ffmpegagent@gmail.com/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> From: softworkz <softworkz@hotmail.com> to allow filtergraph printing to access the information. Signed-off-by: softworkz <softworkz@hotmail.com> --- fftools/ffmpeg_filter.c | 190 +------------------------------- fftools/ffmpeg_filter.h | 234 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+), 189 deletions(-) create mode 100644 fftools/ffmpeg_filter.h diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index d314aec206..eab9487f97 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -21,6 +21,7 @@ #include <stdint.h> #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,157 +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; - int drop_warned; - uint64_t nb_dropped; - - // 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..94b94beece --- /dev/null +++ b/fftools/ffmpeg_filter.h @@ -0,0 +1,234 @@ +/* + * 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 <stdint.h> + +#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 inline FilterGraphPriv *fgp_from_fg(FilterGraph *fg) +{ + return (FilterGraphPriv*)fg; +} + +static inline 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; + int drop_warned; + uint64_t nb_dropped; + + // 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 inline 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 inline 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".