Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 03/11] avformat/avformat: use the side data from AVStream.codecpar
Date: Fri, 6 Oct 2023 05:04:38 +0200
Message-ID: <AS8P250MB0744B74D3EF26B8FFCBEF69E8FC9A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20231004122849.56604-4-jamrial@gmail.com>

James Almer:
> Deprecate AVStream.side_data and its helpers in favor of the AVStream's
> codecpar.side_data.
> 
> This will considerably simplify the propagation of global side data to decoders
> and from encoders. Instead of having to do it inside packets, it will be
> available during init().
> Global and frame specific side data will therefore be distinct.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---

...

> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index a8e245000f..8a3fe137fa 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -940,6 +940,7 @@ typedef struct AVStream {
>       */
>      AVPacket attached_pic;
>  
> +#if FF_API_AVSTREAM_SIDE_DATA
>      /**
>       * An array of side data that applies to the whole stream (i.e. the
>       * container does not allow it to change between packets).
> @@ -956,13 +957,20 @@ typedef struct AVStream {
>       *
>       * Freed by libavformat in avformat_free_context().
>       *
> -     * @see av_format_inject_global_side_data()
> +     * @deprecated use AVStream's @ref AVCodecParameters.side_data
> +     *             "codecpar side data".
>       */
> +    attribute_deprecated
>      AVPacketSideData *side_data;
>      /**
>       * The number of elements in the AVStream.side_data array.
> +     *
> +     * @deprecated use AVStream's @ref AVCodecParameters.side_data
> +     *             "codecpar side data".
>       */
> +    attribute_deprecated
>      int            nb_side_data;
> +#endif
>  
>      /**
>       * Flags indicating events happening on the stream, a combination of
> @@ -1720,11 +1728,18 @@ typedef struct AVFormatContext {
>      int (*io_close2)(struct AVFormatContext *s, AVIOContext *pb);
>  } AVFormatContext;
>  
> +#if FF_API_AVSTREAM_SIDE_DATA
>  /**
>   * This function will cause global side data to be injected in the next packet
>   * of each stream as well as after any subsequent seek.
> + *
> + * @deprecated global side data is always available in every AVStream's
> + *             @ref AVCodecParameters.side_data "codecpar side data" array.
> + * @see av_packet_side_data_get()
>   */
> +attribute_deprecated
>  void av_format_inject_global_side_data(AVFormatContext *s);
> +#endif

This is not a "helper" of AVStream.side_data at all. Whereas porting
code to the new API is straightforward for the other deprecated
functions, this one is not. In fact, removing it adds complications for
users, because a user could simply inject global side data via this
function and then only look at packets, the user now has to add special
code to also inspect the global side data.

One example affected by this is my current patch for the Matroska
demuxer to output the palette as stream side data and not as packet side
data as the other demuxers do. Without
av_format_inject_global_side_data(), this will break every user
searching for palette data only in packet side data and not in stream
side data. In fact, one such user is libavformat itself, because all
muxers (nut and avi and mov (the latter two via rawutils)) only search
for this type of side data in packets.

As you can see in that patch, it fixes an issue with seeking where the
palette is attached to a packet read during avformat_find_stream_info()
that is discarded afterwards due to a seek. The same issue also exists
in avi, yet the solution is not so simple there because avi has a second
way to export palettes and due to the requirement that global and
packet-specific side data is supposed to be distinct one can't simply
attach the palette extracted from extradata as stream side-data. Which
makes me think that this requirement is not really reasonable.

- Andreas

_______________________________________________
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".

  reply	other threads:[~2023-10-06  3:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 12:28 [FFmpeg-devel] [PATCH 00/11 v6] AVCodecContext and AVCodecParameters side data James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 01/11] avcodec/packet: add generic side data helpers James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 02/11] avcodec/codec_par: add side data to AVCodecParameters James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 03/11] avformat/avformat: use the side data from AVStream.codecpar James Almer
2023-10-06  3:04   ` Andreas Rheinhardt [this message]
2023-10-06 11:34     ` James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 04/11] avcodec/packet: add some documentation for AVPacketSideData James Almer
2023-10-04 14:46   ` Anton Khirnov
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 05/11] fftools/ffmpeg: stop using AVStream.side_data James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 06/11] fftools/ffplay: " James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 07/11] fftools/ffprobe: " James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 08/11] avcodec/hevcdec: check for DOVI configuration record in AVCodecContext side data James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 09/11] avcodec/decode: propagate global side data to frames James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 10/11] fftools/ffmpeg: stop injecting stream side data in packets James Almer
2023-10-04 12:28 ` [FFmpeg-devel] [PATCH 11/11] fftools/ffplay: " James Almer
2023-10-04 14:47 ` [FFmpeg-devel] [PATCH 00/11 v6] AVCodecContext and AVCodecParameters side data Anton Khirnov
  -- strict thread matches above, loose matches on Subject: below --
2023-09-27 13:12 [FFmpeg-devel] [PATCH 00/11 v5] " James Almer
2023-09-27 13:12 ` [FFmpeg-devel] [PATCH 03/11] avformat/avformat: use the side data from AVStream.codecpar James Almer
2023-10-03 11:38   ` Anton Khirnov

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=AS8P250MB0744B74D3EF26B8FFCBEF69E8FC9A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --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