[FFmpeg-devel] [PATCH 1/4] avformat/avformat: add a new disposition to signal the stream is an HDR gainmap

2024-09-25 Thread James Almer
HDR images photos taken by certain cameras split this as a separate image.

Signed-off-by: James Almer 
---
 libavformat/avformat.h | 5 +
 libavformat/dump.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 56c1c80289..6d9f5c4399 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -718,6 +718,11 @@ typedef struct AVIndexEntry {
  * Annex G/H, or HEVC Annex F).
  */
 #define AV_DISPOSITION_MULTILAYER   (1 << 21)
+/**
+ * The video stream contains an HDR gainmap. Only ever used with
+ * AV_DISPOSITION_DEPENDENT.
+ */
+#define AV_DISPOSITION_GAINMAP  (1 << 22)
 
 /**
  * @return The AV_DISPOSITION_* flag corresponding to disp or a negative error
diff --git a/libavformat/dump.c b/libavformat/dump.c
index f20c2c4953..5178f19685 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -589,6 +589,8 @@ static void dump_disposition(int disposition, int log_level)
 av_log(NULL, log_level, " (non-diegetic)");
 if (disposition & AV_DISPOSITION_MULTILAYER)
 av_log(NULL, log_level, " (multilayer)");
+if (disposition & AV_DISPOSITION_GAINMAP)
+av_log(NULL, log_level, " (hdr gainmap)");
 }
 
 /* "user interface" functions */
-- 
2.46.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 3/4] avformat/mov: add referenced thumbnail streams to tile stream groups

2024-09-25 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/dump.c |  9 --
 libavformat/isom.h |  3 +-
 libavformat/mov.c  | 71 +++---
 3 files changed, 64 insertions(+), 19 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 5178f19685..ba30b92aaf 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -784,11 +784,16 @@ static void dump_stream_group(const AVFormatContext *ic, 
uint8_t *printed,
 dump_disposition(stg->disposition, AV_LOG_INFO);
 av_log(NULL, AV_LOG_INFO, "\n");
 dump_metadata(NULL, stg->metadata, "", AV_LOG_INFO);
-for (int i = 0; i < stg->nb_streams; i++) {
-const AVStream *st = stg->streams[i];
+for (int i = 0; i < tile_grid->nb_tiles; i++) {
+const AVStream *st = stg->streams[tile_grid->offsets[i].idx];
 dump_stream_format(ic, st->index, i, index, is_output, 
AV_LOG_VERBOSE);
 printed[st->index] = 1;
 }
+for (int i = 0; i < stg->nb_streams; i++) {
+const AVStream *st = stg->streams[i];
+if (!printed[st->index])
+dump_stream_format(ic, st->index, i, index, is_output, 
AV_LOG_VERBOSE);
+}
 break;
 }
 case AV_STREAM_GROUP_PARAMS_LCEVC: {
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 5076bc5da7..1cf69ed042 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -279,6 +279,8 @@ typedef struct HEIFItem {
 AVStream *st;
 char *name;
 int item_id;
+struct HEIFItem **ref_item_list;
+int nb_ref_item_list;
 int64_t extent_length;
 int64_t extent_offset;
 int width;
@@ -360,7 +362,6 @@ typedef struct MOVContext {
 int nb_heif_item;
 HEIFGrid *heif_grid;
 int nb_heif_grid;
-int thmb_item_id;
 int64_t idat_offset;
 int interleaved_read;
 } MOVContext;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index bd502d489a..8a257ba535 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8844,23 +8844,55 @@ static int mov_read_iref_dimg(MOVContext *c, 
AVIOContext *pb, int version)
 return 0;
 }
 
+static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, int version,
+   HEIFItem *from_item)
+{
+HEIFItem **ref_item_list, *to_item = NULL;
+int to_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
+
+for (int j = 0; j < c->nb_heif_item; j++) {
+if (c->heif_item[j].item_id != to_item_id)
+continue;
+to_item = &c->heif_item[j];
+}
+if (!to_item) {
+av_log(c->fc, AV_LOG_ERROR, "thmb in iref references a non-existent 
item\n");
+return AVERROR_INVALIDDATA;
+}
+
+ref_item_list = av_realloc_array(to_item->ref_item_list, 
to_item->nb_ref_item_list + 1U,
+ sizeof(*to_item->ref_item_list));
+if (!ref_item_list)
+return AVERROR(ENOMEM);
+to_item->ref_item_list = ref_item_list;
+to_item->ref_item_list[to_item->nb_ref_item_list++] = from_item;
+
+return 0;
+}
+
 static int mov_read_iref_thmb(MOVContext *c, AVIOContext *pb, int version)
 {
+HEIFItem *from_item = NULL;
 int entries;
-int to_item_id, from_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
+int from_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
 
-entries = avio_rb16(pb);
-if (entries > 1) {
-avpriv_request_sample(c->fc, "thmb in iref referencing several items");
-return AVERROR_PATCHWELCOME;
+for (int i = 0; i < c->nb_heif_item; i++) {
+if (c->heif_item[i].item_id != from_item_id)
+continue;
+from_item = &c->heif_item[i];
+}
+if (!from_item) {
+av_log(c->fc, AV_LOG_ERROR, "thmb in iref references a non-existent 
item\n");
+return AVERROR_INVALIDDATA;
 }
-/* 'to' item ids */
-to_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
-
-if (to_item_id != c->primary_item_id)
-return 0;
 
-c->thmb_item_id = from_item_id;
+entries = avio_rb16(pb);
+/* 'to' item ids */
+for (int i = 0; i < entries; i++) {
+int ret = mov_add_ref_to_item(c, pb, version, from_item);
+if (ret < 0)
+return ret;
+}
 
 av_log(c->fc, AV_LOG_TRACE, "thmb: from_item_id %d, entries %d\n",
from_item_id, entries);
@@ -9718,6 +9750,7 @@ static int mov_read_close(AVFormatContext *s)
 for (i = 0; i < mov->nb_heif_item; i++) {
 av_freep(&mov->heif_item[i].name);
 av_freep(&mov->heif_item[i].aux_type);
+av_freep(&mov->heif_item[i].ref_item_list);
 }
 av_freep(&mov->heif_item);
 for (i = 0; i < mov->nb_heif_grid; i++) {
@@ -10074,6 +10107,17 @@ static int mov_parse_tiles(AVFormatContext *s)
 if (!loop)
 continue;
 
+for (int j = 0; j < grid->item->nb_ref_item_list; j++) {
+AVStream *st = grid->item->ref_item_list[j]->st;
+
+if (!st)
+continue

[FFmpeg-devel] [PATCH 4/4] avformat/mov: support parsing auxl iref type

2024-09-25 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/mov.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8a257ba535..f1274392f3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8844,8 +8844,8 @@ static int mov_read_iref_dimg(MOVContext *c, AVIOContext 
*pb, int version)
 return 0;
 }
 
-static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, int version,
-   HEIFItem *from_item)
+static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, uint32_t type,
+   int version, HEIFItem *from_item)
 {
 HEIFItem **ref_item_list, *to_item = NULL;
 int to_item_id = version ? avio_rb32(pb) : avio_rb16(pb);
@@ -8856,7 +8856,8 @@ static int mov_add_ref_to_item(MOVContext *c, AVIOContext 
*pb, int version,
 to_item = &c->heif_item[j];
 }
 if (!to_item) {
-av_log(c->fc, AV_LOG_ERROR, "thmb in iref references a non-existent 
item\n");
+av_log(c->fc, AV_LOG_ERROR, "%s in iref references a non-existent 
item\n",
+   av_fourcc2str(type));
 return AVERROR_INVALIDDATA;
 }
 
@@ -8870,7 +8871,8 @@ static int mov_add_ref_to_item(MOVContext *c, AVIOContext 
*pb, int version,
 return 0;
 }
 
-static int mov_read_iref_thmb(MOVContext *c, AVIOContext *pb, int version)
+static int mov_read_iref_generic(MOVContext *c, AVIOContext *pb, uint32_t type,
+ int version)
 {
 HEIFItem *from_item = NULL;
 int entries;
@@ -8882,20 +8884,21 @@ static int mov_read_iref_thmb(MOVContext *c, 
AVIOContext *pb, int version)
 from_item = &c->heif_item[i];
 }
 if (!from_item) {
-av_log(c->fc, AV_LOG_ERROR, "thmb in iref references a non-existent 
item\n");
+av_log(c->fc, AV_LOG_ERROR, "%s in iref references a non-existent 
item\n",
+   av_fourcc2str(type));
 return AVERROR_INVALIDDATA;
 }
 
 entries = avio_rb16(pb);
 /* 'to' item ids */
 for (int i = 0; i < entries; i++) {
-int ret = mov_add_ref_to_item(c, pb, version, from_item);
+int ret = mov_add_ref_to_item(c, pb, type, version, from_item);
 if (ret < 0)
 return ret;
 }
 
-av_log(c->fc, AV_LOG_TRACE, "thmb: from_item_id %d, entries %d\n",
-   from_item_id, entries);
+av_log(c->fc, AV_LOG_TRACE, "%s: from_item_id %d, entries %d\n",
+   av_fourcc2str(type), from_item_id, entries);
 
 return 0;
 }
@@ -8924,8 +8927,9 @@ static int mov_read_iref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 case MKTAG('d','i','m','g'):
 mov_read_iref_dimg(c, pb, version);
 break;
+case MKTAG('a','u','x','l'):
 case MKTAG('t','h','m','b'):
-mov_read_iref_thmb(c, pb, version);
+mov_read_iref_generic(c, pb, type, version);
 break;
 default:
 av_log(c->fc, AV_LOG_DEBUG, "Unknown iref type %s size 
%"PRIu32"\n",
-- 
2.46.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] avcodec/ffv1: Implement CRC with -1 initial and final value

2024-09-25 Thread Leo Izen

On 9/25/24 4:06 AM, Michael Niedermayer wrote:

Signed-off-by: Michael Niedermayer 
---
  libavcodec/ffv1.h|  1 +
  libavcodec/ffv1dec.c | 10 ++
  libavcodec/ffv1enc.c | 12 +---
  3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 9aa04529228..06125d2be5f 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -118,6 +118,7 @@ typedef struct FFV1Context {
  int64_t picture_number;
  int key_frame;
  ProgressFrame picture, last_picture;
+int crcref;


Do we require sizeof(int) == 4?
May be more readable to declare this as an int32_t anyway (or even 
uint32_t) to make it more clear that it's a 32-bit value and not a flag, 
especially considering that av_crc takes uint32_t as an argument.



  
  const AVFrame *cur_enc_frame;

  int plane_count;
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 0afdeabd915..2463d2b934e 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -502,15 +502,17 @@ static int read_extra_header(FFV1Context *f)
  
  if (f->version > 2) {

  f->ec = get_symbol(&c, state, 0);
+if (f->ec >= 2)
+f->crcref = -1;


How backward-compatible is this? Or is it not, which is why it needs a 
new version?



  if (f->micro_version > 2)
  f->intra = get_symbol(&c, state, 0);
  }
  
  if (f->version > 2) {

  unsigned v;
-v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0,
+v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref,
 f->avctx->extradata, f->avctx->extradata_size);
-if (v || f->avctx->extradata_size < 4) {
+if (v != f->crcref || f->avctx->extradata_size < 4) {
  av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", v);
  return AVERROR_INVALIDDATA;
  }
@@ -948,8 +950,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
  buf_p -= v;
  
  if (f->ec) {

-unsigned crc = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, 
v);
-if (crc) {
+unsigned crc = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref, 
buf_p, v);


Do we require sizeof(unsigned int) == 4?
Whether or not, it may be more readable to declare crc as a uint32_t



+if (crc != f->crcref) {
  int64_t ts = avpkt->pts != AV_NOPTS_VALUE ? avpkt->pts : 
avpkt->dts;
  av_log(f->avctx, AV_LOG_ERROR, "slice CRC mismatch %X!", crc);
  if (ts != AV_NOPTS_VALUE && avctx->pkt_timebase.num) {
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index a6f405289eb..f4bbdd9b943 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -458,7 +458,7 @@ static int write_extradata(FFV1Context *f)
  }
  
  f->avctx->extradata_size = ff_rac_terminate(&c, 0);

-v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, f->avctx->extradata, 
f->avctx->extradata_size);
+v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref, f->avctx->extradata, 
f->avctx->extradata_size) ^ (f->crcref&0x4964AF46);


Nitpick: should probably be (f->crcref & 0x4964af46), the space makes it 
a bit more readable.



  AV_WL32(f->avctx->extradata + f->avctx->extradata_size, v);
  f->avctx->extradata_size += 4;
  
@@ -544,7 +544,13 @@ static av_cold int encode_init(AVCodecContext *avctx)

  }
  
  if (s->ec < 0) {

-s->ec = (s->version >= 3);
+if (s->version >= 4) {
+s->ec = 2;
+s->crcref = -1;
+} else if (s->version >= 3) {
+s->ec = 1;
+} else
+s->ec = 0;
  }
  
  // CRC requires version 3+

@@ -1230,7 +1236,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
  if (f->ec) {
  unsigned v;
  buf_p[bytes++] = 0;
-v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes);
+v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref, buf_p, bytes) ^ 
(f->crcref&0x4964AF46);


Nitpick: should probably be (f->crcref & 0x4964af46), the space makes it 
a bit more readable.



  AV_WL32(buf_p + bytes, v);
  bytes += 4;
  }


- Leo Izen (Traneptora)


___
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/4] avformat/mov: add support for auxC box

2024-09-25 Thread James Almer
It's used to signal an item is an auxiliary image.

Signed-off-by: James Almer 
---
 libavformat/isom.h |  1 +
 libavformat/mov.c  | 47 +-
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 4723397048..5076bc5da7 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -285,6 +285,7 @@ typedef struct HEIFItem {
 int height;
 int type;
 int is_idat_relative;
+char *aux_type;
 } HEIFItem;
 
 typedef struct HEIFGrid {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a2333ac1fd..bd502d489a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8929,6 +8929,43 @@ static int mov_read_ispe(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 
+static int mov_read_auxc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+AVBPrint bp;
+int64_t size = atom.size;
+char *aux_type;
+int ret;
+
+avio_r8(pb);  /* version */
+avio_rb24(pb);  /* flags */
+size -= 4;
+
+av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED);
+ret = ff_read_string_to_bprint_overwrite(pb, &bp, size);
+if (ret < 0) {
+av_bprint_finalize(&bp, NULL);
+return ret;
+}
+
+size -= ret + 1;
+if (size > 0)
+avio_skip(pb, size);
+
+if (ret)
+av_bprint_finalize(&bp, &aux_type);
+
+av_log(c->fc, AV_LOG_TRACE, "auxC: aux_type %s\n", aux_type);
+
+for (int i = 0; i < c->nb_heif_item; i++) {
+if (c->heif_item[i].item_id == c->cur_item_id) {
+c->heif_item[i].aux_type = aux_type;
+break;
+}
+}
+
+return 0;
+}
+
 static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 typedef struct MOVAtoms {
@@ -9157,6 +9194,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('i','s','p','e'), mov_read_ispe },
 { MKTAG('i','p','r','p'), mov_read_iprp },
 { MKTAG('i','i','n','f'), mov_read_iinf },
+{ MKTAG('a','u','x','C'), mov_read_auxc },
 { MKTAG('a','m','v','e'), mov_read_amve }, /* ambient viewing environment box 
*/
 { MKTAG('l','h','v','C'), mov_read_lhvc },
 { MKTAG('l','v','c','C'), mov_read_glbl },
@@ -9677,8 +9715,10 @@ static int mov_read_close(AVFormatContext *s)
 
 av_freep(&mov->aes_decrypt);
 av_freep(&mov->chapter_tracks);
-for (i = 0; i < mov->nb_heif_item; i++)
+for (i = 0; i < mov->nb_heif_item; i++) {
 av_freep(&mov->heif_item[i].name);
+av_freep(&mov->heif_item[i].aux_type);
+}
 av_freep(&mov->heif_item);
 for (i = 0; i < mov->nb_heif_grid; i++) {
 av_freep(&mov->heif_grid[i].tile_id_list);
@@ -10149,6 +10189,11 @@ static int mov_read_header(AVFormatContext *s)
 if (item->item_id == mov->primary_item_id)
 st->disposition |= AV_DISPOSITION_DEFAULT;
 
+if (item->aux_type &&
+!memcmp(item->aux_type, 
"urn:com:apple:photo:2020:aux:hdrgainmap",
+strlen(item->aux_type)))
+st->disposition |= (AV_DISPOSITION_GAINMAP | 
AV_DISPOSITION_DEPENDENT);
+
 mov_build_index(mov, st);
 }
 
-- 
2.46.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/avformat: add a new disposition to signal the stream is an HDR gainmap

2024-09-25 Thread Anton Khirnov
Quoting James Almer (2024-09-26 00:52:16)
> HDR images photos taken by certain cameras split this as a separate image.
> 
> Signed-off-by: James Almer 
> ---
>  libavformat/avformat.h | 5 +
>  libavformat/dump.c | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 56c1c80289..6d9f5c4399 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -718,6 +718,11 @@ typedef struct AVIndexEntry {
>   * Annex G/H, or HEVC Annex F).
>   */
>  #define AV_DISPOSITION_MULTILAYER   (1 << 21)
> +/**
> + * The video stream contains an HDR gainmap. Only ever used with
> + * AV_DISPOSITION_DEPENDENT.
> + */
> +#define AV_DISPOSITION_GAINMAP  (1 << 22)

Presumably we want this information available in codecs and filters as
well, so then should it not be side data instead?

-- 
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 3/4] avformat/mov: add referenced thumbnail streams to tile stream groups

2024-09-25 Thread Anton Khirnov
> Subject: avformat/mov: add referenced thumbnail streams to tile stream groups

This could use some more explanation.

-- 
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 4/4] avformat/mov: support parsing auxl iref type

2024-09-25 Thread Anton Khirnov
> Subject: avformat/mov: support parsing auxl iref type

This could use some more explanation.

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


[FFmpeg-devel] [PATCH v2] avcodec/videotoolbox: add AV1 hardware acceleration

2024-09-25 Thread Martin Storsjö
From: Jan Ekström 

Use AV1DecContext's current_obu to access the original OBUs, and
feed them to videotoolbox, rather than the bare slice data passed
via decode_slice.

This requires a small addition to AV1DecContext, for keeping track
of the current range of OBUs that belong to the current frame.

Co-authored-by: Ruslan Chernenko 
Co-authored-by: Martin Storsjö 
---
v2: Use current_obu for accessing the original OBUs, rather than
trying to reassemble things from the parts passed via the
start_frame/decode_slice callbacks.

If a packet consists of one frame, we can pass the whole frame
as is, but if it consists of multiple frames, we need to pass
a limited range of OBUs corresponding to each frame at a time.

By passing all OBUs, we end up passing all OBUs to videotoolbox,
including metadata ones that we otherwise handle ourselves.
---
 configure |   4 ++
 libavcodec/Makefile   |   1 +
 libavcodec/av1dec.c   |  18 +-
 libavcodec/av1dec.h   |   1 +
 libavcodec/hwaccels.h |   1 +
 libavcodec/videotoolbox.c |  34 +++
 libavcodec/videotoolbox_av1.c | 104 ++
 libavcodec/vt_internal.h  |   4 ++
 8 files changed, 164 insertions(+), 3 deletions(-)
 create mode 100644 libavcodec/videotoolbox_av1.c

diff --git a/configure b/configure
index d77a55b653..ee4a66a68a 100755
--- a/configure
+++ b/configure
@@ -2461,6 +2461,7 @@ TYPES_LIST="
 kCMVideoCodecType_HEVC
 kCMVideoCodecType_HEVCWithAlpha
 kCMVideoCodecType_VP9
+kCMVideoCodecType_AV1
 kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
 kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange
 kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange
@@ -3166,6 +3167,8 @@ av1_vaapi_hwaccel_deps="vaapi 
VADecPictureParameterBufferAV1_bit_depth_idx"
 av1_vaapi_hwaccel_select="av1_decoder"
 av1_vdpau_hwaccel_deps="vdpau VdpPictureInfoAV1"
 av1_vdpau_hwaccel_select="av1_decoder"
+av1_videotoolbox_hwaccel_deps="videotoolbox"
+av1_videotoolbox_hwaccel_select="av1_decoder"
 av1_vulkan_hwaccel_deps="vulkan"
 av1_vulkan_hwaccel_select="av1_decoder"
 h263_vaapi_hwaccel_deps="vaapi"
@@ -6697,6 +6700,7 @@ enabled videotoolbox && {
 check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC 
"-framework CoreMedia"
 check_func_headers CoreMedia/CMFormatDescription.h 
kCMVideoCodecType_HEVCWithAlpha "-framework CoreMedia"
 check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_VP9 
"-framework CoreMedia"
+check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_AV1 
"-framework CoreMedia"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange "-framework CoreVideo"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a4fcce3b42..21188b2479 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1008,6 +1008,7 @@ OBJS-$(CONFIG_AV1_D3D12VA_HWACCEL)+= dxva2_av1.o 
d3d12va_av1.o
 OBJS-$(CONFIG_AV1_NVDEC_HWACCEL)  += nvdec_av1.o
 OBJS-$(CONFIG_AV1_VAAPI_HWACCEL)  += vaapi_av1.o
 OBJS-$(CONFIG_AV1_VDPAU_HWACCEL)  += vdpau_av1.o
+OBJS-$(CONFIG_AV1_VIDEOTOOLBOX_HWACCEL)   += videotoolbox_av1.o
 OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o
 OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
 OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL)  += videotoolbox.o
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 80e52d1bea..80485fb9c9 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -543,6 +543,7 @@ static int get_pixel_format(AVCodecContext *avctx)
  CONFIG_AV1_NVDEC_HWACCEL + \
  CONFIG_AV1_VAAPI_HWACCEL + \
  CONFIG_AV1_VDPAU_HWACCEL + \
+ CONFIG_AV1_VIDEOTOOLBOX_HWACCEL + \
  CONFIG_AV1_VULKAN_HWACCEL)
 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
 
@@ -570,6 +571,9 @@ static int get_pixel_format(AVCodecContext *avctx)
 #if CONFIG_AV1_VDPAU_HWACCEL
 *fmtp++ = AV_PIX_FMT_VDPAU;
 #endif
+#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL
+*fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
 #if CONFIG_AV1_VULKAN_HWACCEL
 *fmtp++ = AV_PIX_FMT_VULKAN;
 #endif
@@ -594,6 +598,9 @@ static int get_pixel_format(AVCodecContext *avctx)
 #if CONFIG_AV1_VDPAU_HWACCEL
 *fmtp++ = AV_PIX_FMT_VDPAU;
 #endif
+#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL
+*fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
 #if CONFIG_AV1_VULKAN_HWACCEL
 *fmtp++ = AV_PIX_FMT_VULKAN;
 #endif
@@ -1442,7 +1449,9 @@ static int av1_receive_frame_internal(AVCodecContext 
*avctx, AVFrame *frame)
 if (raw_tile_group && (s->tile_num == raw_tile_group

Re: [FFmpeg-devel] [FFmpeg-cvslog] swscale/aarch64: Fix rgb24toyv12 only works with aligned width

2024-09-25 Thread Martin Storsjö

On Wed, 25 Sep 2024, Zhao Zhili wrote:


On Sep 25, 2024, at 16:01, Martin Storsjö  wrote:

On Tue, 24 Sep 2024, Zhao Zhili wrote:


ffmpeg | branch: master | Zhao Zhili  | Wed Sep 18 
21:11:44 2024 +0800| [e18b46d95fadcbaaf450bda9f1871849f2b0c586] | committer: Zhao 
Zhili

swscale/aarch64: Fix rgb24toyv12 only works with aligned width

Since c0666d8b, rgb24toyv12 is broken for width non-aligned to 16.
Add a simple wrapper to handle the non-aligned part.

Co-authored-by: johzzy 
Signed-off-by: Zhao Zhili 


http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e18b46d95fadcbaaf450bda9f1871849f2b0c586

---

libswscale/aarch64/rgb2rgb.c | 23 ++-
tests/checkasm/sw_rgb.c  |  2 +-
2 files changed, 23 insertions(+), 2 deletions(-)
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -129,7 +129,7 @@ static int cmp_off_by_n(const uint8_t *ref, const uint8_t 
*test, size_t n, int a

static void check_rgb24toyv12(struct SwsContext *ctx)
{
-static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, 
-MAX_LINE_SIZE};
+static const int input_sizes[] = {2, 16, 128, 540, MAX_LINE_SIZE, 
-MAX_LINE_SIZE};

   LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
   LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);


These new test cases fail on x86_32; we have got a version of rgb24toyv12 which is specific to 
"#if ARCH_X86_32 && HAVE_7REGS".

Can you have a look?


Sorry for the break. I’m on a short vacation without access to x86_32 
test environment. And I’m not familiar with x86 asm. I’m afraid removing 
the new test is what I can do for now, if that’s an option.


Thanks - yeah I think that's the practically best thing to do at the 
moment. I guess this assembly has existed in this form for a very long 
time already, so while it probably is incorrect for these cases, it 
doesn't seem to be an urgent thing. (But I guess whatever case that was 
noted on aarch64 also would be noted on x86_32?) So silencing the test for 
now probably is simplest, until the assembly can be fixed.


Or we could ifdef out these uneven cases for ARCH_X86_32, but that's also 
kinda ugly...


// Martin
___
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/7] lavfi/buffersink: add a flag for retrieving stream parameters

2024-09-25 Thread James Almer

On 9/25/2024 4:27 PM, Marton Balint wrote:



On Wed, 25 Sep 2024, Nicolas George wrote:


Anton Khirnov (12024-09-25):

Because AVFilterLink is internal state of the filtergraph and should not
be exposed at all.


Anyway, if you cannot come up with an API that does not require dynamic
allocations and all the boilerplate code it requires just to retrieve a
few integers, then drop the series altogether.


I kind of agree. It is suboptimal that the buffersink stores all its 
parameters already in a public struct, but you can only access them if 
you get yourself an owned copy with all the overhead of copying / 
referencing, plus now you have to do extra allocation for the results 
and error checking as well.


Also I don't like that you are misusing an AVFrame struct to pass 
parameters. How the user should know which parameters are set in AVFrame 
and which are not? A dedicated struct would be better, or just use 
AVFilterLink.


There is AVBufferSrcParameters, which could be renamed and reused here. 
Exact same fields, but for the opposite purpose.
It still requires allocating it before using it, but since a normal 
filterchain will have buffersrc -> [...] -> buffersink, the same 
allocated struct can be used for both.


The main benefit i see from doing this is that, much like you don't 
create references/copies for the fields you put in AVBufferSrcParameters 
because av_buffersrc_parameters_set() is what internally will do that, 
buffersink wouldn't need to create references/copies to store anything 
there either, leaving that to the caller (who will be informed the 
fields in the output struct are still owned by the library).




OpenPGP_signature.asc
Description: OpenPGP digital 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] [PATCH] doc: Add email URLs for Fate sample-request

2024-09-25 Thread Martin Schitter




On 25.09.24 21:30, Thilo Borgmann via ffmpeg-devel wrote:

Am 20.09.24 um 02:50 schrieb Martin Schitter:

Because I'm now waiting for one week that someone finally puts my
contributed DNxUncompressed sample files to the Fate sample repo
(see: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2024- 
September/333471.html),

[...]


I see a v6 version not yet ok'd.


Thanks -- In the meanwhile the samples got uploaded and v9 passes all 
tests including the Fate ones.


Also, the complete mail address was hidden for spam reasons when this 
was added IIRC.

You figured it correctly as well.


O.k. -- I see. I was just confused by the fact, that most other service 
addresses and fate-ad...@ffmpeg.org in particular use mailto-links but 
only this one is handled differently.


Martin
___
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] configure: fix passing Objective-C flags

2024-09-25 Thread Marvin Scholz
Passing Objective-C flags from configure to the Makefiles was broken, as
configure incorrectly used the OBJCCFLAGS instead of OBJCFLAGS variable
which was then later overwritten in the common.mak:

  OBJCCFLAGS  = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)

The fix for this is simple, analogous to how it is handled for CFLAGS,
use OBJCFLAGS here so that the flags are properly included in the
aforementioned OBJCCFLAGS definition.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index d77a55b653..0c57dda85b 100755
--- a/configure
+++ b/configure
@@ -8083,7 +8083,7 @@ LN_S=$ln_s
 CPPFLAGS=$CPPFLAGS
 CFLAGS=$CFLAGS
 CXXFLAGS=$CXXFLAGS
-OBJCCFLAGS=$OBJCFLAGS
+OBJCFLAGS=$OBJCFLAGS
 ASFLAGS=$ASFLAGS
 NVCCFLAGS=$nvccflags
 AS_C=$AS_C

base-commit: 10b3edbe24c403973b7910054f104eeef5909707
-- 
2.39.3 (Apple Git-146)


___
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] configure: allow mixed declarations and code for Objective-C

2024-09-25 Thread Marvin Scholz
Mixing declarations and code is quite common in Objective-C (as can be
seen by the number of warnings we have for this in Objective-C files)
and forcing to not do it usually results in worse code, with unnecessary
widely scoped variables, which in turn makes variable shadowing and
accidentally using the wrong variable more common and harder to notice.
---
 configure | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure b/configure
index 0c57dda85b..f630470b68 100755
--- a/configure
+++ b/configure
@@ -7445,6 +7445,10 @@ check_disable_warning -Wno-unused-const-variable
 check_disable_warning -Wno-bool-operation
 check_disable_warning -Wno-char-subscripts
 
+# Disable mixed decl and code warning for Objective-C
+test_objcflags $unknown_warning_flags '-Wdeclaration-after-statement' &&
+add_objcflags '-Wno-declaration-after-statement'
+
 check_disable_warning_headers(){
 warning_flag=-W${1#-Wno-}
 test_cflags $warning_flag && add_cflags_headers $1
-- 
2.39.3 (Apple Git-146)
___
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: add an LCEVC merger bsf

2024-09-25 Thread Anton Khirnov
Missing documentation.

-- 
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 6/7] avcodec/get_bits: dont add a null to a 0

2024-09-25 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-09-23 23:32:48)
> Fixes: undefined behavior
> Fixes: 
> 71747/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5427736120721408

Seems like a bug for a decoder to call init_get_bits() with a NULL
buffer.

-- 
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] doc: Add email URLs for Fate sample-request

2024-09-25 Thread Thilo Borgmann via ffmpeg-devel

Am 20.09.24 um 02:50 schrieb Martin Schitter:

Because I'm now waiting for one week that someone finally puts my
contributed DNxUncompressed sample files to the Fate sample repo
(see: 
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333471.html),
[...]


I see a v6 version not yet ok'd.

Also, the complete mail address was hidden for spam reasons when this was added 
IIRC.
You figured it correctly as well.

-Thilo
___
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] MAINTAINERS: update myself for dvdvideo, rcwtdec, rcwtenc

2024-09-25 Thread Marth64
I plan to look after and test them for the forseeable future.
I am not a committer but do care for these muxers/demuxers.

Signed-off-by: Marth64 
---
 MAINTAINERS | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 76651d5ff8..65fd9d6e86 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -391,7 +391,7 @@ Muxers/Demuxers:
   dss.c Oleksij Rempel
   dtsdec.c  foo86
   dv.c  Roman Shaposhnik
-  dvdvideodec.c Marth64
+  dvdvideodec.c [2] Marth64
   electronicarts.c  Peter Ross
   evc*  Samsung (Dawid Kozinski)
   ffm*  Baptiste Coudurier
@@ -445,7 +445,8 @@ Muxers/Demuxers:
   pva.c Ivo van Poorten
   r3d.c Baptiste Coudurier
   raw.c Michael Niedermayer
-  rcwtenc.c Marth64
+  rcwtdec.c [2] Marth64
+  rcwtenc.c [2] Marth64
   rdt.c Ronald S. Bultje
   rl2.c Sascha Sommer
   rmdec.c, rmenc.c  Ronald S. Bultje
-- 
2.39.5 (Apple Git-154)

___
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/2] avformat/utils: added av_get_frame_filename3() (changed parameter int -> int64_t)

2024-09-25 Thread Filip Mašić
On Wed, 25 Sept 2024 at 09:59, Marton Balint  wrote:

> In general AVBPrint based API for functions like this is preferred to
> discuourage users from limiting the filenames to a fixed size (which
> usually becomes a limitation sooner or later).
>
> E.g: av_get_frame_filename_bprint()
>
> Regards,
> Marton
>

Currently, this patch to reimplement the function internally is preferred:
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333854.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-September/333857.html

That's because it's been suggested by a maintainer and doesn't change the
API/ABI so we can pray it will be merged into the upcoming release and the
bug it was written for finally fixed.

Regarding the API, I don't know what purpose the function serves externally
but in my patch, I did attempt to deprecate all the previous API functions,
so you're welcome to extend it from there and make the replacement
interface use AVBPrint (idk much about that). I'm only interested in the
bugfix I mentioned.

Thanks for your interest in this patch :)
___
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/videotoolbox: add AV1 hardware acceleration

2024-09-25 Thread Martin Storsjö

On Tue, 24 Sep 2024, Cameron Gutman wrote:


On Tue, Sep 24, 2024 at 7:16 AM Martin Storsjö  wrote:


I don't hit any issues with any AV1 samples that I have, I guess I don't
have any samples with tile groups?

Can you or someone else grab and share a small sample of a stream that
fails to decode with this hwaccel, so we have a chance to debug it?



Sure, here's a raw AV1 bitstream sample that should exhibit the issue:
https://drive.google.com/file/d/1rp_O6pedhBYhDWFRuBCGTG1tfpNvtgrR/view


Thanks! I can indeed reproduce the issue with this sample.

// Martin
___
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 v3 1/2] avformat/utils: added av_get_frame_filename3() (changed parameter int -> int64_t)

2024-09-25 Thread Marton Balint



On Mon, 23 Sep 2024, Filip Mašić wrote:


Resolves an integer overflow with the frame_pts option (issue 11194).

Signed-off-by: Filip Mašić 
---
doc/APIchanges |  3 +++
libavformat/avformat.h |  7 +--
libavformat/img2enc.c  |  6 ++
libavformat/utils.c| 12 +---
libavformat/version.h  |  2 +-
5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 81537fea09..9f091f5ec5 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07

API changes, most recent first:

+2024-09-xx - xx - lavf 61.7.100 - avformat.h
+  Add av_get_frame_filename3()
+
2024-09-18 - xx - lavc 61.17.100 - packet.h
  Add AV_PKT_DATA_LCEVC.

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 56c1c80289..1bc0e716dc 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2932,11 +2932,14 @@ void av_dump_format(AVFormatContext *ic,
 *
 * @param buf destination buffer
 * @param buf_size destination buffer size
- * @param path numbered sequence string
- * @param number frame number
+ * @param path path with substitution template
+ * @param number the number to substitute
 * @param flags AV_FRAME_FILENAME_FLAGS_*
 * @return 0 if OK, -1 on format error
 */
+int av_get_frame_filename3(char *buf, int buf_size,
+  const char *path, int64_t number, int flags);
+


In general AVBPrint based API for functions like this is preferred to 
discuourage users from limiting the filenames to a fixed size (which 
usually becomes a limitation sooner or later).


E.g: av_get_frame_filename_bprint()

Regards,
Marton


int av_get_frame_filename2(char *buf, int buf_size,
  const char *path, int number, int flags);

diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 526a11e5ee..460e6a38bd 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -160,13 +160,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL);
}
} else if (img->frame_pts) {
-if (av_get_frame_filename2(filename, sizeof(filename), s->url, pkt->pts, 
AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
+if (av_get_frame_filename3(filename, sizeof(filename), s->url, pkt->pts, 
AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
av_log(s, AV_LOG_ERROR, "Cannot write filename by pts of the 
frames.");
return AVERROR(EINVAL);
}
-} else if (av_get_frame_filename2(filename, sizeof(filename), s->url,
-  img->img_number,
-  AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
+} else if (av_get_frame_filename3(filename, sizeof(filename), s->url, 
img->img_number, AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) {
if (img->img_number == img->start_img_number) {
av_log(s, AV_LOG_WARNING, "The specified filename '%s' does not contain an 
image sequence pattern or a pattern is invalid.\n", s->url);
av_log(s, AV_LOG_WARNING,
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e9ded627ad..0a7ed1a013 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -19,6 +19,7 @@
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

+#include 
#include 

#include "config.h"
@@ -280,7 +281,7 @@ uint64_t ff_parse_ntp_time(uint64_t ntp_ts)
return (sec * 100) + usec;
}

-int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
number, int flags)
+int av_get_frame_filename3(char *buf, int buf_size, const char *path, int64_t 
number, int flags)
{
const char *p;
char *q, buf1[20], c;
@@ -313,7 +314,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const 
char *path, int number
percentd_found = 1;
if (number < 0)
nd += 1;
-snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
+snprintf(buf1, sizeof(buf1), "%0*"PRId64, nd, number);
len = strlen(buf1);
if ((q - buf + len) > buf_size - 1)
goto fail;
@@ -338,9 +339,14 @@ fail:
return -1;
}

+int av_get_frame_filename2(char *buf, int buf_size, const char *path, int 
number, int flags)
+{
+return av_get_frame_filename3(buf, buf_size, path, number, flags);
+}
+
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
{
-return av_get_frame_filename2(buf, buf_size, path, number, 0);
+return av_get_frame_filename3(buf, buf_size, path, number, 0);
}

void av_url_split(char *proto, int proto_size,
diff --git a/libavformat/version.h b/libavformat/version.h
index 4bde82abb4..70c554c19c 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@

#include "version_major.h"

-#define LIBAVFORMAT_VERSION_MINOR   6
+#define LIBAVFORMAT_VERSION_MINOR   7
#define LIBAVFORMAT_VERSION_MICRO 100

#define L

Re: [FFmpeg-devel] [PATCH 2/7] lavfi/buffersink: add a flag for retrieving stream parameters

2024-09-25 Thread Marton Balint




On Mon, 23 Sep 2024, Anton Khirnov wrote:


This way, av_buffersink_get_frame_flags() can replace almost all
av_buffersink_get_*(), including some future parameters we will want to
export.


Why don't you simply expose the AVFilterLink which contains all the 
parameters of the sink? That seems a lot cleaner.


Thanks,
Marton



---
doc/APIchanges   |  1 +
libavfilter/buffersink.c | 47 
libavfilter/buffersink.h | 16 --
3 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b392c756d7..5ddd7189f8 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -4,6 +4,7 @@ API changes, most recent first:

2024-09-xx - xx - lavfi 10.4.100
  Buffersink now sets AVFrame.time_base on the frames it outputs.
+  Add AV_BUFFERSINK_FLAG_PARAMS.

2024-09-23 - xx - lavc 61.18.100 - avcodec.h
  Add a new flag AV_CODEC_EXPORT_DATA_ENHANCEMENTS for export_side_data.
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 575075ff47..d9cd074f17 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -128,8 +128,55 @@ static int get_frame_internal(AVFilterContext *ctx, 
AVFrame *frame, int flags, i
}
}

+static int get_frame_params(AVFilterContext *ctx, AVFrame *frame)
+{
+FilterLink *l = ff_filter_link(ctx->inputs[0]);
+int ret = 0;
+
+frame->time_base = l->pub.time_base;
+frame->format= l->pub.format;
+
+switch (l->pub.type) {
+case AVMEDIA_TYPE_AUDIO:
+ret = av_channel_layout_copy(&frame->ch_layout, &l->pub.ch_layout);
+if (ret < 0)
+goto fail;
+
+frame->sample_rate  = l->pub.sample_rate;
+break;
+case AVMEDIA_TYPE_VIDEO:
+frame->width= l->pub.w;
+frame->height   = l->pub.h;
+frame->sample_aspect_ratio  = l->pub.sample_aspect_ratio;
+frame->colorspace   = l->pub.colorspace;
+frame->color_range  = l->pub.color_range;
+break;
+default: av_assert0(0);
+}
+
+if (l->hw_frames_ctx) {
+frame->hw_frames_ctx = av_buffer_ref(l->hw_frames_ctx);
+if (!frame->hw_frames_ctx) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+}
+
+return 0;
+fail:
+av_frame_unref(frame);
+return ret;
+}
+
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, 
AVFrame *frame, int flags)
{
+if (flags & AV_BUFFERSINK_FLAG_PARAMS) {
+if (flags & ~AV_BUFFERSINK_FLAG_PARAMS)
+return AVERROR(EINVAL);
+
+return get_frame_params(ctx, frame);
+}
+
return get_frame_internal(ctx, frame, flags,
  ff_filter_link(ctx->inputs[0])->min_samples);
}
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 361d603679..9c4468af5b 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -87,14 +87,26 @@ int av_buffersink_get_frame_flags(AVFilterContext *ctx, 
AVFrame *frame, int flag
 * reference, but not remove it from the buffer. This is useful if you
 * need only to read a video/samples buffer, without to fetch it.
 */
-#define AV_BUFFERSINK_FLAG_PEEK 1
+#define AV_BUFFERSINK_FLAG_PEEK (1 << 0)

/**
 * Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
 * If a frame is already buffered, it is read (and removed from the buffer),
 * but if no frame is present, return AVERROR(EAGAIN).
 */
-#define AV_BUFFERSINK_FLAG_NO_REQUEST 2
+#define AV_BUFFERSINK_FLAG_NO_REQUEST   (1 << 1)
+
+/**
+ * Retrieve stream parameters rather than frame data.
+ *
+ * When this flag is set, av_buffersink_get_frame_flags() fills the non-data
+ * fields of the supplied frame without causing any filtergraph activity.
+ *
+ * @note While frame data will be NULL, certain other allocated fields may be
+ * filled (e.g. ch_layout, hw_frames_ctx), so the frame should still be
+ * unreffed before reuse.
+ */
+#define AV_BUFFERSINK_FLAG_PARAMS   (1 << 2)

/**
 * Set the frame size for an audio buffer sink.
--
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 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] FFmpeg 6.1.2 about vulkan h264 video decode

2024-09-25 Thread Wonskuis Yu(SH-RD)
Hi,

   When I use ffmpeg 6.1.2 to do transcode as flow cmd: ffmpeg.exe 
�Chwaccel vulkan �CI H264-4k.mp4 output.mp4

The assert of null pointer occur, after debug source code, I found the pointer 
of layered_frame is null, because it doesn’t created.

Further, I found it only be created when dec->dedicated_dpb && dec->layered_dpb 
are all true.
But the driver report caps only include 
VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR,
not include VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR, it leads the 
layered_frame can’t be created.
For this combination of driver caps, I think it means the reference frame and 
output use the same image resource , the ffmpeg should create layered_frame as 
array?
I’m confused whether It’s the driver issue or not?

Thanks,
WonskuisYu



保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.
___
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 3/4] avcodec/ffv1enc: Fix >8bit context size

2024-09-25 Thread Michael Niedermayer
On Wed, Sep 25, 2024 at 12:24:10AM +0200, Michael Niedermayer wrote:
> Fixes: Ticket5405
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/ffv1enc.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)

will apply

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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] [PATCH 1/4] avcodec/ffv1dec: Blow up if user asks for explosion

2024-09-25 Thread Michael Niedermayer
On Wed, Sep 25, 2024 at 12:24:08AM +0200, Michael Niedermayer wrote:
> Fixes: Ticket8403
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/ffv1dec.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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] [FFmpeg-cvslog] swscale/aarch64: Fix rgb24toyv12 only works with aligned width

2024-09-25 Thread Martin Storsjö

On Tue, 24 Sep 2024, Zhao Zhili wrote:


ffmpeg | branch: master | Zhao Zhili  | Wed Sep 18 
21:11:44 2024 +0800| [e18b46d95fadcbaaf450bda9f1871849f2b0c586] | committer: Zhao 
Zhili

swscale/aarch64: Fix rgb24toyv12 only works with aligned width

Since c0666d8b, rgb24toyv12 is broken for width non-aligned to 16.
Add a simple wrapper to handle the non-aligned part.

Co-authored-by: johzzy 
Signed-off-by: Zhao Zhili 


http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e18b46d95fadcbaaf450bda9f1871849f2b0c586

---

libswscale/aarch64/rgb2rgb.c | 23 ++-
tests/checkasm/sw_rgb.c  |  2 +-
2 files changed, 23 insertions(+), 2 deletions(-)

--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -129,7 +129,7 @@ static int cmp_off_by_n(const uint8_t *ref, const uint8_t 
*test, size_t n, int a

static void check_rgb24toyv12(struct SwsContext *ctx)
{
-static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, 
-MAX_LINE_SIZE};
+static const int input_sizes[] = {2, 16, 128, 540, MAX_LINE_SIZE, 
-MAX_LINE_SIZE};

LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);


These new test cases fail on x86_32; we have got a version of 
rgb24toyv12 which is specific to "#if ARCH_X86_32 && HAVE_7REGS".


Can you have a look?

// Martin

___
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] avcodec/ffv1: Implement CRC with -1 initial and final value

2024-09-25 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/ffv1.h|  1 +
 libavcodec/ffv1dec.c | 10 ++
 libavcodec/ffv1enc.c | 12 +---
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 9aa04529228..06125d2be5f 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -118,6 +118,7 @@ typedef struct FFV1Context {
 int64_t picture_number;
 int key_frame;
 ProgressFrame picture, last_picture;
+int crcref;
 
 const AVFrame *cur_enc_frame;
 int plane_count;
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 0afdeabd915..2463d2b934e 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -502,15 +502,17 @@ static int read_extra_header(FFV1Context *f)
 
 if (f->version > 2) {
 f->ec = get_symbol(&c, state, 0);
+if (f->ec >= 2)
+f->crcref = -1;
 if (f->micro_version > 2)
 f->intra = get_symbol(&c, state, 0);
 }
 
 if (f->version > 2) {
 unsigned v;
-v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0,
+v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref,
f->avctx->extradata, f->avctx->extradata_size);
-if (v || f->avctx->extradata_size < 4) {
+if (v != f->crcref || f->avctx->extradata_size < 4) {
 av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", v);
 return AVERROR_INVALIDDATA;
 }
@@ -948,8 +950,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
 buf_p -= v;
 
 if (f->ec) {
-unsigned crc = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, 
v);
-if (crc) {
+unsigned crc = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref, 
buf_p, v);
+if (crc != f->crcref) {
 int64_t ts = avpkt->pts != AV_NOPTS_VALUE ? avpkt->pts : 
avpkt->dts;
 av_log(f->avctx, AV_LOG_ERROR, "slice CRC mismatch %X!", crc);
 if (ts != AV_NOPTS_VALUE && avctx->pkt_timebase.num) {
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index a6f405289eb..f4bbdd9b943 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -458,7 +458,7 @@ static int write_extradata(FFV1Context *f)
 }
 
 f->avctx->extradata_size = ff_rac_terminate(&c, 0);
-v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, f->avctx->extradata, 
f->avctx->extradata_size);
+v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref, 
f->avctx->extradata, f->avctx->extradata_size) ^ (f->crcref&0x4964AF46);
 AV_WL32(f->avctx->extradata + f->avctx->extradata_size, v);
 f->avctx->extradata_size += 4;
 
@@ -544,7 +544,13 @@ static av_cold int encode_init(AVCodecContext *avctx)
 }
 
 if (s->ec < 0) {
-s->ec = (s->version >= 3);
+if (s->version >= 4) {
+s->ec = 2;
+s->crcref = -1;
+} else if (s->version >= 3) {
+s->ec = 1;
+} else
+s->ec = 0;
 }
 
 // CRC requires version 3+
@@ -1230,7 +1236,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 if (f->ec) {
 unsigned v;
 buf_p[bytes++] = 0;
-v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes);
+v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), f->crcref, buf_p, 
bytes) ^ (f->crcref&0x4964AF46);
 AV_WL32(buf_p + bytes, v);
 bytes += 4;
 }
-- 
2.46.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] [FFmpeg-cvslog] swscale/aarch64: Fix rgb24toyv12 only works with aligned width

2024-09-25 Thread Zhao Zhili


> On Sep 25, 2024, at 16:01, Martin Storsjö  wrote:
> 
> On Tue, 24 Sep 2024, Zhao Zhili wrote:
> 
>> ffmpeg | branch: master | Zhao Zhili  | Wed Sep 18 
>> 21:11:44 2024 +0800| [e18b46d95fadcbaaf450bda9f1871849f2b0c586] | committer: 
>> Zhao Zhili
>> 
>> swscale/aarch64: Fix rgb24toyv12 only works with aligned width
>> 
>> Since c0666d8b, rgb24toyv12 is broken for width non-aligned to 16.
>> Add a simple wrapper to handle the non-aligned part.
>> 
>> Co-authored-by: johzzy 
>> Signed-off-by: Zhao Zhili 
>> 
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e18b46d95fadcbaaf450bda9f1871849f2b0c586
>> ---
>> 
>> libswscale/aarch64/rgb2rgb.c | 23 ++-
>> tests/checkasm/sw_rgb.c  |  2 +-
>> 2 files changed, 23 insertions(+), 2 deletions(-)
>> --- a/tests/checkasm/sw_rgb.c
>> +++ b/tests/checkasm/sw_rgb.c
>> @@ -129,7 +129,7 @@ static int cmp_off_by_n(const uint8_t *ref, const 
>> uint8_t *test, size_t n, int a
>> 
>> static void check_rgb24toyv12(struct SwsContext *ctx)
>> {
>> -static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, 
>> -MAX_LINE_SIZE};
>> +static const int input_sizes[] = {2, 16, 128, 540, MAX_LINE_SIZE, 
>> -MAX_LINE_SIZE};
>> 
>>LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
>>LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);
> 
> These new test cases fail on x86_32; we have got a version of rgb24toyv12 
> which is specific to "#if ARCH_X86_32 && HAVE_7REGS".
> 
> Can you have a look?

Sorry for the break. I’m on a short vacation without access to x86_32 test 
environment. And
I’m not familiar with x86 asm. I’m afraid removing the new test is what I can 
do for now, if
that’s an option.

> 
> // Martin
> 
> ___
> 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] MAINTAINERS: remove libopenjpeg decoder entry

2024-09-25 Thread Gyan Doshi
The decoder wrapper was removed in 60ccb3fe78
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 76651d5ff8..c968fc765c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -206,7 +206,6 @@ Codecs:
   libgsm.c  Michel Bardiaux
   libkvazaar.c  Arttu Ylä-Outinen
   libopenh264enc.c  Martin Storsjo, Linjie Fu
-  libopenjpeg.c Jaikrishnan Menon
   libopenjpegenc.c  Michael Bradshaw
   libtheoraenc.cDavid Conrad
   libvorbis.c   David Conrad
-- 
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 06/22] lavfi/asrc_hilbert: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_hilbert.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/asrc_hilbert.c b/libavfilter/asrc_hilbert.c
index e38af7123b..3cf5e8728e 100644
--- a/libavfilter/asrc_hilbert.c
+++ b/libavfilter/asrc_hilbert.c
@@ -75,7 +75,9 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_freep(&s->taps);
 }
 
-static av_cold int query_formats(AVFilterContext *ctx)
+static av_cold int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 HilbertContext *s = ctx->priv;
 static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } 
};
@@ -84,15 +86,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
 AV_SAMPLE_FMT_FLT,
 AV_SAMPLE_FMT_NONE
 };
-int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
sample_fmts);
 if (ret < 0)
 return ret;
 
-ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 if (ret < 0)
 return ret;
 
-return ff_set_common_samplerates_from_list(ctx, sample_rates);
+return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
 }
 
 static av_cold int config_props(AVFilterLink *outlink)
@@ -168,6 +170,6 @@ const AVFilter ff_asrc_hilbert = {
 .priv_size = sizeof(HilbertContext),
 .inputs= NULL,
 FILTER_OUTPUTS(hilbert_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &hilbert_class,
 };
-- 
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 04/22] lavfi/asrc_anullsrc: convert to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop a redundant call that also happens implicitly in generic
code.
---
 libavfilter/asrc_anullsrc.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c
index 3249cc33ad..d8fd5e7c06 100644
--- a/libavfilter/asrc_anullsrc.c
+++ b/libavfilter/asrc_anullsrc.c
@@ -61,18 +61,20 @@ static const AVOption anullsrc_options[]= {
 
 AVFILTER_DEFINE_CLASS(anullsrc);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-ANullContext *null = ctx->priv;
+const ANullContext *null = ctx->priv;
 const AVChannelLayout chlayouts[] = { null->ch_layout, { 0 } };
 int sample_rates[] = { null->sample_rate, -1 };
 int ret;
 
-if ((ret = ff_set_common_formats (ctx, ff_all_formats  
(AVMEDIA_TYPE_AUDIO))) < 0 ||
-(ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0)
+ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
+if (ret < 0)
 return ret;
 
-return ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+return ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 }
 
 static av_cold int config_props(AVFilterLink *outlink)
@@ -124,7 +126,7 @@ const AVFilter ff_asrc_anullsrc = {
 .priv_size = sizeof(ANullContext),
 .inputs= NULL,
 FILTER_OUTPUTS(avfilter_asrc_anullsrc_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .activate  = activate,
 .priv_class= &anullsrc_class,
 };
-- 
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 03/22] lavfi/asrc_anoisesrc: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_anoisesrc.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c
index a67b2abe9c..0206fd69ce 100644
--- a/libavfilter/asrc_anoisesrc.c
+++ b/libavfilter/asrc_anoisesrc.c
@@ -83,24 +83,26 @@ static const AVOption anoisesrc_options[] = {
 
 AVFILTER_DEFINE_CLASS(anoisesrc);
 
-static av_cold int query_formats(AVFilterContext *ctx)
+static av_cold int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-ANoiseSrcContext *s = ctx->priv;
+const ANoiseSrcContext *s = ctx->priv;
 static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } 
};
 int sample_rates[] = { s->sample_rate, -1 };
 static const enum AVSampleFormat sample_fmts[] = {
 AV_SAMPLE_FMT_DBL,
 AV_SAMPLE_FMT_NONE
 };
-int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
sample_fmts);
 if (ret < 0)
 return ret;
 
-ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 if (ret < 0)
 return ret;
 
-return ff_set_common_samplerates_from_list(ctx, sample_rates);
+return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
 }
 
 static double white_filter(double white, double *buf)
@@ -244,6 +246,6 @@ const AVFilter ff_asrc_anoisesrc = {
 .inputs= NULL,
 .activate  = activate,
 FILTER_OUTPUTS(anoisesrc_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &anoisesrc_class,
 };
-- 
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 01/22] lavfi/asrc_afdelaysrc: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_afdelaysrc.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/asrc_afdelaysrc.c b/libavfilter/asrc_afdelaysrc.c
index c235f0c27a..cb6f236ba6 100644
--- a/libavfilter/asrc_afdelaysrc.c
+++ b/libavfilter/asrc_afdelaysrc.c
@@ -80,22 +80,24 @@ static int activate(AVFilterContext *ctx)
 return ff_filter_frame(outlink, frame);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-AFDelaySrcContext *s = ctx->priv;
+const AFDelaySrcContext *s = ctx->priv;
 AVChannelLayout chlayouts[] = { s->chlayout, { 0 } };
 int sample_rates[] = { s->sample_rate, -1 };
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE };
-int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
sample_fmts);
 if (ret < 0)
 return ret;
 
-ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 if (ret < 0)
 return ret;
 
-return ff_set_common_samplerates_from_list(ctx, sample_rates);
+return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
 }
 
 static int config_output(AVFilterLink *outlink)
@@ -146,5 +148,5 @@ const AVFilter ff_asrc_afdelaysrc = {
 .activate  = activate,
 .inputs= NULL,
 FILTER_OUTPUTS(afdelaysrc_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 };
-- 
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/22] lavfi/asrc_afirsrc: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_afirsrc.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavfilter/asrc_afirsrc.c b/libavfilter/asrc_afirsrc.c
index bc450ec822..0ea611d837 100644
--- a/libavfilter/asrc_afirsrc.c
+++ b/libavfilter/asrc_afirsrc.c
@@ -113,24 +113,26 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_tx_uninit(&s->itx_ctx);
 }
 
-static av_cold int query_formats(AVFilterContext *ctx)
+static av_cold int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-AudioFIRSourceContext *s = ctx->priv;
+const AudioFIRSourceContext *s = ctx->priv;
 static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } 
};
 int sample_rates[] = { s->sample_rate, -1 };
 static const enum AVSampleFormat sample_fmts[] = {
 AV_SAMPLE_FMT_FLT,
 AV_SAMPLE_FMT_NONE
 };
-int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
sample_fmts);
 if (ret < 0)
 return ret;
 
-ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 if (ret < 0)
 return ret;
 
-return ff_set_common_samplerates_from_list(ctx, sample_rates);
+return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
 }
 
 static int parse_string(char *str, float **items, int *nb_items, int 
*items_size)
@@ -304,7 +306,7 @@ const AVFilter ff_asrc_afirsrc = {
 .priv_size = sizeof(AudioFIRSourceContext),
 .inputs= NULL,
 FILTER_OUTPUTS(afirsrc_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &afirsrc_class,
 };
 
@@ -585,6 +587,6 @@ const AVFilter ff_asrc_afireqsrc = {
 .priv_size = sizeof(AudioFIRSourceContext),
 .inputs= NULL,
 FILTER_OUTPUTS(afireqsrc_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &afireqsrc_class,
 };
-- 
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/22] lavfi/avf_aphasemeter: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_aphasemeter.c | 31 ++-
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c
index fe0968c974..adcfcb3c5a 100644
--- a/libavfilter/avf_aphasemeter.c
+++ b/libavfilter/avf_aphasemeter.c
@@ -90,35 +90,32 @@ static const AVOption aphasemeter_options[] = {
 
 AVFILTER_DEFINE_CLASS(aphasemeter);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-AudioPhaseMeterContext *s = ctx->priv;
+const AudioPhaseMeterContext *s = ctx->priv;
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layout = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
+static const AVChannelLayout layouts[] = {
+AV_CHANNEL_LAYOUT_STEREO,
+{ .nb_channels = 0 },
+};
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats
)) < 0 ||
-(ret = ff_formats_ref (formats, &outlink->incfg.formats
)) < 0 ||
-(ret = ff_add_channel_layout  (&layout, 
&(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO )) < 0 ||
-(ret = ff_channel_layouts_ref (layout , 
&inlink->outcfg.channel_layouts)) < 0 ||
-(ret = ff_channel_layouts_ref (layout , 
&outlink->incfg.channel_layouts)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0 ||
+(ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0 ||
-(ret = ff_formats_ref(formats, &outlink->incfg.samplerates)) < 0)
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
layouts);
+if (ret < 0)
 return ret;
 
 if (s->do_video) {
-AVFilterLink *outlink = ctx->outputs[1];
-
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[1]->formats)) < 0)
 return ret;
 }
 
@@ -440,7 +437,7 @@ const AVFilter ff_avf_aphasemeter = {
 FILTER_INPUTS(inputs),
 .activate  = activate,
 .outputs   = NULL,
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &aphasemeter_class,
 .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
 };
-- 
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/22] lavfi/avf_showcwt: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showcwt.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/libavfilter/avf_showcwt.c b/libavfilter/avf_showcwt.c
index 760a07f2ff..dbb9fc7e2f 100644
--- a/libavfilter/avf_showcwt.c
+++ b/libavfilter/avf_showcwt.c
@@ -222,30 +222,21 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_freep(&s->fdsp);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV444P, 
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE };
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_counts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -1334,7 +1325,7 @@ const AVFilter ff_avf_showcwt = {
 .priv_size = sizeof(ShowCWTContext),
 FILTER_INPUTS(ff_audio_default_filterpad),
 FILTER_OUTPUTS(showcwt_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .activate  = activate,
 .priv_class= &showcwt_class,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
-- 
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/22] lavfi/*_vaapi: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/vaapi_vpp.c| 17 ++---
 libavfilter/vaapi_vpp.h|  4 +++-
 libavfilter/vf_deinterlace_vaapi.c |  2 +-
 libavfilter/vf_drawbox_vaapi.c |  2 +-
 libavfilter/vf_misc_vaapi.c|  4 ++--
 libavfilter/vf_pad_vaapi.c |  2 +-
 libavfilter/vf_procamp_vaapi.c |  2 +-
 libavfilter/vf_scale_vaapi.c   |  2 +-
 libavfilter/vf_tonemap_vaapi.c |  2 +-
 libavfilter/vf_transpose_vaapi.c   |  2 +-
 10 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
index 0179977af4..9be076fadb 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -26,22 +26,17 @@
 #include "formats.h"
 #include "vaapi_vpp.h"
 
-int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
+int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx,
+   AVFilterFormatsConfig **cfg_in,
+   AVFilterFormatsConfig **cfg_out)
 {
-enum AVPixelFormat pix_fmts[] = {
+static const enum AVPixelFormat pix_fmts[] = {
 AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
 };
 int err;
 
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->inputs[0]->outcfg.formats)) < 0)
-return err;
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->outputs[0]->incfg.formats)) < 0)
-return err;
-
-if ((err = ff_set_common_all_color_spaces(avctx)) < 0 ||
-(err = ff_set_common_all_color_ranges(avctx)) < 0)
+err = ff_set_common_formats_from_list2(avctx, cfg_in, cfg_out, pix_fmts);
+if (err < 0)
 return err;
 
 return 0;
diff --git a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h
index 6764ab0c39..0919fbbce3 100644
--- a/libavfilter/vaapi_vpp.h
+++ b/libavfilter/vaapi_vpp.h
@@ -67,7 +67,9 @@ void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx);
 
 void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx);
 
-int ff_vaapi_vpp_query_formats(AVFilterContext *avctx);
+int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx,
+   AVFilterFormatsConfig **cfg_in,
+   AVFilterFormatsConfig **cfg_out);
 
 void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx);
 
diff --git a/libavfilter/vf_deinterlace_vaapi.c 
b/libavfilter/vf_deinterlace_vaapi.c
index 0478d6daef..35e68d6e17 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -425,7 +425,7 @@ const AVFilter ff_vf_deinterlace_vaapi = {
 .uninit = &ff_vaapi_vpp_ctx_uninit,
 FILTER_INPUTS(deint_vaapi_inputs),
 FILTER_OUTPUTS(deint_vaapi_outputs),
-FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
 .priv_class = &deint_vaapi_class,
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_drawbox_vaapi.c b/libavfilter/vf_drawbox_vaapi.c
index 5b4f23066f..aa18f2fd39 100644
--- a/libavfilter/vf_drawbox_vaapi.c
+++ b/libavfilter/vf_drawbox_vaapi.c
@@ -364,6 +364,6 @@ const AVFilter ff_vf_drawbox_vaapi = {
 .uninit = &drawbox_vaapi_uninit,
 FILTER_INPUTS(drawbox_vaapi_inputs),
 FILTER_OUTPUTS(drawbox_vaapi_outputs),
-FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
index 3717a21930..981fcc878d 100644
--- a/libavfilter/vf_misc_vaapi.c
+++ b/libavfilter/vf_misc_vaapi.c
@@ -249,7 +249,7 @@ const AVFilter ff_vf_denoise_vaapi = {
 .uninit= &ff_vaapi_vpp_ctx_uninit,
 FILTER_INPUTS(misc_vaapi_inputs),
 FILTER_OUTPUTS(misc_vaapi_outputs),
-FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
 .priv_class= &denoise_vaapi_class,
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
@@ -262,7 +262,7 @@ const AVFilter ff_vf_sharpness_vaapi = {
 .uninit= &ff_vaapi_vpp_ctx_uninit,
 FILTER_INPUTS(misc_vaapi_inputs),
 FILTER_OUTPUTS(misc_vaapi_outputs),
-FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
 .priv_class= &sharpness_vaapi_class,
 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_pad_vaapi.c b/libavfilter/vf_pad_vaapi.c
index f45e503141..478b89d117 100644
--- a/libavfilter/vf_pad_vaapi.c
+++ b/libavfilter/vf_pad_vaapi.c
@@ -278,6 +278,6 @@ const AVFilter ff_vf_pad_vaapi = {
 .uninit = &ff_vaapi_vpp_ctx_uninit,
 FILTER_INPUTS(pad_vaapi_inputs),
 FILTER_OUTPUTS(pad_vaapi_outputs),
-FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
 .flags_internal = FF_FI

[FFmpeg-devel] [PATCH 05/22] lavfi/asrc_flite: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_flite.c | 39 +--
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/libavfilter/asrc_flite.c b/libavfilter/asrc_flite.c
index 5962bf55bb..1bbd329177 100644
--- a/libavfilter/asrc_flite.c
+++ b/libavfilter/asrc_flite.c
@@ -255,24 +255,35 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_audio_fifo_free(flite->fifo);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-FliteContext *flite = ctx->priv;
+const FliteContext *flite = ctx->priv;
+
+static const enum AVSampleFormat formats[] = {
+AV_SAMPLE_FMT_S16,
+AV_SAMPLE_FMT_NONE,
+};
+int sample_rates[] = { flite->sample_rate, -1 };
+AVChannelLayout layouts[2] = {
+{ .nb_channels = 0 },
+};
+
 int ret;
 
-AVFilterChannelLayouts *chlayouts = NULL;
-AVFilterFormats *sample_formats = NULL;
-AVFilterFormats *sample_rates = NULL;
-AVChannelLayout chlayout = { 0 };
+av_channel_layout_default(&layouts[0], flite->nb_channels);
 
-av_channel_layout_default(&chlayout, flite->nb_channels);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
layouts);
+if (ret < 0)
+return ret;
 
-if ((ret = ff_add_channel_layout (&chlayouts , &chlayout   
)) < 0 ||
-(ret = ff_set_common_channel_layouts (ctx, chlayouts   
)) < 0 ||
-(ret = ff_add_format (&sample_formats, 
AV_SAMPLE_FMT_S16   )) < 0 ||
-(ret = ff_set_common_formats (ctx, sample_formats  
)) < 0 ||
-(ret = ff_add_format (&sample_rates  , 
flite->sample_rate  )) < 0 ||
-(ret = ff_set_common_samplerates (ctx, sample_rates
)) < 0)
+ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats);
+if (ret < 0)
+return ret;
+
+ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
+if (ret < 0)
 return ret;
 
 return 0;
@@ -348,6 +359,6 @@ const AVFilter ff_asrc_flite = {
 .activate  = activate,
 .inputs= NULL,
 FILTER_OUTPUTS(flite_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &flite_class,
 };
-- 
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/22] lavfi/asrc_sinc: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_sinc.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c
index 94046f76b9..22b031a60d 100644
--- a/libavfilter/asrc_sinc.c
+++ b/libavfilter/asrc_sinc.c
@@ -74,22 +74,24 @@ static int activate(AVFilterContext *ctx)
 return ff_filter_frame(outlink, frame);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-SincContext *s = ctx->priv;
+const SincContext *s = ctx->priv;
 static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } 
};
 int sample_rates[] = { s->sample_rate, -1 };
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE };
-int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
sample_fmts);
 if (ret < 0)
 return ret;
 
-ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 if (ret < 0)
 return ret;
 
-return ff_set_common_samplerates_from_list(ctx, sample_rates);
+return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
 }
 
 static float *make_lpf(int num_taps, float Fc, float beta, float rho,
@@ -428,5 +430,5 @@ const AVFilter ff_asrc_sinc = {
 .activate  = activate,
 .inputs= NULL,
 FILTER_OUTPUTS(sinc_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 };
-- 
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 11/22] lavfi/avf_abitscope: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_abitscope.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c
index 30ed7d95e3..6d3a40d8d0 100644
--- a/libavfilter/avf_abitscope.c
+++ b/libavfilter/avf_abitscope.c
@@ -65,12 +65,11 @@ static const AVOption abitscope_options[] = {
 
 AVFILTER_DEFINE_CLASS(abitscope);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16P, 
AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_U8P,  
AV_SAMPLE_FMT_S64P,
AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_DBLP,
@@ -79,21 +78,11 @@ static int query_formats(AVFilterContext *ctx)
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_counts();
-if (!layouts)
-return AVERROR(ENOMEM);
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -322,7 +311,7 @@ const AVFilter ff_avf_abitscope = {
 .priv_size = sizeof(AudioBitScopeContext),
 FILTER_INPUTS(inputs),
 FILTER_OUTPUTS(outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .uninit= uninit,
 .activate  = activate,
 .priv_class= &abitscope_class,
-- 
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/22] lavfi/avf_showwaves: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showwaves.c | 23 +++
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 868e6a22d9..de73d8050f 100644
--- a/libavfilter/avf_showwaves.c
+++ b/libavfilter/avf_showwaves.c
@@ -155,32 +155,23 @@ static av_cold void uninit(AVFilterContext *ctx)
 }
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
 int ret;
 
 /* set input audio formats */
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_layouts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 /* set output video format */
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -814,7 +805,7 @@ const AVFilter ff_avf_showwaves = {
 FILTER_INPUTS(ff_audio_default_filterpad),
 .activate  = activate,
 FILTER_OUTPUTS(showwaves_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &showwaves_class,
 };
 
@@ -925,7 +916,7 @@ const AVFilter ff_avf_showwavespic = {
 .priv_size = sizeof(ShowWavesContext),
 FILTER_INPUTS(showwavespic_inputs),
 FILTER_OUTPUTS(showwavespic_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &showwavespic_class,
 };
 
-- 
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/22] lavfi/asrc_sine: convert to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/asrc_sine.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c
index 2e444ba196..96b603dd26 100644
--- a/libavfilter/asrc_sine.c
+++ b/libavfilter/asrc_sine.c
@@ -178,22 +178,24 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_freep(&sine->sin);
 }
 
-static av_cold int query_formats(AVFilterContext *ctx)
+static av_cold int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-SineContext *sine = ctx->priv;
+const SineContext *sine = ctx->priv;
 static const AVChannelLayout chlayouts[] = { AV_CHANNEL_LAYOUT_MONO, { 0 } 
};
 int sample_rates[] = { sine->sample_rate, -1 };
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE };
-int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
+int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, 
sample_fmts);
 if (ret < 0)
 return ret;
 
-ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
chlayouts);
 if (ret < 0)
 return ret;
 
-return ff_set_common_samplerates_from_list(ctx, sample_rates);
+return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, 
sample_rates);
 }
 
 static av_cold int config_props(AVFilterLink *outlink)
@@ -271,6 +273,6 @@ const AVFilter ff_asrc_sine = {
 .priv_size = sizeof(SineContext),
 .inputs= NULL,
 FILTER_OUTPUTS(sine_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &sine_class,
 };
-- 
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/22] lavfi/avf_concat: switch to query_func2()

2024-09-25 Thread Anton Khirnov
---
 libavfilter/avf_concat.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index 2a3d4c8b52..5a4319123f 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -72,9 +72,11 @@ static const AVOption concat_options[] = {
 
 AVFILTER_DEFINE_CLASS(concat);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
-ConcatContext *cat = ctx->priv;
+const ConcatContext *cat = ctx->priv;
 unsigned type, nb_str, idx0 = 0, idx, str, seg;
 AVFilterFormats *formats, *rates = NULL;
 AVFilterChannelLayouts *layouts = NULL;
@@ -87,25 +89,25 @@ static int query_formats(AVFilterContext *ctx)
 
 /* Set the output formats */
 formats = ff_all_formats(type);
-if ((ret = ff_formats_ref(formats, 
&ctx->outputs[idx]->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[idx]->formats)) < 0)
 return ret;
 
 if (type == AVMEDIA_TYPE_AUDIO) {
 rates = ff_all_samplerates();
-if ((ret = ff_formats_ref(rates, 
&ctx->outputs[idx]->incfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(rates, &cfg_out[idx]->samplerates)) 
< 0)
 return ret;
 layouts = ff_all_channel_layouts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&ctx->outputs[idx]->incfg.channel_layouts)) < 0)
+if ((ret = ff_channel_layouts_ref(layouts, 
&cfg_out[idx]->channel_layouts)) < 0)
 return ret;
 }
 
 /* Set the same formats for each corresponding input */
 for (seg = 0; seg < cat->nb_segments; seg++) {
-if ((ret = ff_formats_ref(formats, 
&ctx->inputs[idx]->outcfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[idx]->formats)) < 0)
 return ret;
 if (type == AVMEDIA_TYPE_AUDIO) {
-if ((ret = ff_formats_ref(rates, 
&ctx->inputs[idx]->outcfg.samplerates)) < 0 ||
-(ret = ff_channel_layouts_ref(layouts, 
&ctx->inputs[idx]->outcfg.channel_layouts)) < 0)
+if ((ret = ff_formats_ref(rates, 
&cfg_in[idx]->samplerates)) < 0 ||
+(ret = ff_channel_layouts_ref(layouts, 
&cfg_in[idx]->channel_layouts)) < 0)
 return ret;
 }
 idx += ctx->nb_outputs;
@@ -460,6 +462,6 @@ const AVFilter ff_avf_concat = {
 .outputs   = NULL,
 .priv_class= &concat_class,
 .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | 
AVFILTER_FLAG_DYNAMIC_OUTPUTS,
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .process_command = process_command,
 };
-- 
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/22] lavfi/avf_showcqt: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showcqt.c | 21 -
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 00f679bc9e..9633f36edb 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -1314,12 +1314,11 @@ static av_cold void uninit(AVFilterContext *ctx)
 common_uninit(ctx->priv);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = {
 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
@@ -1331,20 +1330,16 @@ static int query_formats(AVFilterContext *ctx)
 
 /* set input audio formats */
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
-layouts = ff_make_channel_layout_list(channel_layouts);
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
channel_layouts);
+if (ret < 0)
 return ret;
 
 /* set output video format */
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -1612,6 +1607,6 @@ const AVFilter ff_avf_showcqt = {
 .priv_size = sizeof(ShowCQTContext),
 FILTER_INPUTS(ff_audio_default_filterpad),
 FILTER_OUTPUTS(showcqt_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &showcqt_class,
 };
-- 
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/22] lavfi/avf_ahistogram: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_ahistogram.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/libavfilter/avf_ahistogram.c b/libavfilter/avf_ahistogram.c
index b77307f137..baa95c0539 100644
--- a/libavfilter/avf_ahistogram.c
+++ b/libavfilter/avf_ahistogram.c
@@ -92,28 +92,21 @@ static const AVOption ahistogram_options[] = {
 
 AVFILTER_DEFINE_CLASS(ahistogram);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUVA444P, 
AV_PIX_FMT_NONE };
 int ret = AVERROR(EINVAL);
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats
)) < 0 ||
-(layouts = ff_all_channel_counts()) == NULL ||
-(ret = ff_channel_layouts_ref (layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -509,6 +502,6 @@ const AVFilter ff_avf_ahistogram = {
 .activate  = activate,
 FILTER_INPUTS(ahistogram_inputs),
 FILTER_OUTPUTS(ahistogram_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &ahistogram_class,
 };
-- 
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/22] lavfi/avf_showspectrum: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showspectrum.c | 23 +++
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 565f23c28b..c6594177eb 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -358,32 +358,23 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_freep(&s->frames);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV444P, 
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE };
 int ret;
 
 /* set input audio formats */
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_counts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 /* set output video format */
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -1696,7 +1687,7 @@ const AVFilter ff_avf_showspectrum = {
 .priv_size = sizeof(ShowSpectrumContext),
 FILTER_INPUTS(ff_audio_default_filterpad),
 FILTER_OUTPUTS(showspectrum_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .activate  = activate,
 .priv_class= &showspectrum_class,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
@@ -1883,7 +1874,7 @@ const AVFilter ff_avf_showspectrumpic = {
 .priv_size = sizeof(ShowSpectrumContext),
 FILTER_INPUTS(showspectrumpic_inputs),
 FILTER_OUTPUTS(showspectrumpic_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &showspectrumpic_class,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
 };
-- 
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/22] lavfi/avf_showfreqs: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showfreqs.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
index da31b3215e..91e3a339e4 100644
--- a/libavfilter/avf_showfreqs.c
+++ b/libavfilter/avf_showfreqs.c
@@ -116,32 +116,23 @@ static const AVOption showfreqs_options[] = {
 
 AVFILTER_DEFINE_CLASS(showfreqs);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
 int ret;
 
 /* set input audio formats */
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_counts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 /* set output video format */
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -566,6 +557,6 @@ const AVFilter ff_avf_showfreqs = {
 .activate  = activate,
 FILTER_INPUTS(ff_audio_default_filterpad),
 FILTER_OUTPUTS(showfreqs_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &showfreqs_class,
 };
-- 
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/22] lavfi/avf_avectorscope: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_avectorscope.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavfilter/avf_avectorscope.c b/libavfilter/avf_avectorscope.c
index 96bef32e2c..cfcedfda00 100644
--- a/libavfilter/avf_avectorscope.c
+++ b/libavfilter/avf_avectorscope.c
@@ -230,28 +230,29 @@ static int fade(AVFilterContext *ctx, void *arg, int 
jobnr, int nb_jobs)
 return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layout = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, 
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
+static const AVChannelLayout layouts[] = {
+AV_CHANNEL_LAYOUT_STEREO,
+{ .nb_channels = 0 },
+};
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats
)) < 0 ||
-(ret = ff_add_channel_layout  (&layout, 
&(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
-(ret = ff_channel_layouts_ref (layout , 
&inlink->outcfg.channel_layouts)) < 0)
+if ((ret = ff_formats_ref (formats, &cfg_in[0]->formats)) 
< 0)
 return ret;
 
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
layouts);
+if (ret < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -493,7 +494,7 @@ const AVFilter ff_avf_avectorscope = {
 .activate  = activate,
 FILTER_INPUTS(audiovectorscope_inputs),
 FILTER_OUTPUTS(audiovectorscope_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &avectorscope_class,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
 .process_command = ff_filter_process_command,
-- 
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/22] lavfi/avf_showspatial: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showspatial.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavfilter/avf_showspatial.c b/libavfilter/avf_showspatial.c
index f7380f885a..285f2f1a81 100644
--- a/libavfilter/avf_showspatial.c
+++ b/libavfilter/avf_showspatial.c
@@ -80,28 +80,26 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_audio_fifo_free(s->fifo);
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layout = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GBRP, 
AV_PIX_FMT_NONE };
+static const AVChannelLayout layouts[] = { AV_CHANNEL_LAYOUT_STEREO, { 
.nb_channels = 0 } };
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats
)) < 0 ||
-(ret = ff_add_channel_layout  (&layout, 
&(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
-(ret = ff_channel_layouts_ref (layout , 
&inlink->outcfg.channel_layouts)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, 
layouts);
+if (ret < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -330,7 +328,7 @@ const AVFilter ff_avf_showspatial = {
 .priv_size = sizeof(ShowSpatialContext),
 FILTER_INPUTS(ff_audio_default_filterpad),
 FILTER_OUTPUTS(showspatial_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .activate  = spatial_activate,
 .priv_class= &showspatial_class,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
-- 
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/22] lavfi/avf_a3dscope: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_a3dscope.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/libavfilter/avf_a3dscope.c b/libavfilter/avf_a3dscope.c
index dd08990512..18f647e8a6 100644
--- a/libavfilter/avf_a3dscope.c
+++ b/libavfilter/avf_a3dscope.c
@@ -73,30 +73,21 @@ static const AVOption a3dscope_options[] = {
 
 AVFILTER_DEFINE_CLASS(a3dscope);
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref (formats, &inlink->outcfg.formats
)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_counts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -352,7 +343,7 @@ const AVFilter ff_avf_a3dscope = {
 .activate  = activate,
 FILTER_INPUTS(audio3dscope_inputs),
 FILTER_OUTPUTS(audio3dscope_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &a3dscope_class,
 .process_command = ff_filter_process_command,
 };
-- 
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/22] lavfi/avf_showvolume: switch to query_func2()

2024-09-25 Thread Anton Khirnov
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/avf_showvolume.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index d26fc8841d..8caabf5376 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -110,30 +110,21 @@ static av_cold int init(AVFilterContext *ctx)
 return 0;
 }
 
-static int query_formats(AVFilterContext *ctx)
+static int query_formats(const AVFilterContext *ctx,
+ AVFilterFormatsConfig **cfg_in,
+ AVFilterFormatsConfig **cfg_out)
 {
 AVFilterFormats *formats = NULL;
-AVFilterChannelLayouts *layouts = NULL;
-AVFilterLink *inlink = ctx->inputs[0];
-AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
 int ret;
 
 formats = ff_make_format_list(sample_fmts);
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.formats)) < 0)
-return ret;
-
-layouts = ff_all_channel_counts();
-if ((ret = ff_channel_layouts_ref(layouts, 
&inlink->outcfg.channel_layouts)) < 0)
-return ret;
-
-formats = ff_all_samplerates();
-if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_in[0]->formats)) < 0)
 return ret;
 
 formats = ff_make_format_list(pix_fmts);
-if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
+if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
 return ret;
 
 return 0;
@@ -520,6 +511,6 @@ const AVFilter ff_avf_showvolume = {
 .priv_size = sizeof(ShowVolumeContext),
 FILTER_INPUTS(showvolume_inputs),
 FILTER_OUTPUTS(showvolume_outputs),
-FILTER_QUERY_FUNC(query_formats),
+FILTER_QUERY_FUNC2(query_formats),
 .priv_class= &showvolume_class,
 };
-- 
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] fftools/ffplay: use swapchain_colorspace_hint to get better HDR support

2024-09-25 Thread Zhao Zhili
From: Zhao Zhili 

For example, the default surface configuration on macOS is:
VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_PASS_THROUGH_EXT

With HDR10 content and swapchain_colorspace_hint, the surface
configuration updated to:
VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_HDR10_ST2084_EXT
---
 fftools/ffplay_renderer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fftools/ffplay_renderer.c b/fftools/ffplay_renderer.c
index f272cb46f1..618149e7b2 100644
--- a/fftools/ffplay_renderer.c
+++ b/fftools/ffplay_renderer.c
@@ -697,6 +697,7 @@ static int display(VkRenderer *renderer, AVFrame *frame)
 struct pl_frame target = {0};
 RendererContext *ctx = (RendererContext *) renderer;
 int ret = 0;
+struct pl_color_space hint = {0};
 
 ret = convert_frame(renderer, frame);
 if (ret < 0)
@@ -709,6 +710,8 @@ static int display(VkRenderer *renderer, AVFrame *frame)
 return AVERROR_EXTERNAL;
 }
 
+pl_color_space_from_avframe(&hint, frame);
+pl_swapchain_colorspace_hint(ctx->swapchain, &hint);
 if (!pl_swapchain_start_frame(ctx->swapchain, &swap_frame)) {
 av_log(NULL, AV_LOG_ERROR, "start frame failed\n");
 ret = AVERROR_EXTERNAL;
-- 
2.46.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] avcodec/videotoolbox: add AV1 hardware acceleration

2024-09-25 Thread Zhao Zhili


> On Sep 25, 2024, at 20:04, Martin Storsjö  wrote:
> 
> On Wed, 25 Sep 2024, Martin Storsjö wrote:
> 
>> On Tue, 24 Sep 2024, Cameron Gutman wrote:
>> 
>>> On Tue, Sep 24, 2024 at 7:16 AM Martin Storsjö  wrote:
 I don't hit any issues with any AV1 samples that I have, I guess I don't
 have any samples with tile groups?
 Can you or someone else grab and share a small sample of a stream that
 fails to decode with this hwaccel, so we have a chance to debug it?
>>> Sure, here's a raw AV1 bitstream sample that should exhibit the issue:
>>> https://drive.google.com/file/d/1rp_O6pedhBYhDWFRuBCGTG1tfpNvtgrR/view
>> 
>> Thanks! I can indeed reproduce the issue with this sample.
> 
> FWIW, this whole bit feels like a bit of a mess; videotoolbox is inherently 
> not an API at the same level as the other hwaccels that support AV1 - 
> videotoolbox is just a full-packet decoder; if I hack it to bypass the whole 
> start_frame/decode_slice infrastructure and just pass the whole input 
> AVPacket into videotoolbox, it all just works, and we would have had this 
> working ages ago already.

I have the same feeling that videotoolbox should be a separate decoder. It’s 
complex to
squeeze videotoolbox into the hwaccel framework, and some features are lost or 
hard
if not impossible to implementation, e.g. multi layer hevc support (before we 
have 
MV-HEVC support with our native hevc decoder).

> 
> It's just that the hwaccel hooks get data fed via these 
> decode_params/start_frame/decode_slice callbacks, and we'd need to 
> essentially reassemble the complete input packet from that.
> 
> // Martin
> ___
> 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] avcodec/videotoolbox: add AV1 hardware acceleration

2024-09-25 Thread Martin Storsjö

On Wed, 25 Sep 2024, Martin Storsjö wrote:


On Tue, 24 Sep 2024, Cameron Gutman wrote:


On Tue, Sep 24, 2024 at 7:16 AM Martin Storsjö  wrote:


I don't hit any issues with any AV1 samples that I have, I guess I don't
have any samples with tile groups?

Can you or someone else grab and share a small sample of a stream that
fails to decode with this hwaccel, so we have a chance to debug it?



Sure, here's a raw AV1 bitstream sample that should exhibit the issue:
https://drive.google.com/file/d/1rp_O6pedhBYhDWFRuBCGTG1tfpNvtgrR/view


Thanks! I can indeed reproduce the issue with this sample.


FWIW, this whole bit feels like a bit of a mess; videotoolbox is 
inherently not an API at the same level as the other hwaccels that support 
AV1 - videotoolbox is just a full-packet decoder; if I hack it to bypass 
the whole start_frame/decode_slice infrastructure and just pass the whole 
input AVPacket into videotoolbox, it all just works, and we would have had 
this working ages ago already.


It's just that the hwaccel hooks get data fed via these 
decode_params/start_frame/decode_slice callbacks, and we'd need to 
essentially reassemble the complete input packet from that.


// Martin
___
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] configure: Silence Xcode warnings about duplicate libraries

2024-09-25 Thread Martin Storsjö
Since Xcode 15, macOS developer tools use a new linker. The new
linker by default warns for duplicate -l options. As this is a
known and expected thing, not to be considered an issue, ask for
the warning to be silenced.

This silences linker warnings like this:

ld: warning: ignoring duplicate libraries: '-lc++', '-lcrypto', '-lm', 
'-logg', '-lpthread', '-lssl', '-lvorbis', '-lvpx', '-lz'

The linker can also warn about duplicate -rpath options, and there's
currently no option to silence those warnings.
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index d77a55b653..a450b3c8d8 100755
--- a/configure
+++ b/configure
@@ -6480,6 +6480,7 @@ check_cc intrinsics_sse2 emmintrin.h "__m128i test = 
_mm_setzero_si128()"
 
 check_ldflags -Wl,--as-needed
 check_ldflags -Wl,-z,noexecstack
+check_ldflags -Wl,-no_warn_duplicate_libraries
 
 if ! disabled network; then
 check_func getaddrinfo $network_extralibs
-- 
2.39.5 (Apple Git-154)

___
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] avutils/executor: remove unused ready callback

2024-09-25 Thread Nuo Mi
On Tue, Sep 24, 2024 at 11:44 PM Anton Khirnov  wrote:

> Quoting Nuo Mi (2024-09-24 16:56:46)
> > On Tue, Sep 24, 2024 at 10:43 PM Nuo Mi  wrote:
> >
> > Currently, the pure decode speed for 8K is around 27–30 fps.
> > To achieve stable 8K@30 playback, we may need to go through several
> rounds
> > of refactoring and optimization for both the decoder and executor, with
> > each refactor potentially breaking the API/ABI.
>
> API and ABI breaks are not allowed outside of major bumps.
>
Okay, let me explore alternative options. Thank you for pointing that out

>
> --
> 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".
>
___
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] avutils/executor: remove unused ready callback

2024-09-25 Thread Anton Khirnov
Quoting Nuo Mi (2024-09-25 14:37:43)
> On Tue, Sep 24, 2024 at 11:44 PM Anton Khirnov  wrote:
> 
> > Quoting Nuo Mi (2024-09-24 16:56:46)
> > > On Tue, Sep 24, 2024 at 10:43 PM Nuo Mi  wrote:
> > >
> > > Currently, the pure decode speed for 8K is around 27–30 fps.
> > > To achieve stable 8K@30 playback, we may need to go through several
> > rounds
> > > of refactoring and optimization for both the decoder and executor, with
> > > each refactor potentially breaking the API/ABI.
> >
> > API and ABI breaks are not allowed outside of major bumps.
> >
> Okay, let me explore alternative options. Thank you for pointing that out

You could also copy the entire API into libavcodec, then you could
modify it as you wish.

It might eventually be useful elsewhere though.

-- 
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 10/14] swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats

2024-09-25 Thread Ramiro Polla
On Tue, Sep 24, 2024 at 2:24 PM Michael Niedermayer
 wrote:
> On Mon, Sep 23, 2024 at 02:40:13PM +0200, Ramiro Polla wrote:
> > There is an issue with the constants used in YUV to YUV range conversion,
> > where the upper bound is not respected when converting to mpeg range.
> >
> > With this commit, the constants are calculated at runtime, depending on
> > the bit depth. This approach also allows us to more easily understand how
> > the constants are derived.
> >
> > For bit depths <= 14, the number of fixed point bits has been set to 14
> > for all conversions, to simplify the code.
> > For bit depths > 14, the number of fixed points bits has been raised and
> > set to 18, to allow for the conversion to be accurate enough for the mpeg
> > range to be respected.
> >
> > The convert functions now take the conversion constants (amax, coeff,
> > and offset) as function arguments.
> > For bit depths <= 14, amax is 16-bit and offset is 32-bit.
> > For bit depths > 14, amax is 32-bit and offset is 64-bit.
> >
> > NOTE: all simd optimizations for range_convert have been disabled.
> >   they will be re-enabled when they are fixed for each sub-arch.
> >
> > NOTE2: the same issue still exists in rgb2yuv conversions, which is not
> >addressed in this commit.
> > ---
>
> This appears to break:
>
> make fate-filter-owdenoise-sample
> TESTfilter-owdenoise-sample
> stddev:12247.77 PSNR: 14.57 MAXDIFF:65280 bytes:   576000/   576000
> MAXDIFF: |65280 - 1| >= 3539
> Test filter-owdenoise-sample failed. Look at 
> tests/data/fate/filter-owdenoise-sample.err for details.
> make: *** [tests/Makefile:312: fate-filter-owdenoise-sample] Error 1

This is weird. This error didn't show up when I was testing with make
fate. I ran the test individually and I saw the failure. Then I ran
the test again with GEN=1, there are no diffs in the source tree, and
now I can't get the test to fail anymore. I'll have to check again.

> What peformance impact do non constants have ?

It is mostly faster than using constants, both on x86_64 and aarch64.
I will include more comprehensive benchmarks in v2.

Also I figured out I could make it even faster by saturating the
output instead of limiting the range of the input. I'll send a new
patchset when this is done.

Ramiro
___
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 10/14] swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats

2024-09-25 Thread Ramiro Polla
On Wed, Sep 25, 2024 at 7:24 AM Derek Buitenhuis
 wrote:
> On 9/23/2024 1:40 PM, Ramiro Polla wrote:
> >  {
> > +#if 0
> >  int cpu_flags = av_get_cpu_flags();
>
> Are these '#if 0' throughout this patch intended?

Yes, some simd code is disabled because the function changed. Instead
of changing all simd code in one single commit (which I won't be able
to do because I don't know riscv or loongson assembly), I just
disabled it with #if 0.

I'll add a comment above the #if 0 in v2 of the patchset to make this clearer.
___
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 11/14] swscale/x86/range_convert: update sse2 and avx2 range_convert functions to new API

2024-09-25 Thread Ramiro Polla
On Tue, Sep 24, 2024 at 6:39 PM Rémi Denis-Courmont  wrote:
> Le maanantaina 23. syyskuuta 2024, 15.40.14 EEST Ramiro Polla a écrit :
> > chrRangeFromJpeg8_1920_c: 3874.8 ( 1.00x)
> > chrRangeFromJpeg8_1920_sse2:  1493.8 ( 2.59x)
> > chrRangeFromJpeg8_1920_avx2:   741.8 ( 5.22x)
> > chrRangeToJpeg8_1920_c:   5232.8 ( 1.00x)
> > chrRangeToJpeg8_1920_sse2:1673.3 ( 3.13x)
> > chrRangeToJpeg8_1920_avx2: 850.6 ( 6.15x)
> > lumRangeFromJpeg8_1920_c: 2416.3 ( 1.00x)
> > lumRangeFromJpeg8_1920_sse2:   760.1 ( 3.18x)
> > lumRangeFromJpeg8_1920_avx2:   379.6 ( 6.37x)
> > lumRangeToJpeg8_1920_c:   3121.1 ( 1.00x)
> > lumRangeToJpeg8_1920_sse2: 870.1 ( 3.59x)
> > lumRangeToJpeg8_1920_avx2: 434.8 ( 7.18x)
>
> How do these compare to previous benchmarks?

I'll add more comprehensive benchmarks in v2.
___
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 08/10] swscale/swscale_unscaled: Fix odd height with nv24_to_yuv420p_chroma()

2024-09-25 Thread Ramiro Polla
On Tue, Sep 24, 2024 at 3:35 PM Michael Niedermayer
 wrote:
> On Mon, Sep 23, 2024 at 12:42:22AM +0200, Ramiro Polla wrote:
> > Hi,
> >
> > On Mon, Sep 23, 2024 at 12:04 AM Michael Niedermayer
> >  wrote:
> > >
> > > Fixes: out of array read
> > > Fixes: 71726/clusterfuzz-testcase-ffmpeg_SWS_fuzzer-5876893532880896
> > >
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libswscale/swscale_unscaled.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
> > > index dc1d5f35932..d403c953cc7 100644
> > > --- a/libswscale/swscale_unscaled.c
> > > +++ b/libswscale/swscale_unscaled.c
> > > @@ -230,6 +230,8 @@ static void nv24_to_yuv420p_chroma(uint8_t *dst1, int 
> > > dstStride1,
> > >  const uint8_t *src2 = src + srcStride;
> > >  // average 4 pixels into 1 (interleaved U and V)
> > >  for (int y = 0; y < h; y += 2) {
> > > +if (y + 1 == h)
> > > +src2 = src1;
> > >  for (int x = 0; x < w; x++) {
> > >  dst1[x] = (src1[4 * x + 0] + src1[4 * x + 2] +
> > > src2[4 * x + 0] + src2[4 * x + 2]) >> 2;
> >
> > I would prefer to keep nv24_to_yuv420p_chroma() expecting height to be
> > a multiple of 2. We could add && !(c->srcH & 1) before selecting
> > nv24ToYuv420Wrapper.
>
> what advantage does this have ?

This would also have the benefit of keeping the function clearer, and
we wouldn't have to add special cases that might or might not be ok.
It would also make it easier to write simd code, since we wouldn't
have to worry about these special cases.

It is also easy to forget these corner cases, which leads to some
converters behaving differently in corner cases. For example, the
current yuyv422 to yuv420p scaler just doesn't output the last line if
it has an odd height. What is the correct fix? Should we convert the
last line differently like in this case? Should we duplicate the
second-to-last line? Should we just add a couple lines of code to
tweak the converter? Should we instead call this function with an even
height, and call another function for the last line?

IMO a converter to yuv420p with odd width or height shouldn't be an
unscaled converter, since we're effectively scaling the chroma planes
(and not just by a factor of two). In this case, the regular scaler
would be used.
___
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/10] lavfi/buffersink: allow av_buffersink_set_frame_size() to be called earlier

2024-09-25 Thread Anton Khirnov
The function currently writes directly into the input link, which
requires it to be called after the filter has been linked. However, the
documentation does not mention this restriction and the natural place to
call av_buffersink_set_frame_size() during the options-setting stage,
that is before filter init (and so before the input link exists).
---
 libavfilter/buffersink.c | 29 ++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 5811720c61..af4dc38792 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -42,6 +42,7 @@
 typedef struct BufferSinkContext {
 const AVClass *class;
 unsigned warning_limit;
+unsigned frame_size;
 
 /* only used for video */
 enum AVPixelFormat *pixel_fmts; ///< list of accepted pixel formats
@@ -162,11 +163,25 @@ static int activate(AVFilterContext *ctx)
 return 0;
 }
 
+static int config_input_audio(AVFilterLink *inlink)
+{
+BufferSinkContext *buf = inlink->dst->priv;
+FilterLink *l = ff_filter_link(inlink);
+
+l->min_samples = l->max_samples = buf->frame_size;
+
+return 0;
+}
+
 void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size)
 {
-FilterLink *inlink = ff_filter_link(ctx->inputs[0]);
+BufferSinkContext *buf = ctx->priv;
+buf->frame_size = frame_size;
 
-inlink->min_samples = inlink->max_samples = frame_size;
+if (ctx->inputs && ctx->inputs[0]) {
+FilterLink *l = ff_filter_link(ctx->inputs[0]);
+l->min_samples = l->max_samples = buf->frame_size;
+}
 }
 
 #define MAKE_AVFILTERLINK_ACCESSOR(type, field) \
@@ -368,6 +383,14 @@ const AVFilter ff_vsink_buffer = {
 FILTER_QUERY_FUNC(vsink_query_formats),
 };
 
+static const AVFilterPad inputs_audio[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+.config_props = config_input_audio,
+},
+};
+
 const AVFilter ff_asink_abuffer = {
 .name  = "abuffersink",
 .description   = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them 
available to the end of the filter graph."),
@@ -376,7 +399,7 @@ const AVFilter ff_asink_abuffer = {
 .init  = common_init,
 .uninit= uninit,
 .activate  = activate,
-FILTER_INPUTS(ff_audio_default_filterpad),
+FILTER_INPUTS(inputs_audio),
 .outputs   = NULL,
 FILTER_QUERY_FUNC(asink_query_formats),
 };
-- 
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/10] doc/examples/decode_filter_audio: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
See previous commit for details.
---
 doc/examples/decode_filter_audio.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/examples/decode_filter_audio.c 
b/doc/examples/decode_filter_audio.c
index d637ca1724..6d148f7ab4 100644
--- a/doc/examples/decode_filter_audio.c
+++ b/doc/examples/decode_filter_audio.c
@@ -123,10 +123,10 @@ static int init_filters(const char *filters_descr)
 }
 
 /* buffer audio sink: to terminate the filter chain. */
-ret = avfilter_graph_create_filter(&buffersink_ctx, abuffersink, "out",
-   NULL, NULL, filter_graph);
-if (ret < 0) {
+buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, abuffersink, 
"out");
+if (!buffersink_ctx) {
 av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n");
+ret = AVERROR(ENOMEM);
 goto end;
 }
 
@@ -151,6 +151,12 @@ static int init_filters(const char *filters_descr)
 goto end;
 }
 
+ret = avfilter_init_dict(buffersink_ctx, NULL);
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot initialize audio buffer sink\n");
+goto end;
+}
+
 /*
  * Set the endpoints for the filter graph. The filter_graph will
  * be linked to the graph described by filters_descr.
-- 
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/10] lavd/lavfi: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
See previous commits for details.
---
 libavdevice/lavfi.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index ce10d61f8a..17657a0638 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -249,18 +249,24 @@ av_cold static int lavfi_read_header(AVFormatContext 
*avctx)
 AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL,
 };
 
-ret = avfilter_graph_create_filter(&sink, abuffersink,
-   inout->name, NULL,
-   NULL, lavfi->graph);
-if (ret >= 0)
-ret = av_opt_set_bin(sink, "sample_fmts", (const 
uint8_t*)sample_fmts,
- sizeof(sample_fmts), 
AV_OPT_SEARCH_CHILDREN);
+sink = avfilter_graph_alloc_filter(lavfi->graph, abuffersink, 
inout->name);
+if (!sink) {
+ret = AVERROR(ENOMEM);
+goto end;
+}
+
+ret = av_opt_set_bin(sink, "sample_fmts", (const 
uint8_t*)sample_fmts,
+ sizeof(sample_fmts), AV_OPT_SEARCH_CHILDREN);
 if (ret < 0)
 goto end;
 ret = av_opt_set_int(sink, "all_channel_counts", 1,
  AV_OPT_SEARCH_CHILDREN);
 if (ret < 0)
 goto end;
+
+ret = avfilter_init_dict(sink, NULL);
+if (ret < 0)
+goto end;
 } else {
 av_log(avctx,  AV_LOG_ERROR,
"Output '%s' is not a video or audio output, not yet 
supported\n", inout->name);
-- 
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 04/10] doc/examples/transcode: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
See previous commits for details.
---
 doc/examples/transcode.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index cbe5088ef6..7d1e1826a3 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -283,10 +283,10 @@ static int init_filter(FilteringContext* fctx, 
AVCodecContext *dec_ctx,
 goto end;
 }
 
-ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",
-NULL, NULL, filter_graph);
-if (ret < 0) {
+buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, 
"out");
+if (!buffersink_ctx) {
 av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
+ret = AVERROR(ENOMEM);
 goto end;
 }
 
@@ -297,6 +297,12 @@ static int init_filter(FilteringContext* fctx, 
AVCodecContext *dec_ctx,
 av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n");
 goto end;
 }
+
+ret = avfilter_init_dict(buffersink_ctx, NULL);
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot initialize buffer sink\n");
+goto end;
+}
 } else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
 char buf[64];
 buffersrc = avfilter_get_by_name("abuffer");
@@ -322,10 +328,10 @@ static int init_filter(FilteringContext* fctx, 
AVCodecContext *dec_ctx,
 goto end;
 }
 
-ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",
-NULL, NULL, filter_graph);
-if (ret < 0) {
+buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, 
"out");
+if (!buffersink_ctx) {
 av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n");
+ret = AVERROR(ENOMEM);
 goto end;
 }
 
@@ -352,6 +358,12 @@ static int init_filter(FilteringContext* fctx, 
AVCodecContext *dec_ctx,
 av_log(NULL, AV_LOG_ERROR, "Cannot set output sample rate\n");
 goto end;
 }
+
+ret = avfilter_init_dict(buffersink_ctx, NULL);
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot initialize audio buffer 
sink\n");
+goto end;
+}
 } else {
 ret = AVERROR_UNKNOWN;
 goto end;
-- 
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/10] fftools/ffplay: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
This function creates AND initializes a filter, so setting any filter
options after it is wrong. It happens to work when the filter's init
function does not touch the options in question, but is forbidden by the
API and is not guaranteed to remain functional.

Instead, use avfilter_graph_alloc_filter(), followed by setting the
options, and avfilter_init_dict().
---
 fftools/ffplay.c | 56 +---
 1 file changed, 34 insertions(+), 22 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 60d8874eab..349c6075da 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1861,7 +1861,6 @@ static int configure_video_filters(AVFilterGraph *graph, 
VideoState *is, const c
 {
 enum AVPixelFormat pix_fmts[FF_ARRAY_ELEMS(sdl_texture_format_map)];
 char sws_flags_str[512] = "";
-char buffersrc_args[256];
 int ret;
 AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL;
 AVCodecParameters *codecpar = is->video_st->codecpar;
@@ -1895,38 +1894,48 @@ static int configure_video_filters(AVFilterGraph 
*graph, VideoState *is, const c
 
 graph->scale_sws_opts = av_strdup(sws_flags_str);
 
-snprintf(buffersrc_args, sizeof(buffersrc_args),
- "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d:"
- "colorspace=%d:range=%d",
- frame->width, frame->height, frame->format,
- is->video_st->time_base.num, is->video_st->time_base.den,
- codecpar->sample_aspect_ratio.num, 
FFMAX(codecpar->sample_aspect_ratio.den, 1),
- frame->colorspace, frame->color_range);
-if (fr.num && fr.den)
-av_strlcatf(buffersrc_args, sizeof(buffersrc_args), 
":frame_rate=%d/%d", fr.num, fr.den);
 
-if ((ret = avfilter_graph_create_filter(&filt_src,
-avfilter_get_by_name("buffer"),
-"ffplay_buffer", buffersrc_args, 
NULL,
-graph)) < 0)
+filt_src = avfilter_graph_alloc_filter(graph, 
avfilter_get_by_name("buffer"),
+   "ffplay_buffer");
+if (!filt_src) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
+
+par->format  = frame->format;
+par->time_base   = is->video_st->time_base;
+par->width   = frame->width;
+par->height  = frame->height;
+par->sample_aspect_ratio = codecpar->sample_aspect_ratio;
+par->color_space = frame->colorspace;
+par->color_range = frame->color_range;
+par->frame_rate  = fr;
 par->hw_frames_ctx = frame->hw_frames_ctx;
 ret = av_buffersrc_parameters_set(filt_src, par);
 if (ret < 0)
 goto fail;
 
-ret = avfilter_graph_create_filter(&filt_out,
-   avfilter_get_by_name("buffersink"),
-   "ffplay_buffersink", NULL, NULL, graph);
+ret = avfilter_init_dict(filt_src, NULL);
 if (ret < 0)
 goto fail;
 
+filt_out = avfilter_graph_alloc_filter(graph, 
avfilter_get_by_name("buffersink"),
+   "ffplay_buffersink");
+if (!filt_out) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
 if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts,  
AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
 goto fail;
 if (!vk_renderer &&
 (ret = av_opt_set_int_list(filt_out, "color_spaces", 
sdl_supported_color_spaces,  AVCOL_SPC_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 
0)
 goto fail;
 
+ret = avfilter_init_dict(filt_out, NULL);
+if (ret < 0)
+goto fail;
+
 last_filter = filt_out;
 
 /* Note: this macro adds a filter before the lastly added filter, so the
@@ -2029,12 +2038,12 @@ static int configure_audio_filters(VideoState *is, 
const char *afilters, int for
 if (ret < 0)
 goto end;
 
-
-ret = avfilter_graph_create_filter(&filt_asink,
-   avfilter_get_by_name("abuffersink"), 
"ffplay_abuffersink",
-   NULL, NULL, is->agraph);
-if (ret < 0)
+filt_asink = avfilter_graph_alloc_filter(is->agraph, 
avfilter_get_by_name("abuffersink"),
+ "ffplay_abuffersink");
+if (!filt_asink) {
+ret = AVERROR(ENOMEM);
 goto end;
+}
 
 if ((ret = av_opt_set_int_list(filt_asink, "sample_fmts", sample_fmts,  
AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
 goto end;
@@ -2053,6 +2062,9 @@ static int configure_audio_filters(VideoState *is, const 
char *afilters, int for
 goto end;
 }
 
+ret = avfilter_init_dict(filt_asink, NULL);
+if (ret < 0)
+goto end;
 
 if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, 
filt_asink)) < 0)
 goto end;
-- 
2.43.0

__

[FFmpeg-devel] [PATCH 01/10] fftools/ffmpeg_filter: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
This function creates AND initializes a filter, so setting any filter
options after it is wrong. It happens to work when the filter's init
function does not touch the options in question, but is forbidden by the
API and is not guaranteed to remain functional.

Instead, use avfilter_graph_alloc_filter(), followed by setting the
options, and avfilter_init_dict().
---
 fftools/ffmpeg_filter.c | 53 ++---
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index c36a3ad00a..2f7597b491 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1586,14 +1586,18 @@ static int configure_output_audio_filter(FilterGraph 
*fg, AVFilterGraph *graph,
 int ret;
 
 snprintf(name, sizeof(name), "out_%s", ofp->name);
-ret = avfilter_graph_create_filter(&ofp->filter,
-   avfilter_get_by_name("abuffersink"),
-   name, NULL, NULL, graph);
-if (ret < 0)
-return ret;
+ofp->filter = avfilter_graph_alloc_filter(graph,
+  
avfilter_get_by_name("abuffersink"),
+  name);
+if (!ofp->filter)
+return AVERROR(ENOMEM);
 if ((ret = av_opt_set_int(ofp->filter, "all_channel_counts", 1, 
AV_OPT_SEARCH_CHILDREN)) < 0)
 return ret;
 
+ret = avfilter_init_dict(ofp->filter, NULL);
+if (ret < 0)
+return ret;
+
 #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
 AVFilterContext *filt_ctx;  \
 \
@@ -1686,9 +1690,6 @@ static int configure_input_video_filter(FilterGraph *fg, 
AVFilterGraph *graph,
 AVFilterContext *last_filter;
 const AVFilter *buffer_filt = avfilter_get_by_name("buffer");
 const AVPixFmtDescriptor *desc;
-AVRational fr = ifp->opts.framerate;
-AVRational sar;
-AVBPrint args;
 char name[255];
 int ret, pad_idx = 0;
 AVBufferSrcParameters *par = av_buffersrc_parameters_alloc();
@@ -1698,30 +1699,34 @@ static int configure_input_video_filter(FilterGraph 
*fg, AVFilterGraph *graph,
 if (ifp->type_src == AVMEDIA_TYPE_SUBTITLE)
 sub2video_prepare(ifp);
 
-sar = ifp->sample_aspect_ratio;
-if(!sar.den)
-sar = (AVRational){0,1};
-av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
-av_bprintf(&args,
- "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
- "pixel_aspect=%d/%d:colorspace=%d:range=%d",
- ifp->width, ifp->height, ifp->format,
- ifp->time_base.num, ifp->time_base.den, sar.num, sar.den,
- ifp->color_space, ifp->color_range);
-if (fr.num && fr.den)
-av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den);
 snprintf(name, sizeof(name), "graph %d input from stream %s", fg->index,
  ifp->opts.name);
 
-
-if ((ret = avfilter_graph_create_filter(&ifp->filter, buffer_filt, name,
-args.str, NULL, graph)) < 0)
+ifp->filter = avfilter_graph_alloc_filter(graph, buffer_filt, name);
+if (!ifp->filter) {
+ret = AVERROR(ENOMEM);
 goto fail;
-par->hw_frames_ctx = ifp->hw_frames_ctx;
+}
+
+par->format  = ifp->format;
+par->time_base   = ifp->time_base;
+par->frame_rate  = ifp->opts.framerate;
+par->width   = ifp->width;
+par->height  = ifp->height;
+par->sample_aspect_ratio = ifp->sample_aspect_ratio.den > 0 ?
+   ifp->sample_aspect_ratio : (AVRational){ 0, 1 };
+par->color_space = ifp->color_space;
+par->color_range = ifp->color_range;
+par->hw_frames_ctx   = ifp->hw_frames_ctx;
 ret = av_buffersrc_parameters_set(ifp->filter, par);
 if (ret < 0)
 goto fail;
 av_freep(&par);
+
+ret = avfilter_init_dict(ifp->filter, NULL);
+if (ret < 0)
+goto fail;
+
 last_filter = ifp->filter;
 
 desc = av_pix_fmt_desc_get(ifp->format);
-- 
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/10] doc/examples/transcode: handle audio encoder frame size restrictions

2024-09-25 Thread Anton Khirnov
---
 doc/examples/transcode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 54fb315236..1dc1b50502 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -374,6 +374,9 @@ static int init_filter(FilteringContext* fctx, 
AVCodecContext *dec_ctx,
 goto end;
 }
 
+if (enc_ctx->frame_size > 0)
+av_buffersink_set_frame_size(buffersink_ctx, enc_ctx->frame_size);
+
 ret = avfilter_init_dict(buffersink_ctx, NULL);
 if (ret < 0) {
 av_log(NULL, AV_LOG_ERROR, "Cannot initialize audio buffer 
sink\n");
-- 
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/10] doc/examples/transcode: switch to avcodec_get_supported_config()

2024-09-25 Thread Anton Khirnov
---
 doc/examples/transcode.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 7d1e1826a3..54fb315236 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -171,23 +171,38 @@ static int open_output_file(const char *filename)
  * sample rate etc.). These properties can be changed for output
  * streams easily using filters */
 if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+const enum AVPixelFormat *pix_fmts = NULL;
+
 enc_ctx->height = dec_ctx->height;
 enc_ctx->width = dec_ctx->width;
 enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
+
+ret = avcodec_get_supported_config(dec_ctx, NULL,
+   AV_CODEC_CONFIG_PIX_FORMAT, 
0,
+   (const void**)&pix_fmts, 
NULL);
+
 /* take first format from list of supported formats */
-if (encoder->pix_fmts)
-enc_ctx->pix_fmt = encoder->pix_fmts[0];
-else
-enc_ctx->pix_fmt = dec_ctx->pix_fmt;
+enc_ctx->pix_fmt = (ret >= 0 && pix_fmts) ?
+   pix_fmts[0] : dec_ctx->pix_fmt;
+
 /* video time_base can be set to whatever is handy and 
supported by encoder */
 enc_ctx->time_base = av_inv_q(dec_ctx->framerate);
 } else {
+const enum AVSampleFormat *sample_fmts = NULL;
+
 enc_ctx->sample_rate = dec_ctx->sample_rate;
 ret = av_channel_layout_copy(&enc_ctx->ch_layout, 
&dec_ctx->ch_layout);
 if (ret < 0)
 return ret;
+
+ret = avcodec_get_supported_config(dec_ctx, NULL,
+   
AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
+   (const void**)&sample_fmts, 
NULL);
+
 /* take first format from list of supported formats */
-enc_ctx->sample_fmt = encoder->sample_fmts[0];
+enc_ctx->sample_fmt = (ret >= 0 && sample_fmts) ?
+  sample_fmts[0] : dec_ctx->sample_fmt;
+
 enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate};
 }
 
-- 
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 03/10] doc/examples/decode_filter_video: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
See previous commits for details.
---
 doc/examples/decode_filter_video.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/examples/decode_filter_video.c 
b/doc/examples/decode_filter_video.c
index b91ca56d4e..4a5247dbf2 100644
--- a/doc/examples/decode_filter_video.c
+++ b/doc/examples/decode_filter_video.c
@@ -122,10 +122,10 @@ static int init_filters(const char *filters_descr)
 }
 
 /* buffer video sink: to terminate the filter chain. */
-ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",
-   NULL, NULL, filter_graph);
-if (ret < 0) {
+buffersink_ctx = avfilter_graph_alloc_filter(filter_graph, buffersink, 
"out");
+if (!buffersink_ctx) {
 av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
+ret = AVERROR(ENOMEM);
 goto end;
 }
 
@@ -136,6 +136,12 @@ static int init_filters(const char *filters_descr)
 goto end;
 }
 
+ret = avfilter_init_dict(buffersink_ctx, NULL);
+if (ret < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot initialize buffer sink\n");
+goto end;
+}
+
 /*
  * Set the endpoints for the filter graph. The filter_graph will
  * be linked to the graph described by filters_descr.
-- 
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 2/7] lavfi/buffersink: add a flag for retrieving stream parameters

2024-09-25 Thread Anton Khirnov
Quoting Marton Balint (2024-09-25 10:25:44)
> 
> 
> On Mon, 23 Sep 2024, Anton Khirnov wrote:
> 
> > This way, av_buffersink_get_frame_flags() can replace almost all
> > av_buffersink_get_*(), including some future parameters we will want to
> > export.
> 
> Why don't you simply expose the AVFilterLink which contains all the 
> parameters of the sink? That seems a lot cleaner.

Because AVFilterLink is internal state of the filtergraph and should not
be exposed at all.

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


[FFmpeg-devel] [PATCH 10/10] lavfi: clarify the behaviour of avfilter_graph_create_filter()

2024-09-25 Thread Anton Khirnov
Mention explicitly that no options can be set manually when using this
function.
---
 libavfilter/avfilter.h | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 1401577c50..21066dd8da 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -845,9 +845,9 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph 
*graph,
 AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char 
*name);
 
 /**
- * Create and add a filter instance into an existing graph.
- * The filter instance is created from the filter filt and inited
- * with the parameter args. opaque is currently ignored.
+ * A convenience wrapper that allocates and initializes a filter in a single
+ * step. The filter instance is created from the filter filt and inited with 
the
+ * parameter args. opaque is currently ignored.
  *
  * In case of success put in *filt_ctx the pointer to the created
  * filter instance, otherwise set *filt_ctx to NULL.
@@ -856,6 +856,11 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph 
*graph, const char *nam
  * @param graph_ctx the filter graph
  * @return a negative AVERROR error code in case of failure, a non
  * negative value otherwise
+ *
+ * @note Since the filter is initialized after this function successfully
+ *   returns, you MUST NOT set any further options on it. If you need to do
+ *   that, call avfilter_graph_alloc_filter(), followed by setting the
+ *   options, followed by avfilter_init_dict() instead of this function.
  */
 int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter 
*filt,
  const char *name, const char *args, void 
*opaque,
-- 
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 2/7] lavfi/buffersink: add a flag for retrieving stream parameters

2024-09-25 Thread Nicolas George
Anton Khirnov (12024-09-25):
> Because AVFilterLink is internal state of the filtergraph and should not
> be exposed at all.

Anyway, if you cannot come up with an API that does not require dynamic
allocations and all the boilerplate code it requires just to retrieve a
few integers, then drop the series altogether.

-- 
  Nicolas George
___
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 01/10] fftools/ffmpeg_filter: stop using avfilter_graph_alloc_filter() incorrectly

2024-09-25 Thread Anton Khirnov
> fftools/ffmpeg_filter: stop using avfilter_graph_alloc_filter() incorrectly
   ^
Should be s/alloc/create/, fixed locally in all the commits.

Thanks to ePirat for noticing.

-- 
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 2/7] lavfi/buffersink: add a flag for retrieving stream parameters

2024-09-25 Thread Marton Balint




On Wed, 25 Sep 2024, Nicolas George wrote:


Anton Khirnov (12024-09-25):

Because AVFilterLink is internal state of the filtergraph and should not
be exposed at all.


Anyway, if you cannot come up with an API that does not require dynamic
allocations and all the boilerplate code it requires just to retrieve a
few integers, then drop the series altogether.


I kind of agree. It is suboptimal that the buffersink stores all its 
parameters already in a public struct, but you can only access them if you 
get yourself an owned copy with all the overhead of copying / 
referencing, plus now you have to do extra allocation for the results and 
error checking as well.


Also I don't like that you are misusing an AVFrame struct to pass 
parameters. How the user should know which parameters are set in AVFrame 
and which are not? A dedicated struct would be better, or just use 
AVFilterLink.


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