From patchwork Mon Mar 4 18:06:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 46790 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d808:b0:19e:cdac:8cce with SMTP id iv8csp159158pzb; Mon, 4 Mar 2024 10:07:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVlTgMielhgEBSZ0vFCRcJ6fFSwgSaMbZbaKn2Y4lMRgGznl/z/Vfd/h47KeA+gE9pIoX+HRE4TKedAXqOvGTwVysclvf25hyLRiA== X-Google-Smtp-Source: AGHT+IHYEyoJTrEYDqJfGiEPJbG5O25mWHSrUc4BXayeNxEQpQwMrvhxJOo+RuWkr/ZMkG4c5CnP X-Received: by 2002:aa7:c30e:0:b0:567:156e:7893 with SMTP id l14-20020aa7c30e000000b00567156e7893mr4184374edq.4.1709575653158; Mon, 04 Mar 2024 10:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709575653; cv=none; d=google.com; s=arc-20160816; b=aKf9uVgVAfOsd0aoBRByjMYn6SMSwkfLXlobI2F+m5WAs/XbNUq8WvGWSVUTjJIkQy 5pcq/66BN4mLHUNOIOcGfm3aq0o+Tqg79ZvHWEEghVve6r3Skf1g14EZzMrrxhvJMl82 i6ftNlTOxgfEcyv0P5X0Z1IsmRKtTHrJ1mCOEQfUNcJ95mWkHpN01jWL01+cWrd4hI8X O6Vk8OOO9+BWDEP4mNSVuQhiBA210nEfNCmBYV/si4j9aJMtK8zUU4RKLH5/i7SSUGy6 MwlB7RioW0PBJv1vwjXGjsNVgt9yNpIIt3nSGqJBjpJI4dgK1HLulIYWE9Vl9lfKwb4O W0zQ== 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:dkim-signature:delivered-to; bh=04H8nJa8OtKOVjY0BggXNuVtnHtSD94j4Qm63TgHIWE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OaI58IHKtpvAiOsFumOQCpEYXwMW2nQNHwthqavSq9l47YrN7ldBQa5ceRwPlMpoOa A9mgtRDbYaQ1IyAUiygXfcsrSRvVUDso9ja9gTC1baFv3YO84qtj1OulTYy4kfdaI7wD oJtRiOGAA5oBfwKJbC4Azs8L81KuksyVairb3XRnEPr/iHFmp42L+TfmylB1bW2RmKd3 A88v+2kyH2sz1WLGFGqvqQF5rMmDf137KlaRDIMRE0kRqCX0Esy7oUAIt8UTiB/Nty5h koIKOROrNRndNZNS/jlmHe3f5AopMx5Pm5WHw7O/49tDJecbVTYRf1vpIcfffcJS944L J4Qg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=jfieyzWR; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dz15-20020a0564021d4f00b005676b7b8f08si497949edb.50.2024.03.04.10.07.31; Mon, 04 Mar 2024 10:07:33 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=jfieyzWR; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 93E1168D4BE; Mon, 4 Mar 2024 20:07:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2B42868D4A6 for ; Mon, 4 Mar 2024 20:07:06 +0200 (EET) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e5e4b1d1f1so1485011b3a.1 for ; Mon, 04 Mar 2024 10:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709575623; x=1710180423; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=n5Va3DPx83wMFCtHpuUtUts4y9LpR2LZvzjFDSa7Lzc=; b=jfieyzWR3wbfsCpv0n/Me9ssANiCZFCJaJvOhdVml78/g5PaiDotlGteeqpXF6ryr6 owN9/5TaOXlD22tdRWdRv9H4NNt7UYwxsxoXvH0aYspmjU/VvwTRKo01KUuTv04sG+qt YX7gtGXyzb8mOVQKe5BBGul4lCWGGkvm0d03VK/XgJ9v0005S6+K5GWEfG62K8WI4TnC 5wMc84Rlxy/5e7tqx3rV9bJdHPLzsZLGqOtnVs/GRRTgqiPSLlxb917OdBDgil0azTrX 8dk2WFf96OgEfBpFC//WZSSCKOdnx5GRJSpGDxj9wR1gT6WBPyOsQ8Dgxngp9MovP8+/ IlCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709575623; x=1710180423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n5Va3DPx83wMFCtHpuUtUts4y9LpR2LZvzjFDSa7Lzc=; b=WbAWGCg8PWBrUrLgLGzAG4YrYGg+aEcEqxQ3x7rjk15KBo52F5wn8RWbjTMMriToM9 l+hbM7F8XzxX6KouZ5yZqH5unBvZ4FzkYEdztBqWRhY2JjTD9hpFtjC7pVlaE9ysBuZ5 O4krdaPKarKIU1xqeVsYm1Q8f6auXRt82bJYtQn09CtNLgcMsg1pf/kEL8fxsSgMBGkY xajkVhEqkAcwf7rij6LXpML6zvy21u2NPKN4pKlzotV/N+HSKwe7F91drL8Knf51au0M dEnmZjusq2IeJwwSlxWmDVWGEtB8KEIT7CWp4rp9CL5A8oEdO2kCfMzJiUiQAgZVc10U cOog== X-Gm-Message-State: AOJu0Yz3Dd239HEOorgW5l1TkP40a1mRrItk2eaztIfsVXPuVOkVDzbo MzM/9dmKSL959RmJmuEQKfQEkH1ymnH8M/E+m0wZ5GkYJDTL12Y4xRM7j/iB X-Received: by 2002:a17:90a:d589:b0:296:530:996e with SMTP id v9-20020a17090ad58900b002960530996emr264760pju.20.1709575623166; Mon, 04 Mar 2024 10:07:03 -0800 (PST) Received: from localhost.localdomain ([190.194.169.124]) by smtp.gmail.com with ESMTPSA id gx15-20020a17090b124f00b00298ca46547fsm8089145pjb.36.2024.03.04.10.07.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 10:07:02 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 15:06:12 -0300 Message-ID: <20240304180613.7280-3-jamrial@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240125134425.374-1-jamrial@gmail.com> References: <20240125134425.374-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/avformat: Reorder AVFormatContext fields 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: Rn8PSHwBL+qJ Move related fields closer together. Signed-off-by: James Almer --- libavformat/avformat.h | 222 ++++++++++++++++++++--------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index d74db17df1..f28db099d4 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1324,6 +1324,39 @@ typedef struct AVFormatContext { */ AVStream **streams; + /** + * Number of elements in AVFormatContext.stream_groups. + * + * Set by avformat_stream_group_create(), must not be modified by any other code. + */ + unsigned int nb_stream_groups; + /** + * A list of all stream groups in the file. New groups are created with + * avformat_stream_group_create(), and filled with avformat_stream_group_add_stream(). + * + * - demuxing: groups may be created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new groups may also + * appear in av_read_frame(). + * - muxing: groups may be created by the user before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + */ + AVStreamGroup **stream_groups; + + /** + * Number of chapters in AVChapter array. + * When muxing, chapters are normally written in the file header, + * so nb_chapters should normally be initialized before write_header + * is called. Some muxers (e.g. mov and mkv) can also write chapters + * in the trailer. To write chapters in the trailer, nb_chapters + * must be zero when write_header is called and non-zero when + * write_trailer is called. + * - muxing: set by user + * - demuxing: set by libavformat + */ + unsigned int nb_chapters; + AVChapter **chapters; + /** * input or output URL. Unlike the old filename field, this field has no * length restriction. @@ -1443,36 +1476,10 @@ typedef struct AVFormatContext { enum AVCodecID subtitle_codec_id; /** - * Maximum amount of memory in bytes to use for the index of each stream. - * If the index exceeds this size, entries will be discarded as - * needed to maintain a smaller size. This can lead to slower or less - * accurate seeking (depends on demuxer). - * Demuxers for which a full in-memory index is mandatory will ignore - * this. - * - muxing: unused - * - demuxing: set by user - */ - unsigned int max_index_size; - - /** - * Maximum amount of memory in bytes to use for buffering frames - * obtained from realtime capture devices. - */ - unsigned int max_picture_buffer; - - /** - * Number of chapters in AVChapter array. - * When muxing, chapters are normally written in the file header, - * so nb_chapters should normally be initialized before write_header - * is called. Some muxers (e.g. mov and mkv) can also write chapters - * in the trailer. To write chapters in the trailer, nb_chapters - * must be zero when write_header is called and non-zero when - * write_trailer is called. - * - muxing: set by user - * - demuxing: set by libavformat + * Forced Data codec_id. + * Demuxing: Set by user. */ - unsigned int nb_chapters; - AVChapter **chapters; + enum AVCodecID data_codec_id; /** * Metadata that applies to the whole file. @@ -1528,6 +1535,31 @@ typedef struct AVFormatContext { int debug; #define FF_FDEBUG_TS 0x0001 + /** + * The maximum number of streams. + * - encoding: unused + * - decoding: set by user + */ + int max_streams; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * - muxing: unused + * - demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + /** * Maximum buffering duration for interleaving. * @@ -1546,6 +1578,35 @@ typedef struct AVFormatContext { */ int64_t max_interleave_delta; + /** + * Maximum number of packets to read while waiting for the first timestamp. + * Decoding only. + */ + int max_ts_probe; + + /** + * Max chunk time in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user + * - decoding: unused + */ + int max_chunk_duration; + + /** + * Max chunk size in bytes + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user + * - decoding: unused + */ + int max_chunk_size; + + /** + * Maximum number of packets that can be probed + * - encoding: unused + * - decoding: set by user + */ + int max_probe_packets; + /** * Allow non-standard and experimental extension * @see AVCodecContext.strict_std_compliance @@ -1572,11 +1633,6 @@ typedef struct AVFormatContext { */ #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 - /** - * Maximum number of packets to read while waiting for the first timestamp. - * Decoding only. - */ - int max_ts_probe; /** * Avoid negative timestamps during muxing. @@ -1599,22 +1655,6 @@ typedef struct AVFormatContext { */ int audio_preload; - /** - * Max chunk time in microseconds. - * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user - * - decoding: unused - */ - int max_chunk_duration; - - /** - * Max chunk size in bytes - * Note, not all formats support this and unpredictable things may happen if it is used when not supported. - * - encoding: Set by user - * - decoding: unused - */ - int max_chunk_size; - /** * forces the use of wallclock timestamps as pts/dts of packets * This has undefined results in the presence of B frames. @@ -1623,6 +1663,13 @@ typedef struct AVFormatContext { */ int use_wallclock_as_timestamps; + /** + * Skip duration calcuation in estimate_timings_from_pts. + * - encoding: unused + * - decoding: set by user + */ + int skip_estimate_duration_from_pts; + /** * avio flags, used to force AVIO_FLAG_DIRECT. * - encoding: unused @@ -1702,6 +1749,20 @@ typedef struct AVFormatContext { */ char *format_whitelist; + /** + * ',' separated list of allowed protocols. + * - encoding: unused + * - decoding: set by user + */ + char *protocol_whitelist; + + /** + * ',' separated list of disallowed protocols. + * - encoding: unused + * - decoding: set by user + */ + char *protocol_blacklist; + /** * IO repositioned flag. * This is set by avformat when the underlaying IO context read pointer @@ -1774,19 +1835,6 @@ typedef struct AVFormatContext { */ uint8_t *dump_separator; - /** - * Forced Data codec_id. - * Demuxing: Set by user. - */ - enum AVCodecID data_codec_id; - - /** - * ',' separated list of allowed protocols. - * - encoding: unused - * - decoding: set by user - */ - char *protocol_whitelist; - /** * A callback for opening new IO streams. * @@ -1810,34 +1858,6 @@ typedef struct AVFormatContext { int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options); - /** - * ',' separated list of disallowed protocols. - * - encoding: unused - * - decoding: set by user - */ - char *protocol_blacklist; - - /** - * The maximum number of streams. - * - encoding: unused - * - decoding: set by user - */ - int max_streams; - - /** - * Skip duration calcuation in estimate_timings_from_pts. - * - encoding: unused - * - decoding: set by user - */ - int skip_estimate_duration_from_pts; - - /** - * Maximum number of packets that can be probed - * - encoding: unused - * - decoding: set by user - */ - int max_probe_packets; - /** * A callback for closing the streams opened with AVFormatContext.io_open(). * @@ -1850,26 +1870,6 @@ typedef struct AVFormatContext { * @return 0 on success, a negative AVERROR code on failure */ int (*io_close2)(struct AVFormatContext *s, AVIOContext *pb); - - /** - * Number of elements in AVFormatContext.stream_groups. - * - * Set by avformat_stream_group_create(), must not be modified by any other code. - */ - unsigned int nb_stream_groups; - - /** - * A list of all stream groups in the file. New groups are created with - * avformat_stream_group_create(), and filled with avformat_stream_group_add_stream(). - * - * - demuxing: groups may be created by libavformat in avformat_open_input(). - * If AVFMTCTX_NOHEADER is set in ctx_flags, then new groups may also - * appear in av_read_frame(). - * - muxing: groups may be created by the user before avformat_write_header(). - * - * Freed by libavformat in avformat_free_context(). - */ - AVStreamGroup **stream_groups; } AVFormatContext; /**