From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 10/10] fftools/ffmpeg: cosmetics, vertically align structs Date: Wed, 14 Feb 2024 19:24:35 +0100 Message-ID: <20240214182435.31380-10-anton@khirnov.net> (raw) In-Reply-To: <20240214182435.31380-1-anton@khirnov.net> --- fftools/ffmpeg_dec.c | 38 ++++++------- fftools/ffmpeg_demux.c | 68 +++++++++++------------ fftools/ffmpeg_filter.c | 120 ++++++++++++++++++++-------------------- fftools/ffmpeg_mux.h | 66 +++++++++++----------- 4 files changed, 146 insertions(+), 146 deletions(-) diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index 1cfa15b943..769ae36296 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -35,20 +35,20 @@ #include "thread_queue.h" typedef struct DecoderPriv { - Decoder dec; + Decoder dec; - AVCodecContext *dec_ctx; + AVCodecContext *dec_ctx; - AVFrame *frame; - AVPacket *pkt; + AVFrame *frame; + AVPacket *pkt; // override output video sample aspect ratio with this value - AVRational sar_override; + AVRational sar_override; - AVRational framerate_in; + AVRational framerate_in; // a combination of DECODER_FLAG_*, provided to dec_open() - int flags; + int flags; enum AVPixelFormat hwaccel_pix_fmt; enum HWAccelID hwaccel_id; @@ -58,22 +58,22 @@ typedef struct DecoderPriv { // pts/estimated duration of the last decoded frame // * in decoder timebase for video, // * in last_frame_tb (may change during decoding) for audio - int64_t last_frame_pts; - int64_t last_frame_duration_est; - AVRational last_frame_tb; - int64_t last_filter_in_rescale_delta; - int last_frame_sample_rate; + int64_t last_frame_pts; + int64_t last_frame_duration_est; + AVRational last_frame_tb; + int64_t last_filter_in_rescale_delta; + int last_frame_sample_rate; /* previous decoded subtitles */ - AVFrame *sub_prev[2]; - AVFrame *sub_heartbeat; + AVFrame *sub_prev[2]; + AVFrame *sub_heartbeat; - Scheduler *sch; - unsigned sch_idx; + Scheduler *sch; + unsigned sch_idx; - void *log_parent; - char log_name[32]; - char *parent_name; + void *log_parent; + char log_name[32]; + char *parent_name; } DecoderPriv; static DecoderPriv *dp_from_dec(Decoder *d) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index e543c4215c..d5a3dbc1d2 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -40,41 +40,41 @@ #include "libavformat/avformat.h" typedef struct DemuxStream { - InputStream ist; + InputStream ist; // name used for logging - char log_name[32]; + char log_name[32]; - int sch_idx_stream; - int sch_idx_dec; + int sch_idx_stream; + int sch_idx_dec; - double ts_scale; + double ts_scale; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */ - int decoding_needed; + int decoding_needed; #define DECODING_FOR_OST 1 #define DECODING_FOR_FILTER 2 /* true if stream data should be discarded */ - int discard; + int discard; // scheduler returned EOF for this stream - int finished; + int finished; - int streamcopy_needed; - int have_sub2video; - int reinit_filters; + int streamcopy_needed; + int have_sub2video; + int reinit_filters; - int wrap_correction_done; - int saw_first_ts; + int wrap_correction_done; + int saw_first_ts; ///< dts of the first packet read for this stream (in AV_TIME_BASE units) - int64_t first_dts; + int64_t first_dts; /* predicted dts of the next packet read for this stream or (when there are * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */ - int64_t next_dts; + int64_t next_dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units) - int64_t dts; + int64_t dts; const AVCodecDescriptor *codec_desc; @@ -82,45 +82,45 @@ typedef struct DemuxStream { DecoderOpts dec_opts; char dec_name[16]; - AVBSFContext *bsf; + AVBSFContext *bsf; /* number of packets successfully read for this stream */ - uint64_t nb_packets; + uint64_t nb_packets; // combined size of all the packets read - uint64_t data_size; + uint64_t data_size; } DemuxStream; typedef struct Demuxer { - InputFile f; + InputFile f; // name used for logging - char log_name[32]; + char log_name[32]; - int64_t wallclock_start; + int64_t wallclock_start; /** * Extra timestamp offset added by discontinuity handling. */ - int64_t ts_offset_discont; - int64_t last_ts; + int64_t ts_offset_discont; + int64_t last_ts; - int64_t recording_time; - int accurate_seek; + int64_t recording_time; + int accurate_seek; /* number of times input stream should be looped */ - int loop; - int have_audio_dec; + int loop; + int have_audio_dec; /* duration of the looped segment of the input file */ - Timestamp duration; + Timestamp duration; /* pts with the smallest/largest values ever seen */ - Timestamp min_pts; - Timestamp max_pts; + Timestamp min_pts; + Timestamp max_pts; /* number of streams that the user was warned of */ - int nb_streams_warn; + int nb_streams_warn; - float readrate; - double readrate_initial_burst; + float readrate; + double readrate_initial_burst; Scheduler *sch; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index dcd08dbc36..27fafc6704 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -43,27 +43,27 @@ #include "libavcodec/mathops.h" typedef struct FilterGraphPriv { - FilterGraph fg; + FilterGraph fg; // name used for logging - char log_name[32]; + char log_name[32]; - int is_simple; + int is_simple; // true when the filtergraph contains only meta filters // that do not modify the frame data - int is_meta; + int is_meta; // source filters are present in the graph - int have_sources; - int disable_conversions; + int have_sources; + int disable_conversions; - unsigned nb_outputs_done; + unsigned nb_outputs_done; - const char *graph_desc; + const char *graph_desc; // frame for temporarily holding output from the filtergraph - AVFrame *frame; + AVFrame *frame; // frame for sending output to the encoder - AVFrame *frame_enc; + AVFrame *frame_enc; Scheduler *sch; unsigned sch_idx; @@ -81,69 +81,69 @@ static const FilterGraphPriv *cfgp_from_cfg(const FilterGraph *fg) // data that is local to the filter thread and not visible outside of it typedef struct FilterGraphThread { - AVFilterGraph *graph; + AVFilterGraph *graph; - AVFrame *frame; + AVFrame *frame; // Temporary buffer for output frames, since on filtergraph reset // we cannot send them to encoders immediately. // The output index is stored in frame opaque. - AVFifo *frame_queue_out; + AVFifo *frame_queue_out; // index of the next input to request from the scheduler - unsigned next_in; + unsigned next_in; // set to 1 after at least one frame passed through this output - int got_frame; + int got_frame; // EOF status of each input/output, as received by the thread - uint8_t *eof_in; - uint8_t *eof_out; + uint8_t *eof_in; + uint8_t *eof_out; } FilterGraphThread; typedef struct InputFilterPriv { - InputFilter ifilter; + InputFilter ifilter; - InputFilterOptions opts; + InputFilterOptions opts; - int index; + int index; - AVFilterContext *filter; + AVFilterContext *filter; // used to hold submitted input - AVFrame *frame; + AVFrame *frame; /* for filters that are not yet bound to an input stream, * this stores the input linklabel, if any */ - uint8_t *linklabel; + uint8_t *linklabel; // filter data type - enum AVMediaType type; + enum AVMediaType type; // source data type: AVMEDIA_TYPE_SUBTITLE for sub2video, // same as type otherwise - enum AVMediaType type_src; + enum AVMediaType type_src; - int bound; - int eof; + int bound; + int eof; // parameters configured for this input - int format; + int format; - int width, height; - AVRational sample_aspect_ratio; - enum AVColorSpace color_space; - enum AVColorRange color_range; + int width, height; + AVRational sample_aspect_ratio; + enum AVColorSpace color_space; + enum AVColorRange color_range; - int sample_rate; - AVChannelLayout ch_layout; + int sample_rate; + AVChannelLayout ch_layout; - AVRational time_base; + AVRational time_base; - AVFifo *frame_queue; + AVFifo *frame_queue; - AVBufferRef *hw_frames_ctx; + AVBufferRef *hw_frames_ctx; - int displaymatrix_present; - int32_t displaymatrix[9]; + int displaymatrix_present; + int32_t displaymatrix[9]; // fallback parameters to use when no input is ever sent struct { @@ -178,15 +178,15 @@ static InputFilterPriv *ifp_from_ifilter(InputFilter *ifilter) } typedef struct FPSConvContext { - AVFrame *last_frame; + AVFrame *last_frame; /* number of frames emitted by the video-encoding sync code */ - int64_t frame_number; + 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]; + int64_t frames_prev_hist[3]; - uint64_t dup_warning; + uint64_t dup_warning; int last_dropped; int dropped_keyframe; @@ -198,38 +198,38 @@ typedef struct FPSConvContext { } FPSConvContext; typedef struct OutputFilterPriv { - OutputFilter ofilter; + OutputFilter ofilter; - int index; + int index; - AVFilterContext *filter; + AVFilterContext *filter; /* desired output stream properties */ - int format; - int width, height; - int sample_rate; - AVChannelLayout ch_layout; + int format; + int width, height; + int sample_rate; + AVChannelLayout ch_layout; // time base in which the output is sent to our downstream // does not need to match the filtersink's timebase - AVRational tb_out; + 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; + int tb_out_locked; - AVRational sample_aspect_ratio; + AVRational sample_aspect_ratio; // 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 int *formats; + const AVChannelLayout *ch_layouts; + const int *sample_rates; - AVRational enc_timebase; + AVRational enc_timebase; // offset for output timestamps, in AV_TIME_BASE_Q - int64_t ts_offset; - int64_t next_pts; - FPSConvContext fps; + int64_t ts_offset; + int64_t next_pts; + FPSConvContext fps; } OutputFilterPriv; static OutputFilterPriv *ofp_from_ofilter(OutputFilter *ofilter) diff --git a/fftools/ffmpeg_mux.h b/fftools/ffmpeg_mux.h index e1b44142cf..16af6d38ba 100644 --- a/fftools/ffmpeg_mux.h +++ b/fftools/ffmpeg_mux.h @@ -34,73 +34,73 @@ #include "libavutil/fifo.h" typedef struct MuxStream { - OutputStream ost; + OutputStream ost; // name used for logging - char log_name[32]; + char log_name[32]; - AVBSFContext *bsf_ctx; - AVPacket *bsf_pkt; + AVBSFContext *bsf_ctx; + AVPacket *bsf_pkt; - AVPacket *pkt; + AVPacket *pkt; - EncStats stats; + EncStats stats; - int sch_idx; - int sch_idx_enc; - int sch_idx_src; + int sch_idx; + int sch_idx_enc; + int sch_idx_src; - int sq_idx_mux; + int sq_idx_mux; - int64_t max_frames; + int64_t max_frames; // timestamp from which the streamcopied streams should start, // in AV_TIME_BASE_Q; // everything before it should be discarded - int64_t ts_copy_start; + int64_t ts_copy_start; /* dts of the last packet sent to the muxer, in the stream timebase * used for making up missing dts values */ - int64_t last_mux_dts; + int64_t last_mux_dts; - int64_t stream_duration; - AVRational stream_duration_tb; + int64_t stream_duration; + AVRational stream_duration_tb; // state for av_rescale_delta() call for audio in write_packet() - int64_t ts_rescale_delta_last; + int64_t ts_rescale_delta_last; // combined size of all the packets sent to the muxer - uint64_t data_size_mux; + uint64_t data_size_mux; - int copy_initial_nonkeyframes; - int copy_prior_start; - int streamcopy_started; + int copy_initial_nonkeyframes; + int copy_prior_start; + int streamcopy_started; } MuxStream; typedef struct Muxer { - OutputFile of; + OutputFile of; // name used for logging - char log_name[32]; + char log_name[32]; - AVFormatContext *fc; + AVFormatContext *fc; - Scheduler *sch; - unsigned sch_idx; + Scheduler *sch; + unsigned sch_idx; // OutputStream indices indexed by scheduler stream indices - int *sch_stream_idx; - int nb_sch_stream_idx; + int *sch_stream_idx; + int nb_sch_stream_idx; - AVDictionary *opts; + AVDictionary *opts; /* filesize limit expressed in bytes */ - int64_t limit_filesize; - atomic_int_least64_t last_filesize; - int header_written; + int64_t limit_filesize; + atomic_int_least64_t last_filesize; + int header_written; - SyncQueue *sq_mux; - AVPacket *sq_pkt; + SyncQueue *sq_mux; + AVPacket *sq_pkt; } Muxer; int mux_check_init(void *arg); -- 2.42.0 _______________________________________________ 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".
prev parent reply other threads:[~2024-02-14 18:25 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-14 18:24 [FFmpeg-devel] [PATCH 01/10] fftools/ffmpeg_filter: stop taking display matrix from global side data Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 02/10] fftools/ffmpeg_filter: compute input trim start/end in demuxer Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 03/10] fftools/ffmpeg_filter: accept a name from its upstream input Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 04/10] fftools/ffmpeg_filter: pass sub2video canvas size through InputFilterOptions Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 05/10] fftools/ffmpeg_filter: pass autorotate/reinit flags " Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 06/10] fftools/ffmpeg_filter: pass framerate " Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 07/10] fftools/ffmpeg_filter: refactor setting input timebase Anton Khirnov 2024-02-15 1:58 ` Michael Niedermayer 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 08/10] fftools/ffmpeg_filter: drop unused InputFilterPriv.ist Anton Khirnov 2024-02-14 18:24 ` [FFmpeg-devel] [PATCH 09/10] fftools/ffmpeg: move subtitle helpers to ffmpeg_dec, their only user Anton Khirnov 2024-02-14 18:24 ` Anton Khirnov [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240214182435.31380-10-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git