Re: [FFmpeg-devel] [PATCH v4 1/2] lavu/hashtable: create generic robin hood hash table

2024-03-04 Thread Anton Khirnov
Quoting Connor Worley (2024-03-03 23:44:55)
> Any objections to this patchset?

Lack of documentation, for one thing.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avcodec/mediacodecenc: Add a hint message to use nv12 pix_fmt

2024-03-04 Thread Matthieu Bouron
On Mon, Mar 04, 2024 at 11:37:58AM +0800, Zhao Zhili wrote:
> From: Zhao Zhili 
> 
> ---
>  libavcodec/mediacodecenc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
> index 086b545590..984014f1b1 100644
> --- a/libavcodec/mediacodecenc.c
> +++ b/libavcodec/mediacodecenc.c
> @@ -319,6 +319,9 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
>  ret = ff_AMediaCodec_configure(s->codec, format, s->window, NULL, ret);
>  if (ret) {
>  av_log(avctx, AV_LOG_ERROR, "MediaCodec configure failed, %s\n", 
> av_err2str(ret));
> +if (avctx->pix_fmt == AV_PIX_FMT_YUV420P)
> +av_log(avctx, AV_LOG_ERROR, "Please try -pix_fmt nv12, some 
> devices don't "
> +"support yuv420p as encoder input 
> format.\n");
>  goto bailout;
>  }
>  

LGTM.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] Add protocol for Android content providers (v2)

2024-03-04 Thread Matthieu Bouron
On Tue, Feb 27, 2024 at 03:50:36PM +0100, Matthieu Bouron wrote:
> Diff from initial patchset:
> - directly include libavcodec/ffjni.c from libavformat/file.c instead of
>   migrating ffjni to libavutil (avpriv_*)
> - check that the passed application context reference is a global one and 
> error
>   out if it's not the case
> 

Ping.

Note: I reworded locally the commit msgs using avutil/jni to avcodec/jni.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffprobe: add support for Stream Groups

2024-03-04 Thread Stefano Sabatini
On date Saturday 2024-03-02 16:03:20 -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  fftools/ffprobe.c | 186 ++
>  1 file changed, 157 insertions(+), 29 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index ea225f14ab..ec3c713849 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -112,8 +112,10 @@ static int do_show_format  = 0;
>  static int do_show_frames  = 0;
>  static int do_show_packets = 0;
>  static int do_show_programs = 0;
> +static int do_show_stream_groups = 0;
>  static int do_show_streams = 0;
>  static int do_show_stream_disposition = 0;
> +static int do_show_stream_group_disposition = 0;
>  static int do_show_data= 0;
>  static int do_show_program_version  = 0;
>  static int do_show_library_versions = 0;
> @@ -126,6 +128,7 @@ static int do_show_chapter_tags = 0;
>  static int do_show_format_tags = 0;
>  static int do_show_frame_tags = 0;
>  static int do_show_program_tags = 0;
> +static int do_show_stream_group_tags = 0;
>  static int do_show_stream_tags = 0;
>  static int do_show_packet_tags = 0;
>  
> @@ -159,7 +162,7 @@ static int find_stream_info  = 1;
>  
>  /* section structure definition */
>  
> -#define SECTION_MAX_NB_CHILDREN 10
> +#define SECTION_MAX_NB_CHILDREN 11
>  
>  typedef enum {
>  SECTION_ID_NONE = -1,
> @@ -210,6 +213,14 @@ typedef enum {
>  SECTION_ID_STREAM_TAGS,
>  SECTION_ID_STREAM_SIDE_DATA_LIST,
>  SECTION_ID_STREAM_SIDE_DATA,
> +SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
> +SECTION_ID_STREAM_GROUP_STREAM_TAGS,
> +SECTION_ID_STREAM_GROUP,
> +SECTION_ID_STREAM_GROUP_STREAMS,
> +SECTION_ID_STREAM_GROUP_STREAM,
> +SECTION_ID_STREAM_GROUP_DISPOSITION,
> +SECTION_ID_STREAM_GROUP_TAGS,
> +SECTION_ID_STREAM_GROUPS,
>  SECTION_ID_SUBTITLE,
>  } SectionID;
>  
> @@ -286,7 +297,7 @@ static struct section sections[] = {
>  [SECTION_ID_PROGRAM_VERSION] ={ SECTION_ID_PROGRAM_VERSION, 
> "program_version", 0, { -1 } },
>  [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
> "programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
>  [SECTION_ID_ROOT] =   { SECTION_ID_ROOT, "root", 
> SECTION_FLAG_IS_WRAPPER,
> -{ SECTION_ID_CHAPTERS, 
> SECTION_ID_FORMAT, SECTION_ID_FRAMES, SECTION_ID_PROGRAMS, SECTION_ID_STREAMS,
> +{ SECTION_ID_CHAPTERS, 
> SECTION_ID_FORMAT, SECTION_ID_FRAMES, SECTION_ID_PROGRAMS, 
> SECTION_ID_STREAM_GROUPS, SECTION_ID_STREAMS,
>SECTION_ID_PACKETS, 
> SECTION_ID_ERROR, SECTION_ID_PROGRAM_VERSION, SECTION_ID_LIBRARY_VERSIONS,
>SECTION_ID_PIXEL_FORMATS, -1} },
>  [SECTION_ID_STREAMS] ={ SECTION_ID_STREAMS, "streams", 
> SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM, -1 } },
> @@ -295,6 +306,14 @@ static struct section sections[] = {
>  [SECTION_ID_STREAM_TAGS] ={ SECTION_ID_STREAM_TAGS, "tags", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name 
> = "stream_tags" },
>  [SECTION_ID_STREAM_SIDE_DATA_LIST] ={ SECTION_ID_STREAM_SIDE_DATA_LIST, 
> "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_SIDE_DATA, -1 }, 
> .element_name = "side_data", .unique_name = "stream_side_data_list" },
>  [SECTION_ID_STREAM_SIDE_DATA] = { SECTION_ID_STREAM_SIDE_DATA, 
> "side_data", SECTION_FLAG_HAS_TYPE|SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, 
> .unique_name = "stream_side_data", .element_name = "side_datum", .get_type = 
> get_packet_side_data_type },
> +[SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { 
> SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, 
> .unique_name = "stream_group_stream_disposition" },
> +[SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ 
> SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name 
> = "stream_group_stream_tags" },
> +[SECTION_ID_STREAM_GROUP] ={ 
> SECTION_ID_STREAM_GROUP, "stream_group", 0, { SECTION_ID_STREAM_GROUP_TAGS, 
> SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_STREAMS, -1 } },
> +[SECTION_ID_STREAM_GROUP_STREAMS] ={ 
> SECTION_ID_STREAM_GROUP_STREAMS, "streams", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_STREAM_GROUP_STREAM, -1 }, .unique_name = "stream_group_streams" },
> +[SECTION_ID_STREAM_GROUP_STREAM] = { 
> SECTION_ID_STREAM_GROUP_STREAM, "stream", 0, { 
> SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, 
> SECTION_ID_STREAM_GROUP_STREAM_TAGS, -1 }, .unique_name = 
> "stream_group_stream" },
> +[SECTION_ID_STREAM_GROUP_DISPOSITION] ={ 
> SECTION_ID_STREAM_GROUP_DISPOSITION, "disposition", 0, { -1 }, .unique_name = 
> "stream_group_disposition" },
> +[SECTION_ID_STREAM_GROUP_TAGS] =   { 
> SECTION

Re: [FFmpeg-devel] [PATCH 2/2] fftools/ffprobe: print some basic Tile Grid Stream Group parameters

2024-03-04 Thread Stefano Sabatini
On date Saturday 2024-03-02 16:03:21 -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  fftools/ffprobe.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index ec3c713849..6e66f4dfa8 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -3362,7 +3362,15 @@ static void print_stream_group_params(WriterContext 
> *w, AVStreamGroup *stg)
>  else if (stg->type == AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION)
>  print_str("type", "IAMF Mix Presentation");
>  else if (stg->type == AV_STREAM_GROUP_PARAMS_TILE_GRID) {
> +AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid;
>  print_str("type", "Tile Grid");
> +print_int("nb_tiles",  tile_grid->nb_tiles);
> +print_int("coded_width",   tile_grid->coded_width);
> +print_int("coded_height",  tile_grid->coded_height);
> +print_int("horizontal_offset", tile_grid->horizontal_offset);
> +print_int("vertical_offset",   tile_grid->vertical_offset);
> +print_int("width", tile_grid->width);
> +print_int("height",tile_grid->height);

should ffprobe.xsd be updated? (in case it is not a variable field)

>  } else
>  print_str_opt("type", "unknown");
>  }
> -- 
> 2.44.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-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: fix -pgc and -pg options

2024-03-04 Thread Stefano Sabatini
On date Saturday 2024-03-02 20:29:13 -0600, Marth64 wrote:
> In merged DVD patch, -pgc and -pg options were broken. While these are
> rather advanced options, they are the only means to get content for
> some strangely authored discs.
> 
> Signed-off-by: Marth64 
> ---
>  libavformat/dvdvideodec.c | 23 +--
>  1 file changed, 13 insertions(+), 10 deletions(-)

Will apply, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/3] doc/community: Conflict of interest recusal requirement (Similar to mid part of Antons proposal)

2024-03-04 Thread Vittorio Giovara
On Mon, Mar 4, 2024 at 1:46 AM Michael Niedermayer 
wrote:

> > Again, the effective way to work-around this problem is to keep a large
> and
> > diverse enough TC membership to offset the one or few hypothetical
> dishonest
> > votes.
>
> This doesnt work. The set of people is very specific, and they will always
> be
> representatives of the community so when 60% of the community works for
> companies which would benefit by FFmpeg not competing. There
> would be no realistic way to have a committee that wasnt also 60% affected
> by this. And for this we need a clear rule.
>

This scenario is, also, not realistic.
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: fix -pgc and -pg options

2024-03-04 Thread Stefano Sabatini
On date Monday 2024-03-04 10:24:42 +0100, Stefano Sabatini wrote:
> On date Saturday 2024-03-02 20:29:13 -0600, Marth64 wrote:
> > In merged DVD patch, -pgc and -pg options were broken. While these are
> > rather advanced options, they are the only means to get content for
> > some strangely authored discs.
> > 
> > Signed-off-by: Marth64 
> > ---
> >  libavformat/dvdvideodec.c | 23 +--
> >  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> Will apply, thanks.

Not really:
$ git am patches/0001-lavf-dvvideodec-fix-opts.patch  --reject
Applying: avformat/dvdvideodec: fix -pgc and -pg options
Checking patch libavformat/dvdvideodec.c...
Hunk #1 succeeded at 507 (offset -1 lines).
Hunk #2 succeeded at 1255 (offset -12 lines).
error: while searching for:
(ret = dvdvideo_subp_stream_add_all(s)) < 0)
return ret;

if (!c->opt_preindex)
return dvdvideo_chapters_setup_simple(s);

return ret;

error: patch failed: libavformat/dvdvideodec.c:1288
Applying patch libavformat/dvdvideodec.c with 1 reject...
Hunk #1 applied cleanly.
Hunk #2 applied cleanly.
Rejected hunk #3.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [RFC] clarifying the TC conflict of interest rule

2024-03-04 Thread Vittorio Giovara
On Mon, Mar 4, 2024 at 1:57 AM Michael Niedermayer 
wrote:

> On Sun, Mar 03, 2024 at 03:49:33AM +0100, Michael Niedermayer wrote:
> [...]
>
> > +If a TC member is aware of a conflict of interest with regards to the
> case, they must announce it
> > +and recuse themselves from the TC discussion and vote.
>
> please replace this in my proposal by this (as it clearer states what the
> intend is)
>
> > * If a TC member is aware of being in a conflict of interest with
> regards to the case, they must announce it
> > and recuse themselves from the TC discussion and vote.
>
> (also as you can see we have active discussions here, the vote is IMHO
>  premature)
>

we literally had premature voting for STF, despite multiple discussions
taking place during the time
I don't see how a parallel thread here should stop the proposed vote now
please let's stop filibustering and just move on to voting
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/8 v2] fftools/ffprobe: add support for Stream Groups

2024-03-04 Thread Stefano Sabatini
On date Sunday 2024-03-03 15:09:19 -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  doc/ffprobe.xsd   |   1 +
>  fftools/ffprobe.c | 145 --
>  tests/ref/fate/cavs-demux |   2 +-
>  tests/ref/fate/ffprobe_compact|   2 +-
>  tests/ref/fate/ffprobe_csv|   2 +-
>  tests/ref/fate/ffprobe_default|   1 +
>  tests/ref/fate/ffprobe_flat   |   1 +
>  tests/ref/fate/ffprobe_ini|   1 +
>  tests/ref/fate/ffprobe_json   |   1 +
>  tests/ref/fate/ffprobe_xml|   2 +-
>  tests/ref/fate/ffprobe_xsd|   2 +-
>  tests/ref/fate/flv-demux  |   2 +-
>  tests/ref/fate/gapless-mp3-side-data  |   2 +-
>  .../ref/fate/mov-mp4-disposition-mpegts-remux |   3 +
>  tests/ref/fate/mov-mp4-ttml-dfxp  |   3 +
>  tests/ref/fate/mov-mp4-ttml-stpp  |   3 +
>  tests/ref/fate/oggopus-demux  |   2 +-
>  tests/ref/fate/ts-demux   |   2 +-
>  tests/ref/fate/ts-opus-demux  |   2 +-
>  tests/ref/fate/ts-small-demux |   2 +-
>  tests/ref/fate/ts-timed-id3-demux |   2 +-
>  21 files changed, 160 insertions(+), 23 deletions(-)
> 
> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
> index 23d97ed11a..08f2909c02 100644
> --- a/doc/ffprobe.xsd
> +++ b/doc/ffprobe.xsd
> @@ -305,6 +305,7 @@
>  
>  
>  
> +
>  
>  
>  

do we also need to add a new type for the stream group?


> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index ac6b92f5d6..548c5e0948 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -112,8 +112,10 @@ static int do_show_format  = 0;
>  static int do_show_frames  = 0;
>  static int do_show_packets = 0;
>  static int do_show_programs = 0;
> +static int do_show_stream_groups = 0;
>  static int do_show_streams = 0;
>  static int do_show_stream_disposition = 0;
> +static int do_show_stream_group_disposition = 0;
>  static int do_show_data= 0;
>  static int do_show_program_version  = 0;
>  static int do_show_library_versions = 0;
> @@ -126,6 +128,7 @@ static int do_show_chapter_tags = 0;
>  static int do_show_format_tags = 0;
>  static int do_show_frame_tags = 0;
>  static int do_show_program_tags = 0;
> +static int do_show_stream_group_tags = 0;
>  static int do_show_stream_tags = 0;
>  static int do_show_packet_tags = 0;
>  
> @@ -159,7 +162,7 @@ static int find_stream_info  = 1;
>  
>  /* section structure definition */
>  
> -#define SECTION_MAX_NB_CHILDREN 10
> +#define SECTION_MAX_NB_CHILDREN 11
>  
>  typedef enum {
>  SECTION_ID_NONE = -1,
> @@ -203,6 +206,14 @@ typedef enum {
>  SECTION_ID_PROGRAM_TAGS,
>  SECTION_ID_PROGRAM_VERSION,
>  SECTION_ID_PROGRAMS,
> +SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
> +SECTION_ID_STREAM_GROUP_STREAM_TAGS,
> +SECTION_ID_STREAM_GROUP,
> +SECTION_ID_STREAM_GROUP_STREAMS,
> +SECTION_ID_STREAM_GROUP_STREAM,
> +SECTION_ID_STREAM_GROUP_DISPOSITION,
> +SECTION_ID_STREAM_GROUP_TAGS,
> +SECTION_ID_STREAM_GROUPS,
>  SECTION_ID_ROOT,
>  SECTION_ID_STREAM,
>  SECTION_ID_STREAM_DISPOSITION,
> @@ -285,8 +296,16 @@ static struct section sections[] = {
>  [SECTION_ID_PROGRAM_TAGS] =   { SECTION_ID_PROGRAM_TAGS, 
> "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", 
> .unique_name = "program_tags" },
>  [SECTION_ID_PROGRAM_VERSION] ={ SECTION_ID_PROGRAM_VERSION, 
> "program_version", 0, { -1 } },
>  [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
> "programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
> +[SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { 
> SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, 
> .unique_name = "stream_group_stream_disposition" },
> +[SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ 
> SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", 
> SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name 
> = "stream_group_stream_tags" },
> +[SECTION_ID_STREAM_GROUP] ={ 
> SECTION_ID_STREAM_GROUP, "stream_group", 0, { SECTION_ID_STREAM_GROUP_TAGS, 
> SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_STREAMS, -1 } },
> +[SECTION_ID_STREAM_GROUP_STREAMS] ={ 
> SECTION_ID_STREAM_GROUP_STREAMS, "streams", SECTION_FLAG_IS_ARRAY, { 
> SECTION_ID_STREAM_GROUP_STREAM, -1 }, .unique_name = "stream_group_streams" },
> +[SECTION_ID_STREAM_GROUP_STREAM] = { 
> SECTION_ID_STREAM_GROUP_STREAM, "stream", 0, { 
> SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, 
> SECTION_ID_STREAM_GROUP_STREAM_TAGS, -1 }, .unique_name = 
> "stream_group_stream" },
> +[SECTION_ID_STREAM_GROUP_DISPOSITION] ={ 
> SECTION_ID_STREAM_GROUP_DISPOSITION, "disposit

Re: [FFmpeg-devel] [PATCH] doc/demuxers: emphasize that DVD demuxer does not do decryption

2024-03-04 Thread Stefano Sabatini
On date Sunday 2024-03-03 14:49:36 -0600, Marth64 wrote:
> Signed-off-by: Marth64 
> ---
>  doc/demuxers.texi | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> index 905828d852..f4bac8f3b3 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -295,6 +295,9 @@ into a conversion pipeline. Menus and seeking are not 
> supported at this time.
>  Block devices (DVD drives), ISO files, and directory structures are accepted.
>  Activate with @code{-f dvdvideo} in front of one of these inputs.
>  
> +This demuxer does NOT have decryption code of any kind. You are on your own
> +working with encrypted DVDs, and should not expect support on the matter.
> +
>  Underlying playback is handled by libdvdnav, and structure parsing by 
> libdvdread.
>  FFmpeg must be built with GPL library support available as well as the
>  configure switches @code{--enable-libdvdnav} and @code{--enable-libdvdread}.

Looks good, will apply this together with your latest other patches, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] fftools/cmdutils: Inline print_error()

2024-03-04 Thread Stefano Sabatini
On date Sunday 2024-03-03 23:46:24 +0100, Andreas Rheinhardt wrote:
> It is only used by ffprobe (once) and ffplay (twice);
> inlining it avoids including it unnecessarily into ffmpeg.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  fftools/cmdutils.c | 5 -
>  fftools/cmdutils.h | 5 -
>  2 files changed, 4 insertions(+), 6 deletions(-)

LGTM, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 1/6] avcodec: add av_jni_{get, set}_android_app_ctx helper

2024-03-04 Thread Andreas Rheinhardt
Matthieu Bouron:
> This will allow users to pass the Android ApplicationContext which is 
> mandatory
> to retrieve the ContentResolver responsible to resolve/open Android 
> content-uri.
> ---
>  libavcodec/jni.c | 40 
>  libavcodec/jni.h | 17 +
>  2 files changed, 57 insertions(+)
> 
> diff --git a/libavcodec/jni.c b/libavcodec/jni.c
> index ae6490de9d..7d04d0a268 100644
> --- a/libavcodec/jni.c
> +++ b/libavcodec/jni.c
> @@ -64,6 +64,36 @@ void *av_jni_get_java_vm(void *log_ctx)
>  return vm;
>  }
>  
> +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
> +{
> +JNIEnv *env = avpriv_jni_get_env(c);

Patch #1 won't compile on its own due to this; you fix this up in patch #2.

> +if (!env)
> +return AVERROR(EINVAL);
> +
> +jobjectRefType type = (*env)->GetObjectRefType(env, app_ctx);
> +if (type != JNIGlobalRefType) {
> +av_log(log_ctx, AV_LOG_ERROR, "Application context must be passed as 
> a global reference");
> +return AVERROR(EINVAL);
> +}
> +
> +pthread_mutex_lock(&lock);
> +android_app_ctx = app_ctx;
> +pthread_mutex_unlock(&lock);
> +
> +return 0;
> +}
> +
> +void *av_jni_get_android_app_ctx(void)
> +{
> +void *ctx;
> +
> +pthread_mutex_lock(&lock);
> +ctx = android_app_ctx;
> +pthread_mutex_unlock(&lock);
> +
> +return ctx;
> +}
> +
>  #else
>  
>  int av_jni_set_java_vm(void *vm, void *log_ctx)
> @@ -76,4 +106,14 @@ void *av_jni_get_java_vm(void *log_ctx)
>  return NULL;
>  }
>  
> +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
> +{
> +return AVERROR(ENOSYS);
> +}
> +
> +void *av_jni_get_android_app_ctx(void)
> +{
> +return NULL;
> +}

I am against adding stub functions on platforms where they are known to
be useless, i.e. everything except android.

> +
>  #endif
> diff --git a/libavcodec/jni.h b/libavcodec/jni.h
> index dd99e92611..da8025f830 100644
> --- a/libavcodec/jni.h
> +++ b/libavcodec/jni.h
> @@ -43,4 +43,21 @@ int av_jni_set_java_vm(void *vm, void *log_ctx);
>   */
>  void *av_jni_get_java_vm(void *log_ctx);
>  
> +/*
> + * Set the Android application context which will be used to retrieve the 
> Android
> + * content resolver to resolve content uris.
> + *
> + * @param app_ctx global JNI reference to the Android application context
> + * @return 0 on success, < 0 otherwise
> + */
> +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
> +
> +/*
> + * Get the Android application context that has been set with
> + * av_jni_set_android_app_ctx.
> + *
> + * @return a pointer the the Android application context
> + */
> +void *av_jni_get_android_app_ctx(void);
> +
>  #endif /* AVCODEC_JNI_H */

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/dovi_rpu: implement support for profile 10

2024-03-04 Thread Niklas Haas
On Sun, 25 Feb 2024 12:44:49 +0100 Niklas Haas  wrote:
> From: Niklas Haas 
> 
> Instead of the nal_prefix, this profile inside wraps the RPU inside an
> EMDF header, as specified in ETSI TS 102 366. This particular usage is
> supposedly specified in ETSI TS 103 572, at least according to European
> Patent EP 3 588 964 A1, but I could not find any references to DV RPUs
> in the former.
> 
> It's worth pointing out that the EMDF container is not byte-aligned,
> meaning that payloads are delivered at arbitrary byte boundaries. Hence
> the reason for doing it inside ff_dovi_rpu_parse, which already uses
> a bitstream reader, rather than splitting off the container in
> a separate stage. (Plus, we hard-code the DV-specific payload ID)
> 
> Magic values were taken from a combination of the sources below, all of
> which agree about what the specific EMDF header should look like. In
> fact, they all hard-code a very *specific* header sequence, but I wanted
> to go the extra mile and at least properly skip the variable fields
> - even though the non-existent Dolby Vision specification probably
> specifies that they all must be 0. This is probably overkill.
> 
> Validated and tested using sample files from the merge request linked
> below.
> 
> Relevant links:
> - 
> https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf
> - 
> https://patentimages.storage.googleapis.com/8a/0b/da/28294acaed2182/EP3588964A1.pdf
> - 
> https://www.etsi.org/deliver/etsi_ts/103500_103599/103572/01.03.01_60/ts_103572v010301p.pdf
> - 
> https://github.com/rockchip-linux/mpp/blob/fdeb8c378b79d4b4ef80457e4431815de89dc417/mpp/codec/dec/av1/av1d_cbs.c#L2378
> - 
> https://github.com/elginsk8r/android_kernel_amlogic_linux-4.9/blob/23a4c38bf06ef34821e476a8edddbf9213712c8a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c#L5638
> - https://gitlab.com/mbunkus/mkvtoolnix/-/merge_requests/2254

Ping. Is there anybody who could kindly review this?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avcodec/hq_hqadata: Move data in a header

2024-03-04 Thread Andreas Rheinhardt
It is only used by hq_hqa.c, so said header can simply
be included there.
Also move the code to initialize the VLCs to hq_hqa.c.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/Makefile   |  3 +-
 libavcodec/hq_hqa.c   | 39 +++
 libavcodec/hq_hqa.h   | 60 ---
 libavcodec/{hq_hqadata.c => hq_hqadata.h} | 34 ++---
 4 files changed, 48 insertions(+), 88 deletions(-)
 delete mode 100644 libavcodec/hq_hqa.h
 rename libavcodec/{hq_hqadata.c => hq_hqadata.h} (99%)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index eadaab5ec4..cf81a55edb 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -451,8 +451,7 @@ OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER)+= v4l2_m2m_dec.o
 OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER)+= v4l2_m2m_enc.o
 OBJS-$(CONFIG_HEVC_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
 OBJS-$(CONFIG_HNM4_VIDEO_DECODER)  += hnm4video.o
-OBJS-$(CONFIG_HQ_HQA_DECODER)  += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
-  canopus.o
+OBJS-$(CONFIG_HQ_HQA_DECODER)  += hq_hqa.o hq_hqadsp.o canopus.o
 OBJS-$(CONFIG_HQX_DECODER) += hqx.o hqxvlc.o hqxdsp.o canopus.o
 OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
 OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index 0df7995f84..510a66fd91 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -21,6 +21,7 @@
 #include 
 
 #include "libavutil/attributes.h"
+#include "libavutil/mem_internal.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
@@ -28,9 +29,9 @@
 #include "codec_internal.h"
 #include "decode.h"
 #include "get_bits.h"
-
-#include "hq_hqa.h"
+#include "hq_hqadata.h"
 #include "hq_hqadsp.h"
+#include "vlc.h"
 
 /* HQ/HQA slices are a set of macroblocks belonging to a frame, and
  * they usually form a pseudorandom pattern (probably because it is
@@ -48,6 +49,15 @@
  * while lavc simply aligns coded_width and coded_height.
  */
 
+typedef struct HQContext {
+AVCodecContext *avctx;
+HQDSPContext hqhqadsp;
+
+VLC hq_ac_vlc;
+VLC hqa_cbp_vlc;
+DECLARE_ALIGNED(16, int16_t, block)[12][64];
+} HQContext;
+
 static inline void put_blocks(HQContext *c, AVFrame *pic,
   int plane, int x, int y, int ilace,
   int16_t *block0, int16_t *block1)
@@ -70,9 +80,9 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, 
int16_t block[64],
 
 if (!is_hqa) {
 block[0] = get_sbits(gb, 9) * 64;
-q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)];
+q = hq_quants[qsel][is_chroma][get_bits(gb, 2)];
 } else {
-q = ff_hq_quants[qsel][is_chroma][get_bits(gb, 2)];
+q = hq_quants[qsel][is_chroma][get_bits(gb, 2)];
 block[0] = get_sbits(gb, 9) * 64;
 }
 
@@ -81,10 +91,10 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, 
int16_t block[64],
 if (val < 0)
 return AVERROR_INVALIDDATA;
 
-pos += ff_hq_ac_skips[val];
+pos += hq_ac_skips[val];
 if (pos >= 64)
 break;
-block[ff_zigzag_direct[pos]] = (int)(ff_hq_ac_syms[val] * 
(unsigned)q[pos]) >> 12;
+block[ff_zigzag_direct[pos]] = (int)(hq_ac_syms[val] * 
(unsigned)q[pos]) >> 12;
 pos++;
 }
 
@@ -124,10 +134,10 @@ static int hq_decode_frame(HQContext *ctx, AVFrame *pic, 
GetByteContext *gbc,
 int slice, start_off, next_off, i, ret;
 
 if ((unsigned)prof_num >= NUM_HQ_PROFILES) {
-profile = &ff_hq_profile[0];
+profile = &hq_profile[0];
 avpriv_request_sample(ctx->avctx, "HQ Profile %d", prof_num);
 } else {
-profile = &ff_hq_profile[prof_num];
+profile = &hq_profile[prof_num];
 av_log(ctx->avctx, AV_LOG_VERBOSE, "HQ Profile %d\n", prof_num);
 }
 
@@ -362,6 +372,17 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, 
AVFrame *pic,
 return avpkt->size;
 }
 
+static av_cold int hq_init_vlcs(HQContext *c)
+{
+int ret = vlc_init(&c->hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens),
+   cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0);
+if (ret < 0)
+return ret;
+
+return vlc_init(&c->hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES,
+hq_ac_bits, 1, 1, hq_ac_codes, 2, 2, 0);
+}
+
 static av_cold int hq_hqa_decode_init(AVCodecContext *avctx)
 {
 HQContext *ctx = avctx->priv_data;
@@ -369,7 +390,7 @@ static av_cold int hq_hqa_decode_init(AVCodecContext *avctx)
 
 ff_hqdsp_init(&ctx->hqhqadsp);
 
-return ff_hq_init_vlcs(ctx);
+return hq_init_vlcs(ctx);
 }
 
 static av_cold int hq_hqa_decode_close(AVCodecContext *avctx)
diff --git a/libavcodec/hq_hqa.h b/libavcodec/hq_hqa.h
deleted file mode 100644
index 71aa36706c..00
--- a/libavcodec/hq_hqa.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Canopus HQ/HQA decoder
- *
- * This file is

Re: [FFmpeg-devel] [PATCH] avcodec/vvcdec: fix undefined behaviours for derive_affine_mvc

2024-03-04 Thread Nuo Mi
On Sun, Mar 3, 2024 at 10:04 PM Nuo Mi  wrote:

> libavcodec/vvc/vvc_inter.c:823:18: runtime error: signed integer overflow:
> 1426128896 + 1426128896 cannot be represented in type 'int'
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> libavcodec/vvc/vvc_inter.c:823:18
>
> Suggested-by: Andreas Rheinhardt 
> ---
>  libavcodec/vvc/vvc_inter.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/vvc/vvc_inter.c b/libavcodec/vvc/vvc_inter.c
> index d5be32aa14..c5629f7f6f 100644
> --- a/libavcodec/vvc/vvc_inter.c
> +++ b/libavcodec/vvc/vvc_inter.c
> @@ -817,10 +817,13 @@ static void derive_affine_mvc(MvField *mvc, const
> VVCFrameContext *fc, const MvF
>  const int vs = fc->ps.sps->vshift[1];
>  const MvField* mv2 = ff_vvc_get_mvf(fc, x0 + hs * sbw, y0 + vs * sbh);
>  *mvc = *mv;
> -mvc->mv[0].x += mv2->mv[0].x;
> -mvc->mv[0].y += mv2->mv[0].y;
> -mvc->mv[1].x += mv2->mv[1].x;
> -mvc->mv[1].y += mv2->mv[1].y;
> +
> +// Due to different pred_flag, one of the motion vectors may have an
> invalid value.
> +// Cast them to an unsigned type to avoid undefined behavior.
> +mvc->mv[0].x += (unsigned int)mv2->mv[0].x;
> +mvc->mv[0].y += (unsigned int)mv2->mv[0].y;
> +mvc->mv[1].x += (unsigned int)mv2->mv[1].x;
> +mvc->mv[1].y += (unsigned int)mv2->mv[1].y;
>
pushed.

>  ff_vvc_round_mv(mvc->mv + 0, 0, 1);
>  ff_vvc_round_mv(mvc->mv + 1, 0, 1);
>  }
> --
> 2.25.1
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avcodec/vvcdec: fix boundary strength when IBC involved

2024-03-04 Thread Nuo Mi
On Sat, Mar 2, 2024 at 10:05 PM Nuo Mi  wrote:

> The following cases should set bs to 1:
> If the prediction modes are not the same.
> If both prediction modes are MODE_IBC, but the motion vector delta is
> larger than 8 of 1/16 pixels.
> see 8.8.3.5
>
> How to reproduce it:
> vvencapp -i sintel_trailer_2k_1080p24.y4m --preset fast --additional
> "IBC=1" -o sintel.266
> ffmpeg -i sintel.266 -f md5 -
> md5 will mismatch
>
> Found-by: 6ws at
> https://github.com/ffvvc/FFmpeg/issues/187#issuecomment-1962842135
> ---
>
pushed.

>  libavcodec/vvc/vvc_filter.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
> index 379d90d02b..dded447bfa 100644
> --- a/libavcodec/vvc/vvc_filter.c
> +++ b/libavcodec/vvc/vvc_filter.c
> @@ -309,6 +309,10 @@ static int boundary_strength(const VVCLocalContext
> *lc, const MvField *curr, con
>  const RefPicList *neigh_rpl)
>  {
>  RefPicList *rpl = lc->sc->rpl;
> +
> +if (curr->pred_flag == PF_IBC)
> +return FFABS(neigh->mv[0].x - curr->mv[0].x) >= 8 ||
> FFABS(neigh->mv[0].y - curr->mv[0].y) >= 8;
> +
>  if (curr->pred_flag == PF_BI &&  neigh->pred_flag == PF_BI) {
>  // same L0 and L1
>  if (rpl[0].list[curr->ref_idx[0]] ==
> neigh_rpl[0].list[neigh->ref_idx[0]]  &&
> @@ -497,6 +501,7 @@ static av_always_inline int deblock_bs(const
> VVCLocalContext *lc,
>  const int cb_p = (y_p >> log2_min_cb_size) *
> min_cb_width  + (x_p >>  log2_min_cb_size);
>  const int cb_q = (y_q >> log2_min_cb_size) *
> min_cb_width  + (x_q >>  log2_min_cb_size);
>  const uint8_t intra= fc->tab.cpm[chroma][cb_p] == MODE_INTRA
> || fc->tab.cpm[chroma][cb_q] == MODE_INTRA;
> +const uint8_t same_mode= fc->tab.cpm[chroma][cb_p] ==
> fc->tab.cpm[chroma][cb_q];
>
>  if (pcmf)
>  return 0;
> @@ -517,6 +522,9 @@ static av_always_inline int deblock_bs(const
> VVCLocalContext *lc,
>  if ((off_to_cb && ((off_to_cb % 8) || !has_sub_block)))
>  return 0; // inside a cu, not
> aligned to 8 or with no subblocks
>
> +if (!same_mode)
> +return 1;
> +
>  return boundary_strength(lc, mvf_q, mvf_p, rpl_p);
>  }
>
> --
> 2.25.1
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avcodec/hq_hqa: Make VLC tables static

2024-03-04 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/hq_hqa.c | 35 +--
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index 510a66fd91..096fb65dc7 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -22,6 +22,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/mem_internal.h"
+#include "libavutil/thread.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
@@ -53,11 +54,12 @@ typedef struct HQContext {
 AVCodecContext *avctx;
 HQDSPContext hqhqadsp;
 
-VLC hq_ac_vlc;
-VLC hqa_cbp_vlc;
 DECLARE_ALIGNED(16, int16_t, block)[12][64];
 } HQContext;
 
+static VLCElem hq_ac_vlc[1184];
+static VLCElem hqa_cbp_vlc[32];
+
 static inline void put_blocks(HQContext *c, AVFrame *pic,
   int plane, int x, int y, int ilace,
   int16_t *block0, int16_t *block1)
@@ -87,7 +89,7 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, 
int16_t block[64],
 }
 
 for (;;) {
-val = get_vlc2(gb, c->hq_ac_vlc.table, 9, 2);
+val = get_vlc2(gb, hq_ac_vlc, 9, 2);
 if (val < 0)
 return AVERROR_INVALIDDATA;
 
@@ -195,7 +197,7 @@ static int hqa_decode_mb(HQContext *c, AVFrame *pic, int 
qgroup,
 if (get_bits_left(gb) < 1)
 return AVERROR_INVALIDDATA;
 
-cbp = get_vlc2(gb, c->hqa_cbp_vlc.table, 5, 1);
+cbp = get_vlc2(gb, hqa_cbp_vlc, 5, 1);
 
 for (i = 0; i < 12; i++)
 memset(c->block[i], 0, sizeof(*c->block));
@@ -372,33 +374,24 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, 
AVFrame *pic,
 return avpkt->size;
 }
 
-static av_cold int hq_init_vlcs(HQContext *c)
+static av_cold void hq_init_vlcs(void)
 {
-int ret = vlc_init(&c->hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens),
-   cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0);
-if (ret < 0)
-return ret;
+VLC_INIT_STATIC_TABLE(hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens),
+  cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0);
 
-return vlc_init(&c->hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES,
-hq_ac_bits, 1, 1, hq_ac_codes, 2, 2, 0);
+VLC_INIT_STATIC_TABLE(hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES,
+  hq_ac_bits, 1, 1, hq_ac_codes, 2, 2, 0);
 }
 
 static av_cold int hq_hqa_decode_init(AVCodecContext *avctx)
 {
+static AVOnce init_static_once = AV_ONCE_INIT;
 HQContext *ctx = avctx->priv_data;
 ctx->avctx = avctx;
 
 ff_hqdsp_init(&ctx->hqhqadsp);
 
-return hq_init_vlcs(ctx);
-}
-
-static av_cold int hq_hqa_decode_close(AVCodecContext *avctx)
-{
-HQContext *ctx = avctx->priv_data;
-
-ff_vlc_free(&ctx->hq_ac_vlc);
-ff_vlc_free(&ctx->hqa_cbp_vlc);
+ff_thread_once(&init_static_once, hq_init_vlcs);
 
 return 0;
 }
@@ -411,7 +404,5 @@ const FFCodec ff_hq_hqa_decoder = {
 .priv_data_size = sizeof(HQContext),
 .init   = hq_hqa_decode_init,
 FF_CODEC_DECODE_CB(hq_hqa_decode_frame),
-.close  = hq_hqa_decode_close,
 .p.capabilities = AV_CODEC_CAP_DR1,
-.caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.40.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/dovi_rpu: implement support for profile 10

2024-03-04 Thread Andreas Rheinhardt
Niklas Haas:
> From: Niklas Haas 
> 
> Instead of the nal_prefix, this profile inside wraps the RPU inside an
> EMDF header, as specified in ETSI TS 102 366. This particular usage is
> supposedly specified in ETSI TS 103 572, at least according to European
> Patent EP 3 588 964 A1, but I could not find any references to DV RPUs
> in the former.
> 
> It's worth pointing out that the EMDF container is not byte-aligned,
> meaning that payloads are delivered at arbitrary byte boundaries. Hence
> the reason for doing it inside ff_dovi_rpu_parse, which already uses
> a bitstream reader, rather than splitting off the container in
> a separate stage. (Plus, we hard-code the DV-specific payload ID)
> 
> Magic values were taken from a combination of the sources below, all of
> which agree about what the specific EMDF header should look like. In
> fact, they all hard-code a very *specific* header sequence, but I wanted
> to go the extra mile and at least properly skip the variable fields
> - even though the non-existent Dolby Vision specification probably
> specifies that they all must be 0. This is probably overkill.
> 
> Validated and tested using sample files from the merge request linked
> below.
> 
> Relevant links:
> - 
> https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf
> - 
> https://patentimages.storage.googleapis.com/8a/0b/da/28294acaed2182/EP3588964A1.pdf
> - 
> https://www.etsi.org/deliver/etsi_ts/103500_103599/103572/01.03.01_60/ts_103572v010301p.pdf
> - 
> https://github.com/rockchip-linux/mpp/blob/fdeb8c378b79d4b4ef80457e4431815de89dc417/mpp/codec/dec/av1/av1d_cbs.c#L2378
> - 
> https://github.com/elginsk8r/android_kernel_amlogic_linux-4.9/blob/23a4c38bf06ef34821e476a8edddbf9213712c8a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c#L5638
> - https://gitlab.com/mbunkus/mkvtoolnix/-/merge_requests/2254
> ---
>  libavcodec/dovi_rpu.c | 68 +--
>  1 file changed, 65 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
> index a6b23f4dd11..c7cdd65a2f2 100644
> --- a/libavcodec/dovi_rpu.c
> +++ b/libavcodec/dovi_rpu.c
> @@ -174,6 +174,18 @@ static inline int64_t get_se_coef(GetBitContext *gb, 
> const AVDOVIRpuDataHeader *
>  return 0; /* unreachable */
>  }
>  
> +static inline unsigned get_variable_bits(GetBitContext *gb, int n)
> +{
> +unsigned int value = get_bits(gb, n);
> +int read_more = get_bits1(gb);
> +while (read_more) {
> +value = (value + 1) << n;
> +value += get_bits(gb, n);

Using |= is more appropriate.

> +read_more = get_bits1(gb);
> +};

The ';' is a null statement.

> +return value;
> +}
> +
>  #define VALIDATE(VAR, MIN, MAX)  
>\
>  do { 
>\
>  if (VAR < MIN || VAR > MAX) {
>\
> @@ -200,9 +212,59 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t 
> *rpu, size_t rpu_size)
>  if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0)
>  return ret;
>  
> -/* RPU header, common values */
> -nal_prefix = get_bits(gb, 8);
> -VALIDATE(nal_prefix, 25, 25);
> +/* Container header */
> +if (s->dv_profile == 10 /* dav1.10 */) {
> +/* DV inside AV1 re-uses EMDF container, parse header */
> +int emdf_version, key_id, emdf_payload_id, emdf_payload_size, 
> smploffste;
> +emdf_version = get_bits(gb, 2);
> +if (emdf_version == 3)
> +emdf_version += get_variable_bits(gb, 2);
> +key_id = get_bits(gb, 3);
> +if (key_id == 7)
> +key_id += get_variable_bits(gb, 3);
> +emdf_payload_id = get_bits(gb, 5);
> +if (emdf_payload_id == 0x1F)
> +emdf_payload_id += get_variable_bits(gb, 5);
> +
> +/* Magic values taken from amlogic and rockchip drivers, and also
> + * match values found in practice (and validated in hardware) */
> +VALIDATE(key_id, 6, 6);
> +VALIDATE(emdf_payload_id, 256, 256);
> +
> +/* Note: In theory, there could be multiple payloads, and we should
> + * skip over the unused payloads until we find the one we're 
> interested
> + * in. But this capability does not seem to be used in practice, so
> + * the DV-specific usage of EMDF probably requires only one payload
> + * per T.35 OBU */
> +
> +/* Skip emdf_payload_config() */
> +if ((smploffste = get_bits1(gb)))
> +skip_bits(gb, 11 + 1);
> +if (get_bits1(gb)) /* duratione */
> +get_variable_bits(gb, 11);
> +if (get_bits1(gb)) /* groupide */
> +get_variable_bits(gb, 2);
> +if (get_bits1(gb)) /* codecdatae */
> +skip_bits(gb, 8);
> +if (!get_bits1(gb)) { /* discard_unknown_payload */
> +int

[FFmpeg-devel] [PATCH 01/29] lavu/opt: factor per-type dispatch out of av_opt_get()

2024-03-04 Thread Anton Khirnov
Will be useful in following commits.
---
 libavutil/opt.c | 220 ++--
 1 file changed, 121 insertions(+), 99 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index d68184c2cc..dac00478ee 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -844,13 +844,123 @@ static void format_duration(char *buf, size_t size, 
int64_t d)
 *(--e) = 0;
 }
 
+static int opt_get_elem(const AVOption *o, uint8_t **pbuf, size_t buf_len,
+void *dst, int search_flags)
+{
+int ret;
+
+switch (o->type) {
+case AV_OPT_TYPE_BOOL:
+ret = snprintf(*pbuf, buf_len, "%s", get_bool_name(*(int *)dst));
+break;
+case AV_OPT_TYPE_FLAGS:
+ret = snprintf(*pbuf, buf_len, "0x%08X", *(int *)dst);
+break;
+case AV_OPT_TYPE_INT:
+ret = snprintf(*pbuf, buf_len, "%d", *(int *)dst);
+break;
+case AV_OPT_TYPE_INT64:
+ret = snprintf(*pbuf, buf_len, "%"PRId64, *(int64_t *)dst);
+break;
+case AV_OPT_TYPE_UINT64:
+ret = snprintf(*pbuf, buf_len, "%"PRIu64, *(uint64_t *)dst);
+break;
+case AV_OPT_TYPE_FLOAT:
+ret = snprintf(*pbuf, buf_len, "%f", *(float *)dst);
+break;
+case AV_OPT_TYPE_DOUBLE:
+ret = snprintf(*pbuf, buf_len, "%f", *(double *)dst);
+break;
+case AV_OPT_TYPE_VIDEO_RATE:
+case AV_OPT_TYPE_RATIONAL:
+ret = snprintf(*pbuf, buf_len, "%d/%d", ((AVRational *)dst)->num, 
((AVRational *)dst)->den);
+break;
+case AV_OPT_TYPE_CONST:
+ret = snprintf(*pbuf, buf_len, "%"PRId64, o->default_val.i64);
+break;
+case AV_OPT_TYPE_STRING:
+if (*(uint8_t **)dst) {
+*pbuf = av_strdup(*(uint8_t **)dst);
+} else if (search_flags & AV_OPT_ALLOW_NULL) {
+*pbuf = NULL;
+return 0;
+} else {
+*pbuf = av_strdup("");
+}
+return *pbuf ? 0 : AVERROR(ENOMEM);
+case AV_OPT_TYPE_BINARY: {
+const uint8_t *bin;
+int len;
+
+if (!*(uint8_t **)dst && (search_flags & AV_OPT_ALLOW_NULL)) {
+*pbuf = NULL;
+return 0;
+}
+len = *(int *)(((uint8_t *)dst) + sizeof(uint8_t *));
+if ((uint64_t)len * 2 + 1 > INT_MAX)
+return AVERROR(EINVAL);
+if (!(*pbuf = av_malloc(len * 2 + 1)))
+return AVERROR(ENOMEM);
+if (!len) {
+*pbuf[0] = '\0';
+return 0;
+}
+bin = *(uint8_t **)dst;
+for (int i = 0; i < len; i++)
+snprintf(*pbuf + i * 2, 3, "%02X", bin[i]);
+return 0;
+}
+case AV_OPT_TYPE_IMAGE_SIZE:
+ret = snprintf(*pbuf, buf_len, "%dx%d", ((int *)dst)[0], ((int 
*)dst)[1]);
+break;
+case AV_OPT_TYPE_PIXEL_FMT:
+ret = snprintf(*pbuf, buf_len, "%s", (char 
*)av_x_if_null(av_get_pix_fmt_name(*(enum AVPixelFormat *)dst), "none"));
+break;
+case AV_OPT_TYPE_SAMPLE_FMT:
+ret = snprintf(*pbuf, buf_len, "%s", (char 
*)av_x_if_null(av_get_sample_fmt_name(*(enum AVSampleFormat *)dst), "none"));
+break;
+case AV_OPT_TYPE_DURATION: {
+int64_t i64 = *(int64_t *)dst;
+format_duration(*pbuf, buf_len, i64);
+ret = strlen(*pbuf); // no overflow possible, checked by an assert
+break;
+}
+case AV_OPT_TYPE_COLOR:
+ret = snprintf(*pbuf, buf_len, "0x%02x%02x%02x%02x",
+   (int)((uint8_t *)dst)[0], (int)((uint8_t *)dst)[1],
+   (int)((uint8_t *)dst)[2], (int)((uint8_t *)dst)[3]);
+break;
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
+case AV_OPT_TYPE_CHANNEL_LAYOUT: {
+int64_t i64 = *(int64_t *)dst;
+ret = snprintf(*pbuf, buf_len, "0x%"PRIx64, i64);
+break;
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+case AV_OPT_TYPE_CHLAYOUT:
+ret = av_channel_layout_describe(dst, *pbuf, buf_len);
+break;
+case AV_OPT_TYPE_DICT:
+if (!*(AVDictionary **)dst && (search_flags & AV_OPT_ALLOW_NULL)) {
+*pbuf = NULL;
+return 0;
+}
+return av_dict_get_string(*(AVDictionary **)dst, (char **)pbuf, '=', 
':');
+default:
+return AVERROR(EINVAL);
+}
+
+return ret;
+}
+
 int av_opt_get(void *obj, const char *name, int search_flags, uint8_t 
**out_val)
 {
 void *dst, *target_obj;
 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, 
&target_obj);
-uint8_t *bin, buf[128];
-int len, i, ret;
-int64_t i64;
+uint8_t *out, buf[128];
+int ret;
 
 if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST))
 return AVERROR_OPTION_NOT_FOUND;
@@ -861,107 +971,19 @@ int av_opt_get(void *obj, const char *name, int 
search_flags, uint8_t **out_val)
 dst = (uint8_t *)target_obj + o->offset;
 
 buf[0] = 0;
-switch (o->type) {
-case AV_OPT_T

[FFmpeg-devel] [PATCH 03/29] libavutil/opt: rework figuring out option sizes

2024-03-04 Thread Anton Khirnov
Replace the opt_size() function, currently only called from
av_opt_copy(), with
* a constant array of element sizes
* a function that signals whether an option type is POD (i.e.
  memcpyable) or not

Will be useful in following commits.
---
 libavutil/opt.c | 100 +++-
 1 file changed, 56 insertions(+), 44 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index b372c76120..051a121331 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -56,6 +56,56 @@ const AVOption *av_opt_next(const void *obj, const AVOption 
*last)
 return NULL;
 }
 
+static const size_t opt_elem_size[] = {
+[AV_OPT_TYPE_FLAGS] = sizeof(unsigned),
+[AV_OPT_TYPE_INT]   = sizeof(int),
+[AV_OPT_TYPE_INT64] = sizeof(int64_t),
+[AV_OPT_TYPE_UINT64]= sizeof(uint64_t),
+[AV_OPT_TYPE_DOUBLE]= sizeof(double),
+[AV_OPT_TYPE_FLOAT] = sizeof(float),
+[AV_OPT_TYPE_STRING]= sizeof(char *),
+[AV_OPT_TYPE_RATIONAL]  = sizeof(AVRational),
+[AV_OPT_TYPE_BINARY]= sizeof(uint8_t *),
+[AV_OPT_TYPE_DICT]  = sizeof(AVDictionary *),
+[AV_OPT_TYPE_IMAGE_SIZE]= sizeof(int[2]),
+[AV_OPT_TYPE_VIDEO_RATE]= sizeof(AVRational),
+[AV_OPT_TYPE_PIXEL_FMT] = sizeof(int),
+[AV_OPT_TYPE_SAMPLE_FMT]= sizeof(int),
+[AV_OPT_TYPE_DURATION]  = sizeof(int64_t),
+[AV_OPT_TYPE_COLOR] = sizeof(uint8_t[4]),
+#if FF_API_OLD_CHANNEL_LAYOUT
+[AV_OPT_TYPE_CHANNEL_LAYOUT]= sizeof(uint64_t),
+#endif
+[AV_OPT_TYPE_CHLAYOUT]  = sizeof(AVChannelLayout),
+[AV_OPT_TYPE_BOOL]  = sizeof(int),
+};
+
+// option is plain old data
+static int opt_is_pod(enum AVOptionType type)
+{
+switch (type) {
+case AV_OPT_TYPE_FLAGS:
+case AV_OPT_TYPE_INT:
+case AV_OPT_TYPE_INT64:
+case AV_OPT_TYPE_DOUBLE:
+case AV_OPT_TYPE_FLOAT:
+case AV_OPT_TYPE_RATIONAL:
+case AV_OPT_TYPE_UINT64:
+case AV_OPT_TYPE_IMAGE_SIZE:
+case AV_OPT_TYPE_PIXEL_FMT:
+case AV_OPT_TYPE_SAMPLE_FMT:
+case AV_OPT_TYPE_VIDEO_RATE:
+case AV_OPT_TYPE_DURATION:
+case AV_OPT_TYPE_COLOR:
+#if FF_API_OLD_CHANNEL_LAYOUT
+case AV_OPT_TYPE_CHANNEL_LAYOUT:
+#endif
+case AV_OPT_TYPE_BOOL:
+return 1;
+}
+return 0;
+}
+
 static int read_number(const AVOption *o, const void *dst, double *num, int 
*den, int64_t *intnum)
 {
 switch (o->type) {
@@ -1850,45 +1900,6 @@ void *av_opt_ptr(const AVClass *class, void *obj, const 
char *name)
 return (uint8_t*)obj + opt->offset;
 }
 
-static int opt_size(enum AVOptionType type)
-{
-switch(type) {
-case AV_OPT_TYPE_BOOL:
-case AV_OPT_TYPE_INT:
-case AV_OPT_TYPE_FLAGS:
-return sizeof(int);
-case AV_OPT_TYPE_DURATION:
-#if FF_API_OLD_CHANNEL_LAYOUT
-FF_DISABLE_DEPRECATION_WARNINGS
-case AV_OPT_TYPE_CHANNEL_LAYOUT:
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-case AV_OPT_TYPE_INT64:
-case AV_OPT_TYPE_UINT64:
-return sizeof(int64_t);
-case AV_OPT_TYPE_DOUBLE:
-return sizeof(double);
-case AV_OPT_TYPE_FLOAT:
-return sizeof(float);
-case AV_OPT_TYPE_STRING:
-return sizeof(uint8_t*);
-case AV_OPT_TYPE_VIDEO_RATE:
-case AV_OPT_TYPE_RATIONAL:
-return sizeof(AVRational);
-case AV_OPT_TYPE_BINARY:
-return sizeof(uint8_t*) + sizeof(int);
-case AV_OPT_TYPE_IMAGE_SIZE:
-return sizeof(int[2]);
-case AV_OPT_TYPE_PIXEL_FMT:
-return sizeof(enum AVPixelFormat);
-case AV_OPT_TYPE_SAMPLE_FMT:
-return sizeof(enum AVSampleFormat);
-case AV_OPT_TYPE_COLOR:
-return 4;
-}
-return AVERROR(EINVAL);
-}
-
 int av_opt_copy(void *dst, const void *src)
 {
 const AVOption *o = NULL;
@@ -1939,12 +1950,13 @@ int av_opt_copy(void *dst, const void *src)
 } else if (o->type == AV_OPT_TYPE_CHLAYOUT) {
 if (field_dst != field_src)
 ret = av_channel_layout_copy(field_dst, field_src);
+} else if (opt_is_pod(o->type)) {
+size_t size = opt_elem_size[o->type];
+memcpy(field_dst, field_src, size);
 } else {
-int size = opt_size(o->type);
-if (size < 0)
-ret = size;
-else
-memcpy(field_dst, field_src, size);
+av_log(dst, AV_LOG_ERROR, "Unhandled option type: %d\n",
+   o->type);
+ret = AVERROR(EINVAL);
 }
 }
 return ret;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 02/29] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-04 Thread Anton Khirnov
Will be useful in following commits.
---
 libavutil/opt.c | 35 ++-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index dac00478ee..b372c76120 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -494,13 +494,11 @@ static int set_string_channel_layout(void *obj, const 
AVOption *o,
 return av_channel_layout_from_string(channel_layout, val);
 }
 
-int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
+static int opt_set_elem(void *obj, void *target_obj, const AVOption *o,
+const char *val, void *dst)
 {
-int ret = 0;
-void *dst, *target_obj;
-const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, 
&target_obj);
-if (!o || !target_obj)
-return AVERROR_OPTION_NOT_FOUND;
+int ret;
+
 FF_DISABLE_DEPRECATION_WARNINGS
 if (!val && (o->type != AV_OPT_TYPE_STRING &&
  o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != 
AV_OPT_TYPE_SAMPLE_FMT &&
@@ -513,13 +511,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
 return AVERROR(EINVAL);
 FF_ENABLE_DEPRECATION_WARNINGS
 
-if (o->flags & AV_OPT_FLAG_READONLY)
-return AVERROR(EINVAL);
-
-if (o->flags & AV_OPT_FLAG_DEPRECATED)
-av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", 
name, o->help);
-
-dst = ((uint8_t *)target_obj) + o->offset;
 switch (o->type) {
 case AV_OPT_TYPE_BOOL:
 return set_string_bool(obj, o, val, dst);
@@ -599,6 +590,24 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return AVERROR(EINVAL);
 }
 
+int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
+{
+void *dst, *target_obj;
+const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, 
&target_obj);
+if (!o || !target_obj)
+return AVERROR_OPTION_NOT_FOUND;
+
+if (o->flags & AV_OPT_FLAG_READONLY)
+return AVERROR(EINVAL);
+
+if (o->flags & AV_OPT_FLAG_DEPRECATED)
+av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", 
name, o->help);
+
+dst = ((uint8_t *)target_obj) + o->offset;
+
+return opt_set_elem(obj, target_obj, o, val, dst);
+}
+
 #define OPT_EVAL_NUMBER(name, opttype, vartype) \
 int av_opt_eval_ ## name(void *obj, const AVOption *o,  \
  const char *val, vartype *name ## _out)\
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 08/29] avcodec: add internal side data wrappers

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

The signature of these wrappers is more complicated due to a need to
distinguish between "failed allocating side data" and "side data was
already present".

Signed-off-by: Anton Khirnov 
---
 libavcodec/decode.c | 66 +
 libavcodec/decode.h | 20 ++
 2 files changed, 86 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 5c80ef9cd0..f3e8b72be7 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1857,6 +1857,72 @@ int ff_decode_preinit(AVCodecContext *avctx)
 return 0;
 }
 
+/**
+ * Check side data preference and clear existing side data from frame
+ * if needed.
+ *
+ * @retval 0 side data of this type can be added to frame
+ * @retval 1 side data of this type should not be added to frame
+ */
+static int side_data_pref(const AVCodecContext *avctx, AVFrame *frame,
+  enum AVFrameSideDataType type)
+{
+DecodeContext *dc = decode_ctx(avctx->internal);
+
+// Note: could be skipped for `type` without corresponding packet sd
+if (av_frame_get_side_data(frame, type)) {
+if (dc->side_data_pref_mask & (1ULL << type))
+return 1;
+av_frame_remove_side_data(frame, type);
+}
+
+return 0;
+}
+
+
+int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame,
+   enum AVFrameSideDataType type, size_t size,
+   AVFrameSideData **psd)
+{
+AVFrameSideData *sd;
+
+if (side_data_pref(avctx, frame, type)) {
+if (psd)
+*psd = NULL;
+return 0;
+}
+
+sd = av_frame_new_side_data(frame, type, size);
+if (psd)
+*psd = sd;
+
+return sd ? 0 : AVERROR(ENOMEM);
+}
+
+int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx,
+AVFrame *frame, enum AVFrameSideDataType 
type,
+AVBufferRef **buf, AVFrameSideData **psd)
+{
+AVFrameSideData *sd = NULL;
+int ret = 0;
+
+if (side_data_pref(avctx, frame, type))
+goto finish;
+
+sd = av_frame_new_side_data_from_buf(frame, type, *buf);
+if (sd)
+*buf = NULL;
+else
+ret = AVERROR(ENOMEM);
+
+finish:
+av_buffer_unref(buf);
+if (psd)
+*psd = sd;
+
+return ret;
+}
+
 int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
 {
 size_t size;
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index daf1a67444..b269b5a43b 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -155,4 +155,24 @@ int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, 
void **hwaccel_picture_pr
 const AVPacketSideData *ff_get_coded_side_data(const AVCodecContext *avctx,
enum AVPacketSideDataType type);
 
+/**
+ * Wrapper around av_frame_new_side_data, which rejects side data overridden by
+ * the demuxer. Returns 0 on success, and a negative error code otherwise.
+ * If successful and sd is not NULL, *sd may either contain a pointer to the 
new
+ * side data, or NULL in case the side data was already present.
+ */
+int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame,
+   enum AVFrameSideDataType type, size_t size,
+   AVFrameSideData **sd);
+
+/**
+ * Similar to `ff_frame_new_side_data`, but using an existing buffer ref.
+ *
+ * *buf is ALWAYS consumed by this function and NULL written in its place, even
+ * on failure.
+ */
+int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx,
+AVFrame *frame, enum AVFrameSideDataType 
type,
+AVBufferRef **buf, AVFrameSideData **sd);
+
 #endif /* AVCODEC_DECODE_H */
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options

2024-03-04 Thread Anton Khirnov
---
 doc/APIchanges|   3 +
 libavutil/opt.c   | 362 +-
 libavutil/opt.h   |  62 +++-
 libavutil/tests/opt.c |  51 ++
 tests/ref/fate/opt|  35 +++-
 5 files changed, 468 insertions(+), 45 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7d46ebb006..3209614ed6 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2024-02-xx - xx - lavu 58.xx.100 - opt.h
+  Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
+
 2024-02-28 - xx - swr   4.14.100 - swresample.h
   swr_convert() now accepts arrays of const pointers (to input and output).
 
diff --git a/libavutil/opt.c b/libavutil/opt.c
index d18a1c63b7..6a5e3c7174 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -43,6 +43,8 @@
 
 #include 
 
+#define TYPE_BASE(type) ((type) & ~AV_OPT_TYPE_FLAG_ARRAY)
+
 const AVOption *av_opt_next(const void *obj, const AVOption *last)
 {
 const AVClass *class;
@@ -106,6 +108,54 @@ static int opt_is_pod(enum AVOptionType type)
 return 0;
 }
 
+static uint8_t opt_array_sep(const AVOption *o)
+{
+const AVOptionArrayDef *d = o->default_val.arr;
+av_assert1(o->type & AV_OPT_TYPE_FLAG_ARRAY);
+return (d && d->sep) ? d->sep : ',';
+}
+
+static void *opt_array_pelem(const AVOption *o, void *array, unsigned idx)
+{
+av_assert1(o->type & AV_OPT_TYPE_FLAG_ARRAY);
+return (uint8_t *)array + idx * opt_elem_size[TYPE_BASE(o->type)];
+}
+
+static unsigned *opt_array_pcount(const void *parray)
+{
+return (unsigned *)((const void * const *)parray + 1);
+}
+
+static void opt_free_elem(const AVOption *o, void *ptr)
+{
+switch (TYPE_BASE(o->type)) {
+case AV_OPT_TYPE_STRING:
+case AV_OPT_TYPE_BINARY:
+av_freep(ptr);
+break;
+
+case AV_OPT_TYPE_DICT:
+av_dict_free((AVDictionary **)ptr);
+break;
+
+case AV_OPT_TYPE_CHLAYOUT:
+av_channel_layout_uninit((AVChannelLayout *)ptr);
+break;
+
+default:
+break;
+}
+}
+
+static void opt_free_array(const AVOption *o, void *parray, unsigned *count)
+{
+for (unsigned i = 0; i < *count; i++)
+opt_free_elem(o, opt_array_pelem(o, *(void **)parray, i));
+
+av_freep(parray);
+*count = 0;
+}
+
 static int read_number(const AVOption *o, const void *dst, double *num, int 
*den, int64_t *intnum)
 {
 switch (o->type) {
@@ -151,14 +201,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 static int write_number(void *obj, const AVOption *o, void *dst, double num, 
int den, int64_t intnum)
 {
-if (o->type != AV_OPT_TYPE_FLAGS &&
+const enum AVOptionType type = TYPE_BASE(o->type);
+
+if (type != AV_OPT_TYPE_FLAGS &&
 (!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
 num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN);
 av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range 
[%g - %g]\n",
num, o->name, o->min, o->max);
 return AVERROR(ERANGE);
 }
-if (o->type == AV_OPT_TYPE_FLAGS) {
+if (type == AV_OPT_TYPE_FLAGS) {
 double d = num*intnum/den;
 if (d < -1.5 || d > 0x+0.5 || (llrint(d*256) & 255)) {
 av_log(obj, AV_LOG_ERROR,
@@ -168,7 +220,7 @@ static int write_number(void *obj, const AVOption *o, void 
*dst, double num, int
 }
 }
 
-switch (o->type) {
+switch (type) {
 case AV_OPT_TYPE_PIXEL_FMT:
 *(enum AVPixelFormat *)dst = llrint(num / den) * intnum;
 break;
@@ -287,9 +339,10 @@ static int set_string(void *obj, const AVOption *o, const 
char *val, uint8_t **d
 
 static int set_string_number(void *obj, void *target_obj, const AVOption *o, 
const char *val, void *dst)
 {
+const enum AVOptionType type = TYPE_BASE(o->type);
 int ret = 0;
 
-if (o->type == AV_OPT_TYPE_RATIONAL || o->type == AV_OPT_TYPE_VIDEO_RATE) {
+if (type == AV_OPT_TYPE_RATIONAL || type == AV_OPT_TYPE_VIDEO_RATE) {
 int num, den;
 char c;
 if (sscanf(val, "%d%*1[:/]%d%c", &num, &den, &c) == 2) {
@@ -306,7 +359,7 @@ static int set_string_number(void *obj, void *target_obj, 
const AVOption *o, con
 double d;
 int64_t intnum = 1;
 
-if (o->type == AV_OPT_TYPE_FLAGS) {
+if (type == AV_OPT_TYPE_FLAGS) {
 if (*val == '+' || *val == '-')
 cmd = *(val++);
 for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != 
'-'; i++)
@@ -362,7 +415,7 @@ static int set_string_number(void *obj, void *target_obj, 
const AVOption *o, con
 }
 }
 }
-if (o->type == AV_OPT_TYPE_FLAGS) {
+if (type == AV_OPT_TYPE_FLAGS) {
 intnum = *(unsigned int*)dst;
 if (cmd == '+')
 d = intnum | (int64_t)d;
@@ -547,21 +600,22 @@ static int set_string_channel_l

[FFmpeg-devel] [PATCH 11/29] avcodec/cri: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

This function was already ignoring OOM errors.
---
 libavcodec/cri.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cri.c b/libavcodec/cri.c
index c4eb468610..990e52ac99 100644
--- a/libavcodec/cri.c
+++ b/libavcodec/cri.c
@@ -398,8 +398,8 @@ skip:
 }
 
 if (hflip || vflip) {
-rotation = av_frame_new_side_data(p, AV_FRAME_DATA_DISPLAYMATRIX,
-  sizeof(int32_t) * 9);
+ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_DISPLAYMATRIX,
+   sizeof(int32_t) * 9, &rotation);
 if (rotation) {
 av_display_rotation_set((int32_t *)rotation->data, 0.f);
 av_display_matrix_flip((int32_t *)rotation->data, hflip, vflip);
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 10/29] avcodec/av1dec: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

---
 libavcodec/av1dec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 704b9d6298..af80ee0b17 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -954,8 +954,9 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame 
*frame,
 if (!ret)
 break;
 
-if (!av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_A53_CC, 
buf))
-av_buffer_unref(&buf);
+ret = ff_frame_new_side_data_from_buf(avctx, frame, 
AV_FRAME_DATA_A53_CC, &buf, NULL);
+if (ret < 0)
+return ret;
 
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 break;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 15/29] avcodec/libjxldec: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

Also fixes a memory leak where the side data was previously not properly
cleaned up on OOM.

Signed-off-by: Anton Khirnov 
---
 libavcodec/libjxldec.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index b830eee784..d57a27418f 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -483,11 +483,9 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 /* full image is one frame, even if animated */
 av_log(avctx, AV_LOG_DEBUG, "FULL_IMAGE event emitted\n");
 if (ctx->iccp) {
-AVFrameSideData *sd = 
av_frame_new_side_data_from_buf(ctx->frame, AV_FRAME_DATA_ICC_PROFILE, 
ctx->iccp);
-if (!sd)
-return AVERROR(ENOMEM);
-/* ownership is transfered, and it is not ref-ed */
-ctx->iccp = NULL;
+ret = ff_frame_new_side_data_from_buf(avctx, ctx->frame, 
AV_FRAME_DATA_ICC_PROFILE, &ctx->iccp, NULL);
+if (ret < 0)
+return ret;
 }
 if (ctx->basic_info.have_animation) {
 ctx->frame->pts = av_rescale_q(ctx->accumulated_pts, 
ctx->anim_timebase, avctx->pkt_timebase);
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 12/29] avcodec/h264_slice: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

If the time code side data is overridden by the packet level, we also
make sure not to update `out->metadata` to a mismatched timecode.
---
 libavcodec/h264_slice.c | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 8464a0b34c..f30ff33188 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1257,26 +1257,27 @@ static int h264_export_frame_props(H264Context *h)
 if (h->sei.picture_timing.timecode_cnt > 0) {
 uint32_t *tc_sd;
 char tcbuf[AV_TIMECODE_STR_SIZE];
+AVFrameSideData *tcside;
+ret = ff_frame_new_side_data(h->avctx, out, 
AV_FRAME_DATA_S12M_TIMECODE,
+ sizeof(uint32_t)*4, &tcside);
+if (ret < 0)
+return ret;
 
-AVFrameSideData *tcside = av_frame_new_side_data(out,
- 
AV_FRAME_DATA_S12M_TIMECODE,
- sizeof(uint32_t)*4);
-if (!tcside)
-return AVERROR(ENOMEM);
+if (tcside) {
+tc_sd = (uint32_t*)tcside->data;
+tc_sd[0] = h->sei.picture_timing.timecode_cnt;
 
-tc_sd = (uint32_t*)tcside->data;
-tc_sd[0] = h->sei.picture_timing.timecode_cnt;
+for (int i = 0; i < tc_sd[0]; i++) {
+int drop = h->sei.picture_timing.timecode[i].dropframe;
+int   hh = h->sei.picture_timing.timecode[i].hours;
+int   mm = h->sei.picture_timing.timecode[i].minutes;
+int   ss = h->sei.picture_timing.timecode[i].seconds;
+int   ff = h->sei.picture_timing.timecode[i].frame;
 
-for (int i = 0; i < tc_sd[0]; i++) {
-int drop = h->sei.picture_timing.timecode[i].dropframe;
-int   hh = h->sei.picture_timing.timecode[i].hours;
-int   mm = h->sei.picture_timing.timecode[i].minutes;
-int   ss = h->sei.picture_timing.timecode[i].seconds;
-int   ff = h->sei.picture_timing.timecode[i].frame;
-
-tc_sd[i + 1] = av_timecode_get_smpte(h->avctx->framerate, drop, 
hh, mm, ss, ff);
-av_timecode_make_smpte_tc_string2(tcbuf, h->avctx->framerate, 
tc_sd[i + 1], 0, 0);
-av_dict_set(&out->metadata, "timecode", tcbuf, 0);
+tc_sd[i + 1] = av_timecode_get_smpte(h->avctx->framerate, 
drop, hh, mm, ss, ff);
+av_timecode_make_smpte_tc_string2(tcbuf, h->avctx->framerate, 
tc_sd[i + 1], 0, 0);
+av_dict_set(&out->metadata, "timecode", tcbuf, 0);
+}
 }
 h->sei.picture_timing.timecode_cnt = 0;
 }
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 05/29] lavu/opt: distinguish between native and foreign access for AVOption fields

2024-03-04 Thread Anton Khirnov
Native access is from the code that declared the options, foreign access
is from code that is using the options. Forbid foreign access to
AVOption.offset/default_val, for which there is no good reason, and
which should allow us more freedom in extending their semantics in a
compatible way.
---
 libavutil/opt.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavutil/opt.h b/libavutil/opt.h
index e34b8506f8..e402f6a0a0 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -43,6 +43,16 @@
  * ("objects"). An option can have a help text, a type and a range of possible
  * values. Options may then be enumerated, read and written to.
  *
+ * There are two modes of access to members of AVOption and its child structs.
+ * One is called 'native access', and refers to access from the code that
+ * declares the AVOption in question.  The other is 'foreign access', and 
refers
+ * to access from other code.
+ *
+ * Certain struct members in this header are documented as 'native access only'
+ * or similar - it means that only the code that declared the AVOption in
+ * question is allowed to access the field. This allows us to extend the
+ * semantics of those fields without breaking API compatibility.
+ *
  * @section avoptions_implement Implementing AVOptions
  * This section describes how to add AVOptions capabilities to a struct.
  *
@@ -301,6 +311,8 @@ typedef struct AVOption {
 const char *help;
 
 /**
+ * Native access only.
+ *
  * The offset relative to the context structure where the option
  * value is stored. It should be 0 for named constants.
  */
@@ -308,6 +320,8 @@ typedef struct AVOption {
 enum AVOptionType type;
 
 /**
+ * Native access only.
+ *
  * the default value for scalar options
  */
 union {
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 09/29] lavc: add content light/mastering display side data wrappers

2024-03-04 Thread Anton Khirnov
---
 libavcodec/decode.c | 25 +
 libavcodec/decode.h | 21 +
 2 files changed, 46 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index f3e8b72be7..105c9c5c39 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -35,6 +35,7 @@
 #include "libavutil/hwcontext.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
+#include "libavutil/mastering_display_metadata.h"
 
 #include "avcodec.h"
 #include "avcodec_internal.h"
@@ -1923,6 +1924,30 @@ finish:
 return ret;
 }
 
+int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrame 
*frame,
+AVMasteringDisplayMetadata **mdm)
+{
+if (side_data_pref(avctx, frame, 
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA)) {
+*mdm = NULL;
+return 0;
+}
+
+*mdm = av_mastering_display_metadata_create_side_data(frame);
+return *mdm ? 0 : AVERROR(ENOMEM);
+}
+
+int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrame *frame,
+AVContentLightMetadata **clm)
+{
+if (side_data_pref(avctx, frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL)) {
+*clm = NULL;
+return 0;
+}
+
+*clm = av_content_light_metadata_create_side_data(frame);
+return *clm ? 0 : AVERROR(ENOMEM);
+}
+
 int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
 {
 size_t size;
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index b269b5a43b..4ffbd9db8e 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -175,4 +175,25 @@ int ff_frame_new_side_data_from_buf(const AVCodecContext 
*avctx,
 AVFrame *frame, enum AVFrameSideDataType 
type,
 AVBufferRef **buf, AVFrameSideData **sd);
 
+struct AVMasteringDisplayMetadata;
+struct AVContentLightMetadata;
+
+/**
+ * Wrapper around av_mastering_display_metadata_create_side_data(), which
+ * rejects side data overridden by the demuxer. Returns 0 on success, and a
+ * negative error code otherwise. If successful, *mdm may either be a pointer 
to
+ * the new side data, or NULL in case the side data was already present.
+ */
+int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrame 
*frame,
+struct AVMasteringDisplayMetadata **mdm);
+
+/**
+ * Wrapper around av_content_light_metadata_create_side_data(), which
+ * rejects side data overridden by the demuxer. Returns 0 on success, and a
+ * negative error code otherwise. If successful, *clm may either be a pointer 
to
+ * the new side data, or NULL in case the side data was already present.
+ */
+int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrame *frame,
+struct AVContentLightMetadata **clm);
+
 #endif /* AVCODEC_DECODE_H */
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 14/29] avcodec/hevcdec: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

If the time code side data is overridden by the packet level, we also
make sure not to update `out->metadata` to a mismatched timecode.

Signed-off-by: Anton Khirnov 
---
 libavcodec/hevcdec.c | 40 +---
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 17c6a9212f..76aa6b4588 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2788,24 +2788,27 @@ static int set_side_data(HEVCContext *s)
 if (s->sei.timecode.present) {
 uint32_t *tc_sd;
 char tcbuf[AV_TIMECODE_STR_SIZE];
-AVFrameSideData *tcside = av_frame_new_side_data(out, 
AV_FRAME_DATA_S12M_TIMECODE,
- sizeof(uint32_t) * 4);
-if (!tcside)
-return AVERROR(ENOMEM);
+AVFrameSideData *tcside;
+ret = ff_frame_new_side_data(s->avctx, out, 
AV_FRAME_DATA_S12M_TIMECODE,
+ sizeof(uint32_t) * 4, &tcside);
+if (ret < 0)
+return ret;
 
-tc_sd = (uint32_t*)tcside->data;
-tc_sd[0] = s->sei.timecode.num_clock_ts;
+if (tcside) {
+tc_sd = (uint32_t*)tcside->data;
+tc_sd[0] = s->sei.timecode.num_clock_ts;
 
-for (int i = 0; i < tc_sd[0]; i++) {
-int drop = s->sei.timecode.cnt_dropped_flag[i];
-int   hh = s->sei.timecode.hours_value[i];
-int   mm = s->sei.timecode.minutes_value[i];
-int   ss = s->sei.timecode.seconds_value[i];
-int   ff = s->sei.timecode.n_frames[i];
+for (int i = 0; i < tc_sd[0]; i++) {
+int drop = s->sei.timecode.cnt_dropped_flag[i];
+int   hh = s->sei.timecode.hours_value[i];
+int   mm = s->sei.timecode.minutes_value[i];
+int   ss = s->sei.timecode.seconds_value[i];
+int   ff = s->sei.timecode.n_frames[i];
 
-tc_sd[i + 1] = av_timecode_get_smpte(s->avctx->framerate, drop, 
hh, mm, ss, ff);
-av_timecode_make_smpte_tc_string2(tcbuf, s->avctx->framerate, 
tc_sd[i + 1], 0, 0);
-av_dict_set(&out->metadata, "timecode", tcbuf, 0);
+tc_sd[i + 1] = av_timecode_get_smpte(s->avctx->framerate, 
drop, hh, mm, ss, ff);
+av_timecode_make_smpte_tc_string2(tcbuf, s->avctx->framerate, 
tc_sd[i + 1], 0, 0);
+av_dict_set(&out->metadata, "timecode", tcbuf, 0);
+}
 }
 
 s->sei.timecode.num_clock_ts = 0;
@@ -2816,10 +2819,9 @@ static int set_side_data(HEVCContext *s)
 if (!info_ref)
 return AVERROR(ENOMEM);
 
-if (!av_frame_new_side_data_from_buf(out, 
AV_FRAME_DATA_DYNAMIC_HDR_PLUS, info_ref)) {
-av_buffer_unref(&info_ref);
-return AVERROR(ENOMEM);
-}
+ret = ff_frame_new_side_data_from_buf(s->avctx, out, 
AV_FRAME_DATA_DYNAMIC_HDR_PLUS, &info_ref, NULL);
+if (ret < 0)
+return ret;
 }
 
 if (s->rpu_buf) {
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 13/29] lavc/hevcdec: pass an actual codec context to ff_h2645_sei_to_frame()

2024-03-04 Thread Anton Khirnov
Needed by following commit.
---
 libavcodec/hevcdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index b5311ae510..17c6a9212f 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2778,7 +2778,7 @@ static int set_side_data(HEVCContext *s)
 s->sei.common.content_light.present--;
 }
 
-ret = ff_h2645_sei_to_frame(out, &s->sei.common, AV_CODEC_ID_HEVC, NULL,
+ret = ff_h2645_sei_to_frame(out, &s->sei.common, AV_CODEC_ID_HEVC, 
s->avctx,
 &s->ps.sps->vui.common,
 s->ps.sps->bit_depth, 
s->ps.sps->bit_depth_chroma,
 s->ref->poc /* no poc_offset in HEVC */);
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 07/29] lavc: add a decoder option for configuring side data preference

2024-03-04 Thread Anton Khirnov
This and the following commits fix #10857
---
 doc/APIchanges |  3 +++
 libavcodec/avcodec.h   | 20 
 libavcodec/decode.c| 36 
 libavcodec/options_table.h | 13 +
 4 files changed, 72 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 3209614ed6..5d8585d8ba 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2024-02-xx - xx - lavc 60.xx.100 - avcodec.h
+  Add AVCodecContext.[nb_]side_data_prefer_global.
+
 2024-02-xx - xx - lavu 58.xx.100 - opt.h
   Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 43859251cc..307a3e99db 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2120,6 +2120,26 @@ typedef struct AVCodecContext {
  *   an error.
  */
 int64_t frame_num;
+
+/**
+ * Decoding only. May be set by the caller before avcodec_open2() to an
+ * av_malloc()'ed array (or via AVOptions). Owned and freed by the decoder
+ * afterwards.
+ *
+ * By default, when some side data type is present both in global
+ * user-supplied coded_side_data and inside the coded bitstream, avcodec
+ * will propagate the latter to the decoded frame.
+ *
+ * This array contains a list of AVPacketSideDataType for which this
+ * preference should be switched, i.e. avcodec will prefer global side data
+ * over those in stored in the bytestream. It may also contain a single -1,
+ * in which case the preference is switched for all side data types.
+ */
+int*side_data_prefer_global;
+/**
+ * Number of entries in side_data_prefer_global.
+ */
+unsigned nb_side_data_prefer_global;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 7c67b18bc4..5c80ef9cd0 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -60,6 +60,12 @@ typedef struct DecodeContext {
  * The caller has submitted a NULL packet on input.
  */
 int draining_started;
+
+/**
+ * Bitmask indicating for which side data types we prefer global
+ * side data over per-packet.
+ */
+uint64_t side_data_pref_mask;
 } DecodeContext;
 
 static DecodeContext *decode_ctx(AVCodecInternal *avci)
@@ -1744,6 +1750,7 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
 int ff_decode_preinit(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
+DecodeContext *dc = decode_ctx(avci);
 int ret = 0;
 
 /* if the decoder init function was already called previously,
@@ -1804,6 +1811,35 @@ int ff_decode_preinit(AVCodecContext *avctx)
 avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
 }
 
+if (avctx->nb_side_data_prefer_global == 1 &&
+avctx->side_data_prefer_global[0] == -1)
+dc->side_data_pref_mask = ~0ULL;
+else {
+for (unsigned i = 0; i < avctx->nb_side_data_prefer_global; i++) {
+int val = avctx->side_data_prefer_global[i];
+
+if (val < 0 || val >= AV_PKT_DATA_NB) {
+av_log(avctx, AV_LOG_ERROR, "Invalid side data type: %d\n", 
val);
+return AVERROR(EINVAL);
+}
+
+for (unsigned j = 0; j < FF_ARRAY_ELEMS(sd_global_map); j++) {
+if (sd_global_map[j].packet == val) {
+val = sd_global_map[j].frame;
+
+// this code will need to be changed when we have more than
+// 64 frame side data types
+if (val >= 64) {
+av_log(avctx, AV_LOG_ERROR, "Side data type too 
big\n");
+return AVERROR_BUG;
+}
+
+dc->side_data_pref_mask |= 1ULL << val;
+}
+}
+}
+}
+
 avci->in_pkt = av_packet_alloc();
 avci->last_pkt_props = av_packet_alloc();
 if (!avci->in_pkt || !avci->last_pkt_props)
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index ac32d8928a..3ff03d1cf0 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -42,6 +42,8 @@
 #define D AV_OPT_FLAG_DECODING_PARAM
 #define CC AV_OPT_FLAG_CHILD_CONSTS
 
+#define AR AV_OPT_TYPE_FLAG_ARRAY
+
 #define AV_CODEC_DEFAULT_BITRATE 200*1000
 
 static const AVOption avcodec_options[] = {
@@ -405,6 +407,17 @@ static const AVOption avcodec_options[] = {
 {"unsafe_output", "allow potentially unsafe hwaccel frame output that might 
require special care to process successfully", 0, AV_OPT_TYPE_CONST, {.i64 = 
AV_HWACCEL_FLAG_UNSAFE_OUTPUT }, INT_MIN, INT_MAX, V | D, .unit = 
"hwaccel_flags"},
 {"extra_hw_frames", "Number of extra hardware frames to allocate for the 
user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
V|D },

[FFmpeg-devel] [PATCH 04/29] lavu/opt: factor per-type dispatch out of av_opt_copy()

2024-03-04 Thread Anton Khirnov
Will be useful in following commits.
---
 libavutil/opt.c | 89 ++---
 1 file changed, 48 insertions(+), 41 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 051a121331..d18a1c63b7 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1900,6 +1900,51 @@ void *av_opt_ptr(const AVClass *class, void *obj, const 
char *name)
 return (uint8_t*)obj + opt->offset;
 }
 
+static int opt_copy_elem(void *logctx, enum AVOptionType type,
+ void *dst, const void *src)
+{
+uint8_t   **dst8 =   (uint8_t **)dst;
+const uint8_t **src8 = (const uint8_t **)src;
+
+if (type == AV_OPT_TYPE_STRING) {
+if (*dst8 != *src8)
+av_freep(dst8);
+*dst8 = av_strdup(*src8);
+if (*src8 && !*dst8)
+return AVERROR(ENOMEM);
+} else if (type == AV_OPT_TYPE_BINARY) {
+int len = *(const int *)(src8 + 1);
+if (*dst8 != *src8)
+av_freep(dst8);
+*dst8 = av_memdup(*src8, len);
+if (len && !*dst8) {
+*(int *)(dst8 + 1) = 0;
+return AVERROR(ENOMEM);
+}
+*(int *)(dst8 + 1) = len;
+} else if (type == AV_OPT_TYPE_CONST) {
+// do nothing
+} else if (type == AV_OPT_TYPE_DICT) {
+AVDictionary **sdict = (AVDictionary **)src;
+AVDictionary **ddict = (AVDictionary **)dst;
+if (*sdict != *ddict)
+av_dict_free(ddict);
+*ddict = NULL;
+return av_dict_copy(ddict, *sdict, 0);
+} else if (type == AV_OPT_TYPE_CHLAYOUT) {
+if (dst != src)
+return av_channel_layout_copy(dst, src);
+} else if (opt_is_pod(type)) {
+size_t size = opt_elem_size[type];
+memcpy(dst, src, size);
+} else {
+av_log(logctx, AV_LOG_ERROR, "Unhandled option type: %d\n", type);
+return AVERROR(EINVAL);
+}
+
+return 0;
+}
+
 int av_opt_copy(void *dst, const void *src)
 {
 const AVOption *o = NULL;
@@ -1916,48 +1961,10 @@ int av_opt_copy(void *dst, const void *src)
 while ((o = av_opt_next(src, o))) {
 void *field_dst = (uint8_t *)dst + o->offset;
 void *field_src = (uint8_t *)src + o->offset;
-uint8_t **field_dst8 = (uint8_t **)field_dst;
-uint8_t **field_src8 = (uint8_t **)field_src;
 
-if (o->type == AV_OPT_TYPE_STRING) {
-if (*field_dst8 != *field_src8)
-av_freep(field_dst8);
-*field_dst8 = av_strdup(*field_src8);
-if (*field_src8 && !*field_dst8)
-ret = AVERROR(ENOMEM);
-} else if (o->type == AV_OPT_TYPE_BINARY) {
-int len = *(int *)(field_src8 + 1);
-if (*field_dst8 != *field_src8)
-av_freep(field_dst8);
-*field_dst8 = av_memdup(*field_src8, len);
-if (len && !*field_dst8) {
-ret = AVERROR(ENOMEM);
-len = 0;
-}
-*(int *)(field_dst8 + 1) = len;
-} else if (o->type == AV_OPT_TYPE_CONST) {
-// do nothing
-} else if (o->type == AV_OPT_TYPE_DICT) {
-AVDictionary **sdict = (AVDictionary **) field_src;
-AVDictionary **ddict = (AVDictionary **) field_dst;
-int ret2;
-if (*sdict != *ddict)
-av_dict_free(ddict);
-*ddict = NULL;
-ret2 = av_dict_copy(ddict, *sdict, 0);
-if (ret2 < 0)
-ret = ret2;
-} else if (o->type == AV_OPT_TYPE_CHLAYOUT) {
-if (field_dst != field_src)
-ret = av_channel_layout_copy(field_dst, field_src);
-} else if (opt_is_pod(o->type)) {
-size_t size = opt_elem_size[o->type];
-memcpy(field_dst, field_src, size);
-} else {
-av_log(dst, AV_LOG_ERROR, "Unhandled option type: %d\n",
-   o->type);
-ret = AVERROR(EINVAL);
-}
+int err = opt_copy_elem(dst, o->type, field_dst, field_src);
+if (err < 0)
+ret = err;
 }
 return ret;
 }
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 25/29] avcodec/snowdec: use ff_frame_new_side_data

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

For consistency, even though this cannot be overriden at the packet
level.
---
 libavcodec/snowdec.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index 70fbab9a49..97aea748b6 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -787,11 +787,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*picture,
 res = av_frame_ref(picture, s->mconly_picture);
 if (res >= 0 && s->avmv_index) {
 AVFrameSideData *sd;
-
-sd = av_frame_new_side_data(picture, AV_FRAME_DATA_MOTION_VECTORS, 
s->avmv_index * sizeof(AVMotionVector));
-if (!sd)
-return AVERROR(ENOMEM);
-memcpy(sd->data, s->avmv, s->avmv_index * sizeof(AVMotionVector));
+res = ff_frame_new_side_data(s->avctx, picture, 
AV_FRAME_DATA_MOTION_VECTORS,
+ s->avmv_index * sizeof(AVMotionVector), 
&sd);
+if (sd)
+memcpy(sd->data, s->avmv, s->avmv_index * sizeof(AVMotionVector));
 }
 
 if (res < 0)
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 20/29] avcodec/webp: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

---
 libavcodec/webp.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 54b3fde6dc..9308ea2b69 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1500,11 +1500,16 @@ exif_end:
"VP8X header\n");
 
 s->has_iccp = 1;
-sd = av_frame_new_side_data(p, AV_FRAME_DATA_ICC_PROFILE, 
chunk_size);
-if (!sd)
-return AVERROR(ENOMEM);
 
-bytestream2_get_buffer(&gb, sd->data, chunk_size);
+ret = ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_ICC_PROFILE, 
chunk_size, &sd);
+if (ret < 0)
+return ret;
+
+if (sd) {
+bytestream2_get_buffer(&gb, sd->data, chunk_size);
+} else {
+bytestream2_skip(&gb, chunk_size);
+}
 break;
 }
 case MKTAG('A', 'N', 'I', 'M'):
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 19/29] avcodec/tiff: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

---
 libavcodec/tiff.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 71cb703821..cb4d378753 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1706,11 +1706,11 @@ static int tiff_decode_tag(TiffContext *s, AVFrame 
*frame)
 if (bytestream2_get_bytes_left(&gb_temp) < count)
 return AVERROR_INVALIDDATA;
 
-sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, count);
-if (!sd)
-return AVERROR(ENOMEM);
-
-bytestream2_get_bufferu(&gb_temp, sd->data, count);
+ret = ff_frame_new_side_data(s->avctx, frame, 
AV_FRAME_DATA_ICC_PROFILE, count, &sd);
+if (ret < 0)
+return ret;
+if (sd)
+bytestream2_get_bufferu(&gb_temp, sd->data, count);
 break;
 case TIFF_ARTIST:
 ADD_METADATA(count, "artist", NULL);
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 17/29] avcodec/mpeg12dec: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

We only need to consider side data types that may possibly come from the
packet.

Signed-off-by: Anton Khirnov 
---
 libavcodec/mpeg12dec.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index d07eed8744..3a2f17e508 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1306,20 +1306,20 @@ static int mpeg_field_start(MpegEncContext *s, const 
uint8_t *buf, int buf_size)
 }
 }
 
-pan_scan = av_frame_new_side_data(s->current_picture_ptr->f,
-  AV_FRAME_DATA_PANSCAN,
-  sizeof(s1->pan_scan));
-if (!pan_scan)
-return AVERROR(ENOMEM);
-memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
+ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f,
+ AV_FRAME_DATA_PANSCAN, 
sizeof(s1->pan_scan),
+ &pan_scan);
+if (ret < 0)
+return ret;
+if (pan_scan)
+memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
 
 if (s1->a53_buf_ref) {
-AVFrameSideData *sd = av_frame_new_side_data_from_buf(
-s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
-s1->a53_buf_ref);
-if (!sd)
-av_buffer_unref(&s1->a53_buf_ref);
-s1->a53_buf_ref = NULL;
+ret = ff_frame_new_side_data_from_buf(
+s->avctx, s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
+&s1->a53_buf_ref, NULL);
+if (ret < 0)
+return ret;
 }
 
 if (s1->has_stereo3d) {
@@ -1332,13 +1332,13 @@ static int mpeg_field_start(MpegEncContext *s, const 
uint8_t *buf, int buf_size)
 }
 
 if (s1->has_afd) {
-AVFrameSideData *sd =
-av_frame_new_side_data(s->current_picture_ptr->f,
-   AV_FRAME_DATA_AFD, 1);
-if (!sd)
-return AVERROR(ENOMEM);
-
-*sd->data   = s1->afd;
+AVFrameSideData *sd;
+ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f,
+ AV_FRAME_DATA_AFD, 1, &sd);
+if (ret < 0)
+return ret;
+if (sd)
+*sd->data = s1->afd;
 s1->has_afd = 0;
 }
 
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 18/29] avcodec/pngdec: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

---
 libavcodec/pngdec.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 026da30c25..8f409c74b8 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -660,6 +660,7 @@ static int decode_phys_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame)
 {
 PNGDecContext *s = avctx->priv_data;
+int ret;
 
 if (s->have_cicp) {
 if (s->cicp_primaries >= AVCOL_PRI_NB)
@@ -678,11 +679,15 @@ static int populate_avctx_color_fields(AVCodecContext 
*avctx, AVFrame *frame)
 avctx->color_range = frame->color_range = AVCOL_RANGE_UNSPECIFIED;
 }
 } else if (s->iccp_data) {
-AVFrameSideData *sd = av_frame_new_side_data(frame, 
AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len);
-if (!sd)
-return AVERROR(ENOMEM);
-memcpy(sd->data, s->iccp_data, s->iccp_data_len);
-av_dict_set(&sd->metadata, "name", s->iccp_name, 0);
+AVFrameSideData *sd;
+ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE,
+ s->iccp_data_len, &sd);
+if (ret < 0)
+return ret;
+if (sd) {
+memcpy(sd->data, s->iccp_data, s->iccp_data_len);
+av_dict_set(&sd->metadata, "name", s->iccp_name, 0);
+}
 } else if (s->have_srgb) {
 avctx->color_primaries = frame->color_primaries = AVCOL_PRI_BT709;
 avctx->color_trc = frame->color_trc = AVCOL_TRC_IEC61966_2_1;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 26/29] avcodec/mjpegdec: use ff_frame_new_side_data

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

For consistency, even though this can't (yet) be overriden at the packet
level.
---
 libavcodec/mjpegdec.c | 66 ++-
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 43b36d0a8f..4ef565fe2d 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2865,42 +2865,44 @@ the_end:
 if (orientation >= 2 && orientation <= 8) {
 int32_t *matrix;
 
-sd = av_frame_new_side_data(frame, 
AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9);
-if (!sd) {
+ret = ff_frame_new_side_data(avctx, frame, 
AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9, &sd);
+if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side 
data\n");
-return AVERROR(ENOMEM);
+return ret;
 }
 
-matrix = (int32_t *)sd->data;
+if (sd) {
+matrix = (int32_t *)sd->data;
 
-switch (orientation) {
-case 2:
-av_display_rotation_set(matrix, 0.0);
-av_display_matrix_flip(matrix, 1, 0);
-break;
-case 3:
-av_display_rotation_set(matrix, 180.0);
-break;
-case 4:
-av_display_rotation_set(matrix, 180.0);
-av_display_matrix_flip(matrix, 1, 0);
-break;
-case 5:
-av_display_rotation_set(matrix, 90.0);
-av_display_matrix_flip(matrix, 1, 0);
-break;
-case 6:
-av_display_rotation_set(matrix, 90.0);
-break;
-case 7:
-av_display_rotation_set(matrix, -90.0);
-av_display_matrix_flip(matrix, 1, 0);
-break;
-case 8:
-av_display_rotation_set(matrix, -90.0);
-break;
-default:
-av_assert0(0);
+switch (orientation) {
+case 2:
+av_display_rotation_set(matrix, 0.0);
+av_display_matrix_flip(matrix, 1, 0);
+break;
+case 3:
+av_display_rotation_set(matrix, 180.0);
+break;
+case 4:
+av_display_rotation_set(matrix, 180.0);
+av_display_matrix_flip(matrix, 1, 0);
+break;
+case 5:
+av_display_rotation_set(matrix, 90.0);
+av_display_matrix_flip(matrix, 1, 0);
+break;
+case 6:
+av_display_rotation_set(matrix, 90.0);
+break;
+case 7:
+av_display_rotation_set(matrix, -90.0);
+av_display_matrix_flip(matrix, 1, 0);
+break;
+case 8:
+av_display_rotation_set(matrix, -90.0);
+break;
+default:
+av_assert0(0);
+}
 }
 }
 }
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

For consistency, even though this cannot be overriden at the packet
level.
---
 libavcodec/mpeg12dec.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 3a2f17e508..aa116336dd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, 
AVFrame *picture,
 
 if (s->timecode_frame_start != -1 && *got_output) {
 char tcbuf[AV_TIMECODE_STR_SIZE];
-AVFrameSideData *tcside = av_frame_new_side_data(picture,
- 
AV_FRAME_DATA_GOP_TIMECODE,
- sizeof(int64_t));
-if (!tcside)
-return AVERROR(ENOMEM);
-memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t));
+AVFrameSideData *tcside;
+ret = ff_frame_new_side_data(avctx, picture, 
AV_FRAME_DATA_GOP_TIMECODE,
+ sizeof(int64_t), &tcside);
+if (ret < 0)
+return ret;
+if (tcside) {
+memcpy(tcside->data, &s->timecode_frame_start, 
sizeof(int64_t));
 
-av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);
-av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
+av_timecode_make_mpeg_tc_string(tcbuf, 
s->timecode_frame_start);
+av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
+}
 
 s->timecode_frame_start = -1;
 }
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 28/29] lavc/*dec: use side data preference for mastering display/content light metadata

2024-03-04 Thread Anton Khirnov
---
 libavcodec/av1dec.c| 46 +++-
 libavcodec/h2645_sei.c | 96 +++---
 libavcodec/libdav1d.c  | 47 -
 libavcodec/pngdec.c| 54 ++--
 libavcodec/qsvdec.c| 50 +-
 5 files changed, 165 insertions(+), 128 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index af80ee0b17..bbb5634773 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -999,31 +999,39 @@ static int export_metadata(AVCodecContext *avctx, AVFrame 
*frame)
 int ret = 0;
 
 if (s->mdcv) {
-AVMasteringDisplayMetadata *mastering = 
av_mastering_display_metadata_create_side_data(frame);
-if (!mastering)
-return AVERROR(ENOMEM);
+AVMasteringDisplayMetadata *mastering;
 
-for (int i = 0; i < 3; i++) {
-mastering->display_primaries[i][0] = 
av_make_q(s->mdcv->primary_chromaticity_x[i], 1 << 16);
-mastering->display_primaries[i][1] = 
av_make_q(s->mdcv->primary_chromaticity_y[i], 1 << 16);
+ret = ff_decode_mastering_display_new(avctx, frame, &mastering);
+if (ret < 0)
+return ret;
+
+if (mastering) {
+for (int i = 0; i < 3; i++) {
+mastering->display_primaries[i][0] = 
av_make_q(s->mdcv->primary_chromaticity_x[i], 1 << 16);
+mastering->display_primaries[i][1] = 
av_make_q(s->mdcv->primary_chromaticity_y[i], 1 << 16);
+}
+mastering->white_point[0] = 
av_make_q(s->mdcv->white_point_chromaticity_x, 1 << 16);
+mastering->white_point[1] = 
av_make_q(s->mdcv->white_point_chromaticity_y, 1 << 16);
+
+mastering->max_luminance = av_make_q(s->mdcv->luminance_max, 1 << 
8);
+mastering->min_luminance = av_make_q(s->mdcv->luminance_min, 1 << 
14);
+
+mastering->has_primaries = 1;
+mastering->has_luminance = 1;
 }
-mastering->white_point[0] = 
av_make_q(s->mdcv->white_point_chromaticity_x, 1 << 16);
-mastering->white_point[1] = 
av_make_q(s->mdcv->white_point_chromaticity_y, 1 << 16);
-
-mastering->max_luminance = av_make_q(s->mdcv->luminance_max, 1 << 8);
-mastering->min_luminance = av_make_q(s->mdcv->luminance_min, 1 << 14);
-
-mastering->has_primaries = 1;
-mastering->has_luminance = 1;
 }
 
 if (s->cll) {
-AVContentLightMetadata *light = 
av_content_light_metadata_create_side_data(frame);
-if (!light)
-return AVERROR(ENOMEM);
+AVContentLightMetadata *light;
 
-light->MaxCLL = s->cll->max_cll;
-light->MaxFALL = s->cll->max_fall;
+ret = ff_decode_content_light_new(avctx, frame, &light);
+if (ret < 0)
+return ret;
+
+if (light) {
+light->MaxCLL = s->cll->max_cll;
+light->MaxFALL = s->cll->max_fall;
+}
 }
 
 while (av_fifo_read(s->itut_t35_fifo, &itut_t35, 1) >= 0) {
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index 56539608cd..a9d17cc9fd 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -516,6 +516,7 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
   int seed)
 {
 H2645SEIFramePacking *fp = &sei->frame_packing;
+int ret;
 
 if (fp->present &&
 is_frame_packing_type_valid(fp->arrangement_type, codec_id) &&
@@ -710,56 +711,63 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
 const int chroma_den = 5;
 const int luma_den = 1;
 int i;
-AVMasteringDisplayMetadata *metadata =
-av_mastering_display_metadata_create_side_data(frame);
-if (!metadata)
-return AVERROR(ENOMEM);
+AVMasteringDisplayMetadata *metadata;
 
-for (i = 0; i < 3; i++) {
-const int j = mapping[i];
-metadata->display_primaries[i][0].num = 
sei->mastering_display.display_primaries[j][0];
-metadata->display_primaries[i][0].den = chroma_den;
-metadata->display_primaries[i][1].num = 
sei->mastering_display.display_primaries[j][1];
-metadata->display_primaries[i][1].den = chroma_den;
+ret = ff_decode_mastering_display_new(avctx, frame, &metadata);
+if (ret < 0)
+return ret;
+
+if (metadata) {
+for (i = 0; i < 3; i++) {
+const int j = mapping[i];
+metadata->display_primaries[i][0].num = 
sei->mastering_display.display_primaries[j][0];
+metadata->display_primaries[i][0].den = chroma_den;
+metadata->display_primaries[i][1].num = 
sei->mastering_display.display_primaries[j][1];
+metadata->display_primaries[i][1].den = chroma_den;
+}
+metadata->white_point[0].num = 
sei->mastering_display.white_point[0];
+metadata->white_point[0].den = chro

[FFmpeg-devel] [PATCH 27/29] avcodec/hevcdec: switch to ff_frame_new_side_data_from_buf

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

For consistency, even though this cannot be overriden at the packet
level.

Signed-off-by: Anton Khirnov 
---
 libavcodec/hevcdec.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 76aa6b4588..a6b124dd2a 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2825,11 +2825,9 @@ static int set_side_data(HEVCContext *s)
 }
 
 if (s->rpu_buf) {
-AVFrameSideData *rpu = av_frame_new_side_data_from_buf(out, 
AV_FRAME_DATA_DOVI_RPU_BUFFER, s->rpu_buf);
-if (!rpu)
-return AVERROR(ENOMEM);
-
-s->rpu_buf = NULL;
+ret = ff_frame_new_side_data_from_buf(s->avctx, out, 
AV_FRAME_DATA_DOVI_RPU_BUFFER, &s->rpu_buf, NULL);
+if (ret < 0)
+return ret;
 }
 
 if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0)
@@ -2840,10 +2838,9 @@ static int set_side_data(HEVCContext *s)
 if (!info_ref)
 return AVERROR(ENOMEM);
 
-if (!av_frame_new_side_data_from_buf(out, 
AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref)) {
-av_buffer_unref(&info_ref);
-return AVERROR(ENOMEM);
-}
+ret = ff_frame_new_side_data_from_buf(s->avctx, out, 
AV_FRAME_DATA_DYNAMIC_HDR_VIVID, &info_ref, NULL);
+if (ret < 0)
+return ret;
 }
 
 return 0;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 24/29] avcodec/h2645_sei: use ff_frame_new_side_data_from_buf

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

For consistency, even though this cannot be overriden at the packet
level.

Signed-off-by: Anton Khirnov 
---
 libavcodec/h2645_sei.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index cb6be0594b..56539608cd 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -35,6 +35,7 @@
 
 #include "atsc_a53.h"
 #include "avcodec.h"
+#include "decode.h"
 #include "dynamic_hdr_vivid.h"
 #include "get_bits.h"
 #include "golomb.h"
@@ -607,12 +608,11 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
 H2645SEIUnregistered *unreg = &sei->unregistered;
 
 if (unreg->buf_ref[i]) {
-AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame,
+int ret = ff_frame_new_side_data_from_buf(avctx, frame,
 AV_FRAME_DATA_SEI_UNREGISTERED,
-unreg->buf_ref[i]);
-if (!sd)
-av_buffer_unref(&unreg->buf_ref[i]);
-unreg->buf_ref[i] = NULL;
+&unreg->buf_ref[i], NULL);
+if (ret < 0)
+return ret;
 }
 }
 sei->unregistered.nb_buf_ref = 0;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 22/29] avcodec/dpx: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

If the time code side data is overridden by the packet level, we also
make sure not to update `p->metadata` to a mismatched timecode.
---
 libavcodec/dpx.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index 31e4a3f82c..80616d98a2 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -287,19 +287,21 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
 tc = av_bswap32(read32(&buf, endian));
 
 if (i != 0x) {
-AVFrameSideData *tcside =
-av_frame_new_side_data(p, AV_FRAME_DATA_S12M_TIMECODE,
-   sizeof(uint32_t) * 4);
-if (!tcside)
-return AVERROR(ENOMEM);
+AVFrameSideData *tcside;
+ret = ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_S12M_TIMECODE,
+ sizeof(uint32_t) * 4, &tcside);
+if (ret < 0)
+return ret;
 
-tc_sd = (uint32_t*)tcside->data;
-tc_sd[0] = 1;
-tc_sd[1] = tc;
+if (tcside) {
+tc_sd = (uint32_t*)tcside->data;
+tc_sd[0] = 1;
+tc_sd[1] = tc;
 
-av_timecode_make_smpte_tc_string2(tcbuf, avctx->framerate,
-  tc_sd[1], 0, 0);
-av_dict_set(&p->metadata, "timecode", tcbuf, 0);
+av_timecode_make_smpte_tc_string2(tcbuf, avctx->framerate,
+  tc_sd[1], 0, 0);
+av_dict_set(&p->metadata, "timecode", tcbuf, 0);
+}
 }
 }
 
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 21/29] avcodec/libdav1d: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

Signed-off-by: Anton Khirnov 
---
 libavcodec/libdav1d.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 78a5c63bf4..3714137ed0 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -561,8 +561,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!res)
 break;
 
-if (!av_frame_new_side_data_from_buf(frame, 
AV_FRAME_DATA_A53_CC, buf))
-av_buffer_unref(&buf);
+res = ff_frame_new_side_data_from_buf(c, frame, 
AV_FRAME_DATA_A53_CC, &buf, NULL);
+if (res < 0)
+goto fail;
 
 c->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 break;
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 16/29] avcodec/mjpegdec: respect side data preference

2024-03-04 Thread Anton Khirnov
From: Niklas Haas 

---
 libavcodec/mjpegdec.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 81f724d230..43b36d0a8f 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2840,16 +2840,18 @@ the_end:
 for (i = 0; i < s->iccnum; i++)
 total_size += s->iccentries[i].length;
 
-sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, 
total_size);
-if (!sd) {
+ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE, 
total_size, &sd);
+if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side 
data\n");
-return AVERROR(ENOMEM);
+return ret;
 }
 
-/* Reassemble the parts, which are now in-order. */
-for (i = 0; i < s->iccnum; i++) {
-memcpy(sd->data + offset, s->iccentries[i].data, 
s->iccentries[i].length);
-offset += s->iccentries[i].length;
+if (sd) {
+/* Reassemble the parts, which are now in-order. */
+for (i = 0; i < s->iccnum; i++) {
+memcpy(sd->data + offset, s->iccentries[i].data, 
s->iccentries[i].length);
+offset += s->iccentries[i].length;
+}
 }
 }
 
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 29/29] tests/fate/matroska: add tests for side data preference

2024-03-04 Thread Anton Khirnov
Cf. #10857
---
 tests/fate/matroska.mak   |   6 +
 tests/ref/fate/matroska-side-data-pref-codec  | 255 ++
 tests/ref/fate/matroska-side-data-pref-global | 255 ++
 3 files changed, 516 insertions(+)
 create mode 100644 tests/ref/fate/matroska-side-data-pref-codec
 create mode 100644 tests/ref/fate/matroska-side-data-pref-global

diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 9ab747184a..e9433ce730 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -264,6 +264,12 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, 
VP9_PARSER) \
+= fate-matroska-hdr10-plus-remux
 fate-matroska-hdr10-plus-remux: CMD = transcode webm 
$(TARGET_SAMPLES)/mkv/hdr10_plus_vp9_sample.webm matroska "-map 0 -c:v copy" 
"-map 0 -c:v copy" "-show_packets"
 
+fate-matroska-side-data-pref-codec: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
$(TARGET_SAMPLES)/mkv/hdr10tags-both.mkv \
+-show_streams -show_frames -show_entries 
stream=stream_side_data:frame=frame_side_data_list
+fate-matroska-side-data-pref-global: CMD = run ffprobe$(PROGSSUF)$(EXESUF) 
$(TARGET_SAMPLES)/mkv/hdr10tags-both.mkv \
+-show_streams -show_frames -show_entries 
stream=stream_side_data:frame=frame_side_data_list -side_data_prefer_global 
mastering_display_metadata,content_light_level
+FATE_MATROSKA_FFPROBE-$(call ALLYES MATROSKA_DEMUXER HEVC_DECODER) += 
fate-matroska-side-data-pref-codec fate-matroska-side-data-pref-global
+
 FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
 FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes)
 FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes)
diff --git a/tests/ref/fate/matroska-side-data-pref-codec 
b/tests/ref/fate/matroska-side-data-pref-codec
new file mode 100644
index 00..d27134d0c9
--- /dev/null
+++ b/tests/ref/fate/matroska-side-data-pref-codec
@@ -0,0 +1,255 @@
+[FRAME]
+[SIDE_DATA]
+side_data_type=H.26[45] User Data Unregistered SEI message
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=300
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=35400/5
+red_y=14599/5
+green_x=8500/5
+green_y=39850/5
+blue_x=6550/5
+blue_y=2300/5
+white_point_x=15634/5
+white_point_y=16450/5
+min_luminance=10/1
+max_luminance=1000/1
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Co

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/dovi_rpu: implement support for profile 10

2024-03-04 Thread Niklas Haas
On Mon, 04 Mar 2024 14:06:51 +0100 Andreas Rheinhardt 
 wrote:
> Niklas Haas:
> > From: Niklas Haas 
> > 
> > Instead of the nal_prefix, this profile inside wraps the RPU inside an
> > EMDF header, as specified in ETSI TS 102 366. This particular usage is
> > supposedly specified in ETSI TS 103 572, at least according to European
> > Patent EP 3 588 964 A1, but I could not find any references to DV RPUs
> > in the former.
> > 
> > It's worth pointing out that the EMDF container is not byte-aligned,
> > meaning that payloads are delivered at arbitrary byte boundaries. Hence
> > the reason for doing it inside ff_dovi_rpu_parse, which already uses
> > a bitstream reader, rather than splitting off the container in
> > a separate stage. (Plus, we hard-code the DV-specific payload ID)
> > 
> > Magic values were taken from a combination of the sources below, all of
> > which agree about what the specific EMDF header should look like. In
> > fact, they all hard-code a very *specific* header sequence, but I wanted
> > to go the extra mile and at least properly skip the variable fields
> > - even though the non-existent Dolby Vision specification probably
> > specifies that they all must be 0. This is probably overkill.
> > 
> > Validated and tested using sample files from the merge request linked
> > below.
> > 
> > Relevant links:
> > - 
> > https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf
> > - 
> > https://patentimages.storage.googleapis.com/8a/0b/da/28294acaed2182/EP3588964A1.pdf
> > - 
> > https://www.etsi.org/deliver/etsi_ts/103500_103599/103572/01.03.01_60/ts_103572v010301p.pdf
> > - 
> > https://github.com/rockchip-linux/mpp/blob/fdeb8c378b79d4b4ef80457e4431815de89dc417/mpp/codec/dec/av1/av1d_cbs.c#L2378
> > - 
> > https://github.com/elginsk8r/android_kernel_amlogic_linux-4.9/blob/23a4c38bf06ef34821e476a8edddbf9213712c8a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c#L5638
> > - https://gitlab.com/mbunkus/mkvtoolnix/-/merge_requests/2254
> > ---
> >  libavcodec/dovi_rpu.c | 68 +--
> >  1 file changed, 65 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
> > index a6b23f4dd11..c7cdd65a2f2 100644
> > --- a/libavcodec/dovi_rpu.c
> > +++ b/libavcodec/dovi_rpu.c
> > @@ -174,6 +174,18 @@ static inline int64_t get_se_coef(GetBitContext *gb, 
> > const AVDOVIRpuDataHeader *
> >  return 0; /* unreachable */
> >  }
> >  
> > +static inline unsigned get_variable_bits(GetBitContext *gb, int n)
> > +{
> > +unsigned int value = get_bits(gb, n);
> > +int read_more = get_bits1(gb);
> > +while (read_more) {
> > +value = (value + 1) << n;
> > +value += get_bits(gb, n);
> 
> Using |= is more appropriate.
> 
> > +read_more = get_bits1(gb);
> > +};
> 
> The ';' is a null statement.

Fixed both, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options

2024-03-04 Thread Andreas Rheinhardt
Anton Khirnov:
> ---
>  doc/APIchanges|   3 +
>  libavutil/opt.c   | 362 +-
>  libavutil/opt.h   |  62 +++-
>  libavutil/tests/opt.c |  51 ++
>  tests/ref/fate/opt|  35 +++-
>  5 files changed, 468 insertions(+), 45 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 7d46ebb006..3209614ed6 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
>  
>  API changes, most recent first:
>  
> +2024-02-xx - xx - lavu 58.xx.100 - opt.h
> +  Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
> +
>  2024-02-28 - xx - swr   4.14.100 - swresample.h
>swr_convert() now accepts arrays of const pointers (to input and output).
>  
> diff --git a/libavutil/opt.h b/libavutil/opt.h
> index e402f6a0a0..77797b3fbe 100644
> --- a/libavutil/opt.h
> +++ b/libavutil/opt.h
> @@ -253,6 +253,17 @@ enum AVOptionType{
>  #endif
>  AV_OPT_TYPE_BOOL,
>  AV_OPT_TYPE_CHLAYOUT,
> +
> +/**
> + * May be combined with another regular option type to declare an array
> + * option.
> + *
> + * For array options, @ref AVOption.offset should refer to a pointer
> + * corresponding to the option type. The pointer should be immediately
> + * followed by an unsigned int that will store the number of elements in 
> the
> + * array.

How about we make this actually type-safe and use an actual struct for
this instead of relying on the compiler not adding padding between a
pointer and an unsigned int?

> + */
> +AV_OPT_TYPE_FLAG_ARRAY = (1 << 16),
>  };
>  
>  /**
> @@ -298,6 +309,46 @@ enum AVOptionType{
>   */
>  #define AV_OPT_FLAG_CHILD_CONSTS(1 << 18)
>  
> +/**
> + * Must be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
> + */
> +typedef struct AVOptionArrayDef {
> +/**
> + * Must be set to sizeof(AVOptionArrayDef), in order to allow extending 
> this
> + * struct without breaking ABI.
> + */
> +size_t  sizeof_self;

I do not really get the point of this field: It is not sufficient for
detecting whether a user used a version that set a certain field due to
trailing padding (i.e. an additional field need not increase
sizeof(AVOptionArrayDef); this is actually relevant for this structure,
because on x64 at least a new int/unsigned would fit into trailing padding).
Luckily we already have a way to know the user's lavu version, as it is
contained in the AVClass.

> +
> +/**
> + * Native access only.
> + *
> + * Default value of the option, as would be serialized by av_opt_get() 
> (i.e.
> + * using the value of sep as the separator).
> + */
> +const char *def;
> +
> +/**
> + * Minimum number of elements in the array. When this field is non-zero, 
> def
> + * must be non-NULL and contain at least this number of elements.
> + */
> +unsignedsize_min;
> +/**
> + * Maximum number of elements in the array, 0 when unlimited.
> + */
> +unsignedsize_max;
> +
> +/**
> + * Separator between array elements in string representations of this
> + * option, used by av_opt_set() and av_opt_get(). It must be a printable
> + * ASCII character, excluding alphanumeric and the backslash. A comma is
> + * used when sep=0.
> + *
> + * The separator and the backslash must be backslash-escaped in order to
> + * appear in string representations of the option value.
> + */
> +uint8_t sep;

If this is a printable ASCII character, then it should be a char.

> +} AVOptionArrayDef;
> +
>  /**
>   * AVOption
>   */
> @@ -320,8 +371,7 @@ typedef struct AVOption {
>  enum AVOptionType type;
>  
>  /**
> - * Native access only.
> - *
> + * Native access only, except when documented otherwise.
>   * the default value for scalar options
>   */
>  union {
> @@ -330,6 +380,14 @@ typedef struct AVOption {
>  const char *str;
>  /* TODO those are unused now */
>  AVRational q;
> +
> +/**
> + * Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL.
> + *
> + * Foreign access to some members allowed, as noted in 
> AVOptionArrayDef
> + * documentation.
> + */
> +const AVOptionArrayDef *arr;
>  } default_val;
>  double min; ///< minimum valid value for the option
>  double max; ///< maximum valid value for the option

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 23/29] avcodec/mpeg12dec: use ff_frame_new_side_data

2024-03-04 Thread Andreas Rheinhardt
Anton Khirnov:
> From: Niklas Haas 
> 
> For consistency, even though this cannot be overriden at the packet
> level.
> ---
>  libavcodec/mpeg12dec.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 3a2f17e508..aa116336dd 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, 
> AVFrame *picture,
>  
>  if (s->timecode_frame_start != -1 && *got_output) {
>  char tcbuf[AV_TIMECODE_STR_SIZE];
> -AVFrameSideData *tcside = av_frame_new_side_data(picture,
> - 
> AV_FRAME_DATA_GOP_TIMECODE,
> - 
> sizeof(int64_t));
> -if (!tcside)
> -return AVERROR(ENOMEM);
> -memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t));
> +AVFrameSideData *tcside;
> +ret = ff_frame_new_side_data(avctx, picture, 
> AV_FRAME_DATA_GOP_TIMECODE,
> + sizeof(int64_t), &tcside);
> +if (ret < 0)
> +return ret;
> +if (tcside) {
> +memcpy(tcside->data, &s->timecode_frame_start, 
> sizeof(int64_t));
>  
> -av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);
> -av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
> +av_timecode_make_mpeg_tc_string(tcbuf, 
> s->timecode_frame_start);
> +av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
> +}
>  
>  s->timecode_frame_start = -1;
>  }

-1 to everything that is only done for consistency.

- 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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v5 1/3] avformat/flvdec: support enhanced flv PacketTypeMetadata

2024-03-04 Thread zhupengfei via ffmpeg-devel
From: Zhu Pengfei <411294...@qq.com>

Signed-off-by: Zhu Pengfei <411294...@qq.com>
---
 libavformat/flvdec.c | 177 ++-
 1 file changed, 176 insertions(+), 1 deletion(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index e25b5bd163..2a0aec7291 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -33,6 +33,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "avformat.h"
 #include "demux.h"
@@ -45,6 +46,28 @@
 
 #define MAX_DEPTH 16  ///< arbitrary limit to prevent unbounded recursion
 
+typedef struct FLVMasteringMeta {
+double r_x;
+double r_y;
+double g_x;
+double g_y;
+double b_x;
+double b_y;
+double white_x;
+double white_y;
+double max_luminance;
+double min_luminance;
+} FLVMasteringMeta;
+
+typedef struct FLVMetaVideoColor {
+uint64_t matrix_coefficients;
+uint64_t transfer_characteristics;
+uint64_t primaries;
+uint64_t max_cll;
+uint64_t max_fall;
+FLVMasteringMeta mastering_meta;
+} FLVMetaVideoColor;
+
 typedef struct FLVContext {
 const AVClass *class; ///< Class for private options.
 int trust_metadata;   ///< configure streams according onMetaData
@@ -80,6 +103,8 @@ typedef struct FLVContext {
 int64_t time_offset;
 int64_t time_pos;
 
+FLVMetaVideoColor *metaVideoColor;
+int meta_color_info_flag;
 } FLVContext;
 
 /* AMF date type */
@@ -524,6 +549,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
*astream,
 FLVContext *flv = s->priv_data;
 AVIOContext *ioc;
 AMFDataType amf_type;
+FLVMetaVideoColor *meta_video_color = flv->metaVideoColor;
 char str_val[1024];
 double num_val;
 amf_date date;
@@ -672,6 +698,43 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
*astream,
 }
 }
 
+if (meta_video_color) {
+if (amf_type == AMF_DATA_TYPE_NUMBER ||
+amf_type == AMF_DATA_TYPE_BOOL) {
+if (!strcmp(key, "colorPrimaries")) {
+meta_video_color->primaries = num_val;
+} else if (!strcmp(key, "transferCharacteristics")) {
+meta_video_color->transfer_characteristics = num_val;
+} else if (!strcmp(key, "matrixCoefficients")) {
+meta_video_color->matrix_coefficients = num_val;
+} else if (!strcmp(key, "maxFall")) {
+meta_video_color->max_fall = num_val;
+} else if (!strcmp(key, "maxCLL")) {
+meta_video_color->max_cll = num_val;
+} else if (!strcmp(key, "redX")) {
+meta_video_color->mastering_meta.r_x = num_val;
+} else if (!strcmp(key, "redY")) {
+meta_video_color->mastering_meta.r_y = num_val;
+} else if (!strcmp(key, "greenX")) {
+meta_video_color->mastering_meta.g_x = num_val;
+} else if (!strcmp(key, "greenY")) {
+meta_video_color->mastering_meta.g_y = num_val;
+} else if (!strcmp(key, "blueX")) {
+meta_video_color->mastering_meta.b_x = num_val;
+} else if (!strcmp(key, "blueY")) {
+meta_video_color->mastering_meta.b_y = num_val;
+} else if (!strcmp(key, "whitePointX")) {
+meta_video_color->mastering_meta.white_x = num_val;
+} else if (!strcmp(key, "whitePointY")) {
+meta_video_color->mastering_meta.white_y = num_val;
+} else if (!strcmp(key, "maxLuminance")) {
+meta_video_color->mastering_meta.max_luminance = num_val;
+} else if (!strcmp(key, "minLuminance")) {
+meta_video_color->mastering_meta.min_luminance = num_val;
+}
+}
+}
+
 if (amf_type == AMF_DATA_TYPE_OBJECT && s->nb_streams == 1 &&
((!apar && !strcmp(key, "audiocodecid")) ||
 (!vpar && !strcmp(key, "videocodecid"
@@ -824,6 +887,7 @@ static int flv_read_close(AVFormatContext *s)
 av_freep(&flv->new_extradata[i]);
 av_freep(&flv->keyframe_times);
 av_freep(&flv->keyframe_filepositions);
+av_freep(&flv->metaVideoColor);
 return 0;
 }
 
@@ -1028,6 +1092,103 @@ static int resync(AVFormatContext *s)
 return AVERROR_EOF;
 }
 
+static int flv_parse_video_color_info(AVFormatContext *s, AVStream *st, 
int64_t next_pos)
+{
+FLVContext *flv = s->priv_data;
+AMFDataType type;
+AVIOContext *ioc;
+char buffer[32];
+ioc = s->pb;
+
+// first object needs to be "colorInfo" string
+type = avio_r8(ioc);
+if (type != AMF_DATA_TYPE_STRING ||
+amf_get_string(ioc, buffer, sizeof(buffer)) 

[FFmpeg-devel] [PATCH v5 2/3] avformat/flvenc: support enhanced flv PacketTypeMetadata

2024-03-04 Thread zhupengfei via ffmpeg-devel
From: Zhu Pengfei <411294...@qq.com>

Signed-off-by: Zhu Pengfei <411294...@qq.com>
---
 libavformat/flvenc.c | 139 +++
 1 file changed, 139 insertions(+)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index f6d10f331c..261e5d800c 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -23,6 +23,7 @@
 #include "libavutil/dict.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/avassert.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/codec_desc.h"
 #include "libavcodec/mpeg4audio.h"
@@ -124,6 +125,7 @@ typedef struct FLVContext {
 
 int flags;
 int64_t last_ts[FLV_STREAM_TYPE_NB];
+int metadata_pkt_written;
 } FLVContext;
 
 static int get_audio_flags(AVFormatContext *s, AVCodecParameters *par)
@@ -478,6 +480,142 @@ static void write_metadata(AVFormatContext *s, unsigned 
int ts)
 avio_wb32(pb, flv->metadata_totalsize + 11);
 }
 
+static void flv_write_metadata_packet(AVFormatContext *s, AVCodecParameters 
*par, unsigned int ts)
+{
+AVIOContext *pb = s->pb;
+FLVContext *flv = s->priv_data;
+AVContentLightMetadata *lightMetadata = NULL;
+AVMasteringDisplayMetadata *displayMetadata = NULL;
+int64_t metadata_size_pos = 0;
+int64_t total_size = 0;
+const AVPacketSideData *side_data = NULL;
+
+if (flv->metadata_pkt_written) return;
+if (par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 
||
+par->codec_id == AV_CODEC_ID_VP9) {
+int flags_size = 5;
+side_data = av_packet_side_data_get(par->coded_side_data, 
par->nb_coded_side_data,
+AV_PKT_DATA_CONTENT_LIGHT_LEVEL);
+if (side_data)
+lightMetadata = (AVContentLightMetadata *)side_data->data;
+
+side_data = av_packet_side_data_get(par->coded_side_data, 
par->nb_coded_side_data,
+
AV_PKT_DATA_MASTERING_DISPLAY_METADATA);
+if (side_data)
+displayMetadata = (AVMasteringDisplayMetadata *)side_data->data;
+
+/*
+* Reference Enhancing FLV
+* https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp.pdf
+* */
+avio_w8(pb, FLV_TAG_TYPE_VIDEO); //write video tag type
+metadata_size_pos = avio_tell(pb);
+avio_wb24(pb, 0 + flags_size);
+put_timestamp(pb, ts); //ts = pkt->dts, gen
+avio_wb24(pb, flv->reserved);
+
+if (par->codec_id == AV_CODEC_ID_HEVC) {
+avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata| 
FLV_FRAME_VIDEO_INFO_CMD); // ExVideoTagHeader mode with PacketTypeMetadata
+avio_write(pb, "hvc1", 4);
+} else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == 
AV_CODEC_ID_VP9) {
+avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata| 
FLV_FRAME_VIDEO_INFO_CMD);
+avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 
4);
+}
+
+avio_w8(pb, AMF_DATA_TYPE_STRING);
+put_amf_string(pb, "colorInfo");
+
+avio_w8(pb, AMF_DATA_TYPE_OBJECT);
+
+put_amf_string(pb, "colorConfig");  // colorConfig
+
+avio_w8(pb, AMF_DATA_TYPE_OBJECT);
+
+if (par->color_trc != AVCOL_TRC_UNSPECIFIED &&
+par->color_trc < AVCOL_TRC_NB) {
+put_amf_string(pb, "transferCharacteristics");  // color_trc
+put_amf_double(pb, par->color_trc);
+}
+
+if (par->color_space != AVCOL_SPC_UNSPECIFIED &&
+par->color_space < AVCOL_SPC_NB) {
+put_amf_string(pb, "matrixCoefficients"); // colorspace
+put_amf_double(pb, par->color_space);
+}
+
+if (par->color_primaries != AVCOL_PRI_UNSPECIFIED &&
+par->color_primaries < AVCOL_PRI_NB) {
+put_amf_string(pb, "colorPrimaries"); // color_primaries
+put_amf_double(pb, par->color_primaries);
+}
+
+put_amf_string(pb, "");
+avio_w8(pb, AMF_END_OF_OBJECT);
+
+if (lightMetadata) {
+put_amf_string(pb, "hdrCll");
+avio_w8(pb, AMF_DATA_TYPE_OBJECT);
+
+put_amf_string(pb, "maxFall");
+put_amf_double(pb, lightMetadata->MaxFALL);
+
+put_amf_string(pb, "maxCLL");
+put_amf_double(pb, lightMetadata->MaxCLL);
+
+put_amf_string(pb, "");
+avio_w8(pb, AMF_END_OF_OBJECT);
+}
+
+if (displayMetadata && (displayMetadata->has_primaries || 
displayMetadata->has_luminance)) {
+put_amf_string(pb, "hdrMdcv");
+avio_w8(pb, AMF_DATA_TYPE_OBJECT);
+if (displayMetadata->has_primaries) {
+put_amf_string(pb, "redX");
+put_amf_double(pb, 
av_q2d(displayMetadata->display_primaries[0][0]));
+
+put_amf_string(pb, "redY");
+put_amf_double(pb, 
av_q2d(displayMetadata->display_prim

[FFmpeg-devel] [PATCH v5 3/3] fate/flvenc: support enhanced flv PacketTypeMetadata

2024-03-04 Thread zhupengfei via ffmpeg-devel
From: Zhu Pengfei <411294...@qq.com>

Signed-off-by: Zhu Pengfei <411294...@qq.com>
---
 tests/fate/lavf-container.mak| 2 ++
 tests/ref/fate/enhanced-flv-hevc | 4 ++--
 tests/ref/fate/enhanced-flv-vp9  | 4 ++--
 tests/ref/lavf-fate/hevc.flv | 3 +++
 4 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 tests/ref/lavf-fate/hevc.flv

diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak
index fa7ecd2cb5..efef00d5b3 100644
--- a/tests/fate/lavf-container.mak
+++ b/tests/fate/lavf-container.mak
@@ -80,6 +80,7 @@ FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXER
LATM_MUXER) +
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MP3_DEMUXERMP3_MUXER)  
+= mp3
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, MOV_DEMUXERMOV_MUXER)  
+= qtrle_mace6.mov
 FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERAVI_MUXER)  
+= cram.avi
+FATE_LAVF_CONTAINER_FATE-$(call ALLYES, AVI_DEMUXERFLV_MUXER)  
+= hevc.flv
 
 FATE_LAVF_CONTAINER_FATE = $(FATE_LAVF_CONTAINER_FATE-yes:%=fate-lavf-fate-%)
 
@@ -96,6 +97,7 @@ fate-lavf-fate-latm: CMD = lavf_container_fate 
"aac/al04_44.mp4" "" "-acodec cop
 fate-lavf-fate-mp3: CMD = lavf_container_fate "mp3-conformance/he_32khz.bit" 
"" "-acodec copy"
 fate-lavf-fate-qtrle_mace6.mov: CMD = lavf_container_fate 
"qtrle/Animation-16Greys.mov" "-idct auto"
 fate-lavf-fate-cram.avi: CMD = lavf_container_fate "cram/toon.avi" "-idct auto"
+fate-lavf-fate-hevc.flv: CMD = lavf_container_fate "mkv/hdr10tags-both.mkv" "" 
"-c:v copy"
 
 FATE_SAMPLES_FFMPEG += $(FATE_LAVF_CONTAINER_FATE)
 fate-lavf-fate fate-lavf: $(FATE_LAVF_CONTAINER_FATE)
diff --git a/tests/ref/fate/enhanced-flv-hevc b/tests/ref/fate/enhanced-flv-hevc
index 90b81fcc0f..f011d38a30 100644
--- a/tests/ref/fate/enhanced-flv-hevc
+++ b/tests/ref/fate/enhanced-flv-hevc
@@ -1,5 +1,5 @@
-25fb1fcdcfde498ab86a3387f1a7f833 *tests/data/fate/enhanced-flv-hevc.flv
-3602897 tests/data/fate/enhanced-flv-hevc.flv
+0da54607064548fa1aae5695751f189c *tests/data/fate/enhanced-flv-hevc.flv
+3603038 tests/data/fate/enhanced-flv-hevc.flv
 #extradata 0:  551, 0xa18acf66
 #extradata 1:2, 0x00340022
 #tb 0: 1/1000
diff --git a/tests/ref/fate/enhanced-flv-vp9 b/tests/ref/fate/enhanced-flv-vp9
index c9bcaa8029..1c70b52e6a 100644
--- a/tests/ref/fate/enhanced-flv-vp9
+++ b/tests/ref/fate/enhanced-flv-vp9
@@ -1,5 +1,5 @@
-f5cd49123111202ff220850e60f17ac4 *tests/data/fate/enhanced-flv-vp9.flv
-9388 tests/data/fate/enhanced-flv-vp9.flv
+7dae331e8e7a73e2e2288a31fe51104c *tests/data/fate/enhanced-flv-vp9.flv
+9441 tests/data/fate/enhanced-flv-vp9.flv
 #extradata 0:   12, 0x03bc009d
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/lavf-fate/hevc.flv b/tests/ref/lavf-fate/hevc.flv
new file mode 100644
index 00..5f47c352fd
--- /dev/null
+++ b/tests/ref/lavf-fate/hevc.flv
@@ -0,0 +1,3 @@
+eca3b99e846e509c6957260b1ce4d82d *tests/data/lavf-fate/lavf.hevc.flv
+11784 tests/data/lavf-fate/lavf.hevc.flv
+tests/data/lavf-fate/lavf.hevc.flv CRC=0xd29da885
-- 
2.44.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 07/29] lavc: add a decoder option for configuring side data preference

2024-03-04 Thread Derek Buitenhuis
On 3/4/2024 1:06 PM, Anton Khirnov wrote:
> +/**
> + * Decoding only. May be set by the caller before avcodec_open2() to an
> + * av_malloc()'ed array (or via AVOptions). Owned and freed by the 
> decoder
> + * afterwards.
> + *
> + * By default, when some side data type is present both in global
> + * user-supplied coded_side_data and inside the coded bitstream, avcodec
> + * will propagate the latter to the decoded frame.
> + *
> + * This array contains a list of AVPacketSideDataType for which this
> + * preference should be switched, i.e. avcodec will prefer global side 
> data
> + * over those in stored in the bytestream. It may also contain a single 
> -1,
> + * in which case the preference is switched for all side data types.
> + */
> +int*side_data_prefer_global;

My only comment is that it would be nice to include some text about what the 
practical
application of this option is, rather than just technical details. Something 
like:

This can be useful, when, for example, input contains data in both the 
container
and bitstream.

- Derek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] lavc: move AVCodecContext.pts_correction* to DecodeContext

2024-03-04 Thread Anton Khirnov
These fields are documented to be non-public and are only used in
decode.c
---
 libavcodec/avcodec.h | 10 --
 libavcodec/decode.c  | 37 ++---
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 43859251cc..0578c5d525 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1827,16 +1827,6 @@ typedef struct AVCodecContext {
  */
 const struct AVCodecDescriptor *codec_descriptor;
 
-/**
- * Current statistics for PTS correction.
- * - decoding: maintained and used by libavcodec, not intended to be used 
by user apps
- * - encoding: unused
- */
-int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values 
so far
-int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values 
so far
-int64_t pts_correction_last_pts;   /// PTS of the last frame
-int64_t pts_correction_last_dts;   /// DTS of the last frame
-
 /**
  * Character encoding of the input subtitles file.
  * - decoding: set by user
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 7c67b18bc4..c2b4266b78 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -60,6 +60,11 @@ typedef struct DecodeContext {
  * The caller has submitted a NULL packet on input.
  */
 int draining_started;
+
+int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values 
so far
+int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values 
so far
+int64_t pts_correction_last_pts;   /// PTS of the last frame
+int64_t pts_correction_last_dts;   /// DTS of the last frame
 } DecodeContext;
 
 static DecodeContext *decode_ctx(AVCodecInternal *avci)
@@ -273,24 +278,24 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
*pkt)
  * @param dts the dts field of the decoded AVPacket
  * @return one of the input values, may be AV_NOPTS_VALUE
  */
-static int64_t guess_correct_pts(AVCodecContext *ctx,
+static int64_t guess_correct_pts(DecodeContext *dc,
  int64_t reordered_pts, int64_t dts)
 {
 int64_t pts = AV_NOPTS_VALUE;
 
 if (dts != AV_NOPTS_VALUE) {
-ctx->pts_correction_num_faulty_dts += dts <= 
ctx->pts_correction_last_dts;
-ctx->pts_correction_last_dts = dts;
+dc->pts_correction_num_faulty_dts += dts <= 
dc->pts_correction_last_dts;
+dc->pts_correction_last_dts = dts;
 } else if (reordered_pts != AV_NOPTS_VALUE)
-ctx->pts_correction_last_dts = reordered_pts;
+dc->pts_correction_last_dts = reordered_pts;
 
 if (reordered_pts != AV_NOPTS_VALUE) {
-ctx->pts_correction_num_faulty_pts += reordered_pts <= 
ctx->pts_correction_last_pts;
-ctx->pts_correction_last_pts = reordered_pts;
+dc->pts_correction_num_faulty_pts += reordered_pts <= 
dc->pts_correction_last_pts;
+dc->pts_correction_last_pts = reordered_pts;
 } else if(dts != AV_NOPTS_VALUE)
-ctx->pts_correction_last_pts = dts;
+dc->pts_correction_last_pts = dts;
 
-if 
((ctx->pts_correction_num_faulty_pts<=ctx->pts_correction_num_faulty_dts || dts 
== AV_NOPTS_VALUE)
+if ((dc->pts_correction_num_faulty_pts<=dc->pts_correction_num_faulty_dts 
|| dts == AV_NOPTS_VALUE)
&& reordered_pts != AV_NOPTS_VALUE)
 pts = reordered_pts;
 else
@@ -617,6 +622,7 @@ static int decode_simple_receive_frame(AVCodecContext 
*avctx, AVFrame *frame)
 static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
 {
 AVCodecInternal *avci = avctx->internal;
+DecodeContext *dc = decode_ctx(avci);
 const FFCodec *const codec = ffcodec(avctx->codec);
 int ret, ok;
 
@@ -672,7 +678,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
 frame->top_field_first =  !!(frame->flags & 
AV_FRAME_FLAG_TOP_FIELD_FIRST);
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
-frame->best_effort_timestamp = guess_correct_pts(avctx,
+frame->best_effort_timestamp = guess_correct_pts(dc,
  frame->pts,
  frame->pkt_dts);
 
@@ -1744,6 +1750,7 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
 int ff_decode_preinit(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
+DecodeContext *dc = decode_ctx(avci);
 int ret = 0;
 
 /* if the decoder init function was already called previously,
@@ -1791,10 +1798,10 @@ int ff_decode_preinit(AVCodecContext *avctx)
 }
 }
 
-avctx->pts_correction_num_faulty_pts =
-avctx->pts_correction_num_faulty_dts = 0;
-avctx->pts_correction_last_pts =
-avctx->pts_correction_last_dts = INT64_MIN;
+dc->pts_correction_num_faulty_pts =
+dc->pts_correction_num_faulty_dts = 0;
+dc->pts_correction_last_pts =
+dc->pts_correction_last_dts = INT64_MIN;
 
 if (   !CO

Re: [FFmpeg-devel] [PATCH v2 1/6] avcodec: add av_jni_{get, set}_android_app_ctx helper

2024-03-04 Thread Matthieu Bouron
On Mon, Mar 4, 2024 at 12:29 PM Andreas Rheinhardt
 wrote:
>
> Matthieu Bouron:
> > This will allow users to pass the Android ApplicationContext which is 
> > mandatory
> > to retrieve the ContentResolver responsible to resolve/open Android 
> > content-uri.
> > ---
> >  libavcodec/jni.c | 40 
> >  libavcodec/jni.h | 17 +
> >  2 files changed, 57 insertions(+)
> >
> > diff --git a/libavcodec/jni.c b/libavcodec/jni.c
> > index ae6490de9d..7d04d0a268 100644
> > --- a/libavcodec/jni.c
> > +++ b/libavcodec/jni.c
> > @@ -64,6 +64,36 @@ void *av_jni_get_java_vm(void *log_ctx)
> >  return vm;
> >  }
> >
> > +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
> > +{
> > +JNIEnv *env = avpriv_jni_get_env(c);
>
> Patch #1 won't compile on its own due to this; you fix this up in patch #2.
>
> > +if (!env)
> > +return AVERROR(EINVAL);
> > +
> > +jobjectRefType type = (*env)->GetObjectRefType(env, app_ctx);
> > +if (type != JNIGlobalRefType) {
> > +av_log(log_ctx, AV_LOG_ERROR, "Application context must be passed 
> > as a global reference");
> > +return AVERROR(EINVAL);
> > +}
> > +
> > +pthread_mutex_lock(&lock);
> > +android_app_ctx = app_ctx;
> > +pthread_mutex_unlock(&lock);
> > +
> > +return 0;
> > +}
> > +
> > +void *av_jni_get_android_app_ctx(void)
> > +{
> > +void *ctx;
> > +
> > +pthread_mutex_lock(&lock);
> > +ctx = android_app_ctx;
> > +pthread_mutex_unlock(&lock);
> > +
> > +return ctx;
> > +}
> > +
> >  #else
> >
> >  int av_jni_set_java_vm(void *vm, void *log_ctx)
> > @@ -76,4 +106,14 @@ void *av_jni_get_java_vm(void *log_ctx)
> >  return NULL;
> >  }
> >
> > +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
> > +{
> > +return AVERROR(ENOSYS);
> > +}
> > +
> > +void *av_jni_get_android_app_ctx(void)
> > +{
> > +return NULL;
> > +}
>
> I am against adding stub functions on platforms where they are known to
> be useless, i.e. everything except android.

Ok. Will update the patch introducing a new header "jni_android.h".
Unless we want to also scope avcodec/jni.h to Android only ?

>
> > +
> >  #endif
> > diff --git a/libavcodec/jni.h b/libavcodec/jni.h
> > index dd99e92611..da8025f830 100644
> > --- a/libavcodec/jni.h
> > +++ b/libavcodec/jni.h
> > @@ -43,4 +43,21 @@ int av_jni_set_java_vm(void *vm, void *log_ctx);
> >   */
> >  void *av_jni_get_java_vm(void *log_ctx);
> >
> > +/*
> > + * Set the Android application context which will be used to retrieve the 
> > Android
> > + * content resolver to resolve content uris.
> > + *
> > + * @param app_ctx global JNI reference to the Android application context
> > + * @return 0 on success, < 0 otherwise
> > + */
> > +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
> > +
> > +/*
> > + * Get the Android application context that has been set with
> > + * av_jni_set_android_app_ctx.
> > + *
> > + * @return a pointer the the Android application context
> > + */
> > +void *av_jni_get_android_app_ctx(void);
> > +
> >  #endif /* AVCODEC_JNI_H */
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] lavfi: deprecate avfilter_config_links()

2024-03-04 Thread Anton Khirnov
It never makes sense for this function to be called by users.
---
 libavfilter/avfilter.c   | 8 ++--
 libavfilter/avfilter.h   | 8 +++-
 libavfilter/avfiltergraph.c  | 2 +-
 libavfilter/f_streamselect.c | 2 +-
 libavfilter/internal.h   | 8 
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index cb2128252b..859a6f9d16 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -212,6 +212,10 @@ void avfilter_link_free(AVFilterLink **link)
 {
 link_free(link);
 }
+int avfilter_config_links(AVFilterContext *filter)
+{
+return ff_filter_config_links(EINVAL);
+}
 #endif
 
 static void update_link_current_pts(FilterLinkInternal *li, int64_t pts)
@@ -322,7 +326,7 @@ int avfilter_insert_filter(AVFilterLink *link, 
AVFilterContext *filt,
 return 0;
 }
 
-int avfilter_config_links(AVFilterContext *filter)
+int ff_filter_config_links(AVFilterContext *filter)
 {
 int (*config_link)(AVFilterLink *);
 unsigned i;
@@ -353,7 +357,7 @@ int avfilter_config_links(AVFilterContext *filter)
 case AVLINK_UNINIT:
 li->init_state = AVLINK_STARTINIT;
 
-if ((ret = avfilter_config_links(link->src)) < 0)
+if ((ret = ff_filter_config_links(link->src)) < 0)
 return ret;
 
 if (!(config_link = link->srcpad->config_props)) {
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 0949870de4..08f185c4d2 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -698,15 +698,13 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
  */
 attribute_deprecated
 void avfilter_link_free(AVFilterLink **link);
-#endif
 
 /**
- * Negotiate the media format, dimensions, etc of all inputs to a filter.
- *
- * @param filter the filter to negotiate the properties for its inputs
- * @return   zero on successful negotiation
+ * @deprecated this function should never be called by users
  */
+attribute_deprecated
 int avfilter_config_links(AVFilterContext *filter);
+#endif
 
 #define AVFILTER_CMD_FLAG_ONE   1 ///< Stop once a filter understood the 
command (for target=all for example), fast filters are favored automatically
 #define AVFILTER_CMD_FLAG_FAST  2 ///< Only execute command when its fast 
(like a video out that supports contrast adjustment in hw)
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 674711ec35..ac491ee89b 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -251,7 +251,7 @@ static int graph_config_links(AVFilterGraph *graph, void 
*log_ctx)
 filt = graph->filters[i];
 
 if (!filt->nb_outputs) {
-if ((ret = avfilter_config_links(filt)))
+if ((ret = ff_filter_config_links(filt)))
 return ret;
 }
 }
diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c
index 1328a842f9..fb96a46862 100644
--- a/libavfilter/f_streamselect.c
+++ b/libavfilter/f_streamselect.c
@@ -250,7 +250,7 @@ static int process_command(AVFilterContext *ctx, const char 
*cmd, const char *ar
 
 if (ret < 0)
 return ret;
-return avfilter_config_links(ctx);
+return ff_filter_config_links(ctx);
 }
 return AVERROR(ENOSYS);
 }
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 0e3f68d1f4..000f94cb16 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -246,6 +246,14 @@ int ff_parse_channel_layout(AVChannelLayout *ret, int 
*nret, const char *arg,
  */
 void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t 
pts);
 
+/**
+ * Negotiate the media format, dimensions, etc of all inputs to a filter.
+ *
+ * @param filter the filter to negotiate the properties for its inputs
+ * @return   zero on successful negotiation
+ */
+int ff_filter_config_links(AVFilterContext *filter);
+
 #define D2TS(d)  (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] lavfi: deprecate avfilter_link_free()

2024-03-04 Thread Anton Khirnov
It never makes sense for this function to be called by users.
---
 libavfilter/avfilter.c  | 11 +--
 libavfilter/avfilter.h  |  5 -
 libavfilter/version_major.h |  1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index daa7c3672a..cb2128252b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -192,7 +192,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
 return 0;
 }
 
-void avfilter_link_free(AVFilterLink **link)
+static void link_free(AVFilterLink **link)
 {
 FilterLinkInternal *li;
 
@@ -207,6 +207,13 @@ void avfilter_link_free(AVFilterLink **link)
 av_freep(link);
 }
 
+#if FF_API_LINK_PUBLIC
+void avfilter_link_free(AVFilterLink **link)
+{
+link_free(link);
+}
+#endif
+
 static void update_link_current_pts(FilterLinkInternal *li, int64_t pts)
 {
 AVFilterLink *const link = &li->l;
@@ -763,7 +770,7 @@ static void free_link(AVFilterLink *link)
 ff_formats_unref(&link->outcfg.samplerates);
 ff_channel_layouts_unref(&link->incfg.channel_layouts);
 ff_channel_layouts_unref(&link->outcfg.channel_layouts);
-avfilter_link_free(&link);
+link_free(&link);
 }
 
 void avfilter_free(AVFilterContext *filter)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 5eff35b836..0949870de4 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -692,10 +692,13 @@ struct AVFilterLink {
 int avfilter_link(AVFilterContext *src, unsigned srcpad,
   AVFilterContext *dst, unsigned dstpad);
 
+#if FF_API_LINK_PUBLIC
 /**
- * Free the link in *link, and set its pointer to NULL.
+ * @deprecated this function should never be called by users
  */
+attribute_deprecated
 void avfilter_link_free(AVFilterLink **link);
+#endif
 
 /**
  * Negotiate the media format, dimensions, etc of all inputs to a filter.
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index 1decc4012e..97fcd57e90 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -36,5 +36,6 @@
  */
 
 #define FF_API_LIBPLACEBO_OPTS (LIBAVFILTER_VERSION_MAJOR < 10)
+#define FF_API_LINK_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 11)
 
 #endif /* AVFILTER_VERSION_MAJOR_H */
-- 
2.43.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avformat/aviobuf: Move code specific to URLContexts to avio.c

2024-03-04 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> This separates the URL-layer adjacent parts of the code
> from the parts that are also usable with custom IO.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/avio.c| 191 +-
>  libavformat/aviobuf.c | 186 
>  libavformat/url.h |   2 -
>  3 files changed, 189 insertions(+), 190 deletions(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index b793a7546c..794ebd4bd8 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -24,6 +24,7 @@
>  #include "libavutil/opt.h"
>  #include "libavutil/time.h"
>  #include "libavutil/avassert.h"
> +#include "avio_internal.h"
>  #include "os_support.h"
>  #include "internal.h"
>  #if CONFIG_NETWORK
> @@ -31,6 +32,8 @@
>  #endif
>  #include "url.h"
>  
> +#define IO_BUFFER_SIZE 32768
> +
>  /** @name Logging context. */
>  /*@{*/
>  static const char *urlcontext_to_name(void *ptr)
> @@ -60,7 +63,7 @@ static const AVOption options[] = {
>  { NULL }
>  };
>  
> -const AVClass ffurl_context_class = {
> +static const AVClass url_context_class = {
>  .class_name   = "URLContext",
>  .item_name= urlcontext_to_name,
>  .option   = options,
> @@ -70,6 +73,47 @@ const AVClass ffurl_context_class = {
>  };
>  /*@}*/
>  
> +static void *avio_child_next(void *obj, void *prev)
> +{
> +AVIOContext *s = obj;
> +return prev ? NULL : s->opaque;
> +}
> +
> +static const AVClass *child_class_iterate(void **iter)
> +{
> +const AVClass *c = *iter ? NULL : &url_context_class;
> +*iter = (void*)(uintptr_t)c;
> +return c;
> +}
> +
> +#define AVIOOFFSET(x) offsetof(AVIOContext,x)
> +#define E AV_OPT_FLAG_ENCODING_PARAM
> +#define D AV_OPT_FLAG_DECODING_PARAM
> +static const AVOption avio_options[] = {
> +{"protocol_whitelist", "List of protocols that are allowed to be used", 
> AVIOOFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  0, 0, D 
> },
> +{ NULL },
> +};
> +
> +const AVClass ff_avio_class = {
> +.class_name = "AVIOContext",
> +.item_name  = av_default_item_name,
> +.version= LIBAVUTIL_VERSION_INT,
> +.option = avio_options,
> +.child_next = avio_child_next,
> +.child_class_iterate = child_class_iterate,
> +};
> +
> +URLContext *ffio_geturlcontext(AVIOContext *s)
> +{
> +if (!s)
> +return NULL;
> +
> +if (s->opaque && s->read_packet == ffurl_read2)
> +return s->opaque;
> +else
> +return NULL;
> +}
> +
>  static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up,
>const char *filename, int flags,
>const AVIOInterruptCB *int_cb)
> @@ -96,7 +140,7 @@ static int url_alloc_for_protocol(URLContext **puc, const 
> URLProtocol *up,
>  err = AVERROR(ENOMEM);
>  goto fail;
>  }
> -uc->av_class = &ffurl_context_class;
> +uc->av_class = &url_context_class;
>  uc->filename = (char *)&uc[1];
>  strcpy(uc->filename, filename);
>  uc->prot= up;
> @@ -225,6 +269,17 @@ int ffurl_accept(URLContext *s, URLContext **c)
>  return AVERROR(EBADF);
>  }
>  
> +int avio_accept(AVIOContext *s, AVIOContext **c)
> +{
> +int ret;
> +URLContext *sc = s->opaque;
> +URLContext *cc = NULL;
> +ret = ffurl_accept(sc, &cc);
> +if (ret < 0)
> +return ret;
> +return ffio_fdopen(c, cc);
> +}
> +
>  int ffurl_handshake(URLContext *c)
>  {
>  int ret;
> @@ -237,6 +292,12 @@ int ffurl_handshake(URLContext *c)
>  return 0;
>  }
>  
> +int avio_handshake(AVIOContext *c)
> +{
> +URLContext *cc = c->opaque;
> +return ffurl_handshake(cc);
> +}
> +
>  #define URL_SCHEME_CHARS\
>  "abcdefghijklmnopqrstuvwxyz"\
>  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"\
> @@ -347,6 +408,92 @@ fail:
>  return ret;
>  }
>  
> +int ffio_fdopen(AVIOContext **s, URLContext *h)
> +{
> +uint8_t *buffer = NULL;
> +int buffer_size, max_packet_size;
> +
> +max_packet_size = h->max_packet_size;
> +if (max_packet_size) {
> +buffer_size = max_packet_size; /* no need to bufferize more than one 
> packet */
> +} else {
> +buffer_size = IO_BUFFER_SIZE;
> +}
> +if (!(h->flags & AVIO_FLAG_WRITE) && h->is_streamed) {
> +if (buffer_size > INT_MAX/2)
> +return AVERROR(EINVAL);
> +buffer_size *= 2;
> +}
> +buffer = av_malloc(buffer_size);
> +if (!buffer)
> +return AVERROR(ENOMEM);
> +
> +*s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, 
> h,
> +ffurl_read2, ffurl_write2, ffurl_seek2);
> +if (!*s) {
> +av_freep(&buffer);
> +return AVERROR(ENOMEM);
> +}
> +(*s)->protocol_whitelist = av_strdup(h->protocol_whitelist);
> +if (!(*s)->protocol_whitelist && h->protocol_whitelist)

Re: [FFmpeg-devel] [PATCH v2 1/6] avcodec: add av_jni_{get, set}_android_app_ctx helper

2024-03-04 Thread Matthieu Bouron
On Mon, Mar 4, 2024 at 4:11 PM Matthieu Bouron
 wrote:
>
> On Mon, Mar 4, 2024 at 12:29 PM Andreas Rheinhardt
>  wrote:
> >
> > Matthieu Bouron:
> > > This will allow users to pass the Android ApplicationContext which is 
> > > mandatory
> > > to retrieve the ContentResolver responsible to resolve/open Android 
> > > content-uri.
> > > ---
> > >  libavcodec/jni.c | 40 
> > >  libavcodec/jni.h | 17 +
> > >  2 files changed, 57 insertions(+)
> > >
> > > diff --git a/libavcodec/jni.c b/libavcodec/jni.c
> > > index ae6490de9d..7d04d0a268 100644
> > > --- a/libavcodec/jni.c
> > > +++ b/libavcodec/jni.c
> > > @@ -64,6 +64,36 @@ void *av_jni_get_java_vm(void *log_ctx)
> > >  return vm;
> > >  }
> > >
> > > +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
> > > +{
> > > +JNIEnv *env = avpriv_jni_get_env(c);
> >
> > Patch #1 won't compile on its own due to this; you fix this up in patch #2.
> >
> > > +if (!env)
> > > +return AVERROR(EINVAL);
> > > +
> > > +jobjectRefType type = (*env)->GetObjectRefType(env, app_ctx);
> > > +if (type != JNIGlobalRefType) {
> > > +av_log(log_ctx, AV_LOG_ERROR, "Application context must be 
> > > passed as a global reference");
> > > +return AVERROR(EINVAL);
> > > +}
> > > +
> > > +pthread_mutex_lock(&lock);
> > > +android_app_ctx = app_ctx;
> > > +pthread_mutex_unlock(&lock);
> > > +
> > > +return 0;
> > > +}
> > > +
> > > +void *av_jni_get_android_app_ctx(void)
> > > +{
> > > +void *ctx;
> > > +
> > > +pthread_mutex_lock(&lock);
> > > +ctx = android_app_ctx;
> > > +pthread_mutex_unlock(&lock);
> > > +
> > > +return ctx;
> > > +}
> > > +
> > >  #else
> > >
> > >  int av_jni_set_java_vm(void *vm, void *log_ctx)
> > > @@ -76,4 +106,14 @@ void *av_jni_get_java_vm(void *log_ctx)
> > >  return NULL;
> > >  }
> > >
> > > +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
> > > +{
> > > +return AVERROR(ENOSYS);
> > > +}
> > > +
> > > +void *av_jni_get_android_app_ctx(void)
> > > +{
> > > +return NULL;
> > > +}
> >
> > I am against adding stub functions on platforms where they are known to
> > be useless, i.e. everything except android.
>
> Ok. Will update the patch introducing a new header "jni_android.h".
> Unless we want to also scope avcodec/jni.h to Android only ?

Or maybe you mean adding a ifdef guard to it ?

>
> >
> > > +
> > >  #endif
> > > diff --git a/libavcodec/jni.h b/libavcodec/jni.h
> > > index dd99e92611..da8025f830 100644
> > > --- a/libavcodec/jni.h
> > > +++ b/libavcodec/jni.h
> > > @@ -43,4 +43,21 @@ int av_jni_set_java_vm(void *vm, void *log_ctx);
> > >   */
> > >  void *av_jni_get_java_vm(void *log_ctx);
> > >
> > > +/*
> > > + * Set the Android application context which will be used to retrieve 
> > > the Android
> > > + * content resolver to resolve content uris.
> > > + *
> > > + * @param app_ctx global JNI reference to the Android application context
> > > + * @return 0 on success, < 0 otherwise
> > > + */
> > > +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
> > > +
> > > +/*
> > > + * Get the Android application context that has been set with
> > > + * av_jni_set_android_app_ctx.
> > > + *
> > > + * @return a pointer the the Android application context
> > > + */
> > > +void *av_jni_get_android_app_ctx(void);
> > > +
> > >  #endif /* AVCODEC_JNI_H */
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: fix -pgc and -pg options

2024-03-04 Thread Marth64
Looks like v2 made it in. All good here. Thanks, Stefano !

On Mon, Mar 4, 2024 at 3:43 AM Stefano Sabatini  wrote:

> On date Monday 2024-03-04 10:24:42 +0100, Stefano Sabatini wrote:
> > On date Saturday 2024-03-02 20:29:13 -0600, Marth64 wrote:
> > > In merged DVD patch, -pgc and -pg options were broken. While these are
> > > rather advanced options, they are the only means to get content for
> > > some strangely authored discs.
> > >
> > > Signed-off-by: Marth64 
> > > ---
> > >  libavformat/dvdvideodec.c | 23 +--
> > >  1 file changed, 13 insertions(+), 10 deletions(-)
> >
> > Will apply, thanks.
>
> Not really:
> $ git am patches/0001-lavf-dvvideodec-fix-opts.patch  --reject
> Applying: avformat/dvdvideodec: fix -pgc and -pg options
> Checking patch libavformat/dvdvideodec.c...
> Hunk #1 succeeded at 507 (offset -1 lines).
> Hunk #2 succeeded at 1255 (offset -12 lines).
> error: while searching for:
> (ret = dvdvideo_subp_stream_add_all(s)) < 0)
> return ret;
>
> if (!c->opt_preindex)
> return dvdvideo_chapters_setup_simple(s);
>
> return ret;
>
> error: patch failed: libavformat/dvdvideodec.c:1288
> Applying patch libavformat/dvdvideodec.c with 1 reject...
> Hunk #1 applied cleanly.
> Hunk #2 applied cleanly.
> Rejected hunk #3.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 0/3] Fix /// comments that should be ///

2024-03-04 Thread Stefano Sabatini
On date Wednesday 2024-02-28 17:09:38 +, Andrew Sayers wrote:
> This is the first in a planned series of patch series aimed at
> fixing documentation issues, especially doxygen rendering.
> I hope to post more as time allows in the coming days.
> 
> The first patch reflects the output of a `sed` command,
> further patches fix edge cases not covered by `sed`.
> Splitting commits this way allows merge conflicts
> to be resolved by throwing the old commit away,
> then running the command in the commit message.
> 
> Andrew Sayers (3):
>   all: Fix /// comments that should be ///<
>   avcodec/ivi: Make comments more Doxygen-friendly
>   avcodec/avcodec: Downgrade multi-member comment to non-Doxygen comment
> 
>  libavcodec/avcodec.h | 10 +-
>  libavcodec/bsf/noise.c   | 24 
>  libavcodec/ivi.h | 15 +++
>  libavfilter/vf_deshake.c |  2 +-
>  libavformat/rmdec.c  |  4 ++--
>  5 files changed, 27 insertions(+), 28 deletions(-)

Will apply, thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] all: fix "param"s that should be "@param"

2024-03-04 Thread Stefano Sabatini
On date Thursday 2024-02-29 15:51:33 +, Andrew Sayers wrote:
> Actual command: sed -i -e "s/\(^ *\\* \)\(param[^a-z]\)/\1@\2/" $( git grep 
> -l "^ *\\* param[^a-z]" )
> 
> Signed-off-by: Andrew Sayers 
> ---
>  libavcodec/evrcdec.c | 10 +-
>  libavutil/bprint.h   | 12 ++--
>  2 files changed, 11 insertions(+), 11 deletions(-)

will apply, thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] all: fix "@param foo[in/out]" to "@param[in, out] foo"

2024-03-04 Thread Stefano Sabatini
On date Thursday 2024-02-29 15:58:58 +, Andrew Sayers wrote:
> Fix a few invalid doxygen comments:
> 
> /**
>  * @param[in,out] correctly_formatted
>  * @param incorrect1[in] - [in] must come immediately after @param
>  * @param incorrect2[in/out] - '/' must be ','
>  */
> 
> Actual command: sed -i -e "s/\(\* .*param\)\( [^\[]*\)\(\[.*\]\)/\1\3\2/g" -e 
> "s/in\//in,/" $( git grep -l "\* .*param .*\[\(in\|out\)" )
> 
> Signed-off-by: Andrew Sayers 
> ---
>  libavcodec/g729postfilter.c  |  8 
>  libavcodec/g729postfilter.h  | 14 +++---
>  libavutil/hdr_dynamic_metadata.h |  4 ++--
>  3 files changed, 13 insertions(+), 13 deletions(-)

will apply, thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 0/3] Fix /// comments that should be ///

2024-03-04 Thread Andreas Rheinhardt
Stefano Sabatini:
> On date Wednesday 2024-02-28 17:09:38 +, Andrew Sayers wrote:
>> This is the first in a planned series of patch series aimed at
>> fixing documentation issues, especially doxygen rendering.
>> I hope to post more as time allows in the coming days.
>>
>> The first patch reflects the output of a `sed` command,
>> further patches fix edge cases not covered by `sed`.
>> Splitting commits this way allows merge conflicts
>> to be resolved by throwing the old commit away,
>> then running the command in the commit message.
>>
>> Andrew Sayers (3):
>>   all: Fix /// comments that should be ///<
>>   avcodec/ivi: Make comments more Doxygen-friendly
>>   avcodec/avcodec: Downgrade multi-member comment to non-Doxygen comment
>>
>>  libavcodec/avcodec.h | 10 +-
>>  libavcodec/bsf/noise.c   | 24 
>>  libavcodec/ivi.h | 15 +++
>>  libavfilter/vf_deshake.c |  2 +-
>>  libavformat/rmdec.c  |  4 ++--
>>  5 files changed, 27 insertions(+), 28 deletions(-)
> 
> Will apply, thanks.

Please don't. Anton intends to remove the pts_correction fields with the
bump and so this is unnecessary and will just cause a rebase conflict.

- 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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 0/3] Fix /// comments that should be ///

2024-03-04 Thread Stefano Sabatini
On date Monday 2024-03-04 17:49:27 +0100, Andreas Rheinhardt wrote:
> Stefano Sabatini:
> > On date Wednesday 2024-02-28 17:09:38 +, Andrew Sayers wrote:
> >> This is the first in a planned series of patch series aimed at
> >> fixing documentation issues, especially doxygen rendering.
> >> I hope to post more as time allows in the coming days.
> >>
> >> The first patch reflects the output of a `sed` command,
> >> further patches fix edge cases not covered by `sed`.
> >> Splitting commits this way allows merge conflicts
> >> to be resolved by throwing the old commit away,
> >> then running the command in the commit message.
> >>
> >> Andrew Sayers (3):
> >>   all: Fix /// comments that should be ///<
> >>   avcodec/ivi: Make comments more Doxygen-friendly
> >>   avcodec/avcodec: Downgrade multi-member comment to non-Doxygen 
> >> comment
> >>
> >>  libavcodec/avcodec.h | 10 +-
> >>  libavcodec/bsf/noise.c   | 24 
> >>  libavcodec/ivi.h | 15 +++
> >>  libavfilter/vf_deshake.c |  2 +-
> >>  libavformat/rmdec.c  |  4 ++--
> >>  5 files changed, 27 insertions(+), 28 deletions(-)
> > 
> > Will apply, thanks.
> 

> Please don't. Anton intends to remove the pts_correction fields with the
> bump and so this is unnecessary and will just cause a rebase conflict.

Too late, sorry, hopefully the rebase should not too hard to fix (also
there are more changes unrelated to pts_correction we want to keep).

Let me know if we should hold header changes to prevent rebase conflicts
at this stage.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 4/5] avcodec/h264_parser: fix start of packet for some broken streams

2024-03-04 Thread Nicolas Gaullier
Signed-off-by: Nicolas Gaullier 
---
 libavcodec/h264_parser.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 94cfbc481e..6b721ec253 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -124,7 +124,16 @@ static int h264_find_frame_end(H264ParseContext *p, const 
uint8_t *buf,
 if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS ||
 nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) {
 if (pc->frame_start_found) {
-i++;
+/* Some streams in the wild are missing the zero_byte at 
the NAL_AUD:
+ * it is following just afterwards.
+ * To avoid any accidental borrowing of a byte in the 
previous frame
+ * (which would return a negative index and indicate that 
fetch_timestamps
+ * has to get the pts from the previous frame),
+ * better have the start of packet strictly aligned.
+ * To make it a more general rule, just test the following 
three bytes are null.
+ */
+i += 1 + (!p->is_avc && state == 5 && i == 3 && nalu_type 
== H264_NAL_AUD &&
+buf_size >= 9 && !AV_RB24(buf + 5));
 goto found;
 }
 } else if (nalu_type == H264_NAL_SLICE || nalu_type == 
H264_NAL_DPA ||
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 1/5] avcodec/parser: merge packets from the same frame

2024-03-04 Thread Nicolas Gaullier
The mpegts demuxer splits packets according to its max_packet_size.
This currently fills the AVCodecParserContext s->cur_frame_* arrays with
kind of 'empty' entries: no pts/dts.
This patch merges these entries, so the parser behaviour is independent
from the demuxer settings.
This patch is required for the following patch which will fetch 'past'
timestamps from past cur_frames.

Signed-off-by: Nicolas Gaullier 
---
 libavcodec/parser.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index efc28b8918..90461075fd 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -142,6 +142,8 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 memset(dummy_buf, 0, sizeof(dummy_buf));
 buf = dummy_buf;
 } else if (s->cur_offset + buf_size != 
s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */
+if (pos != s->cur_frame_pos[s->cur_frame_start_index] || pos <= 0 ||
+pts != AV_NOPTS_VALUE || dts != AV_NOPTS_VALUE ) {
 /* add a new packet descriptor */
 i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
 s->cur_frame_start_index = i;
@@ -150,6 +152,9 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 s->cur_frame_pts[i]  = pts;
 s->cur_frame_dts[i]  = dts;
 s->cur_frame_pos[i]  = pos;
+} else {
+s->cur_frame_end[s->cur_frame_start_index] = s->cur_offset + 
buf_size;
+}
 }
 
 if (s->fetch_timestamp) {
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 3/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets

2024-03-04 Thread Nicolas Gaullier
Fix fetch_timestamp when the frame start is in a previous packet.

Signed-off-by: Nicolas Gaullier 
---
 libavcodec/parser.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 496ebbc231..3c22fdcc2f 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -102,7 +102,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, 
int remove, int fuzzy)
 s->dts= s->cur_frame_dts[i];
 s->pts= s->cur_frame_pts[i];
 s->pos= s->cur_frame_pos[i];
-s->offset = s->next_frame_offset - s->cur_frame_offset[i];
+s->offset = FFMAX( 0, s->next_frame_offset - 
s->cur_frame_offset[i]);
 }
 if (remove)
 s->cur_frame_offset[i] = INT64_MAX;
@@ -158,11 +158,11 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 }
 
 if (s->fetch_timestamp) {
-s->fetch_timestamp = 0;
 s->last_pts= s->pts;
 s->last_dts= s->dts;
 s->last_pos= s->pos;
-ff_fetch_timestamp(s, 0, 0, 0);
+ff_fetch_timestamp(s, FFMIN(s->fetch_timestamp, 0), 0, 0);
+s->fetch_timestamp = 0;
 }
 /* WARNING: the returned index can be negative */
 index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
@@ -179,12 +179,13 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 
 /* update the file pointer */
 if (*poutbuf_size) {
+s->fetch_timestamp   = index >= 0 || !s->frame_offset ? 1 : index;
+
 /* fill the data for the current frame */
 s->frame_offset = s->next_frame_offset;
 
 /* offset of the next frame */
 s->next_frame_offset = s->cur_offset + index;
-s->fetch_timestamp   = 1;
 } else {
 /* Don't return a pointer to dummy_buf. */
 *poutbuf = NULL;
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets

2024-03-04 Thread Nicolas Gaullier
Updated from v2:
patch 1: fix audio case where pts=AV_NOPTS_VALUE but dts exists (thanks to 
Michael)
now pass fate with --assert-level=2
patch 5: add inline comments and moved a line to make it more easy to read 
(thanks to James)

Thank you for this review

Nicolas Gaullier (5):
  avcodec/parser: merge packets from the same frame
  avcodec/parser: reindent after previous commit
  avcodec/parser: fix fetch_timestamp in a scenario with unaligned
packets
  avcodec/h264_parser: fix start of packet for some broken streams
  lavf/demux: duplicate side_data in parse_packet()

 libavcodec/h264_parser.c  |  11 +-
 libavcodec/parser.c   |  30 ++--
 libavformat/demux.c   |  25 ++-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +-
 tests/ref/fate/ts-demux   |   8 +-
 5 files changed, 134 insertions(+), 104 deletions(-)

-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 2/5] avcodec/parser: reindent after previous commit

2024-03-04 Thread Nicolas Gaullier
Signed-off-by: Nicolas Gaullier 
---
 libavcodec/parser.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 90461075fd..496ebbc231 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -144,14 +144,14 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 } else if (s->cur_offset + buf_size != 
s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */
 if (pos != s->cur_frame_pos[s->cur_frame_start_index] || pos <= 0 ||
 pts != AV_NOPTS_VALUE || dts != AV_NOPTS_VALUE ) {
-/* add a new packet descriptor */
-i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
-s->cur_frame_start_index = i;
-s->cur_frame_offset[i]   = s->cur_offset;
-s->cur_frame_end[i]  = s->cur_offset + buf_size;
-s->cur_frame_pts[i]  = pts;
-s->cur_frame_dts[i]  = dts;
-s->cur_frame_pos[i]  = pos;
+/* add a new packet descriptor */
+i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
+s->cur_frame_start_index = i;
+s->cur_frame_offset[i]   = s->cur_offset;
+s->cur_frame_end[i]  = s->cur_offset + buf_size;
+s->cur_frame_pts[i]  = pts;
+s->cur_frame_dts[i]  = dts;
+s->cur_frame_pos[i]  = pos;
 } else {
 s->cur_frame_end[s->cur_frame_start_index] = s->cur_offset + 
buf_size;
 }
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 5/5] lavf/demux: duplicate side_data in parse_packet()

2024-03-04 Thread Nicolas Gaullier
Signed-off-by: Nicolas Gaullier 
---
 libavformat/demux.c   |  25 ++-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +-
 tests/ref/fate/ts-demux   |   8 +-
 3 files changed, 106 insertions(+), 91 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2e1d0ed66d..299e693606 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1186,7 +1186,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
 FFStream *const sti = ffstream(st);
 const uint8_t *data = pkt->data;
 int size = pkt->size;
-int ret = 0, got_output = flush;
+int ret = 0, got_output = flush, pkt_side_data_consumed = 0;
 
 if (!size && !flush && sti->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
 // preserve 0-size sync packets
@@ -1231,10 +1231,21 @@ static int parse_packet(AVFormatContext *s, AVPacket 
*pkt,
 }
 
 if (pkt->side_data) {
-out_pkt->side_data   = pkt->side_data;
-out_pkt->side_data_elems = pkt->side_data_elems;
-pkt->side_data  = NULL;
-pkt->side_data_elems= 0;
+/* for the first iteration, side_data are simply moved to output.
+ * in case of additional iterations, they are duplicated each 
time. */
+if (!pkt_side_data_consumed) {
+pkt_side_data_consumed = 1;
+out_pkt->side_data   = pkt->side_data;
+out_pkt->side_data_elems = pkt->side_data_elems;
+} else for (int i = 0; i < pkt->side_data_elems; i++) {
+const AVPacketSideData *const src_sd = &pkt->side_data[i];
+uint8_t *dst_data = av_packet_new_side_data(out_pkt, 
src_sd->type, src_sd->size);
+if (!dst_data) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+memcpy(dst_data, src_sd->data, src_sd->size);
+}
 }
 
 /* set the duration */
@@ -1286,6 +1297,10 @@ static int parse_packet(AVFormatContext *s, AVPacket 
*pkt,
 }
 
 fail:
+if (pkt_side_data_consumed) {
+pkt->side_data  = NULL;
+pkt->side_data_elems= 0;
+}
 if (ret < 0)
 av_packet_unref(out_pkt);
 av_packet_unref(pkt);
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts 
b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 548cab01c6..ee49e331f3 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -7,19 +7,19 @@ 
video|1|18982|0.210911|15382|0.170911|3600|0.04|13092|84788|___|MPEGTS Strea
 video|1|22582|0.250911|18982|0.210911|3600|0.04|12755|98700|___|MPEGTS 
Stream ID|224
 video|1|26182|0.290911|22582|0.250911|3600|0.04|12023|111860|___|MPEGTS 
Stream ID|224
 audio|0|0|0.00|0|0.00|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192
-audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__
-audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__
-audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__
-audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__
-audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__
-audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__
-audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__
-audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__
-audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__
-audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__
-audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__
-audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__
-audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__
+audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
+audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__|MPEGTS Stream 
ID|192
 video|1|29782|0.330911|26182|0.290911|3600|0.04|14098|124268|___|MPEGTS 
Stream 

[FFmpeg-devel] [PATCH] configure: do not specify -ldvdread, as pkg-config check is already done

2024-03-04 Thread Marth64
Reported-by: BtbN
Signed-off-by: Marth64 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index db7dc89755..bbf1a70731 100755
--- a/configure
+++ b/configure
@@ -6782,7 +6782,7 @@ enabled libdavs2  && require_pkg_config libdavs2 
"davs2 >= 1.6.0" davs2.
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& check_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
 enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" 
dvdnav/dvdnav.h dvdnav_open2
-enabled libdvdread&& require_pkg_config libdvdread "dvdread >= 6.1.2" 
dvdread/dvd_reader.h DVDOpen2 -ldvdread
+enabled libdvdread&& require_pkg_config libdvdread "dvdread >= 6.1.2" 
dvdread/dvd_reader.h DVDOpen2
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac &&
  warn "using libfdk without pkg-config"; } }
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame

2024-03-04 Thread Nicolas Gaullier
>De : ffmpeg-devel  De la part de Michael 
>Niedermayer
>Envoyé : dimanche 3 mars 2024 23:07
>À : FFmpeg development discussions and patches 
>Objet : Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from 
>the same frame
>
>On Fri, Mar 01, 2024 at 02:39:19PM +0100, Nicolas Gaullier wrote:
>> The mpegts demuxer splits packets according to its max_packet_size.
>> This currently fills the AVCodecParserContext s->cur_frame_* arrays 
>> with kind of 'empty' entries: no pts/dts.
>> This patch merges these entries, so the parser behaviour is 
>> independent from the demuxer settings.
>> This patch is required for the following patch which will fetch 'past'
>> timestamps from past cur_frames.
>> 
>> Signed-off-by: Nicolas Gaullier 
>> ---
>>  libavcodec/parser.c | 4 
>>  1 file changed, 4 insertions(+)
>
>Breaks fate-seek-lavf-as

Really sorry about that, I was not aware that assert-level=2 had to be enabled 
to get full fate tests.
Maybe this should be documented in the fate.texi.
I also checked the green light on patchwork... It seems at least assert-level=1 
is not supposed to consume too much cpu, so maybe it could be enabled for 
patchwork?

Thank you very much for taking time for this review.
Nicolas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] configure: do not specify -ldvdread, as pkg-config check is already done

2024-03-04 Thread Timo Rothenpieler

applied
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH5] avcodec/codec_par: Reorder AVCodecParameters fields

2024-03-04 Thread James Almer
Move related fields closer together.

Signed-off-by: James Almer 
---
 libavcodec/codec_par.h | 59 +-
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h
index fa6851294f..f4b9bb5c06 100644
--- a/libavcodec/codec_par.h
+++ b/libavcodec/codec_par.h
@@ -72,6 +72,19 @@ typedef struct AVCodecParameters {
  */
 int  extradata_size;
 
+/**
+ * Additional data associated with the entire stream.
+ *
+ * Should be allocated with av_packet_side_data_new() or
+ * av_packet_side_data_add(), and will be freed by 
avcodec_parameters_free().
+ */
+AVPacketSideData *coded_side_data;
+
+/**
+ * Amount of entries in @ref coded_side_data.
+ */
+int nb_coded_side_data;
+
 /**
  * - video: the pixel format, the value corresponds to enum AVPixelFormat.
  * - audio: the sample format, the value corresponds to enum 
AVSampleFormat.
@@ -130,6 +143,18 @@ typedef struct AVCodecParameters {
  */
 AVRational sample_aspect_ratio;
 
+/**
+ * Video only. Number of frames per second, for streams with constant frame
+ * durations. Should be set to { 0, 1 } when some frames have differing
+ * durations or if the value is not known.
+ *
+ * @note This field correponds to values that are stored in codec-level
+ * headers and is typically overridden by container/transport-layer
+ * timestamps, when available. It should thus be used only as a last 
resort,
+ * when no higher-level timing information is available.
+ */
+AVRational framerate;
+
 /**
  * Video only. The order of the fields in interlaced video.
  */
@@ -149,6 +174,10 @@ typedef struct AVCodecParameters {
  */
 int video_delay;
 
+/**
+ * Audio only. The channel layout and number of channels.
+ */
+AVChannelLayout ch_layout;
 /**
  * Audio only. The number of audio samples per second.
  */
@@ -183,36 +212,6 @@ typedef struct AVCodecParameters {
  * Audio only. Number of samples to skip after a discontinuity.
  */
 int seek_preroll;
-
-/**
- * Audio only. The channel layout and number of channels.
- */
-AVChannelLayout ch_layout;
-
-/**
- * Video only. Number of frames per second, for streams with constant frame
- * durations. Should be set to { 0, 1 } when some frames have differing
- * durations or if the value is not known.
- *
- * @note This field correponds to values that are stored in codec-level
- * headers and is typically overridden by container/transport-layer
- * timestamps, when available. It should thus be used only as a last 
resort,
- * when no higher-level timing information is available.
- */
-AVRational framerate;
-
-/**
- * Additional data associated with the entire stream.
- *
- * Should be allocated with av_packet_side_data_new() or
- * av_packet_side_data_add(), and will be freed by 
avcodec_parameters_free().
- */
-AVPacketSideData *coded_side_data;
-
-/**
- * Amount of entries in @ref coded_side_data.
- */
-int nb_coded_side_data;
 } AVCodecParameters;
 
 /**
-- 
2.44.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/avformat: remove AVFormatContext.ts_id

2024-03-04 Thread James Almer
It's been replaced by a demuxer exported private option.

Signed-off-by: James Almer 
---
 libavformat/avformat.h | 6 --
 libavformat/mpegts.c   | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1ae4c37d45..d74db17df1 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1591,12 +1591,6 @@ typedef struct AVFormatContext {
 #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they 
are non negative
 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that 
they start at 0
 
-/**
- * Transport stream id.
- * This will be moved into demuxer private options. Thus no API/ABI 
compatibility
- */
-int ts_id;
-
 /**
  * Audio preload in microseconds.
  * Note, not all formats support this and unpredictable things may happen 
if it is used when not supported.
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index d4fe03bb67..de7a3c8b45 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2561,7 +2561,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len
 
 if (skip_identical(h, tssf))
 return;
-ts->stream->ts_id = ts->id = h->id;
+ts->id = h->id;
 
 for (;;) {
 sid = get16(&p, p_end);
-- 
2.44.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avformat/avformat: Reorder AVFormatContext fields

2024-03-04 Thread James Almer
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_TS0x0001
 
+/**
+ * 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 

[FFmpeg-devel] [PATCH] lavc: move AVCodecContext.pts_correction* to DecodeContext

2024-03-04 Thread James Almer
From: Anton Khirnov 

These fields are documented to be non-public and are only used in
decode.c

Signed-off-by: James Almer 
---
 libavcodec/avcodec.h | 10 --
 libavcodec/decode.c  | 37 ++---
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 035f08a8e0..fb0612ed26 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1860,16 +1860,6 @@ typedef struct AVCodecContext {
  */
 const struct AVCodecDescriptor *codec_descriptor;
 
-/**
- * Current statistics for PTS correction.
- * - decoding: maintained and used by libavcodec, not intended to be used 
by user apps
- * - encoding: unused
- */
-int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values 
so far
-int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values 
so far
-int64_t pts_correction_last_pts;   /// PTS of the last frame
-int64_t pts_correction_last_dts;   /// DTS of the last frame
-
 /**
  * Character encoding of the input subtitles file.
  * - decoding: set by user
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6579c9cbbf..c20b2ebdb3 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -60,6 +60,11 @@ typedef struct DecodeContext {
  * The caller has submitted a NULL packet on input.
  */
 int draining_started;
+
+int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values 
so far
+int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values 
so far
+int64_t pts_correction_last_pts;   /// PTS of the last frame
+int64_t pts_correction_last_dts;   /// DTS of the last frame
 } DecodeContext;
 
 static DecodeContext *decode_ctx(AVCodecInternal *avci)
@@ -240,24 +245,24 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
*pkt)
  * @param dts the dts field of the decoded AVPacket
  * @return one of the input values, may be AV_NOPTS_VALUE
  */
-static int64_t guess_correct_pts(AVCodecContext *ctx,
+static int64_t guess_correct_pts(DecodeContext *dc,
  int64_t reordered_pts, int64_t dts)
 {
 int64_t pts = AV_NOPTS_VALUE;
 
 if (dts != AV_NOPTS_VALUE) {
-ctx->pts_correction_num_faulty_dts += dts <= 
ctx->pts_correction_last_dts;
-ctx->pts_correction_last_dts = dts;
+dc->pts_correction_num_faulty_dts += dts <= 
dc->pts_correction_last_dts;
+dc->pts_correction_last_dts = dts;
 } else if (reordered_pts != AV_NOPTS_VALUE)
-ctx->pts_correction_last_dts = reordered_pts;
+dc->pts_correction_last_dts = reordered_pts;
 
 if (reordered_pts != AV_NOPTS_VALUE) {
-ctx->pts_correction_num_faulty_pts += reordered_pts <= 
ctx->pts_correction_last_pts;
-ctx->pts_correction_last_pts = reordered_pts;
+dc->pts_correction_num_faulty_pts += reordered_pts <= 
dc->pts_correction_last_pts;
+dc->pts_correction_last_pts = reordered_pts;
 } else if(dts != AV_NOPTS_VALUE)
-ctx->pts_correction_last_pts = dts;
+dc->pts_correction_last_pts = dts;
 
-if 
((ctx->pts_correction_num_faulty_pts<=ctx->pts_correction_num_faulty_dts || dts 
== AV_NOPTS_VALUE)
+if ((dc->pts_correction_num_faulty_pts<=dc->pts_correction_num_faulty_dts 
|| dts == AV_NOPTS_VALUE)
&& reordered_pts != AV_NOPTS_VALUE)
 pts = reordered_pts;
 else
@@ -575,6 +580,7 @@ static int decode_simple_receive_frame(AVCodecContext 
*avctx, AVFrame *frame)
 static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
 {
 AVCodecInternal *avci = avctx->internal;
+DecodeContext *dc = decode_ctx(avci);
 const FFCodec *const codec = ffcodec(avctx->codec);
 int ret, ok;
 
@@ -630,7 +636,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
 frame->top_field_first =  !!(frame->flags & 
AV_FRAME_FLAG_TOP_FIELD_FIRST);
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
-frame->best_effort_timestamp = guess_correct_pts(avctx,
+frame->best_effort_timestamp = guess_correct_pts(dc,
  frame->pts,
  frame->pkt_dts);
 
@@ -1672,6 +1678,7 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame 
*frame, int flags)
 int ff_decode_preinit(AVCodecContext *avctx)
 {
 AVCodecInternal *avci = avctx->internal;
+DecodeContext *dc = decode_ctx(avci);
 int ret = 0;
 
 /* if the decoder init function was already called previously,
@@ -1719,10 +1726,10 @@ int ff_decode_preinit(AVCodecContext *avctx)
 }
 }
 
-avctx->pts_correction_num_faulty_pts =
-avctx->pts_correction_num_faulty_dts = 0;
-avctx->pts_correction_last_pts =
-avctx->pts_correction_last_dts = INT64_MIN;
+dc->pts_correction_num_faulty_pts =
+dc->pts_correction_num_faulty_dts = 0;
+dc->pts_correction_last_pts =
+dc->pts

[FFmpeg-devel] [PATCH] fftools/ffprobe: fix printing side data components and pieces

2024-03-04 Thread James Almer
Components and pieces are side data specific fields and there's a variable
amount of them.
They also need to be identified in some form, so print a type too.

Signed-off-by: James Almer 
---
You can see the difference with

ffprobe -show_frames -of compact $fate_samples/mov/dovi-p7.mp4
ffprobe -show_frames -of xml $fate_samples/mov/dovi-p7.mp4

 fftools/ffprobe.c | 33 +++--
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index ac6b92f5d6..d3f27987a0 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -244,6 +244,11 @@ static const char *get_frame_side_data_type(const void 
*data)
 return av_x_if_null(av_frame_side_data_name(sd->type), "unknown");
 }
 
+static const char *get_raw_string_type(const void *data)
+{
+return data;
+}
+
 static struct section sections[] = {
 [SECTION_ID_CHAPTERS] =   { SECTION_ID_CHAPTERS, "chapters", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } },
 [SECTION_ID_CHAPTER] ={ SECTION_ID_CHAPTER, "chapter", 0, { 
SECTION_ID_CHAPTER_TAGS, -1 } },
@@ -258,10 +263,10 @@ static struct section sections[] = {
 [SECTION_ID_FRAME_SIDE_DATA] = { SECTION_ID_FRAME_SIDE_DATA, 
"side_data", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, -1 }, .unique_name = 
"frame_side_data", .element_name = "side_datum", .get_type = 
get_frame_side_data_type },
 [SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST] =  { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, "timecodes", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE, -1 } },
 [SECTION_ID_FRAME_SIDE_DATA_TIMECODE] =   { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, 
{ SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 0, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 0, { -1 } },
+[SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, 
{ SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, .unique_name = 
"frame_side_data_components" },
+[SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 }, .unique_name = 
"frame_side_data_component", .element_name = "component_entry", .get_type = 
get_raw_string_type },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .unique_name = 
"frame_side_data_component_pieces" },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .unique_name = 
"frame_side_data_component_piece", .element_name = "piece_entry", .get_type = 
get_raw_string_type },
 [SECTION_ID_FRAME_LOGS] = { SECTION_ID_FRAME_LOGS, "logs", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_LOG, -1 } },
 [SECTION_ID_FRAME_LOG] =  { SECTION_ID_FRAME_LOG, "log", 0, { -1 
},  },
 [SECTION_ID_LIBRARY_VERSIONS] =   { SECTION_ID_LIBRARY_VERSIONS, 
"library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } },
@@ -2063,14 +2068,30 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 
 for (int c = 0; c < 3; c++) {
 const AVDOVIReshapingCurve *curve = &mapping->curves[c];
-writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
+writer_print_section_header(w, "Reshaping curve", 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
 
 print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, 1, 
curve->pivots[idx]);
 
 writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST);
 for (int i = 0; i < curve->num_pivots - 1; i++) {
+AVBPrint piece_buf;
+
+av_bprint_init(&piece_buf, 1, AV_BPRINT_SIZE_UNLIMITED);
+switch (curve->mapping_idc[i]) {
+case AV_DOVI_MAPPING_POLYNOMIAL:
+av_bprintf(&piece_buf, "Polynomial");
+break;
+case AV_DOVI_MAPPING_MMR:
+av_bprintf(&piece_buf, "MMR");
+break;
+default:
+av_bprintf(&piece_buf, "

Re: [FFmpeg-devel] [PATCH v2 1/6] avcodec: add av_jni_{get, set}_android_app_ctx helper

2024-03-04 Thread Matthieu Bouron
On Mon, Mar 04, 2024 at 05:35:36PM +0100, Matthieu Bouron wrote:
> On Mon, Mar 4, 2024 at 4:11 PM Matthieu Bouron
>  wrote:
> >
> > On Mon, Mar 4, 2024 at 12:29 PM Andreas Rheinhardt
> >  wrote:

[...]

> > >
> > > I am against adding stub functions on platforms where they are known to
> > > be useless, i.e. everything except android.
> >
> > Ok. Will update the patch introducing a new header "jni_android.h".
> > Unless we want to also scope avcodec/jni.h to Android only ?
> 
> Or maybe you mean adding a ifdef guard to it ?
> 

New patch attached. The functions are now only built for Android.

[...]
>From 1b674e78c6a86090f5c9ed6fef5f47ae83ba98be Mon Sep 17 00:00:00 2001
From: Matthieu Bouron 
Date: Mon, 12 Feb 2024 23:13:09 +0100
Subject: [PATCH v3 1/6] avcodec: add av_jni_{get,set}_android_app_ctx helper

This will allow users to pass the Android ApplicationContext which is mandatory
to retrieve the ContentResolver responsible to resolve/open Android content-uri.
---
 libavcodec/jni.c | 42 ++
 libavcodec/jni.h | 17 +
 2 files changed, 59 insertions(+)

diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index ae6490de9d..cfe95bd1ec 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -77,3 +77,45 @@ void *av_jni_get_java_vm(void *log_ctx)
 }
 
 #endif
+
+#if defined(__ANDROID__)
+
+int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx)
+{
+#if CONFIG_JNI
+JNIEnv *env = ff_jni_get_env(log_ctx);
+if (!env)
+return AVERROR(EINVAL);
+
+jobjectRefType type = (*env)->GetObjectRefType(env, app_ctx);
+if (type != JNIGlobalRefType) {
+av_log(log_ctx, AV_LOG_ERROR, "Application context must be passed as a 
global reference");
+return AVERROR(EINVAL);
+}
+
+pthread_mutex_lock(&lock);
+android_app_ctx = app_ctx;
+pthread_mutex_unlock(&lock);
+
+return 0;
+#else
+return AVERROR(ENOSYS);
+#endif
+}
+
+void *av_jni_get_android_app_ctx(void)
+{
+#if CONFIG_JNI
+void *ctx;
+
+pthread_mutex_lock(&lock);
+ctx = android_app_ctx;
+pthread_mutex_unlock(&lock);
+
+return ctx;
+#else
+return NULL;
+#endif
+}
+
+#endif
diff --git a/libavcodec/jni.h b/libavcodec/jni.h
index dd99e92611..da8025f830 100644
--- a/libavcodec/jni.h
+++ b/libavcodec/jni.h
@@ -43,4 +43,21 @@ int av_jni_set_java_vm(void *vm, void *log_ctx);
  */
 void *av_jni_get_java_vm(void *log_ctx);
 
+/*
+ * Set the Android application context which will be used to retrieve the 
Android
+ * content resolver to resolve content uris.
+ *
+ * @param app_ctx global JNI reference to the Android application context
+ * @return 0 on success, < 0 otherwise
+ */
+int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx);
+
+/*
+ * Get the Android application context that has been set with
+ * av_jni_set_android_app_ctx.
+ *
+ * @return a pointer the the Android application context
+ */
+void *av_jni_get_android_app_ctx(void);
+
 #endif /* AVCODEC_JNI_H */
-- 
2.44.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/6] avformat: add Android content resolver protocol support

2024-03-04 Thread Matthieu Bouron
On Tue, Feb 27, 2024 at 03:50:38PM +0100, Matthieu Bouron wrote:
> Handles Android content-uri starting with content://.
> ---

[...]

New patch attached (I moved an unrelated chunk to the previous commit).
>From 6ef059b721c1b1635565cc9e7d836be4733c928d Mon Sep 17 00:00:00 2001
From: Matthieu Bouron 
Date: Mon, 12 Feb 2024 23:14:35 +0100
Subject: [PATCH v3 2/6] avformat: add Android content resolver protocol
 support

Handles Android content-uri starting with content://.
---
 configure   |   2 +
 doc/APIchanges  |   3 +
 libavcodec/jni.c|   1 +
 libavformat/Makefile|   1 +
 libavformat/file.c  | 157 
 libavformat/protocols.c |   1 +
 6 files changed, 165 insertions(+)

diff --git a/configure b/configure
index bb5e630bad..790a1df7c8 100755
--- a/configure
+++ b/configure
@@ -3655,6 +3655,8 @@ xcbgrab_indev_suggest="libxcb_shm libxcb_shape 
libxcb_xfixes"
 xv_outdev_deps="xlib_xv xlib_x11 xlib_xext"
 
 # protocols
+android_content_protocol_deps="jni"
+android_content_protocol_select="file_protocol"
 async_protocol_deps="threads"
 bluray_protocol_deps="libbluray"
 ffrtmpcrypt_protocol_conflict="librtmp_protocol"
diff --git a/doc/APIchanges b/doc/APIchanges
index 10f6667e9e..258e953ca6 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2024-02-xx - xx - lavc 60.41.100 - jni.h
+  Add av_jni_set_android_app_ctx() and av_jni_get_android_app_ctx().
+
 2024-02-26 - xx - lavf 60.22.101 - avformat.h
   AV_DISPOSITION_DEPENDENT may now also be used for video streams
   intended to be merged with other video streams for presentation.
diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index cfe95bd1ec..1193c608c3 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -35,6 +35,7 @@
 #include "ffjni.h"
 
 static void *java_vm;
+static void *android_app_ctx;
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 
 int av_jni_set_java_vm(void *vm, void *log_ctx)
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 4a380668bd..08fe98a535 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -657,6 +657,7 @@ OBJS-$(CONFIG_LIBOPENMPT_DEMUXER)+= libopenmpt.o
 OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER)   += vapoursynth.o
 
 # protocols I/O
+OBJS-$(CONFIG_ANDROID_CONTENT_PROTOCOL)  += file.o
 OBJS-$(CONFIG_ASYNC_PROTOCOL)+= async.o
 OBJS-$(CONFIG_APPLEHTTP_PROTOCOL)+= hlsproto.o
 OBJS-$(CONFIG_BLURAY_PROTOCOL)   += bluray.o
diff --git a/libavformat/file.c b/libavformat/file.c
index 64df7ff6fb..1b2b69f090 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -40,6 +40,12 @@
 #include 
 #include "os_support.h"
 #include "url.h"
+#if CONFIG_ANDROID_CONTENT_PROTOCOL
+#include 
+#include "libavcodec/jni.h"
+#include "libavcodec/ffjni.c"
+#endif
+
 
 /* Some systems may not have S_ISFIFO */
 #ifndef S_ISFIFO
@@ -101,6 +107,21 @@ typedef struct FileContext {
 int64_t initial_pos;
 } FileContext;
 
+
+#if CONFIG_ANDROID_CONTENT_PROTOCOL
+static const AVOption android_content_options[] = {
+{ "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ NULL }
+};
+
+static const AVClass android_content_class = {
+.class_name = "android_content",
+.item_name  = av_default_item_name,
+.option = android_content_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+#endif
+
 static const AVOption file_options[] = {
 { "truncate", "truncate existing files on write", offsetof(FileContext, 
trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
 { "blocksize", "set I/O operation maximum block size", 
offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
@@ -524,3 +545,139 @@ const URLProtocol ff_fd_protocol = {
 };
 
 #endif /* CONFIG_FD_PROTOCOL */
+
+#if CONFIG_ANDROID_CONTENT_PROTOCOL
+
+struct JFields {
+jclass uri_class;
+jmethodID parse_id;
+
+jclass context_class;
+jmethodID get_content_resolver_id;
+
+jclass content_resolver_class;
+jmethodID open_file_descriptor_id;
+
+jclass parcel_file_descriptor_class;
+jmethodID detach_fd_id;
+};
+
+#define OFFSET(x) offsetof(struct JFields, x)
+static const struct FFJniField jfields_mapping[] = {
+{ "android/net/Uri", NULL, NULL, FF_JNI_CLASS, OFFSET(uri_class), 1 },
+{ "android/net/Uri", "parse", "(Ljava/lang/String;)Landroid/net/Uri;", 
FF_JNI_STATIC_METHOD, OFFSET(parse_id), 1 },
+
+{ "android/content/Context", NULL, NULL, FF_JNI_CLASS, 
OFFSET(context_class), 1 },
+{ "android/content/Context", "getContentResolver", 
"()Landroid/content/ContentResolver;", FF_JNI_METHOD, 
OFFSET(get_content_resolver_id), 1 },
+
+{ "android/content/ContentResolver", 

Re: [FFmpeg-devel] [PATCH v2 3/6] avutil/jni: use size_t to store structure offsets

2024-03-04 Thread Andreas Rheinhardt
Matthieu Bouron:
> ---
>  libavcodec/ffjni.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/ffjni.h b/libavcodec/ffjni.h
> index 6027bac0ab..d5894609ed 100644
> --- a/libavcodec/ffjni.h
> +++ b/libavcodec/ffjni.h
> @@ -24,6 +24,7 @@
>  #define AVCODEC_FFJNI_H
>  
>  #include 
> +#include 
>  

stddef.h is the "cheaper" header for size_t.

>  /*
>   * Attach permanently a JNI environment to the current thread and retrieve 
> it.
> @@ -105,7 +106,7 @@ struct FFJniField {
>  const char *method;
>  const char *signature;
>  enum FFJniFieldType type;
> -int offset;
> +size_t offset;
>  int mandatory;
>  
>  };

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options

2024-03-04 Thread Anton Khirnov
Quoting Andreas Rheinhardt (2024-03-04 14:29:59)
> Anton Khirnov:
> > ---
> >  doc/APIchanges|   3 +
> >  libavutil/opt.c   | 362 +-
> >  libavutil/opt.h   |  62 +++-
> >  libavutil/tests/opt.c |  51 ++
> >  tests/ref/fate/opt|  35 +++-
> >  5 files changed, 468 insertions(+), 45 deletions(-)
> > 
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 7d46ebb006..3209614ed6 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 
> > 2023-02-09
> >  
> >  API changes, most recent first:
> >  
> > +2024-02-xx - xx - lavu 58.xx.100 - opt.h
> > +  Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
> > +
> >  2024-02-28 - xx - swr   4.14.100 - swresample.h
> >swr_convert() now accepts arrays of const pointers (to input and output).
> >  
> > diff --git a/libavutil/opt.h b/libavutil/opt.h
> > index e402f6a0a0..77797b3fbe 100644
> > --- a/libavutil/opt.h
> > +++ b/libavutil/opt.h
> > @@ -253,6 +253,17 @@ enum AVOptionType{
> >  #endif
> >  AV_OPT_TYPE_BOOL,
> >  AV_OPT_TYPE_CHLAYOUT,
> > +
> > +/**
> > + * May be combined with another regular option type to declare an array
> > + * option.
> > + *
> > + * For array options, @ref AVOption.offset should refer to a pointer
> > + * corresponding to the option type. The pointer should be immediately
> > + * followed by an unsigned int that will store the number of elements 
> > in the
> > + * array.
> 
> How about we make this actually type-safe and use an actual struct for
> this instead of relying on the compiler not adding padding between a
> pointer and an unsigned int?

A struct containing what exactly?

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [RFC] clarifying the TC conflict of interest rule

2024-03-04 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-03-04 00:36:21)
> [words words]

Again - why do you personally need so many choices? Just one should be
enough. If someone else wants some other choice on the ballot, they
should ask for it.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/29] lavu/opt: add array options

2024-03-04 Thread Marton Balint




On Mon, 4 Mar 2024, Anton Khirnov wrote:


---
doc/APIchanges|   3 +
libavutil/opt.c   | 362 +-
libavutil/opt.h   |  62 +++-
libavutil/tests/opt.c |  51 ++
tests/ref/fate/opt|  35 +++-
5 files changed, 468 insertions(+), 45 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7d46ebb006..3209614ed6 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09

API changes, most recent first:

+2024-02-xx - xx - lavu 58.xx.100 - opt.h
+  Add AV_OPT_TYPE_FLAG_ARRAY and AVOptionArrayDef.
+
2024-02-28 - xx - swr   4.14.100 - swresample.h
  swr_convert() now accepts arrays of const pointers (to input and output).


[...]



diff --git a/libavutil/opt.h b/libavutil/opt.h
index e402f6a0a0..77797b3fbe 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -253,6 +253,17 @@ enum AVOptionType{
#endif
AV_OPT_TYPE_BOOL,
AV_OPT_TYPE_CHLAYOUT,
+
+/**
+ * May be combined with another regular option type to declare an array
+ * option.
+ *
+ * For array options, @ref AVOption.offset should refer to a pointer
+ * corresponding to the option type. The pointer should be immediately
+ * followed by an unsigned int that will store the number of elements in 
the
+ * array.
+ */
+AV_OPT_TYPE_FLAG_ARRAY = (1 << 16),
};

/**
@@ -298,6 +309,46 @@ enum AVOptionType{
 */
#define AV_OPT_FLAG_CHILD_CONSTS(1 << 18)

+/**
+ * Must be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
+ */
+typedef struct AVOptionArrayDef {
+/**
+ * Must be set to sizeof(AVOptionArrayDef), in order to allow extending 
this
+ * struct without breaking ABI.
+ */
+size_t  sizeof_self;
+
+/**
+ * Native access only.
+ *
+ * Default value of the option, as would be serialized by av_opt_get() 
(i.e.
+ * using the value of sep as the separator).
+ */
+const char *def;
+
+/**
+ * Minimum number of elements in the array. When this field is non-zero, 
def
+ * must be non-NULL and contain at least this number of elements.
+ */
+unsignedsize_min;
+/**
+ * Maximum number of elements in the array, 0 when unlimited.
+ */
+unsignedsize_max;
+
+/**
+ * Separator between array elements in string representations of this
+ * option, used by av_opt_set() and av_opt_get(). It must be a printable
+ * ASCII character, excluding alphanumeric and the backslash. A comma is
+ * used when sep=0.
+ *
+ * The separator and the backslash must be backslash-escaped in order to
+ * appear in string representations of the option value.
+ */
+uint8_t sep;
+} AVOptionArrayDef;
+
/**
 * AVOption
 */
@@ -320,8 +371,7 @@ typedef struct AVOption {
enum AVOptionType type;

/**
- * Native access only.
- *
+ * Native access only, except when documented otherwise.
 * the default value for scalar options
 */
union {
@@ -330,6 +380,14 @@ typedef struct AVOption {
const char *str;
/* TODO those are unused now */
AVRational q;
+
+/**
+ * Used for AV_OPT_TYPE_FLAG_ARRAY options. May be NULL.


This contradicts with the documentation of AVOptionArrayDef above, because 
there you write that default_val MUST be set.



+ *
+ * Foreign access to some members allowed, as noted in AVOptionArrayDef
+ * documentation.
+ */
+const AVOptionArrayDef *arr;
} default_val;


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 05/29] lavu/opt: distinguish between native and foreign access for AVOption fields

2024-03-04 Thread Marton Balint




On Mon, 4 Mar 2024, Anton Khirnov wrote:


Native access is from the code that declared the options, foreign access
is from code that is using the options. Forbid foreign access to
AVOption.offset/default_val, for which there is no good reason, and
which should allow us more freedom in extending their semantics in a
compatible way.
---
libavutil/opt.h | 14 ++
1 file changed, 14 insertions(+)

diff --git a/libavutil/opt.h b/libavutil/opt.h
index e34b8506f8..e402f6a0a0 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -43,6 +43,16 @@
 * ("objects"). An option can have a help text, a type and a range of possible
 * values. Options may then be enumerated, read and written to.
 *
+ * There are two modes of access to members of AVOption and its child structs.
+ * One is called 'native access', and refers to access from the code that
+ * declares the AVOption in question.  The other is 'foreign access', and 
refers
+ * to access from other code.
+ *
+ * Certain struct members in this header are documented as 'native access only'
+ * or similar - it means that only the code that declared the AVOption in
+ * question is allowed to access the field. This allows us to extend the
+ * semantics of those fields without breaking API compatibility.
+ *


Changing private/public status of existing fields retrospecitvely can be 
considered an API break.



 * @section avoptions_implement Implementing AVOptions
 * This section describes how to add AVOptions capabilities to a struct.
 *
@@ -301,6 +311,8 @@ typedef struct AVOption {
const char *help;

/**
+ * Native access only.
+ *
 * The offset relative to the context structure where the option
 * value is stored. It should be 0 for named constants.


I don't quite see the reason hiding this. I think it is pretty safe to 
say that its semantics won't change, and getting the offset, adding it to 
the object pointer and directly reading or writing the value is the most 
efficient way to get or set the values. Also there is av_opt_ptr() which 
implicitly returns this anyway. Or you want to fully disallow pointer 
based member access? Some issues would be:

1) for a dictionary type you don't have a getter which does not copy
2) some types simply don't have a native typed getter/setter function
3) if you have multiple object of the same class, when using getters 
there will always be a linear search for the attribute name each time you 
get/set.



 */
@@ -308,6 +320,8 @@ typedef struct AVOption {
enum AVOptionType type;

/**
+ * Native access only.
+ *
 * the default value for scalar options
 */


One could argue that it will be more difficult to get the default value of 
an option (you'd have to create an object, call av_opt_set_defaults() and 
finally do av_opt_get), but what I find more problematic is the 
inconsistency. You are not allowed to access default_val, unless it is an 
array type, in which case you might access it to get array settings, but - 
oh well - not the default value.


In general, we should avoid having public API fields which are in fact 
private. We have existing techniques to really hide those. Considering we 
can always add new option types to define new semantics, I don't really 
think that keeping the existing public API fields public is such a blow.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/9] avformat/avformat: add a function to return the name of stream groups

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
Missing version bump and APIChanges entry.

 libavformat/avformat.c | 10 ++
 libavformat/avformat.h |  5 +
 2 files changed, 15 insertions(+)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index eb898223d2..98dfac2f89 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -321,6 +321,16 @@ AVStream *ff_stream_clone(AVFormatContext *dst_ctx, const 
AVStream *src)
 return st;
 }
 
+const char *avformat_stream_group_name(enum AVStreamGroupParamsType type)
+{
+switch(type) {
+case AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT:return "IAMF Audio 
Element";
+case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: return "IAMF Mix 
Presentation";
+case AV_STREAM_GROUP_PARAMS_TILE_GRID: return "Tile Grid";
+}
+return NULL;
+}
+
 AVProgram *av_new_program(AVFormatContext *ac, int id)
 {
 AVProgram *program = NULL;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f4506f4cf1..c41041b1bc 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2120,6 +2120,11 @@ const AVClass *av_stream_get_class(void);
  */
 const AVClass *av_stream_group_get_class(void);
 
+/**
+ * @return a string identifying the stream group type
+ */
+const char *avformat_stream_group_name(enum AVStreamGroupParamsType type);
+
 /**
  * Add a new empty stream group to a media file.
  *
-- 
2.44.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/9 v2] fftools/ffprobe: fix printing side data components and pieces

2024-03-04 Thread James Almer
Components and pieces are side data specific fields and there's a variable
amount of them.
They also need to be identified in some form, so print a type too.

Signed-off-by: James Almer 
---
 fftools/ffprobe.c | 32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index ac6b92f5d6..8390377159 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -244,6 +244,11 @@ static const char *get_frame_side_data_type(const void 
*data)
 return av_x_if_null(av_frame_side_data_name(sd->type), "unknown");
 }
 
+static const char *get_raw_string_type(const void *data)
+{
+return data;
+}
+
 static struct section sections[] = {
 [SECTION_ID_CHAPTERS] =   { SECTION_ID_CHAPTERS, "chapters", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } },
 [SECTION_ID_CHAPTER] ={ SECTION_ID_CHAPTER, "chapter", 0, { 
SECTION_ID_CHAPTER_TAGS, -1 } },
@@ -258,10 +263,10 @@ static struct section sections[] = {
 [SECTION_ID_FRAME_SIDE_DATA] = { SECTION_ID_FRAME_SIDE_DATA, 
"side_data", SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, -1 }, .unique_name = 
"frame_side_data", .element_name = "side_datum", .get_type = 
get_frame_side_data_type },
 [SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST] =  { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, "timecodes", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE, -1 } },
 [SECTION_ID_FRAME_SIDE_DATA_TIMECODE] =   { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, 
{ SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 0, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 } },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 0, { -1 } },
+[SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, 
{ SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", 
.unique_name = "frame_side_data_components" },
+[SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 }, .unique_name = 
"frame_side_data_component", .element_name = "component_entry", .get_type = 
get_raw_string_type },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece" },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = 
"piece_entry", .get_type = get_raw_string_type },
 [SECTION_ID_FRAME_LOGS] = { SECTION_ID_FRAME_LOGS, "logs", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_LOG, -1 } },
 [SECTION_ID_FRAME_LOG] =  { SECTION_ID_FRAME_LOG, "log", 0, { -1 
},  },
 [SECTION_ID_LIBRARY_VERSIONS] =   { SECTION_ID_LIBRARY_VERSIONS, 
"library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } },
@@ -2063,14 +2068,29 @@ static void print_dovi_metadata(WriterContext *w, const 
AVDOVIMetadata *dovi)
 
 for (int c = 0; c < 3; c++) {
 const AVDOVIReshapingCurve *curve = &mapping->curves[c];
-writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
+writer_print_section_header(w, "Reshaping curve", 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT);
 
 print_list_fmt("pivots", "%"PRIu16, curve->num_pivots, 1, 
curve->pivots[idx]);
 
 writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST);
 for (int i = 0; i < curve->num_pivots - 1; i++) {
+AVBPrint piece_buf;
+
+av_bprint_init(&piece_buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
+switch (curve->mapping_idc[i]) {
+case AV_DOVI_MAPPING_POLYNOMIAL:
+av_bprintf(&piece_buf, "Polynomial");
+break;
+case AV_DOVI_MAPPING_MMR:
+av_bprintf(&piece_buf, "MMR");
+break;
+default:
+av_bprintf(&piece_buf, "Unknown");
+break;
+}
+av_bprintf(&piece_buf, " mapping");
 
-writer_print_section_header(w, NULL, 
SECTION_ID_FRAME_SIDE_DATA_PIECE);
+  

[FFmpeg-devel] [PATCH 3/9 v3] fftools/ffprobe: add support for Stream Groups

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
 Changelog |   1 +
 doc/ffprobe.xsd   |   1 +
 fftools/ffprobe.c | 147 --
 tests/ref/fate/cavs-demux |   2 +-
 tests/ref/fate/ffprobe_compact|   2 +-
 tests/ref/fate/ffprobe_csv|   2 +-
 tests/ref/fate/ffprobe_default|   1 +
 tests/ref/fate/ffprobe_flat   |   1 +
 tests/ref/fate/ffprobe_ini|   1 +
 tests/ref/fate/ffprobe_json   |   1 +
 tests/ref/fate/ffprobe_xml|   2 +-
 tests/ref/fate/ffprobe_xsd|   2 +-
 tests/ref/fate/flv-demux  |   2 +-
 tests/ref/fate/gapless-mp3-side-data  |   2 +-
 .../ref/fate/mov-mp4-disposition-mpegts-remux |   3 +
 tests/ref/fate/mov-mp4-ttml-dfxp  |   3 +
 tests/ref/fate/mov-mp4-ttml-stpp  |   3 +
 tests/ref/fate/oggopus-demux  |   2 +-
 tests/ref/fate/ts-demux   |   2 +-
 tests/ref/fate/ts-opus-demux  |   2 +-
 tests/ref/fate/ts-small-demux |   2 +-
 tests/ref/fate/ts-timed-id3-demux |   2 +-
 22 files changed, 163 insertions(+), 23 deletions(-)

diff --git a/Changelog b/Changelog
index f388d41b02..0ba3a77c08 100644
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,7 @@ version :
 - Change the default bitrate control method from VBR to CQP for QSV encoders.
 - removed deprecated ffmpeg CLI options -psnr and -map_channel
 - DVD-Video demuxer, powered by libdvdnav and libdvdread
+- ffprobe -show_stream_groups option
 
 
 version 6.1:
diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 9490a20ce8..dc04ce7142 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -337,6 +337,7 @@
 
 
 
+
 
 
 
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 8390377159..ff05c4c1db 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -112,8 +112,10 @@ static int do_show_format  = 0;
 static int do_show_frames  = 0;
 static int do_show_packets = 0;
 static int do_show_programs = 0;
+static int do_show_stream_groups = 0;
 static int do_show_streams = 0;
 static int do_show_stream_disposition = 0;
+static int do_show_stream_group_disposition = 0;
 static int do_show_data= 0;
 static int do_show_program_version  = 0;
 static int do_show_library_versions = 0;
@@ -126,6 +128,7 @@ static int do_show_chapter_tags = 0;
 static int do_show_format_tags = 0;
 static int do_show_frame_tags = 0;
 static int do_show_program_tags = 0;
+static int do_show_stream_group_tags = 0;
 static int do_show_stream_tags = 0;
 static int do_show_packet_tags = 0;
 
@@ -159,7 +162,7 @@ static int find_stream_info  = 1;
 
 /* section structure definition */
 
-#define SECTION_MAX_NB_CHILDREN 10
+#define SECTION_MAX_NB_CHILDREN 11
 
 typedef enum {
 SECTION_ID_NONE = -1,
@@ -203,6 +206,14 @@ typedef enum {
 SECTION_ID_PROGRAM_TAGS,
 SECTION_ID_PROGRAM_VERSION,
 SECTION_ID_PROGRAMS,
+SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
+SECTION_ID_STREAM_GROUP_STREAM_TAGS,
+SECTION_ID_STREAM_GROUP,
+SECTION_ID_STREAM_GROUP_STREAMS,
+SECTION_ID_STREAM_GROUP_STREAM,
+SECTION_ID_STREAM_GROUP_DISPOSITION,
+SECTION_ID_STREAM_GROUP_TAGS,
+SECTION_ID_STREAM_GROUPS,
 SECTION_ID_ROOT,
 SECTION_ID_STREAM,
 SECTION_ID_STREAM_DISPOSITION,
@@ -249,6 +260,12 @@ static const char *get_raw_string_type(const void *data)
 return data;
 }
 
+static const char *get_stream_group_type(const void *data)
+{
+const AVStreamGroup *stg = (const AVStreamGroup *)data;
+return av_x_if_null(avformat_stream_group_name(stg->type), "unknown");
+}
+
 static struct section sections[] = {
 [SECTION_ID_CHAPTERS] =   { SECTION_ID_CHAPTERS, "chapters", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_CHAPTER, -1 } },
 [SECTION_ID_CHAPTER] ={ SECTION_ID_CHAPTER, "chapter", 0, { 
SECTION_ID_CHAPTER_TAGS, -1 } },
@@ -290,8 +307,16 @@ static struct section sections[] = {
 [SECTION_ID_PROGRAM_TAGS] =   { SECTION_ID_PROGRAM_TAGS, 
"tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", 
.unique_name = "program_tags" },
 [SECTION_ID_PROGRAM_VERSION] ={ SECTION_ID_PROGRAM_VERSION, 
"program_version", 0, { -1 } },
 [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
"programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
+[SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { 
SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, 
.unique_name = "stream_group_stream_disposition" },
+[SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ 
SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, 
{ -1 }, .element_name = "tag", .unique_name = "stream_group_stream_tags" },
+[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_S

[FFmpeg-devel] [PATCH 4/9 v2] fate/iamf: print stream group information

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/iamf.mak |  8 ++--
 tests/ref/fate/iamf-5_1_4   | 60 +
 tests/ref/fate/iamf-7_1_4   | 68 +
 tests/ref/fate/iamf-ambisonic_1 | 44 +
 tests/ref/fate/iamf-stereo  | 20 ++
 5 files changed, 196 insertions(+), 4 deletions(-)

diff --git a/tests/fate/iamf.mak b/tests/fate/iamf.mak
index 8b0de7f4b2..2257580871 100644
--- a/tests/fate/iamf.mak
+++ b/tests/fate/iamf.mak
@@ -4,7 +4,7 @@ fate-iamf-stereo: SRC = 
$(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-iamf-stereo: CMD = transcode wav $(SRC) iamf " \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/audio_element-stereo \
   -/stream_group 
$(TARGET_PATH)/tests/data/streamgroups/mix_presentation-stereo \
-  -streamid 0:0 -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -c:a flac -t 1" "-c:a copy -map 0" "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_stream=index,id"
 
 FATE_IAMF += fate-iamf-5_1_4
 fate-iamf-5_1_4: tests/data/asynth-44100-10.wav 
tests/data/filtergraphs/iamf_5_1_4 tests/data/streamgroups/audio_element-5_1_4 
tests/data/streamgroups/mix_presentation-5_1_4
@@ -13,7 +13,7 @@ fate-iamf-5_1_4: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters \
   -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/iamf_5_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/audio_element-5_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/mix_presentation-5_1_4 
\
-  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] -map 
[TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] -map 
[TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_stream=index,id"
 
 FATE_IAMF += fate-iamf-7_1_4
 fate-iamf-7_1_4: tests/data/asynth-44100-12.wav 
tests/data/filtergraphs/iamf_7_1_4 tests/data/streamgroups/audio_element-7_1_4 
tests/data/streamgroups/mix_presentation-7_1_4
@@ -22,7 +22,7 @@ fate-iamf-7_1_4: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters \
   -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/iamf_7_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/audio_element-7_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/mix_presentation-7_1_4 
\
-  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -streamid 6:6 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] 
-map [SIDE] -map [TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -streamid 6:6 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] 
-map [SIDE] -map [TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" 
"-show_entries 
stream_group=index,id,nb_streams,type:stream_group_stream=index,id"
 
 FATE_IAMF += fate-iamf-ambisonic_1
 fate-iamf-ambisonic_1: tests/data/asynth-44100-4.wav 
tests/data/filtergraphs/iamf_ambisonic_1 
tests/data/streamgroups/audio_element-ambisonic_1 
tests/data/streamgroups/mix_presentation-ambisonic_1
@@ -31,7 +31,7 @@ fate-iamf-ambisonic_1: CMD = transcode wav $(SRC) iamf 
"-auto_conversion_filters
   -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/iamf_ambisonic_1 \
   -/stream_group 
$(TARGET_PATH)/tests/data/streamgroups/audio_element-ambisonic_1 \
   -/stream_group 
$(TARGET_PATH)/tests/data/streamgroups/mix_presentation-ambisonic_1 \
-  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -map [MONO0] -map 
[MONO1] -map [MONO2] -map [MONO3] -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -map [MONO0] -map 
[MONO1] -map [MONO2] -map [MONO3] -c:a flac -t 1" "-c:a copy -map 0" 
"-show_entries 
stream_group=index,id,nb_streams,type:stream_group_stream=index,id"
 
 FATE_IAMF-$(call TRANSCODE, FLAC, IAMF, WAV_DEMUXER PCM_S16LE_DECODER) += 
$(FATE_IAMF)
 
diff --git a/tests/ref/fate/iamf-5_1_4 b/tests/ref/fate/iamf-5_1_4
index e6eb356ff0..daa9653006 100644
--- a/tests/ref/fate/iamf-5_1_4
+++ b/tests/ref/fate/iamf-5_1_4
@@ -96,3 +96,63 @@ c447cbbc8943cfb751fdf1145a094250 
*tests/data/fate/iamf-5_1_4.iamf
 3,  41472,  41472, 4608,  923, 0xa7225edf
 4,  41472,  41472, 4608,  926, 0xc26a5eae
 5,  41472,  41472, 4608,  926, 0xc26a5eae
+[STREAM_GROUP]
+index=0
+id=0x1
+nb_streams=6
+type=IAMF Audio Element
+[STREAM]
+index=0
+id=0x0
+[/STREAM]
+[STREAM]
+index=1
+id=0x1
+[/STREAM]
+[STREAM]
+index=2
+id=0x2
+[/STREAM]
+[STREAM]
+index=3
+id=0x3
+[/STREAM]
+[STREAM]
+index=4
+id=0x4
+[/STREAM]
+[STREAM]
+index=5
+id=0x5
+[/STREAM]
+[/STREAM_GROUP]
+[STREAM_GROUP]
+index=1
+id=0x2
+nb_streams=6
+

[FFmpeg-devel] [PATCH 5/9 v2] fate/mov: print stream group information for iamf tests

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/mov.mak  |  12 +-
 tests/ref/fate/mov-mp4-iamf-5_1_4   | 318 +
 tests/ref/fate/mov-mp4-iamf-7_1_4   | 362 
 tests/ref/fate/mov-mp4-iamf-ambisonic_1 | 230 +++
 tests/ref/fate/mov-mp4-iamf-stereo  |  98 +++
 5 files changed, 1016 insertions(+), 4 deletions(-)

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 535647c474..de0e654532 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -211,7 +211,8 @@ fate-mov-mp4-iamf-stereo: SRC = 
$(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-mov-mp4-iamf-stereo: CMD = transcode wav $(SRC) mp4 " \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/audio_element-stereo \
   -/stream_group 
$(TARGET_PATH)/tests/data/streamgroups/mix_presentation-stereo \
-  -streamid 0:0 -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -c:a flac -t 1" "-c:a copy -map 0" \
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
 FATE_MOV_FFMPEG-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER PCM_S16LE_DECODER) += 
fate-mov-mp4-iamf-5_1_4
 fate-mov-mp4-iamf-5_1_4: tests/data/asynth-44100-10.wav 
tests/data/filtergraphs/iamf_5_1_4 tests/data/streamgroups/audio_element-5_1_4 
tests/data/streamgroups/mix_presentation-5_1_4
@@ -220,7 +221,8 @@ fate-mov-mp4-iamf-5_1_4: CMD = transcode wav $(SRC) mp4 
"-auto_conversion_filter
   -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/iamf_5_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/audio_element-5_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/mix_presentation-5_1_4 
\
-  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] -map 
[TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] -map 
[TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" \
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
 FATE_MOV_FFMPEG-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER PCM_S16LE_DECODER) += 
fate-mov-mp4-iamf-7_1_4
 fate-mov-mp4-iamf-7_1_4: tests/data/asynth-44100-12.wav 
tests/data/filtergraphs/iamf_7_1_4 tests/data/streamgroups/audio_element-7_1_4 
tests/data/streamgroups/mix_presentation-7_1_4
@@ -229,7 +231,8 @@ fate-mov-mp4-iamf-7_1_4: CMD = transcode wav $(SRC) mp4 
"-auto_conversion_filter
   -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/iamf_7_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/audio_element-7_1_4 \
   -/stream_group $(TARGET_PATH)/tests/data/streamgroups/mix_presentation-7_1_4 
\
-  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -streamid 6:6 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] 
-map [SIDE] -map [TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -streamid 4:4 
-streamid 5:5 -streamid 6:6 -map [FRONT] -map [BACK] -map [CENTER] -map [LFE] 
-map [SIDE] -map [TOP_FRONT] -map [TOP_BACK] -c:a flac -t 1" "-c:a copy -map 0" 
\
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
 FATE_MOV_FFMPEG-$(call TRANSCODE, FLAC, MOV, WAV_DEMUXER PCM_S16LE_DECODER) += 
fate-mov-mp4-iamf-ambisonic_1
 fate-mov-mp4-iamf-ambisonic_1: tests/data/asynth-44100-4.wav 
tests/data/filtergraphs/iamf_ambisonic_1 
tests/data/streamgroups/audio_element-ambisonic_1 
tests/data/streamgroups/mix_presentation-ambisonic_1
@@ -238,7 +241,8 @@ fate-mov-mp4-iamf-ambisonic_1: CMD = transcode wav $(SRC) 
mp4 "-auto_conversion_
   -/filter_complex $(TARGET_PATH)/tests/data/filtergraphs/iamf_ambisonic_1 \
   -/stream_group 
$(TARGET_PATH)/tests/data/streamgroups/audio_element-ambisonic_1 \
   -/stream_group 
$(TARGET_PATH)/tests/data/streamgroups/mix_presentation-ambisonic_1 \
-  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -map [MONO0] -map 
[MONO1] -map [MONO2] -map [MONO3] -c:a flac -t 1" "-c:a copy -map 0"
+  -streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 -map [MONO0] -map 
[MONO1] -map [MONO2] -map [MONO3] -c:a flac -t 1" "-c:a copy -map 0" \
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
 FATE_FFMPEG += $(FATE_MOV_FFMPEG-yes)
 
diff --git a/tests/ref/fate/mov-mp4-iamf-5_1_4 
b/tests/ref/fate/mov-mp4-iamf-5_1_4
index 2f29a83cf4..fde95296eb 100644
--- a/tests/ref/fate/mov-mp4-iamf-5_1_4
+++ b/tests/ref/fate/mov-mp4-iamf-5_1_4
@@ -96,3 +96,321 @@
 3,  4

[FFmpeg-devel] [PATCH 8/9 v2] fate/mov: use framecrc for the remaining avif/heic tests

2024-03-04 Thread James Almer
Put them in sync with the other tests.

Signed-off-by: James Almer 
---
 tests/fate/mov.mak| 21 ++-
 .../fate/mov-avif-demux-still-image-1-item|  8 ++-
 .../mov-avif-demux-still-image-multiple-items |  8 ++-
 .../fate/mov-heic-demux-still-image-1-item|  8 ++-
 .../mov-heic-demux-still-image-multiple-items | 12 ---
 5 files changed, 21 insertions(+), 36 deletions(-)

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 91b71d68b1..f9cc9e14b1 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -143,23 +143,24 @@ fate-mov-mp4-ttml-stpp: CMD = transcode srt 
$(TARGET_SAMPLES)/sub/SubRip_capabil
 fate-mov-mp4-ttml-dfxp: CMD = transcode srt 
$(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml 
-time_base:s 1:1000 -tag:s dfxp -strict unofficial" "-map 0 -c copy" "-of json 
-show_entries 
packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
 
 # avif demuxing - still image with 1 item.
-FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, AV1, AV1_PARSER) \
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMECRC, MOV, AV1, AV1_PARSER) \
+= fate-mov-avif-demux-still-image-1-item
-fate-mov-avif-demux-still-image-1-item: CMD = framemd5 -c:v av1 -i 
$(TARGET_SAMPLES)/avif/still_image.avif -c:v copy
+fate-mov-avif-demux-still-image-1-item: CMD = framecrc -c:v av1 -i 
$(TARGET_SAMPLES)/avif/still_image.avif -c:v copy
 
-# avif demuxing - still image with multiple items. only the primary item will 
be
-# parsed.
-FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, AV1, AV1_PARSER) \
+# avif demuxing - still image with multiple items.
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMECRC, MOV, AV1, AV1_PARSER) \
+= fate-mov-avif-demux-still-image-multiple-items
-fate-mov-avif-demux-still-image-multiple-items: CMD = framemd5 -c:v av1 -i 
$(TARGET_SAMPLES)/avif/still_image_exif.avif -c:v copy
+fate-mov-avif-demux-still-image-multiple-items: CMD = framecrc -c:v av1 -i 
$(TARGET_SAMPLES)/avif/still_image_exif.avif -c:v copy
 
-FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+# heic demuxing - still image with 1 item.
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMECRC, MOV, HEVC, HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-1-item
-fate-mov-heic-demux-still-image-1-item: CMD = framemd5 -i 
$(TARGET_SAMPLES)/heif-conformance/C002.heic -c:v copy
+fate-mov-heic-demux-still-image-1-item: CMD = framecrc -i 
$(TARGET_SAMPLES)/heif-conformance/C002.heic -c:v copy
 
-FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+# heic demuxing - still image with multiple items.
+FATE_MOV_FFMPEG_SAMPLES-$(call FRAMECRC, MOV, HEVC, HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-multiple-items
-fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i 
$(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy -map 0
+fate-mov-heic-demux-still-image-multiple-items: CMD = framecrc -i 
$(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy -map 0
 
 # heic demuxing - still image with multiple items in a grid.
 FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call DEMMUX, MOV, FRAMECRC, HEVC_DECODER 
HEVC_PARSER) \
diff --git a/tests/ref/fate/mov-avif-demux-still-image-1-item 
b/tests/ref/fate/mov-avif-demux-still-image-1-item
index 1ead593caa..0108877d10 100644
--- a/tests/ref/fate/mov-avif-demux-still-image-1-item
+++ b/tests/ref/fate/mov-avif-demux-still-image-1-item
@@ -1,11 +1,7 @@
-#format: frame checksums
-#version: 2
-#hash: MD5
-#extradata 0,   4, b24b71499a8480fa4469bcbcba2140aa
+#extradata 0:4, 0x021c008d
 #tb 0: 1/1
 #media_type 0: video
 #codec_id 0: av1
 #dimensions 0: 352x288
 #sar 0: 0/1
-#stream#, dts,pts, duration, size, hash
-0,  0,  0,1,36265, 235b0c6e389c4084845981e08d60db04
+0,  0,  0,1,36265, 0x6c8c9941
diff --git a/tests/ref/fate/mov-avif-demux-still-image-multiple-items 
b/tests/ref/fate/mov-avif-demux-still-image-multiple-items
index 1ead593caa..0108877d10 100644
--- a/tests/ref/fate/mov-avif-demux-still-image-multiple-items
+++ b/tests/ref/fate/mov-avif-demux-still-image-multiple-items
@@ -1,11 +1,7 @@
-#format: frame checksums
-#version: 2
-#hash: MD5
-#extradata 0,   4, b24b71499a8480fa4469bcbcba2140aa
+#extradata 0:4, 0x021c008d
 #tb 0: 1/1
 #media_type 0: video
 #codec_id 0: av1
 #dimensions 0: 352x288
 #sar 0: 0/1
-#stream#, dts,pts, duration, size, hash
-0,  0,  0,1,36265, 235b0c6e389c4084845981e08d60db04
+0,  0,  0,1,36265, 0x6c8c9941
diff --git a/tests/ref/fate/mov-heic-demux-still-image-1-item 
b/tests/ref/fate/mov-heic-demux-still-image-1-item
index c850c1ff9c..63ee5e492e 100644
--- a/tests/ref/fate/mov-heic-demux-st

[FFmpeg-devel] [PATCH 6/9] fftools/ffprobe: export Tile Grid Stream Group parameters

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
 fftools/ffprobe.c | 41 -
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index ff05c4c1db..e736023bcd 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -209,6 +209,10 @@ typedef enum {
 SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION,
 SECTION_ID_STREAM_GROUP_STREAM_TAGS,
 SECTION_ID_STREAM_GROUP,
+SECTION_ID_STREAM_GROUP_COMPONENTS,
+SECTION_ID_STREAM_GROUP_COMPONENT,
+SECTION_ID_STREAM_GROUP_PIECES,
+SECTION_ID_STREAM_GROUP_PIECE,
 SECTION_ID_STREAM_GROUP_STREAMS,
 SECTION_ID_STREAM_GROUP_STREAM,
 SECTION_ID_STREAM_GROUP_DISPOSITION,
@@ -282,8 +286,8 @@ static struct section sections[] = {
 [SECTION_ID_FRAME_SIDE_DATA_TIMECODE] =   { 
SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
 [SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, 
{ SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 }, .element_name = "component", 
.unique_name = "frame_side_data_components" },
 [SECTION_ID_FRAME_SIDE_DATA_COMPONENT] =  { 
SECTION_ID_FRAME_SIDE_DATA_COMPONENT, "component", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, -1 }, .unique_name = 
"frame_side_data_component", .element_name = "component_entry", .get_type = 
get_raw_string_type },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece" },
-[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = 
"piece_entry", .get_type = get_raw_string_type },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST] =   { 
SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_FRAME_SIDE_DATA_PIECE, -1 }, .element_name = "piece", .unique_name = 
"frame_side_data_pieces" },
+[SECTION_ID_FRAME_SIDE_DATA_PIECE] ={ 
SECTION_ID_FRAME_SIDE_DATA_PIECE, "piece", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = 
"piece_entry", .unique_name = "frame_side_data_piece", .get_type = 
get_raw_string_type },
 [SECTION_ID_FRAME_LOGS] = { SECTION_ID_FRAME_LOGS, "logs", 
SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_LOG, -1 } },
 [SECTION_ID_FRAME_LOG] =  { SECTION_ID_FRAME_LOG, "log", 0, { -1 
},  },
 [SECTION_ID_LIBRARY_VERSIONS] =   { SECTION_ID_LIBRARY_VERSIONS, 
"library_versions", SECTION_FLAG_IS_ARRAY, { SECTION_ID_LIBRARY_VERSION, -1 } },
@@ -309,7 +313,11 @@ static struct section sections[] = {
 [SECTION_ID_PROGRAMS] =   { SECTION_ID_PROGRAMS, 
"programs", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PROGRAM, -1 } },
 [SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION] = { 
SECTION_ID_STREAM_GROUP_STREAM_DISPOSITION, "disposition", 0, { -1 }, 
.unique_name = "stream_group_stream_disposition" },
 [SECTION_ID_STREAM_GROUP_STREAM_TAGS] ={ 
SECTION_ID_STREAM_GROUP_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, 
{ -1 }, .element_name = "tag", .unique_name = "stream_group_stream_tags" },
-[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_STREAM_GROUP, 
"stream_group", SECTION_FLAG_HAS_TYPE, { SECTION_ID_STREAM_GROUP_TAGS, 
SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_STREAMS, -1 }, 
.get_type = get_stream_group_type },
+[SECTION_ID_STREAM_GROUP] ={ SECTION_ID_STREAM_GROUP, 
"stream_group", SECTION_FLAG_HAS_TYPE, { SECTION_ID_STREAM_GROUP_TAGS, 
SECTION_ID_STREAM_GROUP_DISPOSITION, SECTION_ID_STREAM_GROUP_COMPONENTS, 
SECTION_ID_STREAM_GROUP_STREAMS, -1 }, .get_type = get_stream_group_type },
+[SECTION_ID_STREAM_GROUP_COMPONENTS] = { 
SECTION_ID_STREAM_GROUP_COMPONENTS, "components", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_STREAM_GROUP_COMPONENT, -1 }, .element_name = "component", 
.unique_name = "stream_group_components" },
+[SECTION_ID_STREAM_GROUP_COMPONENT] =  { 
SECTION_ID_STREAM_GROUP_COMPONENT, "component", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { 
SECTION_ID_STREAM_GROUP_PIECES, -1 }, .unique_name = "stream_group_component", 
.element_name = "component_entry", .get_type = get_raw_string_type },
+[SECTION_ID_STREAM_GROUP_PIECES] = { 
SECTION_ID_STREAM_GROUP_PIECES, "pieces", SECTION_FLAG_IS_ARRAY, { 
SECTION_ID_STREAM_GROUP_PIECE, -1 }, .element_name = "piece", .unique_name = 
"stream_group_pieces" },
+[SECTION_ID_STREAM_GROUP_PIECE] =  { 
SECTION_ID_STREAM_GROUP_PIECE, "piece", 
SECTION_FLAG_HAS_VARIABLE_FIELDS|SECTION_FLAG_HAS_TYPE, { -1 }, .element_name = 
"piece_entry", .unique_name = "stream_group_piece", .get_type = 
get_raw_string_type },
 [SECTION_ID_STREAM_GROUP_STREAMS]

[FFmpeg-devel] [PATCH 9/9] fate/mov: add a heic test with a derived image using a single item twice

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate/mov.mak|  6 ++
 .../fate/mov-heic-demux-still-image-iovl-2| 73 +++
 2 files changed, 79 insertions(+)
 create mode 100644 tests/ref/fate/mov-heic-demux-still-image-iovl-2

diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index f9cc9e14b1..f56301426f 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -174,6 +174,12 @@ FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call DEMMUX, MOV, 
FRAMECRC, HEVC_DECODER HEVC_
 fate-mov-heic-demux-still-image-iovl: CMD = stream_demux mov 
$(TARGET_SAMPLES)/heif-conformance/C015.heic "" "-c:v copy -map 0:g:0" \
   "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
+# heic demuxing - still image where one image item is laid twice on an overlay 
canvas.
+FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call DEMMUX, MOV, FRAMECRC, HEVC_DECODER 
HEVC_PARSER) \
+   += fate-mov-heic-demux-still-image-iovl-2
+fate-mov-heic-demux-still-image-iovl-2: CMD = stream_demux mov 
$(TARGET_SAMPLES)/heif-conformance/C021.heic "" "-c:v copy -map 0:g:0" \
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
+
 # Resulting remux should have:
 # 1. first audio stream with AV_DISPOSITION_HEARING_IMPAIRED
 # 2. second audio stream with AV_DISPOSITION_VISUAL_IMPAIRED | DESCRIPTIONS
diff --git a/tests/ref/fate/mov-heic-demux-still-image-iovl-2 
b/tests/ref/fate/mov-heic-demux-still-image-iovl-2
new file mode 100644
index 00..d7aff60bf1
--- /dev/null
+++ b/tests/ref/fate/mov-heic-demux-still-image-iovl-2
@@ -0,0 +1,73 @@
+#extradata 0:  100, 0xee3e15e9
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: hevc
+#dimensions 0: 1280x720
+#sar 0: 0/1
+0,  0,  0,1,   111554, 0xa0679859
+[STREAM_GROUP]
+index=0
+id=0x3eb
+nb_streams=1
+type=Tile Grid
+[COMPONENT]
+nb_tiles=2
+coded_width=640
+coded_height=360
+horizontal_offset=0
+vertical_offset=0
+width=640
+height=360
+[PIECE]
+stream_index=0
+tile_horizontal_offset=0
+tile_vertical_offset=0
+[/PIECE]
+[PIECE]
+stream_index=0
+tile_horizontal_offset=64896
+tile_vertical_offset=65176
+[/PIECE]
+[/COMPONENT]
+DISPOSITION:default=0
+DISPOSITION:dub=0
+DISPOSITION:original=0
+DISPOSITION:comment=0
+DISPOSITION:lyrics=0
+DISPOSITION:karaoke=0
+DISPOSITION:forced=0
+DISPOSITION:hearing_impaired=0
+DISPOSITION:visual_impaired=0
+DISPOSITION:clean_effects=0
+DISPOSITION:attached_pic=0
+DISPOSITION:timed_thumbnails=0
+DISPOSITION:non_diegetic=0
+DISPOSITION:captions=0
+DISPOSITION:descriptions=0
+DISPOSITION:metadata=0
+DISPOSITION:dependent=0
+DISPOSITION:still_image=0
+TAG:title=Derived image
+[STREAM]
+index=0
+id=0x3ea
+DISPOSITION:default=1
+DISPOSITION:dub=0
+DISPOSITION:original=0
+DISPOSITION:comment=0
+DISPOSITION:lyrics=0
+DISPOSITION:karaoke=0
+DISPOSITION:forced=0
+DISPOSITION:hearing_impaired=0
+DISPOSITION:visual_impaired=0
+DISPOSITION:clean_effects=0
+DISPOSITION:attached_pic=0
+DISPOSITION:timed_thumbnails=0
+DISPOSITION:non_diegetic=0
+DISPOSITION:captions=0
+DISPOSITION:descriptions=0
+DISPOSITION:metadata=0
+DISPOSITION:dependent=0
+DISPOSITION:still_image=0
+[/STREAM]
+[/STREAM_GROUP]
-- 
2.44.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 7/9 v3] fate/mov: print stream group information for avif/heic tests

2024-03-04 Thread James Almer
Signed-off-by: James Almer 
---
 tests/fate-run.sh |  13 ++
 tests/fate/mov.mak|  12 +-
 .../ref/fate/mov-heic-demux-still-image-grid  | 162 --
 .../ref/fate/mov-heic-demux-still-image-iovl  | 100 ++-
 4 files changed, 263 insertions(+), 24 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 7a7344e645..2de560354f 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -272,6 +272,19 @@ transcode(){
 run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || 
return
 }
 
+stream_demux(){
+src_fmt=$1
+srcfile=$2
+src_opts=$3
+enc_opts=$4
+ffprobe_opts=$5
+tsrcfile=$(target_path $srcfile)
+ffmpeg $DEC_OPTS -f $src_fmt $src_opts -i $tsrcfile $ENC_OPTS $FLAGS 
$enc_opts \
+-f framecrc - || return
+test -z "$ffprobe_opts" || \
+run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tsrcfile || 
return
+}
+
 stream_remux(){
 src_fmt=$1
 srcfile=$2
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index de0e654532..91b71d68b1 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -161,13 +161,17 @@ FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, 
HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-multiple-items
 fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i 
$(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy -map 0
 
-FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+# heic demuxing - still image with multiple items in a grid.
+FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call DEMMUX, MOV, FRAMECRC, HEVC_DECODER 
HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-grid
-fate-mov-heic-demux-still-image-grid: CMD = framemd5 -i 
$(TARGET_SAMPLES)/heif-conformance/C007.heic -c:v copy -map 0:g:0
+fate-mov-heic-demux-still-image-grid: CMD = stream_demux mov 
$(TARGET_SAMPLES)/heif-conformance/C007.heic "" "-c:v copy -map 0:g:0" \
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
-FATE_MOV_FFMPEG_SAMPLES-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \
+# heic demuxing - still image with multiple items in an overlay canvas.
+FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call DEMMUX, MOV, FRAMECRC, HEVC_DECODER 
HEVC_PARSER) \
+= fate-mov-heic-demux-still-image-iovl
-fate-mov-heic-demux-still-image-iovl: CMD = framemd5 -i 
$(TARGET_SAMPLES)/heif-conformance/C015.heic -c:v copy -map 0:g:0
+fate-mov-heic-demux-still-image-iovl: CMD = stream_demux mov 
$(TARGET_SAMPLES)/heif-conformance/C015.heic "" "-c:v copy -map 0:g:0" \
+  "-show_entries 
stream_group=index,id,nb_streams,type:stream_group_components:stream_group_disposition:stream_group_tags:stream_group_stream=index,id:stream_group_stream_disposition"
 
 # Resulting remux should have:
 # 1. first audio stream with AV_DISPOSITION_HEARING_IMPAIRED
diff --git a/tests/ref/fate/mov-heic-demux-still-image-grid 
b/tests/ref/fate/mov-heic-demux-still-image-grid
index 6fde8fff28..5c4092bb09 100644
--- a/tests/ref/fate/mov-heic-demux-still-image-grid
+++ b/tests/ref/fate/mov-heic-demux-still-image-grid
@@ -1,10 +1,7 @@
-#format: frame checksums
-#version: 2
-#hash: MD5
-#extradata 0, 100, 5444bf01e03182c73ae957179d560f4d
-#extradata 1, 100, 5444bf01e03182c73ae957179d560f4d
-#extradata 2, 100, 5444bf01e03182c73ae957179d560f4d
-#extradata 3, 100, 5444bf01e03182c73ae957179d560f4d
+#extradata 0:  100, 0xee3e15e9
+#extradata 1:  100, 0xee3e15e9
+#extradata 2:  100, 0xee3e15e9
+#extradata 3:  100, 0xee3e15e9
 #tb 0: 1/1
 #media_type 0: video
 #codec_id 0: hevc
@@ -25,8 +22,149 @@
 #codec_id 3: hevc
 #dimensions 3: 1280x720
 #sar 3: 0/1
-#stream#, dts,pts, duration, size, hash
-0,  0,  0,1,   111554, 03ceabfab39afd2e2e796b9362111f32
-1,  0,  0,1,   111481, e5db978adbe4de7ee50fe73abc39fcfa
-2,  0,  0,1,   111451, 08700213113cadbb6628ecb8253c1c2a
-3,  0,  0,1,   111353, 5de942e14c848e5e22fad5d88fb13776
+0,  0,  0,1,   111554, 0xa0679859
+1,  0,  0,1,   111481, 0xc5386eaf
+2,  0,  0,1,   111451, 0xdbde88de
+3,  0,  0,1,   111353, 0x26435c8c
+[STREAM_GROUP]
+index=0
+id=0x3f1
+nb_streams=4
+type=Tile Grid
+[COMPONENT]
+nb_tiles=4
+coded_width=2560
+coded_height=1440
+horizontal_offset=0
+vertical_offset=0
+width=2560
+height=1440
+[PIECE]
+stream_index=0
+tile_horizontal_offset=0
+tile_vertical_offset=0
+[/PIECE]
+[PIECE]
+stream_index=1
+tile_horizontal_offset=1280
+tile_vertical_offset=0
+[/PIECE]
+[PIECE]
+stream_index=2
+tile_horizontal_offset=0
+

Re: [FFmpeg-devel] [PATCH 2/3] doc/community: Conflict of interest recusal requirement (Similar to mid part of Antons proposal)

2024-03-04 Thread Michael Niedermayer
On Mon, Mar 04, 2024 at 10:42:02AM +0100, Vittorio Giovara wrote:
> On Mon, Mar 4, 2024 at 1:46 AM Michael Niedermayer 
> wrote:
> 
> > > Again, the effective way to work-around this problem is to keep a large
> > and
> > > diverse enough TC membership to offset the one or few hypothetical
> > dishonest
> > > votes.
> >
> > This doesnt work. The set of people is very specific, and they will always
> > be
> > representatives of the community so when 60% of the community works for
> > companies which would benefit by FFmpeg not competing. There
> > would be no realistic way to have a committee that wasnt also 60% affected
> > by this. And for this we need a clear rule.
> >
> 
> This scenario is, also, not realistic.

that may or may not be,

but rules cannot be applied at the discretion of the person who has
a conflicting interrest against FFmpeg

thx



[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [RFC] clarifying the TC conflict of interest rule

2024-03-04 Thread Michael Niedermayer
On Mon, Mar 04, 2024 at 10:15:31PM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2024-03-04 00:36:21)
> > [words words]
> 
> Again - why do you personally need so many choices? Just one should be
> enough. If someone else wants some other choice on the ballot, they
> should ask for it.

Many people do not speak up,
Also there has not been a real discussion from which i can see what the
community prefers.
I asked you to comment on the patches i posted but you dont want to.

the closest to a discussion where remis replies to my patches
and of course the other proposals for vote options.
if 10 people would reply and state their preferrance and i mean
10 random people not everyone from "one side" of the main disagreement
then i would have a better feeling what people prefer
and assuming that points to one or 2 clear directions then i could
suggest options that are targetet to these oppinions.

But people like boykoting my suggestion for trying to move this
forward first by discussion and consensus. That may fail but its
failure will give us knowledge what needs to be in the vote

So yes, these options are for the people not for me.

Also, extra options do no harm in a condorcet vote, it gives noone
an advanatge. It might just result in a outcome that represents the
will of more people

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [RFC] clarifying the TC conflict of interest rule

2024-03-04 Thread Michael Niedermayer
On Mon, Mar 04, 2024 at 10:45:02AM +0100, Vittorio Giovara wrote:
> On Mon, Mar 4, 2024 at 1:57 AM Michael Niedermayer 
> wrote:
> 
> > On Sun, Mar 03, 2024 at 03:49:33AM +0100, Michael Niedermayer wrote:
> > [...]
> >
> > > +If a TC member is aware of a conflict of interest with regards to the
> > case, they must announce it
> > > +and recuse themselves from the TC discussion and vote.
> >
> > please replace this in my proposal by this (as it clearer states what the
> > intend is)
> >
> > > * If a TC member is aware of being in a conflict of interest with
> > regards to the case, they must announce it
> > > and recuse themselves from the TC discussion and vote.
> >
> > (also as you can see we have active discussions here, the vote is IMHO
> >  premature)
> >
> 
> we literally had premature voting for STF, despite multiple discussions
> taking place during the time

The STF opertunity had a deadline.
Also we can already start discussing what shall be done when the next grant
opertunity comes. I dont know if we will be accepted, so its possible
1. that if we are rejected that we will hear of that narrowly before the
next deadline.
2. there is always the chance for more opertunities, we should be ready
to know what we want next time


> I don't see how a parallel thread here should stop the proposed vote now
> please let's stop filibustering and just move on to voting

voting on what ?

With a simple yes/no vote one can maybe just vote but this is a complex
change to the committee rules about conflict of interrest, who can vote
and who not, if everyone can just flip a coin and decide or if theres
a rule to follow. If members can vote on things they themselves are
involved in, in their own disagreements they have with others.

A discussion allows people to find others points of view, and refine
their own. Its essential even if no consensus is found, dont you agree ?

Iam not blocking the vote btw, i suggested several options for it.
What i think is that a real discussion would make sense before the vote
if no such discussion happens and the vote moves forward with all options
then that will work out too i guess.

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


  1   2   >