[FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: change the output frame's width and height

2022-11-24 Thread Xiang, Haihao
From: "Chen,Wenbin" 

Make sure the size of the output frame always matches the agreed upon
image size.

Signed-off-by: Wenbin Chen 
---
 libavfilter/qsvvpp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 8428ee89ab..bf719b2a29 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s, 
AVFilterLink *outlink)
 if (!out_frame->frame)
 return NULL;
 
-out_frame->frame->width  = outlink->w;
-out_frame->frame->height = outlink->h;
-
 ret = map_frame_to_surface(out_frame->frame,
&out_frame->surface);
 if (ret < 0)
 return NULL;
 }
 
+out_frame->frame->width  = outlink->w;
+out_frame->frame->height = outlink->h;
 out_frame->surface.Info = s->vpp_param.vpp.Out;
 
 return out_frame;
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 2/4] lavfi/qsvvpp: avoid overriding the returned value

2022-11-24 Thread Xiang, Haihao
From: Haihao Xiang 

It means more than one output is ready when
MFXVideoVPP_RunFrameVPPAsync() returns MFX_ERR_MORE_SURFACE [1].
Currently the returned value from MFXVideoVPP_RunFrameVPPAsync() might
be overridden, so the check of 'ret == MFX_ERR_MORE_SURFACE' is always
false when MFX_ERR_MORE_SURFACE is returned from
MFXVideoVPP_RunFrameVPPAsync()

[1] 
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#video-processing-procedures

Signed-off-by: Haihao Xiang 
---
 libavfilter/qsvvpp.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index bf719b2a29..a088f6b61f 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -833,7 +833,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink 
*inlink, AVFrame *picr
 QSVAsyncFrame aframe;
 mfxSyncPoint  sync;
 QSVFrame *in_frame, *out_frame;
-int   ret, filter_ret;
+int   ret, ret1, filter_ret;
 
 while (s->eof && av_fifo_read(s->async_fifo, &aframe, 1) >= 0) {
 if (MFXVideoCORE_SyncOperation(s->session, aframe.sync, 1000) < 0)
@@ -890,8 +890,13 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink 
*inlink, AVFrame *picr
 av_fifo_read(s->async_fifo, &aframe, 1);
 
 do {
-ret = MFXVideoCORE_SyncOperation(s->session, aframe.sync, 
1000);
-} while (ret == MFX_WRN_IN_EXECUTION);
+ret1 = MFXVideoCORE_SyncOperation(s->session, aframe.sync, 
1000);
+} while (ret1 == MFX_WRN_IN_EXECUTION);
+
+if (ret1 < 0) {
+ret = ret1;
+break;
+}
 
 filter_ret = s->filter_frame(outlink, aframe.frame->frame);
 if (filter_ret < 0) {
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 3/4] lavfi/qsvvpp: provide a default framerate if needed

2022-11-24 Thread Xiang, Haihao
From: Haihao Xiang 

VPP in the SDK requires the frame rate to be set to a valid value,
otherwise init will fail, so always set a default framerate when the
input link doesn't have a valid framerate.

Signed-off-by: Haihao Xiang 
---
 libavfilter/qsvvpp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index a088f6b61f..a588a37610 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -324,6 +324,14 @@ static int fill_frameinfo_by_link(mfxFrameInfo *frameinfo, 
AVFilterLink *link)
 frameinfo->CropH  = link->h;
 frameinfo->FrameRateExtN  = link->frame_rate.num;
 frameinfo->FrameRateExtD  = link->frame_rate.den;
+
+/* Apparently VPP in the SDK requires the frame rate to be set to some 
value, otherwise
+ * init will fail */
+if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN == 0) {
+frameinfo->FrameRateExtN = 25;
+frameinfo->FrameRateExtD = 1;
+}
+
 frameinfo->AspectRatioW   = link->sample_aspect_ratio.num ? 
link->sample_aspect_ratio.num : 1;
 frameinfo->AspectRatioH   = link->sample_aspect_ratio.den ? 
link->sample_aspect_ratio.den : 1;
 
-- 
2.25.1

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

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


[FFmpeg-devel] [PATCH 4/4] lavf/vf_vpp_qsv: scale_mode can be applied to color conversion

2022-11-24 Thread Xiang, Haihao
From: Haihao Xiang 

Signed-off-by: Haihao Xiang 
---
 libavfilter/vf_vpp_qsv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 4a053f9145..17f2989245 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -492,7 +492,7 @@ static int config_output(AVFilterLink *outlink)
 }
 }
 
-if (inlink->w != outlink->w || inlink->h != outlink->h) {
+if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != 
vpp->out_format) {
 if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
 memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
 vpp->scale_conf.Header.BufferId= MFX_EXTBUFF_VPP_SCALING;
-- 
2.25.1

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

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


Re: [FFmpeg-devel] Developer meeting Dec 2

2022-11-24 Thread Tomas Härdin
sön 2022-11-20 klockan 17:06 +0100 skrev Jean-Baptiste Kempf:
> Hello Guys & Girls,
> 
> Some of us are planning to meet this 2nd of December, in Barcelona.
> 
> There is no predefinite agenda, just meet, discuss and code around
> FFmpeg.
> Everybody that feels part of this community is invited.
> 
> It might be a good idea to do a developer call at the end of the day
> (16:00 was the correct time, to get both Chinese and Us West Coast
> members IIRC), to have a more formal discussion, since it's been a
> long time that we've not done that.

Will this be over Jitsi Meet or similar?

/Tomas

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/av1_vaapi: add direct film grain mode

2022-11-24 Thread Dong, Ruijing
[AMD Official Use Only - General]

I might have misunderstood some of the questions, and I would like to explain 
more about the issue from my perspective, please correct me if anything wrong.

This patch is NOT a hack, like @Mark Thompson  mentioned.

Video codec, especially decoders will need to meet the requirements of video 
codecs first, if the reference picture management (DPB) was implemented wrongly,
then it could not meet the fundamental decoder criteria. From this point of 
view, different hardware will need to follow the same standard for the 
implementation
so that the decoders can generate the conformance outputs.

The DPB is always an internal part of the decoder, the detail implementation 
could be differed with different benefits, if DPB is managed by the 
application, it can be
more flexible and easily maintained, the other way is the DPB is managed by the 
driver and hardware itself, it could have more space for the optimization, for
example the reference frame access, where the format of reference frames is NOT 
used for display output, and the display output cannot be used for the
reference frames neither because reference frames could use a different format, 
which is more efficient for reference access however not good for display.
>From my point of view VAAPI supports both of the above two ideas, and it is 
>not necessary to force one to follow another, because that is limited by the 
>initial design
Idea.  In this case, there is no pre-grain output in the former decoder, it has 
only one display output.

>From the other side, most of the AMD AV1 decoding issues are resolved from the 
>community, the film grain problem becomes more noticeable. And generally 
>speaking
it is usually a flexible part of the post processing phase after video 
decoding, and here it is strictly defined in AV1 spec, and it is part of the 
decoding standard.
It is not practical to make changes in the DPB design idea for resolving this 
issue from AMD decoder side. And naturally output the applied firm grain is 
just another
film grain process mode, I called it "direct film grain mode".

I have asked the community to inspire me to have a better idea, and eventually 
I found out there is no good way other than to have the external user choice or 
detecting
AMD driver.  I understand doing the string match to choose AMD driver is not a 
perfect idea, but we really need to have a method to resolve this issue. Please 
let me know
If a better way come to your mind, which can resolve this issue and in the 
meanwhile not affecting other AV1 implementation path.

Appreciate for the help and comments!

Ruijing

-Original Message-
From: ffmpeg-devel  On Behalf Of Dong, Ruijing
Sent: Tuesday, November 22, 2022 9:43 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/av1_vaapi: add direct film grain 
mode

[AMD Official Use Only - General]

[AMD Official Use Only - General]

Hi Mark,

Just got the ffmpeg email, please see my answer below in [rdong].

Thanks,
Ruijing

-Original Message-
From: ffmpeg-devel  On Behalf Of Mark Thompson
Sent: Tuesday, November 22, 2022 6:34 PM
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/av1_vaapi: add direct film grain 
mode

On 22/11/2022 20:59, Mark Thompson wrote:
> On 22/11/2022 20:26, Mark Thompson wrote:
>> On 22/11/2022 19:18, Dong, Ruijing wrote:
>>> [AMD Official Use Only - General]
>>>
>>> Hi Mark,
>>>
>>> Sorry for being late to reply to you.
>>>
>>> Your understanding is correct, and I have sent a new patch [v4] for
>>> addressing the current issue and to use driver quirk mechanism to specify 
>>> only AMD VAAPI driver has this behavior, then this could be more specific.
>>>
>>> For AMD hardware, it allocates GPU memory internally for the DPB 
>>> management, the output is always the final one with or without applied 
>>> film-grain.
>>
>> I don't see why this requires you to write the output to the wrong surface.  
>> Why not write it to the correct one instead?
>
> Indeed, this seems to be a trivial fix in Mesa: 
> .
>
> It would be helpful if someone with suitable hardware could test that.

This was too naive, the Mesa driver doesn't make this easy.

It is only set up to write to a single surface, which is the one provided to 
vaBeginPicture().  However, VAAPI does not work that way - it wants you to 
write to both the pre-grain and the post-grain surfaces, where the pre-grain 
surface is the primary target and gets passed the vaBeginPicture() and the

[FFmpeg-devel] [PATCH] avformat/file: Fix handing of file URIs

2022-11-24 Thread Nick Sarnie
The current URI handling only removes the file: prefix, but we also need 
to consider the case of percent encoding.

Percent encoding can happen with non-ASCII characters in the path.

I hit this through mpv with vobsub subtitles when dragging subtitles 
onto the player using the mouse.
Vobsub uses two files: an .idx file and a .sub file. mpv decodes the 
file path for direct inputs to mpv (the .idx file here), so that's why 
mpv works for most things today.
When passed the .idx file from a mouse-drag, mpv calls the FFmpeg mpeg 
demuxer which then tries to find the corresponding .sub file in 
vobsub_read_header.
However, mpv does not decode the path for the vobsub track name, which 
FFmpeg uses to find the sub file,
so open() was receiving the path with "file:" removed but still had the 
percent encoding, so it obviously failed.


I have a similar patch for mpv to make mpv decode the vobsub sub file 
name before passing to
FFmpeg as well, but I have received feedback from multiple mpv 
developers that this is also a

FFmpeg issue, so hopefully we can fix it in both places.

Signed-off-by: Nick Sarnie 
---
 libavformat/file.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index 6103c37b34..416e7a0b6b 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -21,6 +21,7 @@
  #include "config_components.h"
 +#include "libavformat/urldecode.h"
 #include "libavutil/avstring.h"
 #include "libavutil/file_open.h"
 #include "libavutil/internal.h"
@@ -142,7 +143,9 @@ static int file_check(URLContext *h, int mask)
 int ret = 0;
 const char *filename = h->filename;
 av_strstart(filename, "file:", &filename);
-
+filename = ff_urldecode(filename, 0);
+if(!filename)
+  return AVERROR(ENOMEM);
 {
 #if HAVE_ACCESS && defined(R_OK)
 if (access(filename, F_OK) < 0)
@@ -174,7 +177,9 @@ static int file_delete(URLContext *h)
 int ret;
 const char *filename = h->filename;
 av_strstart(filename, "file:", &filename);
-
+filename = ff_urldecode(filename, 0);
+if(!filename)
+  return AVERROR(ENOMEM);
 ret = rmdir(filename);
 if (ret < 0 && (errno == ENOTDIR
 #   ifdef _WIN32
@@ -196,7 +201,13 @@ static int file_move(URLContext *h_src, URLContext 
*h_dst)

 const char *filename_src = h_src->filename;
 const char *filename_dst = h_dst->filename;
 av_strstart(filename_src, "file:", &filename_src);
+filename_src = ff_urldecode(filename_src, 0);
+if(!filename_src)
+  return AVERROR(ENOMEM);
 av_strstart(filename_dst, "file:", &filename_dst);
+filename_dst = ff_urldecode(filename_dst, 0);
+if(!filename_dst)
+  return AVERROR(ENOMEM);
  if (rename(filename_src, filename_dst) < 0)
 return AVERROR(errno);
@@ -212,6 +223,9 @@ static int file_open(URLContext *h, const char 
*filename, int flags)

 struct stat st;
  av_strstart(filename, "file:", &filename);
+filename = ff_urldecode(filename, 0);
+if(!filename)
+  return AVERROR(ENOMEM);
  if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) {
 access = O_CREAT | O_RDWR;
--
2.38.1

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

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


Re: [FFmpeg-devel] [PATCH] avformat/file: Fix handing of file URIs

2022-11-24 Thread Nicolas George
Nick Sarnie (12022-11-24):
> The current URI handling only removes the file: prefix, but we also need to
> consider the case of percent encoding.
> Percent encoding can happen with non-ASCII characters in the path.

NAK, this is a huge compatibility break.

But this fix is necessary, you are right.

What needs to happen to handle this correctly:

- Introduce a “fs:” protocol as a synonym to file:.

- Change “file:” (but not “fs:”!) to detect if the rest of the path
  looks like a real file URL or a raw file path.

  - If it looks like a real file URL, de-percent-escape it.

  - If it looks like a raw file path, treat it the legacy way after
printing a warning.

- In a few years, remove the heuristics and always handle “file:” in the
  standards-compliant way.

I believe we can ignore incomplete / relative file:// URLs in the
transition period. The triple / would be a very reliable way of
identification.

Regards,

-- 
  Nicolas George


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] avformat/file: Fix handing of file URIs

2022-11-24 Thread Nick Sarnie
Okay, thanks. I tried asking if this patch would be accepted in IRC 
before posting this to prevent this kind of situation but nobody responded.


I don't know enough about the codebase to implement the suggested 
solution, so I'll let you all decide if you want to do it.



___
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] lavf/vf_vpp_qsv: scale_mode can be applied to color conversion

2022-11-24 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Xiang, Haihao
> Sent: Thursday, November 24, 2022 10:20 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Haihao Xiang 
> Subject: [FFmpeg-devel] [PATCH 4/4] lavf/vf_vpp_qsv: scale_mode can
> be applied to color conversion
> 
> From: Haihao Xiang 
> 
> Signed-off-by: Haihao Xiang 
> ---
>  libavfilter/vf_vpp_qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index 4a053f9145..17f2989245 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -492,7 +492,7 @@ static int config_output(AVFilterLink *outlink)
>  }
>  }
> 
> -if (inlink->w != outlink->w || inlink->h != outlink->h) {
> +if (inlink->w != outlink->w || inlink->h != outlink->h ||
> in_format != vpp->out_format) {
>  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
>  memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
>  vpp->scale_conf.Header.BufferId=
> MFX_EXTBUFF_VPP_SCALING;
> --

LGTM. But maybe the warning below should be adjusted, as it would
be confusing when it says scaling even though no scaling is
configured.

softworkz
___
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] lavfi/qsvvpp: change the output frame's width and height

2022-11-24 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Xiang, Haihao
> Sent: Thursday, November 24, 2022 10:19 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Chen,Wenbin 
> Subject: [FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: change the output
> frame's width and height
> 
> From: "Chen,Wenbin" 
> 
> Make sure the size of the output frame always matches the agreed upon
> image size.
> 
> Signed-off-by: Wenbin Chen 
> ---
>  libavfilter/qsvvpp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index 8428ee89ab..bf719b2a29 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> AVFilterLink *outlink)
>  if (!out_frame->frame)
>  return NULL;
> 
> -out_frame->frame->width  = outlink->w;
> -out_frame->frame->height = outlink->h;
> -
>  ret = map_frame_to_surface(out_frame->frame,
> &out_frame->surface);
>  if (ret < 0)
>  return NULL;
>  }
> 
> +out_frame->frame->width  = outlink->w;
> +out_frame->frame->height = outlink->h;
>  out_frame->surface.Info = s->vpp_param.vpp.Out;
> 
>  return out_frame;
> --

Which problem case does this address?

Thanks,
sw
___
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] lavfi/qsvvpp: provide a default framerate if needed

2022-11-24 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Xiang, Haihao
> Sent: Thursday, November 24, 2022 10:19 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Haihao Xiang 
> Subject: [FFmpeg-devel] [PATCH 3/4] lavfi/qsvvpp: provide a default
> framerate if needed
> 
> From: Haihao Xiang 
> 
> VPP in the SDK requires the frame rate to be set to a valid value,
> otherwise init will fail, so always set a default framerate when the
> input link doesn't have a valid framerate.
> 
> Signed-off-by: Haihao Xiang 
> ---
>  libavfilter/qsvvpp.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index a088f6b61f..a588a37610 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -324,6 +324,14 @@ static int fill_frameinfo_by_link(mfxFrameInfo
> *frameinfo, AVFilterLink *link)
>  frameinfo->CropH  = link->h;
>  frameinfo->FrameRateExtN  = link->frame_rate.num;
>  frameinfo->FrameRateExtD  = link->frame_rate.den;
> +
> +/* Apparently VPP in the SDK requires the frame rate to be set
> to some value, otherwise
> + * init will fail */
> +if (frameinfo->FrameRateExtD == 0 || frameinfo->FrameRateExtN ==
> 0) {
> +frameinfo->FrameRateExtN = 25;
> +frameinfo->FrameRateExtD = 1;
> +}
> +
>  frameinfo->AspectRatioW   = link->sample_aspect_ratio.num ?
> link->sample_aspect_ratio.num : 1;
>  frameinfo->AspectRatioH   = link->sample_aspect_ratio.den ?
> link->sample_aspect_ratio.den : 1;
> 
> --

LGTM. I have this in place for about a year.

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/av1_vaapi: add direct film grain mode

2022-11-24 Thread Mark Thompson

On 24/11/2022 15:27, Dong, Ruijing wrote:

[AMD Official Use Only - General]

I might have misunderstood some of the questions, and I would like to explain 
more about the issue from my perspective, please correct me if anything wrong.


Are you perhaps missing that this is intended to be a common API between 
multiple implementations and users?

The important feature is that once the API has specified the behaviour then 
both the driver implementers (such as Mesa, but also others) and the users 
(such as FFmpeg, but also others) don't need to know what is going on on the 
other side, because the other side always behaves in the same way.

In this case, the API specifies that there are two output surfaces - one is 
written with the reference (pre-grain) frame, one is written with the display 
(post-grain) frame.

The Mesa driver is incorrect because it writes the display frame to the 
reference surface, and doesn't bother to write the display surface at all.  
This is then very visible when any user tries to display the display surface, 
because it hasn't been written.


This patch is NOT a hack, like @Mark Thompson  mentioned.


Your proposed patch is trying to crystalise an alternative not-quite-VAAPI 
which uses the same library and appears compatible, but actually isn't because 
it differs in critical ways.  I don't think it is unreasonable to characterise 
this as a hack.


Video codec, especially decoders will need to meet the requirements of video 
codecs first, if the reference picture management (DPB) was implemented wrongly,
then it could not meet the fundamental decoder criteria. From this point of 
view, different hardware will need to follow the same standard for the 
implementation
so that the decoders can generate the conformance outputs.

The DPB is always an internal part of the decoder, the detail implementation 
could be differed with different benefits, if DPB is managed by the 
application, it can be
more flexible and easily maintained, the other way is the DPB is managed by the 
driver and hardware itself, it could have more space for the optimization, for
example the reference frame access, where the format of reference frames is NOT 
used for display output, and the display output cannot be used for the
reference frames neither because reference frames could use a different format, 
which is more efficient for reference access however not good for display.
 From my point of view VAAPI supports both of the above two ideas, and it is 
not necessary to force one to follow another, because that is limited by the 
initial design
Idea.  In this case, there is no pre-grain output in the former decoder, it has 
only one display output.


Fair enough.  Luckily, the API clearly states where that display output should be 
written: .

You can get away with not writing the reference frame because it won't be 
displayed in this case, but you must write the display frame because that is 
the one the API says will be displayed to the user.

The unwritten reference frame will still get used in references because that is 
how the API is defined, but since Mesa deals with this by attaching hidden 
metadata to the frames there is no problem.


 From the other side, most of the AMD AV1 decoding issues are resolved from the 
community, the film grain problem becomes more noticeable. And generally 
speaking
it is usually a flexible part of the post processing phase after video 
decoding, and here it is strictly defined in AV1 spec, and it is part of the 
decoding standard.
It is not practical to make changes in the DPB design idea for resolving this 
issue from AMD decoder side. And naturally output the applied firm grain is 
just another
film grain process mode, I called it "direct film grain mode".

I have asked the community to inspire me to have a better idea, and eventually 
I found out there is no good way other than to have the external user choice or 
detecting
AMD driver.  I understand doing the string match to choose AMD driver is not a 
perfect idea, but we really need to have a method to resolve this issue. Please 
let me know
If a better way come to your mind, which can resolve this issue and in the 
meanwhile not affecting other AV1 implementation path.


The proper fix is straighforward: correct the error in the Mesa driver so that 
it writes the display output to the display surface, as the API says it should 
be.

Thanks,

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/av1_vaapi: add direct film grain mode

2022-11-24 Thread Dong, Ruijing
[AMD Official Use Only - General]

Thanks for the input.

I will try this way.

Ruijing

-Original Message-
From: Mark Thompson 
Sent: Thursday, November 24, 2022 4:10 PM
To: Dong, Ruijing ; FFmpeg development discussions and 
patches 
Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/av1_vaapi: add direct film grain 
mode

On 24/11/2022 15:27, Dong, Ruijing wrote:
> [AMD Official Use Only - General]
>
> I might have misunderstood some of the questions, and I would like to explain 
> more about the issue from my perspective, please correct me if anything wrong.

Are you perhaps missing that this is intended to be a common API between 
multiple implementations and users?

The important feature is that once the API has specified the behaviour then 
both the driver implementers (such as Mesa, but also others) and the users 
(such as FFmpeg, but also others) don't need to know what is going on on the 
other side, because the other side always behaves in the same way.

In this case, the API specifies that there are two output surfaces - one is 
written with the reference (pre-grain) frame, one is written with the display 
(post-grain) frame.

The Mesa driver is incorrect because it writes the display frame to the 
reference surface, and doesn't bother to write the display surface at all.  
This is then very visible when any user tries to display the display surface, 
because it hasn't been written.

> This patch is NOT a hack, like @Mark Thompson  mentioned.

Your proposed patch is trying to crystalise an alternative not-quite-VAAPI 
which uses the same library and appears compatible, but actually isn't because 
it differs in critical ways.  I don't think it is unreasonable to characterise 
this as a hack.

> Video codec, especially decoders will need to meet the requirements of
> video codecs first, if the reference picture management (DPB) was
> implemented wrongly, then it could not meet the fundamental decoder criteria. 
> From this point of view, different hardware will need to follow the same 
> standard for the implementation so that the decoders can generate the 
> conformance outputs.
>
> The DPB is always an internal part of the decoder, the detail
> implementation could be differed with different benefits, if DPB is
> managed by the application, it can be more flexible and easily
> maintained, the other way is the DPB is managed by the driver and hardware 
> itself, it could have more space for the optimization, for example the 
> reference frame access, where the format of reference frames is NOT used for 
> display output, and the display output cannot be used for the reference 
> frames neither because reference frames could use a different format, which 
> is more efficient for reference access however not good for display.
>  From my point of view VAAPI supports both of the above two ideas, and
> it is not necessary to force one to follow another, because that is limited 
> by the initial design Idea.  In this case, there is no pre-grain output in 
> the former decoder, it has only one display output.

Fair enough.  Luckily, the API clearly states where that display output should 
be written: 
.

You can get away with not writing the reference frame because it won't be 
displayed in this case, but you must write the display frame because that is 
the one the API says will be displayed to the user.

The unwritten reference frame will still get used in references because that is 
how the API is defined, but since Mesa deals with this by attaching hidden 
metadata to the frames there is no problem.

>  From the other side, most of the AMD AV1 decoding issues are resolved
> from the community, the film grain problem becomes more noticeable. And 
> generally speaking it is usually a flexible part of the post processing phase 
> after video decoding, and here it is strictly defined in AV1 spec, and it is 
> part of the decoding standard.
> It is not practical to make changes in the DPB design idea for
> resolving this issue from AMD decoder side. And naturally output the applied 
> firm grain is just another film grain process mode, I called it "direct film 
> grain mode".
>
> I have asked the community to inspire me to have a better idea, and
> eventually I found out there is no good way other than to have the
> external user choice or detecting AMD driver.  I understand doing the string 
> match to choose AMD driver is not a perfect idea, but we really need to have 
> a method to resolve this issue. Please let me know If a better way come to 
> your m

Re: [FFmpeg-devel] [PATCH] Makefile: Build complete doc with Doxygen

2022-11-24 Thread Jan Ekström
On Wed, Nov 16, 2022 at 7:21 PM Marvin Scholz  wrote:
>
> On 24 Sep 2022, at 23:09, Marvin Scholz wrote:
>
> > Add DISABLEDINSTHEADERS, a variable containing the headers of disabled
> > libraries. This is needed so that Doxygen does not generate incomplete
> > documentation when a component is disabled, which is quite unexpected
> > behaviour and results in warnings due to, among other things, broken
> > references.
> > ---

I can get behind the idea of "always building the full docs,
especially if the documentation is otherwise broken.", thus +1 for the
idea behind the patch at least.

> >  Makefile | 10 ++
> >  doc/Makefile |  2 +-
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 61f79e27ae..26714950b7 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -110,7 +110,17 @@ include $(SRC_PATH)/$(1)/Makefile
> >  include $(SRC_PATH)/ffbuild/library.mak
> >  endef
> >
> > +define DODISABLEDSUBDIR
> > +$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V
> > +SUBDIR := $(1)/
> > +include $(SRC_PATH)/$(1)/Makefile

Now, I am not 100% sure what the effect of this inclusion is, so it'd
be nice if you could enlighten me. I see there are some unconditional
definitions in f.ex. libavcodec/Makefile (such as TESTPROGS), but
would those be still under the defined NAME (avcodec) or so, and thus
effectively not affect the build even where some unconditional
definitions exist in the included Makefile?

Do excuse me if there is a very similar inclusion for something not
enabled just outside of the patch diff context, thus noting that this
is completely OK :)

> > +DISABLEDINSTHEADERS := $$(DISABLEDINSTHEADERS) $$(HEADERS:%=$$(SUBDIR)%)
> > +endef
> > +
> > +DISABLEDFFLIBS := $(filter-out $(FFLIBS),$(ALLFFLIBS))
> > +
> >  $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D
> > +$(foreach D,$(DISABLEDFFLIBS),$(eval $(call DODISABLEDSUBDIR,lib$(D
> >
> >  include $(SRC_PATH)/fftools/Makefile
> >  include $(SRC_PATH)/doc/Makefile
> > diff --git a/doc/Makefile b/doc/Makefile
> > index 25774c7bad..d71a02e408 100644
> > --- a/doc/Makefile
> > +++ b/doc/Makefile
> > @@ -100,7 +100,7 @@ doc/%.3: doc/%.pod $(GENTEXI)
> >
> >  $(DOCS) doc/doxy/html: | doc/
> >
> > -DOXY_INPUT  = $(INSTHEADERS)
> > +DOXY_INPUT  = $(INSTHEADERS) $(DISABLEDINSTHEADERS)
> >  DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) 
> > ffbuild/config.mak
> >
> >  doc/doxy/html: TAG = DOXY
> > --
> > 2.37.0 (Apple Git-136)
>
> Ping for review

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

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


[FFmpeg-devel] [PATCH]lavc/mscc: Change BGRA to BGR0, there is no transparency in screen recordings

2022-11-24 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes an issue mentioned in ticket #10068.

Please comment, Carl Eugen


0001-lavc-mscc-Change-BGRA-to-BGR0-there-is-no-transparen.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH]lavc/codec_desc: Mark V210 as lossy

2022-11-24 Thread Carl Eugen Hoyos
Hi!

Our V210 encoder limits the written values, so do not mark the codec
as lossless.

Please comment, Carl Eugen


0001-lavc-codec_desc-Mark-V210-as-lossy.patch
Description: Binary data
___
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/mjpegenc: take into account component count when writing the SOF header size

2022-11-24 Thread James Almer
Fixes ticket #10069

Signed-off-by: James Almer 
---
 libavcodec/mjpegenc_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 6dfc4469a5..049ae3d929 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -308,7 +308,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, 
PutBitContext *pb,
 default: av_assert0(0);
 }
 
-put_bits(pb, 16, 17);
+put_bits(pb, 16, 8 + 3 * components);
 if (lossless && (  avctx->pix_fmt == AV_PIX_FMT_BGR0
 || avctx->pix_fmt == AV_PIX_FMT_BGRA
 || avctx->pix_fmt == AV_PIX_FMT_BGR24))
-- 
2.38.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] [crop support for matroska demuxer, V4 2/3] libavcodec: Public code to support container crop

2022-11-24 Thread Michael Niedermayer
On Wed, Nov 23, 2022 at 03:44:25PM +0100, Dmitrii Ovchinnikov wrote:
> >>The types seems mismatching
> 
> The reason for the mismatch of types is that I left the
> int type according to the comments :
> "
> James Almer
> IMO the AVFrame ones should have not been size_t to begin with, not just
> because the actual dimensions you'll apply them to are int, but because
> these fields are not arch dependent or meant for the size of some object
> in memory.
> "
> 
>  It seems that performing casts would not be a good idea.
>  Should I make crop fields size_t type as in AVFrame?
>  Or is there a more correct way?

the type specified in the format string has to match the types passed
in the argument to av_log
"%"SIZE_SPECIFIER" + size_t
or
%d + int

otherwise you have undefined behavior

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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]lavc/mscc: Change BGRA to BGR0, there is no transparency in screen recordings

2022-11-24 Thread Paul B Mahol
On 11/24/22, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch fixes an issue mentioned in ticket #10068.
>
> Please comment, Carl Eugen
>

NAK
Not correct.
___
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]lavc/mscc: Change BGRA to BGR0, there is no transparency in screen recordings

2022-11-24 Thread Carl Eugen Hoyos
Am Fr., 25. Nov. 2022 um 00:08 Uhr schrieb Paul B Mahol :
>
> On 11/24/22, Carl Eugen Hoyos  wrote:
> > Hi!
> >
> > Attached patch fixes an issue mentioned in ticket #10068.
> >
> > Please comment, Carl Eugen
> >
>
> NAK
> Not correct.

How do you suggest to fix the issue?

Note that the same bug was fixed in several other screen recording
codecs in the past.

Carl Eugen
___
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/mjpegenc: take into account component count when writing the SOF header size

2022-11-24 Thread Carl Eugen Hoyos
Am Fr., 25. Nov. 2022 um 00:00 Uhr schrieb James Almer :
>
> Fixes ticket #10069
>
> Signed-off-by: James Almer 
> ---
>  libavcodec/mjpegenc_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
> index 6dfc4469a5..049ae3d929 100644
> --- a/libavcodec/mjpegenc_common.c
> +++ b/libavcodec/mjpegenc_common.c
> @@ -308,7 +308,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext 
> *avctx, PutBitContext *pb,
>  default: av_assert0(0);
>  }
>
> -put_bits(pb, 16, 17);
> +put_bits(pb, 16, 8 + 3 * components);

Could this also fix #2967?

Carl Eugen
___
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/mjpegenc: take into account component count when writing the SOF header size

2022-11-24 Thread James Almer

On 11/24/2022 8:12 PM, Carl Eugen Hoyos wrote:

Am Fr., 25. Nov. 2022 um 00:00 Uhr schrieb James Almer :


Fixes ticket #10069

Signed-off-by: James Almer 
---
  libavcodec/mjpegenc_common.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 6dfc4469a5..049ae3d929 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -308,7 +308,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, 
PutBitContext *pb,
  default: av_assert0(0);
  }

-put_bits(pb, 16, 17);
+put_bits(pb, 16, 8 + 3 * components);


Could this also fix #2967?

Carl Eugen


Doesn't look like. The examples in that ticket have all three 
components, which was the hardcoded len value (17) before 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/mjpegenc: take into account component count when writing the SOF header size

2022-11-24 Thread StreamNG Harold Camargo
please unsuscribe.

Harold F. Camargo R.
Stream NG
Cel. 318 3227862
Bogotá Colombia
www.stream-ng.com


El jue, 24 nov 2022 a las 18:24, James Almer () escribió:

> On 11/24/2022 8:12 PM, Carl Eugen Hoyos wrote:
> > Am Fr., 25. Nov. 2022 um 00:00 Uhr schrieb James Almer <
> jamr...@gmail.com>:
> >>
> >> Fixes ticket #10069
> >>
> >> Signed-off-by: James Almer 
> >> ---
> >>   libavcodec/mjpegenc_common.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
> >> index 6dfc4469a5..049ae3d929 100644
> >> --- a/libavcodec/mjpegenc_common.c
> >> +++ b/libavcodec/mjpegenc_common.c
> >> @@ -308,7 +308,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext
> *avctx, PutBitContext *pb,
> >>   default: av_assert0(0);
> >>   }
> >>
> >> -put_bits(pb, 16, 17);
> >> +put_bits(pb, 16, 8 + 3 * components);
> >
> > Could this also fix #2967?
> >
> > Carl Eugen
>
> Doesn't look like. The examples in that ticket have all three
> components, which was the hardcoded len value (17) before 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".
>
___
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]lavc/mscc: Change BGRA to BGR0, there is no transparency in screen recordings

2022-11-24 Thread Paul B Mahol
On 11/25/22, Carl Eugen Hoyos  wrote:
> Am Fr., 25. Nov. 2022 um 00:08 Uhr schrieb Paul B Mahol :
>>
>> On 11/24/22, Carl Eugen Hoyos  wrote:
>> > Hi!
>> >
>> > Attached patch fixes an issue mentioned in ticket #10068.
>> >
>> > Please comment, Carl Eugen
>> >
>>
>> NAK
>> Not correct.
>
> How do you suggest to fix the issue?
>
> Note that the same bug was fixed in several other screen recording
> codecs in the past.

All invalid and should be reverted ASAP!

>
> Carl Eugen
> ___
> 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 00/31] Use av_dict_iterate where approproate

2022-11-24 Thread Marvin Scholz
This patchset replaces the common use of:

av_dict_get(format_options, "", entry, AV_DICT_IGNORE_SUFFIX)

with the new av_dict_iterate in most places where it makes
sense. It is more concise and clearer to understand the
intention of the code.

Additionally for fftools/ffmpeg_filter it switches to
av_dict_get_string, as it makes more sense to use the
proper API for that instead of manually assembling the
string.

Marvin Scholz (31):
  fftools: use av_dict_iterate
  fftools: use av_dict_get_string
  avcodec/librav1e: use av_dict_iterate
  avcodec/librav1e: remove unnecessary variable
  avcodec/libvpxenc: use av_dict_iterate
  avformat/smjpegenc: use av_dict_iterate
  avutil: use av_dict_iterate
  avfilter/vf_scale: use av_dict_iterate
  avfilter/vf_coreimage: use av_dict_iterate
  avcodec/libxavs2: use av_dict_iterate
  avcodec/avpacket: use av_dict_iterate
  avformat/vorbiscomment: use av_dict_iterate
  avfilter/vf_libvmaf: use av_dict_iterate
  avfilter/f_metadata: use av_dict_iterate
  avformat/cafenc: use av_dict_iterate
  doc/examples/metadata: use av_dict_iterate
  avformat/movenc: use av_dict_iterate
  avformat/metadata: use av_dict_iterate
  avformat/flvenc: use av_dict_iterate
  avformat/hls: use av_dict_iterate
  avformat/lrcenc: use av_dict_iterate
  avformat/dump: use av_dict_iterate
  avformat/wtvenc: use av_dict_iterate
  avformat/ffmetaenc: use av_dict_iterate
  avformat/id3v2enc: use av_dict_iterate
  avformat/nutenc: use av_dict_iterate
  avformat/apetag: use av_dict_iterate
  avformat/asfenc: use av_dict_iterate
  avformat/http: use av_dict_iterate
  avformat/matroskaenc: use av_dict_iterate
  avformat/fifo: use av_dict_iterate

 doc/examples/metadata.c |  2 +-
 fftools/cmdutils.c  |  2 +-
 fftools/ffmpeg.c|  2 +-
 fftools/ffmpeg_demux.c  |  5 ++---
 fftools/ffmpeg_filter.c | 34 ++
 fftools/ffmpeg_opt.c|  2 +-
 fftools/ffplay.c|  4 ++--
 fftools/ffprobe.c   |  6 +++---
 libavcodec/avpacket.c   |  2 +-
 libavcodec/librav1e.c   |  7 +++
 libavcodec/libvpxenc.c  |  4 ++--
 libavcodec/libxavs2.c   |  4 ++--
 libavfilter/f_metadata.c|  4 ++--
 libavfilter/vf_coreimage.m  | 16 
 libavfilter/vf_libvmaf.c| 10 +-
 libavfilter/vf_scale.c  |  4 ++--
 libavformat/apetag.c|  4 ++--
 libavformat/asfenc.c|  4 ++--
 libavformat/cafenc.c|  6 +++---
 libavformat/dump.c  |  2 +-
 libavformat/ffmetaenc.c |  4 ++--
 libavformat/fifo.c  |  4 ++--
 libavformat/flvenc.c|  4 ++--
 libavformat/hls.c   |  6 +++---
 libavformat/http.c  |  6 +++---
 libavformat/id3v2enc.c  | 10 +-
 libavformat/lrcenc.c|  3 +--
 libavformat/matroskaenc.c   |  2 +-
 libavformat/metadata.c  |  4 ++--
 libavformat/movenc.c|  8 
 libavformat/nutenc.c| 12 ++--
 libavformat/smjpegenc.c |  4 ++--
 libavformat/vorbiscomment.c | 14 +++---
 libavformat/wtvenc.c|  8 
 libavutil/opt.c | 12 ++--
 libavutil/tests/dict.c  | 10 +-
 36 files changed, 113 insertions(+), 122 deletions(-)

-- 
2.37.0 (Apple Git-136)

___
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/31] fftools: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 fftools/cmdutils.c  | 2 +-
 fftools/ffmpeg.c| 2 +-
 fftools/ffmpeg_demux.c  | 5 ++---
 fftools/ffmpeg_filter.c | 3 +--
 fftools/ffmpeg_opt.c| 2 +-
 fftools/ffplay.c| 4 ++--
 fftools/ffprobe.c   | 6 +++---
 7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index beef8ce385..a1de621d1c 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -921,7 +921,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum 
AVCodecID codec_id,
 break;
 }
 
-while (t = av_dict_get(opts, "", t, AV_DICT_IGNORE_SUFFIX)) {
+while (t = av_dict_iterate(opts, t)) {
 const AVClass *priv_class;
 char *p = strchr(t->key, ':');
 
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 3767ab444b..0aeb06e5d5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -620,7 +620,7 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b)
 {
 const AVDictionaryEntry *t = NULL;
 
-while ((t = av_dict_get(b, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(b, t))) {
 av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE);
 }
 }
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 2ac1d795b2..e845e6784d 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1082,13 +1082,12 @@ int ifile_open(const OptionsContext *o, const char 
*filename)
 unused_opts = strip_specifiers(o->g->codec_opts);
 for (i = 0; i < f->nb_streams; i++) {
 e = NULL;
-while ((e = av_dict_get(f->streams[i]->decoder_opts, "", e,
-AV_DICT_IGNORE_SUFFIX)))
+while ((e = av_dict_iterate(f->streams[i]->decoder_opts, e)))
 av_dict_set(&unused_opts, e->key, NULL, 0);
 }
 
 e = NULL;
-while ((e = av_dict_get(unused_opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
+while ((e = av_dict_iterate(unused_opts, e))) {
 const AVClass *class = avcodec_get_class();
 const AVOption *option = av_opt_find(&class, e->key, NULL, 0,
  AV_OPT_SEARCH_CHILDREN | 
AV_OPT_SEARCH_FAKE_OBJ);
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 5d50092b72..b0c4c8ece3 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -452,8 +452,7 @@ static int configure_output_video_filter(FilterGraph *fg, 
OutputFilter *ofilter,
 snprintf(args, sizeof(args), "%d:%d",
  ofilter->width, ofilter->height);
 
-while ((e = av_dict_get(ost->sws_dict, "", e,
-AV_DICT_IGNORE_SUFFIX))) {
+while ((e = av_dict_iterate(ost->sws_dict, e))) {
 av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
 }
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index a9dcf0e088..3df02b7d7f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -169,7 +169,7 @@ AVDictionary *strip_specifiers(const AVDictionary *dict)
 const AVDictionaryEntry *e = NULL;
 AVDictionary*ret = NULL;
 
-while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
+while ((e = av_dict_iterate(dict, e))) {
 char *p = strchr(e->key, ':');
 
 if (p)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index bcc00afe31..fc7e1c2fb1 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1860,7 +1860,7 @@ static int configure_video_filters(AVFilterGraph *graph, 
VideoState *is, const c
 }
 pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE;
 
-while ((e = av_dict_get(sws_dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
+while ((e = av_dict_iterate(sws_dict, e))) {
 if (!strcmp(e->key, "sws_flags")) {
 av_strlcatf(sws_flags_str, sizeof(sws_flags_str), "%s=%s:", 
"flags", e->value);
 } else
@@ -1966,7 +1966,7 @@ static int configure_audio_filters(VideoState *is, const 
char *afilters, int for
 
 av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
 
-while ((e = av_dict_get(swr_opts, "", e, AV_DICT_IGNORE_SUFFIX)))
+while ((e = av_dict_iterate(swr_opts, e)))
 av_strlcatf(aresample_swr_opts, sizeof(aresample_swr_opts), "%s=%s:", 
e->key, e->value);
 if (strlen(aresample_swr_opts))
 aresample_swr_opts[strlen(aresample_swr_opts)-1] = '\0';
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f46925618c..d2f126d9d6 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -656,7 +656,7 @@ static int writer_open(WriterContext **wctx, const Writer 
*writer, const char *a
 goto fail;
 }
 
-while ((opt = av_dict_get(opts, "", opt, AV_DICT_IGNORE_SUFFIX))) {
+while ((opt = av_dict_iterate(opts, opt))) {
 if ((ret = av_opt_set(*wctx, opt->key, opt->value, 
AV_OPT_SEARCH_CHILDREN)) < 0) {
 av_log(*wctx, AV_LOG_ERROR, "Failed to set option '%s' with 
value '%s' provided to writer context\n",
opt->key, opt->value);
@@ -1945,7 +1945,7 @@

[FFmpeg-devel] [PATCH 02/31] fftools: use av_dict_get_string

2022-11-24 Thread Marvin Scholz
Instead of manually assembling the string, use av_dict_get_string
which handles things like proper escaping too (even though it is
not yet needed here).
---
 fftools/ffmpeg_filter.c | 31 +--
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b0c4c8ece3..29794fdc85 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -972,7 +972,7 @@ int configure_filtergraph(FilterGraph *fg)
 
 if (simple) {
 OutputStream *ost = fg->outputs[0]->ost;
-char args[512];
+char *args = NULL;
 const AVDictionaryEntry *e = NULL;
 
 if (filter_nbthreads) {
@@ -985,26 +985,21 @@ int configure_filtergraph(FilterGraph *fg)
 av_opt_set(fg->graph, "threads", e->value, 0);
 }
 
-args[0] = 0;
-e   = NULL;
-while ((e = av_dict_get(ost->sws_dict, "", e,
-AV_DICT_IGNORE_SUFFIX))) {
-av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
-}
-if (strlen(args)) {
-args[strlen(args)-1] = 0;
-fg->graph->scale_sws_opts = av_strdup(args);
+if (av_dict_count(ost->sws_dict)) {
+ret = av_dict_get_string(ost->sws_dict, &args, '=', ':');
+if (ret < 0)
+goto fail;
+fg->graph->scale_sws_opts = args;
+args = NULL;
 }
 
-args[0] = 0;
-e   = NULL;
-while ((e = av_dict_get(ost->swr_opts, "", e,
-AV_DICT_IGNORE_SUFFIX))) {
-av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
+if (av_dict_count(ost->swr_opts)) {
+ret = av_dict_get_string(ost->swr_opts, &args, '=', ':');
+if (ret < 0)
+goto fail;
+av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
+free(args);
 }
-if (strlen(args))
-args[strlen(args)-1] = 0;
-av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
 } else {
 fg->graph->nb_threads = filter_complex_nbthreads;
 }
-- 
2.37.0 (Apple Git-136)

___
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/31] avfilter/vf_coreimage: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavfilter/vf_coreimage.m | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 874bdc8c56..b1959861de 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -416,8 +416,8 @@ static void set_option(CoreImageContext *ctx, CIFilter 
*filter, const char *key,
 
 // set user options
 if (filter_options) {
-AVDictionaryEntry *o = NULL;
-while ((o = av_dict_get(filter_options, "", o, 
AV_DICT_IGNORE_SUFFIX))) {
+const AVDictionaryEntry *o = NULL;
+while ((o = av_dict_iterate(filter_options, o))) {
 set_option(ctx, filter, o->key, o->value);
 }
 }
@@ -427,10 +427,10 @@ static void set_option(CoreImageContext *ctx, CIFilter 
*filter, const char *key,
 
 static av_cold int init(AVFilterContext *fctx)
 {
-CoreImageContext *ctx = fctx->priv;
-AVDictionary *filter_dict = NULL;
-AVDictionaryEntry *f  = NULL;
-AVDictionaryEntry *o  = NULL;
+CoreImageContext *ctx   = fctx->priv;
+AVDictionary *filter_dict   = NULL;
+const AVDictionaryEntry *f  = NULL;
+const AVDictionaryEntry *o  = NULL;
 int ret;
 int i;
 
@@ -460,7 +460,7 @@ static av_cold int init(AVFilterContext *fctx)
 
 // parse filters for option key-value pairs (opt=val@opt2=val2) 
separated by @
 i = 0;
-while ((f = av_dict_get(filter_dict, "", f, AV_DICT_IGNORE_SUFFIX))) {
+while ((f = av_dict_iterate(filter_dict, f))) {
 AVDictionary *filter_options = NULL;
 
 if (strncmp(f->value, "default", 7)) { // not default
@@ -477,7 +477,7 @@ static av_cold int init(AVFilterContext *fctx)
 if (!filter_options) {
 av_log(ctx, AV_LOG_DEBUG, "\tusing default options\n");
 } else {
-while ((o = av_dict_get(filter_options, "", o, 
AV_DICT_IGNORE_SUFFIX))) {
+while ((o = av_dict_iterate(filter_options, o))) {
 av_log(ctx, AV_LOG_DEBUG, "\t%s: %s\n", o->key, 
o->value);
 }
 }
-- 
2.37.0 (Apple Git-136)

___
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/31] avcodec/librav1e: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavcodec/librav1e.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index 4f424caf5b..f48d5e0eb4 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -243,8 +243,8 @@ static av_cold int librav1e_encode_init(AVCodecContext 
*avctx)
 }
 
 {
-AVDictionaryEntry *en = NULL;
-while ((en = av_dict_get(ctx->rav1e_opts, "", en, 
AV_DICT_IGNORE_SUFFIX))) {
+const AVDictionaryEntry *en = NULL;
+while ((en = av_dict_iterate(ctx->rav1e_opts, en))) {
 int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
 if (parse_ret < 0)
 av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", 
en->key, en->value);
-- 
2.37.0 (Apple Git-136)

___
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/31] avcodec/libxavs2: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavcodec/libxavs2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 1672edfc07..c493ddc325 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -96,8 +96,8 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
 xavs2_opt_set2("OpenGOP",  "%d", !(avctx->flags & 
AV_CODEC_FLAG_CLOSED_GOP));
 
 {
-AVDictionaryEntry *en = NULL;
-while ((en = av_dict_get(cae->xavs2_opts, "", en, 
AV_DICT_IGNORE_SUFFIX)))
+const AVDictionaryEntry *en = NULL;
+while ((en = av_dict_iterate(cae->xavs2_opts, en)))
 xavs2_opt_set2(en->key, "%s", en->value);
 }
 
-- 
2.37.0 (Apple Git-136)

___
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/31] avcodec/avpacket: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavcodec/avpacket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index bcbc4166cb..5fef65e97a 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -316,7 +316,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, 
size_t *size)
 const AVDictionaryEntry *t = NULL;
 size_t total_length = 0;
 
-while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(dict, t))) {
 for (int i = 0; i < 2; i++) {
 const char  *str = i ? t->value : t->key;
 const size_t len = strlen(str) + 1;
-- 
2.37.0 (Apple Git-136)

___
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/31] avcodec/librav1e: remove unnecessary variable

2022-11-24 Thread Marvin Scholz
---
 libavcodec/librav1e.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index f48d5e0eb4..3481b7637d 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -245,8 +245,7 @@ static av_cold int librav1e_encode_init(AVCodecContext 
*avctx)
 {
 const AVDictionaryEntry *en = NULL;
 while ((en = av_dict_iterate(ctx->rav1e_opts, en))) {
-int parse_ret = rav1e_config_parse(cfg, en->key, en->value);
-if (parse_ret < 0)
+if (rav1e_config_parse(cfg, en->key, en->value) < 0)
 av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", 
en->key, en->value);
 }
 }
-- 
2.37.0 (Apple Git-136)

___
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/31] avcodec/libvpxenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavcodec/libvpxenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 667cffc200..9aa5510c28 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -900,7 +900,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 vpx_codec_caps_t codec_caps = vpx_codec_get_caps(iface);
 vpx_svc_extra_cfg_t svc_params;
 #endif
-AVDictionaryEntry* en = NULL;
+const AVDictionaryEntry* en = NULL;
 
 av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
 av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
@@ -1072,7 +1072,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 
 enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & 
VP8F_ERROR_RESILIENT;
 
-while ((en = av_dict_get(ctx->vpx_ts_parameters, "", en, 
AV_DICT_IGNORE_SUFFIX))) {
+while ((en = av_dict_iterate(ctx->vpx_ts_parameters, en))) {
 if (vpx_ts_param_parse(ctx, &enccfg, en->key, en->value, 
avctx->codec_id) < 0)
 av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/vorbiscomment: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/vorbiscomment.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index 13ee065a44..abe12fd586 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -45,17 +45,17 @@ int64_t ff_vorbiscomment_length(const AVDictionary *m, 
const char *vendor_string
 len += strlen(vendor_string);
 if (chapters && nb_chapters) {
 for (int i = 0; i < nb_chapters; i++) {
-AVDictionaryEntry *tag = NULL;
+const AVDictionaryEntry *tag = NULL;
 len += 4 + 12 + 1 + 10;
-while ((tag = av_dict_get(chapters[i]->metadata, "", tag, 
AV_DICT_IGNORE_SUFFIX))) {
+while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
 int64_t len1 = !strcmp(tag->key, "title") ? 4 : 
strlen(tag->key);
 len += 4 + 10 + len1 + 1 + strlen(tag->value);
 }
 }
 }
 if (m) {
-AVDictionaryEntry *tag = NULL;
-while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+const AVDictionaryEntry *tag = NULL;
+while ((tag = av_dict_iterate(m, tag))) {
 len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
 }
 }
@@ -77,9 +77,9 @@ int ff_vorbiscomment_write(AVIOContext *pb, const 
AVDictionary *m,
 }
 if (m) {
 int count = av_dict_count(m) + cm_count;
-AVDictionaryEntry *tag = NULL;
+const AVDictionaryEntry *tag = NULL;
 avio_wl32(pb, count);
-while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+while ((tag = av_dict_iterate(m, tag))) {
 int64_t len1 = strlen(tag->key);
 int64_t len2 = strlen(tag->value);
 if (len1+1+len2 > UINT32_MAX)
@@ -109,7 +109,7 @@ int ff_vorbiscomment_write(AVIOContext *pb, const 
AVDictionary *m,
 avio_write(pb, chapter_time, 12);
 
 tag = NULL;
-while ((tag = av_dict_get(chapters[i]->metadata, "", tag, 
AV_DICT_IGNORE_SUFFIX))) {
+while ((tag = av_dict_iterate(chapters[i]->metadata, tag))) {
 int64_t len1 = !strcmp(tag->key, "title") ? 4 : 
strlen(tag->key);
 int64_t len2 = strlen(tag->value);
 if (len1+1+len2+10 > UINT32_MAX)
-- 
2.37.0 (Apple Git-136)

___
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/31] avfilter/vf_libvmaf: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavfilter/vf_libvmaf.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 8f649c5b02..2586f37d99 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -236,9 +236,9 @@ static int parse_features(AVFilterContext *ctx)
 for (unsigned i = 0; i < dict_cnt; i++) {
 char *feature_name = NULL;
 VmafFeatureDictionary *feature_opts_dict = NULL;
-AVDictionaryEntry *e = NULL;
+const AVDictionaryEntry *e = NULL;
 
-while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+while (e = av_dict_iterate(dict[i], e)) {
 if (av_stristr(e->key, "name")) {
 feature_name = e->value;
 continue;
@@ -295,11 +295,11 @@ static int parse_models(AVFilterContext *ctx)
 
 for (unsigned i = 0; i < dict_cnt; i++) {
 VmafModelConfig model_cfg = { 0 };
-AVDictionaryEntry *e = NULL;
+const AVDictionaryEntry *e = NULL;
 char *version = NULL;
 char  *path = NULL;
 
-while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+while (e = av_dict_iterate(dict[i], e)) {
 if (av_stristr(e->key, "disable_clip")) {
 model_cfg.flags |= av_stristr(e->value, "true") ?
 VMAF_MODEL_FLAG_DISABLE_CLIP : 0;
@@ -355,7 +355,7 @@ static int parse_models(AVFilterContext *ctx)
 goto exit;
 }
 
-while (e = av_dict_get(dict[i], "", e, AV_DICT_IGNORE_SUFFIX)) {
+while (e = av_dict_iterate(dict[i], e)) {
 VmafFeatureDictionary *feature_opts_dict = NULL;
 char *feature_opt = NULL;
 
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/smjpegenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/smjpegenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 888ece2f7c..edba08cf9b 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -35,7 +35,7 @@ typedef struct SMJPEGMuxContext {
 
 static int smjpeg_write_header(AVFormatContext *s)
 {
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 AVIOContext *pb = s->pb;
 int n, tag;
 
@@ -48,7 +48,7 @@ static int smjpeg_write_header(AVFormatContext *s)
 avio_wb32(pb, 0);
 
 ff_standardize_creation_time(s);
-while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(s->metadata, t))) {
 avio_wl32(pb, SMJPEG_TXT);
 avio_wb32(pb, strlen(t->key) + strlen(t->value) + 3);
 avio_write(pb, t->key, strlen(t->key));
-- 
2.37.0 (Apple Git-136)

___
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/31] avutil: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavutil/opt.c| 12 ++--
 libavutil/tests/dict.c | 10 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index a3940f47fb..0a909a8b22 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
 
 int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
 {
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 AVDictionary*tmp = NULL;
 int ret;
 
 if (!options)
 return 0;
 
-while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(*options, t))) {
 ret = av_opt_set(obj, t->key, t->value, search_flags);
 if (ret == AVERROR_OPTION_NOT_FOUND)
 ret = av_dict_set(&tmp, t->key, t->value, 0);
@@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
 case AV_OPT_TYPE_DICT: {
 AVDictionary *dict1 = NULL;
 AVDictionary *dict2 = *(AVDictionary **)dst;
-AVDictionaryEntry *en1 = NULL;
-AVDictionaryEntry *en2 = NULL;
+const AVDictionaryEntry *en1 = NULL;
+const AVDictionaryEntry *en2 = NULL;
 ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
 if (ret < 0) {
 av_dict_free(&dict1);
 return ret;
 }
 do {
-en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
-en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
+en1 = av_dict_iterate(dict1, en1);
+en2 = av_dict_iterate(dict2, en2);
 } while (en1 && en2 && !strcmp(en1->key, en2->key) && 
!strcmp(en1->value, en2->value));
 av_dict_free(&dict1);
 return (!en1 && !en2);
diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
index d053545f4d..8c05752ea7 100644
--- a/libavutil/tests/dict.c
+++ b/libavutil/tests/dict.c
@@ -22,8 +22,8 @@
 
 static void print_dict(const AVDictionary *m)
 {
-AVDictionaryEntry *t = NULL;
-while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
+const AVDictionaryEntry *t = NULL;
+while ((t = av_dict_iterate(m, t)))
 printf("%s %s   ", t->key, t->value);
 printf("\n");
 }
@@ -94,7 +94,7 @@ int main(void)
 if (av_dict_get(dict, NULL, NULL, 0))
 printf("av_dict_get() does not correctly handle NULL key.\n");
 e = NULL;
-while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
+while ((e = av_dict_iterate(dict, e)))
 printf("%s %s\n", e->key, e->value);
 av_dict_free(&dict);
 
@@ -106,7 +106,7 @@ int main(void)
 printf("av_dict_set does not correctly handle NULL key\n");
 
 e = NULL;
-while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
+while ((e = av_dict_iterate(dict, e)))
 printf("'%s' '%s'\n", e->key, e->value);
 av_dict_free(&dict);
 
@@ -122,7 +122,7 @@ int main(void)
 av_dict_set_int(&dict, "12", 1, 0);
 av_dict_set_int(&dict, "12", 2, AV_DICT_APPEND);
 e = NULL;
-while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
+while ((e = av_dict_iterate(dict, e)))
 printf("%s %s\n", e->key, e->value);
 av_dict_free(&dict);
 
-- 
2.37.0 (Apple Git-136)

___
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/31] avfilter/vf_scale: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavfilter/vf_scale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 2b12cf283c..b95e2e6c66 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -555,8 +555,8 @@ static int config_props(AVFilterLink *outlink)
scale->out_range == AVCOL_RANGE_JPEG, 0);
 
 if (scale->opts) {
-AVDictionaryEntry *e = NULL;
-while ((e = av_dict_get(scale->opts, "", e, 
AV_DICT_IGNORE_SUFFIX))) {
+const AVDictionaryEntry *e = NULL;
+while ((e = av_dict_iterate(scale->opts, e))) {
 if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0)
 return ret;
 }
-- 
2.37.0 (Apple Git-136)

___
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/31] avfilter/f_metadata: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavfilter/f_metadata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 82491f2bb8..4b7cfb0cb7 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -308,7 +308,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 AVFilterLink *outlink = ctx->outputs[0];
 MetadataContext *s = ctx->priv;
 AVDictionary **metadata = &frame->metadata;
-AVDictionaryEntry *e;
+const AVDictionaryEntry *e;
 
 e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
 !s->key ? AV_DICT_IGNORE_SUFFIX: 0);
@@ -339,7 +339,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%s\n",
  inlink->frame_count_out, av_ts2str(frame->pts), 
av_ts2timestr(frame->pts, &inlink->time_base));
 s->print(ctx, "%s=%s\n", e->key, e->value);
-while ((e = av_dict_get(*metadata, "", e, AV_DICT_IGNORE_SUFFIX)) 
!= NULL) {
+while ((e = av_dict_iterate(*metadata, e)) != NULL) {
 s->print(ctx, "%s=%s\n", e->key, e->value);
 }
 } else if (e && e->value && (!s->value || (e->value && s->compare(s, 
e->value, s->value {
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/cafenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/cafenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index b90811d46f..b8317cd5ed 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -113,7 +113,7 @@ static int caf_write_header(AVFormatContext *s)
 AVIOContext *pb = s->pb;
 AVCodecParameters *par = s->streams[0]->codecpar;
 CAFContext *caf = s->priv_data;
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, 
par->codec_id);
 int64_t chunk_size = 0;
 int frame_size = par->frame_size, sample_rate = par->sample_rate;
@@ -195,13 +195,13 @@ static int caf_write_header(AVFormatContext *s)
 ff_standardize_creation_time(s);
 if (av_dict_count(s->metadata)) {
 ffio_wfourcc(pb, "info"); //< Information chunk
-while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(s->metadata, t))) {
 chunk_size += strlen(t->key) + strlen(t->value) + 2;
 }
 avio_wb64(pb, chunk_size + 4);
 avio_wb32(pb, av_dict_count(s->metadata));
 t = NULL;
-while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(s->metadata, t))) {
 avio_put_str(pb, t->key);
 avio_put_str(pb, t->value);
 }
-- 
2.37.0 (Apple Git-136)

___
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/31] doc/examples/metadata: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 doc/examples/metadata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/examples/metadata.c b/doc/examples/metadata.c
index 7c44009a24..734b12df16 100644
--- a/doc/examples/metadata.c
+++ b/doc/examples/metadata.c
@@ -52,7 +52,7 @@ int main (int argc, char **argv)
 return ret;
 }
 
-while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, 
AV_DICT_IGNORE_SUFFIX)))
+while ((tag = av_dict_iterate(fmt_ctx->metadata, tag)))
 printf("%s=%s\n", tag->key, tag->value);
 
 avformat_close_input(&fmt_ctx);
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/movenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/movenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 064b541972..7b00e65cdd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4110,7 +4110,7 @@ static int mov_write_mdta_hdlr_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
 {
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 int64_t pos = avio_tell(pb);
 int64_t curpos, entry_pos;
 int count = 0;
@@ -4121,7 +4121,7 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 entry_pos = avio_tell(pb);
 avio_wb32(pb, 0); /* entry count */
 
-while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
+while (t = av_dict_iterate(s->metadata, t)) {
 size_t key_len = strlen(t->key);
 avio_wb32(pb, key_len + 8);
 ffio_wfourcc(pb, "mdta");
@@ -4139,14 +4139,14 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 static int mov_write_mdta_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
 {
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 int64_t pos = avio_tell(pb);
 int count = 1; /* keys are 1-index based */
 
 avio_wb32(pb, 0); /* size */
 ffio_wfourcc(pb, "ilst");
 
-while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
+while (t = av_dict_iterate(s->metadata, t)) {
 int64_t entry_pos = avio_tell(pb);
 avio_wb32(pb, 0); /* size */
 avio_wb32(pb, count); /* key */
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/metadata: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/metadata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index b9b6de7972..a0258ea125 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -29,14 +29,14 @@ void ff_metadata_conv(AVDictionary **pm, const 
AVMetadataConv *d_conv,
 /* TODO: use binary search to look up the two conversion tables
if the tables are getting big enough that it would matter speed wise */
 const AVMetadataConv *sc, *dc;
-AVDictionaryEntry *mtag = NULL;
+const AVDictionaryEntry *mtag = NULL;
 AVDictionary *dst = NULL;
 const char *key;
 
 if (d_conv == s_conv || !pm)
 return;
 
-while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) {
+while ((mtag = av_dict_iterate(*pm, mtag))) {
 key = mtag->key;
 if (s_conv)
 for (sc=s_conv; sc->native; sc++)
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/flvenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/flvenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 59be11eba8..128ae8ebc0 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -277,7 +277,7 @@ static void write_metadata(AVFormatContext *s, unsigned int 
ts)
 int write_duration_filesize = !(flv->flags & FLV_NO_DURATION_FILESIZE);
 int metadata_count = 0;
 int64_t metadata_count_pos;
-AVDictionaryEntry *tag = NULL;
+const AVDictionaryEntry *tag = NULL;
 
 /* write meta_tag */
 avio_w8(pb, FLV_TAG_TYPE_META);// tag type META
@@ -353,7 +353,7 @@ static void write_metadata(AVFormatContext *s, unsigned int 
ts)
 }
 
 ff_standardize_creation_time(s);
-while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+while ((tag = av_dict_iterate(s->metadata, tag))) {
 if(   !strcmp(tag->key, "width")
 ||!strcmp(tag->key, "height")
 ||!strcmp(tag->key, "videodatarate")
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/hls: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
And constify oldentry too while at it.
---
 libavformat/hls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 402eb2b5a0..926d053939 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1104,10 +1104,10 @@ static void parse_id3(AVFormatContext *s, AVIOContext 
*pb,
 static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata,
   ID3v2ExtraMetaAPIC *apic)
 {
-AVDictionaryEntry *entry = NULL;
-AVDictionaryEntry *oldentry;
+const AVDictionaryEntry *entry = NULL;
+const AVDictionaryEntry *oldentry;
 /* check that no keys have changed values */
-while ((entry = av_dict_get(metadata, "", entry, AV_DICT_IGNORE_SUFFIX))) {
+while ((entry = av_dict_iterate(metadata, entry))) {
 oldentry = av_dict_get(pls->id3_initial, entry->key, NULL, 
AV_DICT_MATCH_CASE);
 if (!oldentry || strcmp(oldentry->value, entry->value) != 0)
 return 1;
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/lrcenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/lrcenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c
index f7a5a6982d..2d6ca33e38 100644
--- a/libavformat/lrcenc.c
+++ b/libavformat/lrcenc.c
@@ -63,8 +63,7 @@ static int lrc_write_header(AVFormatContext *s)
 av_dict_set(&s->metadata, "ve", NULL, 0);
 }
 for(metadata_item = NULL;
-   (metadata_item = av_dict_get(s->metadata, "", metadata_item,
-AV_DICT_IGNORE_SUFFIX));) {
+   (metadata_item = av_dict_iterate(s->metadata, metadata_item));) {
 char *delim;
 if(!metadata_item->value[0]) {
 continue;
-- 
2.37.0 (Apple Git-136)

___
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/31] avformat/dump: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 225f80ac22..d31e4c2ec6 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -140,7 +140,7 @@ static void dump_metadata(void *ctx, const AVDictionary *m, 
const char *indent)
 const AVDictionaryEntry *tag = NULL;
 
 av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
-while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
+while ((tag = av_dict_iterate(m, tag)))
 if (strcmp("language", tag->key)) {
 const char *p = tag->value;
 av_log(ctx, AV_LOG_INFO,
-- 
2.37.0 (Apple Git-136)

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

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


[FFmpeg-devel] [PATCH 23/31] avformat/wtvenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/wtvenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 7e28b2082e..977e16c5a4 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -670,12 +670,12 @@ static void write_table_entries_attrib(AVFormatContext *s)
 {
 WtvContext *wctx = s->priv_data;
 AVIOContext *pb = s->pb;
-AVDictionaryEntry *tag = 0;
+const AVDictionaryEntry *tag = 0;
 
 ff_standardize_creation_time(s);
 //FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
 ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
-while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
+while ((tag = av_dict_iterate(s->metadata, tag)))
 write_tag(pb, tag->key, tag->value);
 
 if (wctx->thumbnail.size) {
@@ -698,11 +698,11 @@ static void 
write_table_redirector_legacy_attrib(AVFormatContext *s)
 {
 WtvContext *wctx = s->priv_data;
 AVIOContext *pb = s->pb;
-AVDictionaryEntry *tag = 0;
+const AVDictionaryEntry *tag = 0;
 int64_t pos = 0;
 
 //FIXME: translate special tags to binary representation
-while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
+while ((tag = av_dict_iterate(s->metadata, tag))) {
 avio_wl64(pb, pos);
 pos += metadata_header_size(tag->key) + strlen(tag->value)*2 + 2;
 }
-- 
2.37.0 (Apple Git-136)

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

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


[FFmpeg-devel] [PATCH 24/31] avformat/ffmetaenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/ffmetaenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c
index edd66e1a04..f27ac1ac50 100644
--- a/libavformat/ffmetaenc.c
+++ b/libavformat/ffmetaenc.c
@@ -40,8 +40,8 @@ static void write_escape_str(AVIOContext *s, const uint8_t 
*str)
 
 static void write_tags(AVIOContext *s, AVDictionary *m)
 {
-AVDictionaryEntry *t = NULL;
-while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
+const AVDictionaryEntry *t = NULL;
+while ((t = av_dict_iterate(m, t))) {
 write_escape_str(s, t->key);
 avio_w8(s, '=');
 write_escape_str(s, t->value);
-- 
2.37.0 (Apple Git-136)

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

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


[FFmpeg-devel] [PATCH 25/31] avformat/id3v2enc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/id3v2enc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c
index 515d2efd7d..ac907c2758 100644
--- a/libavformat/id3v2enc.c
+++ b/libavformat/id3v2enc.c
@@ -150,7 +150,7 @@ static int id3v2_put_priv(ID3v2EncContext *id3, AVIOContext 
*avioc, const char *
 return len + ID3v2_HEADER_SIZE;
 }
 
-static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, 
AVDictionaryEntry *t,
+static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, const 
AVDictionaryEntry *t,
  const char table[][4], enum ID3v2Encoding enc)
 {
 uint32_t tag;
@@ -167,13 +167,13 @@ static int id3v2_check_write_tag(ID3v2EncContext *id3, 
AVIOContext *pb, AVDictio
 
 static void id3v2_3_metadata_split_date(AVDictionary **pm)
 {
-AVDictionaryEntry *mtag = NULL;
+const AVDictionaryEntry *mtag = NULL;
 AVDictionary *dst = NULL;
 const char *key, *value;
 char year[5] = {0}, day_month[5] = {0};
 int i;
 
-while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) {
+while ((mtag = av_dict_iterate(*pm, mtag))) {
 key = mtag->key;
 if (!av_strcasecmp(key, "date")) {
 /* split date tag using "-MM-DD" format into year and 
month/day segments */
@@ -220,7 +220,7 @@ void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, 
int id3v2_version,
 static int write_metadata(AVIOContext *pb, AVDictionary **metadata,
   ID3v2EncContext *id3, int enc)
 {
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 int ret;
 
 ff_metadata_conv(metadata, ff_id3v2_34_metadata_conv, NULL);
@@ -229,7 +229,7 @@ static int write_metadata(AVIOContext *pb, AVDictionary 
**metadata,
 else if (id3->version == 4)
 ff_metadata_conv(metadata, ff_id3v2_4_metadata_conv, NULL);
 
-while ((t = av_dict_get(*metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(*metadata, t))) {
 if ((ret = id3v2_check_write_tag(id3, pb, t, ff_id3v2_tags, enc)) > 0) 
{
 id3->len += ret;
 continue;
-- 
2.37.0 (Apple Git-136)

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

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


[FFmpeg-devel] [PATCH 26/31] avformat/nutenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/nutenc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 1afdeeb8ab..ff81ee34aa 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -516,7 +516,7 @@ static int add_info(AVIOContext *bc, const char *type, 
const char *value)
 static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
 {
 AVFormatContext *s   = nut->avf;
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 AVIOContext *dyn_bc;
 uint8_t *dyn_buf = NULL;
 int count= 0, dyn_size;
@@ -525,7 +525,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext 
*bc)
 return ret;
 
 ff_standardize_creation_time(s);
-while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+while ((t = av_dict_iterate(s->metadata, t)))
 count += add_info(dyn_bc, t->key, t->value);
 
 put_v(bc, 0); //stream_if_plus1
@@ -544,7 +544,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext 
*bc)
 static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
 AVFormatContext *s= nut->avf;
 AVStream* st = s->streams[stream_id];
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 AVIOContext *dyn_bc;
 uint8_t *dyn_buf=NULL;
 int count=0, dyn_size, i;
@@ -552,7 +552,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext 
*bc, int stream_id) {
 if (ret < 0)
 return ret;
 
-while ((t = av_dict_get(st->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+while ((t = av_dict_iterate(st->metadata, t)))
 count += add_info(dyn_bc, t->key, t->value);
 for (i=0; ff_nut_dispositions[i].flag; ++i) {
 if (st->disposition & ff_nut_dispositions[i].flag)
@@ -587,7 +587,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, 
int id)
 {
 AVIOContext *dyn_bc;
 uint8_t *dyn_buf = NULL;
-AVDictionaryEntry *t = NULL;
+const AVDictionaryEntry *t = NULL;
 AVChapter *ch= nut->avf->chapters[id];
 int ret, dyn_size, count = 0;
 
@@ -600,7 +600,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, 
int id)
 put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start
 put_v(bc, ch->end - ch->start); // chapter_len
 
-while ((t = av_dict_get(ch->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
+while ((t = av_dict_iterate(ch->metadata, t)))
 count += add_info(dyn_bc, t->key, t->value);
 
 put_v(bc, count);
-- 
2.37.0 (Apple Git-136)

___
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 27/31] avformat/apetag: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/apetag.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index e861aac0f8..f2794c46f2 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -175,7 +175,7 @@ static int string_is_ascii(const uint8_t *str)
 
 int ff_ape_write_tag(AVFormatContext *s)
 {
-AVDictionaryEntry *e = NULL;
+const AVDictionaryEntry *e = NULL;
 int size, ret, count = 0;
 AVIOContext *dyn_bc;
 uint8_t *dyn_buf;
@@ -184,7 +184,7 @@ int ff_ape_write_tag(AVFormatContext *s)
 return ret;
 
 ff_standardize_creation_time(s);
-while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
+while ((e = av_dict_iterate(s->metadata, e))) {
 int val_len;
 
 if (!string_is_ascii(e->key)) {
-- 
2.37.0 (Apple Git-136)

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

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


[FFmpeg-devel] [PATCH 28/31] avformat/asfenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/asfenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 70800a6df5..47240fc0a8 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -570,10 +570,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t 
file_size,
 end_header(pb, hpos);
 }
 if (metadata_count) {
-AVDictionaryEntry *tag = NULL;
+const AVDictionaryEntry *tag = NULL;
 hpos = put_header(pb, &ff_asf_extended_content_header);
 avio_wl16(pb, metadata_count);
-while ((tag = av_dict_get(s->metadata, "", tag, 
AV_DICT_IGNORE_SUFFIX))) {
+while ((tag = av_dict_iterate(s->metadata, tag))) {
 put_str16(pb, dyn_buf, tag->key);
 avio_wl16(pb, 0);
 put_str16(pb, dyn_buf, tag->value);
-- 
2.37.0 (Apple Git-136)

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

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


[FFmpeg-devel] [PATCH 29/31] avformat/http: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/http.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index c5c48c7900..7bce821535 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1021,11 +1021,11 @@ static int parse_cookie(HTTPContext *s, const char *p, 
AVDictionary **cookies)
 
 static int cookie_string(AVDictionary *dict, char **cookies)
 {
-AVDictionaryEntry *e = NULL;
+const AVDictionaryEntry *e = NULL;
 int len = 1;
 
 // determine how much memory is needed for the cookies string
-while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+while ((e = av_dict_iterate(dict, e)))
 len += strlen(e->key) + strlen(e->value) + 1;
 
 // reallocate the cookies
@@ -1036,7 +1036,7 @@ static int cookie_string(AVDictionary *dict, char 
**cookies)
 *cookies[0] = '\0';
 
 // write out the cookies
-while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+while ((e = av_dict_iterate(dict, e)))
 av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);
 
 return 0;
-- 
2.37.0 (Apple Git-136)

___
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 30/31] avformat/matroskaenc: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2be4f87284..2deb4284e8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2048,7 +2048,7 @@ static int mkv_write_tag(MatroskaMuxContext *mkv, const 
AVDictionary *m,
 
 mkv_write_tag_targets(mkv, tmp_bc, elementid, uid);
 
-while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
+while ((t = av_dict_iterate(m, t))) {
 if (mkv_check_tag_name(t->key, elementid)) {
 ret = mkv_write_simpletag(tmp_bc, t);
 if (ret < 0)
-- 
2.37.0 (Apple Git-136)

___
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 31/31] avformat/fifo: use av_dict_iterate

2022-11-24 Thread Marvin Scholz
---
 libavformat/fifo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 7b35c9bf02..c125a97b0d 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -148,8 +148,8 @@ static int fifo_thread_write_header(FifoThreadContext *ctx)
 
 // Check for options unrecognized by underlying muxer
 if (format_options) {
-AVDictionaryEntry *entry = NULL;
-while ((entry = av_dict_get(format_options, "", entry, 
AV_DICT_IGNORE_SUFFIX)))
+const AVDictionaryEntry *entry = NULL;
+while ((entry = av_dict_iterate(format_options, entry)))
 av_log(avf2, AV_LOG_ERROR, "Unknown option '%s'\n", entry->key);
 ret = AVERROR(EINVAL);
 }
-- 
2.37.0 (Apple Git-136)

___
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] lavf/vf_vpp_qsv: scale_mode can be applied to color conversion

2022-11-24 Thread Xiang, Haihao
On Thu, 2022-11-24 at 18:47 +, Soft Works wrote:
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Xiang, Haihao
> > Sent: Thursday, November 24, 2022 10:20 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Haihao Xiang 
> > Subject: [FFmpeg-devel] [PATCH 4/4] lavf/vf_vpp_qsv: scale_mode can
> > be applied to color conversion
> > 
> > From: Haihao Xiang 
> > 
> > Signed-off-by: Haihao Xiang 
> > ---
> >  libavfilter/vf_vpp_qsv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> > index 4a053f9145..17f2989245 100644
> > --- a/libavfilter/vf_vpp_qsv.c
> > +++ b/libavfilter/vf_vpp_qsv.c
> > @@ -492,7 +492,7 @@ static int config_output(AVFilterLink *outlink)
> >  }
> >  }
> > 
> > -if (inlink->w != outlink->w || inlink->h != outlink->h) {
> > +if (inlink->w != outlink->w || inlink->h != outlink->h ||
> > in_format != vpp->out_format) {
> >  if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
> >  memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
> >  vpp->scale_conf.Header.BufferId=
> > MFX_EXTBUFF_VPP_SCALING;
> > --
> 
> LGTM. But maybe the warning below should be adjusted, as it would
> be confusing when it says scaling even though no scaling is
> configured.
> 

Thanks, I'll update the comment.

-Haihao

___
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] lavfi/qsvvpp: change the output frame's width and height

2022-11-24 Thread Xiang, Haihao
On Thu, 2022-11-24 at 18:57 +, Soft Works wrote:
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Xiang, Haihao
> > Sent: Thursday, November 24, 2022 10:19 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Chen,Wenbin 
> > Subject: [FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: change the output
> > frame's width and height
> > 
> > From: "Chen,Wenbin" 
> > 
> > Make sure the size of the output frame always matches the agreed upon
> > image size.
> > 
> > Signed-off-by: Wenbin Chen 
> > ---
> >  libavfilter/qsvvpp.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> > index 8428ee89ab..bf719b2a29 100644
> > --- a/libavfilter/qsvvpp.c
> > +++ b/libavfilter/qsvvpp.c
> > @@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> > AVFilterLink *outlink)
> >  if (!out_frame->frame)
> >  return NULL;
> > 
> > -out_frame->frame->width  = outlink->w;
> > -out_frame->frame->height = outlink->h;
> > -
> >  ret = map_frame_to_surface(out_frame->frame,
> > &out_frame->surface);
> >  if (ret < 0)
> >  return NULL;
> >  }
> > 
> > +out_frame->frame->width  = outlink->w;
> > +out_frame->frame->height = outlink->h;
> >  out_frame->surface.Info = s->vpp_param.vpp.Out;
> > 
> >  return out_frame;
> > --
> 
> Which problem case does this address?

av_hwframe_get_buffer() gets a frame with aligned dimension, the filtered_frame
dimension might not be the expected one if don't reset width and height to the
agreed image width and height. E.g. the filtered frame is 1920x1088, not
1920x1080 in the following command

$ ffmpeg -hwaccel qsv -i input.mp4 -vf "vpp_qsv=w=1920:h=1080" -f null -

Thanks
Haihao

___
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] avcodec/pictordec: Check that the image fits in the input

2022-11-24 Thread Peter Ross
On Tue, Nov 22, 2022 at 11:56:51PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 53438/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-5458939919859712
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpe
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/pictordec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
> index 71bad40a0a..09229b94fd 100644
> --- a/libavcodec/pictordec.c
> +++ b/libavcodec/pictordec.c
> @@ -162,6 +162,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
> *frame,
>  
>  if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
>  return -1;
> +if (bytestream2_get_bytes_left(&s->g) < s->width * s->height / 65536 * 5)
> +return AVERROR_INVALIDDATA;

how did you arrive at this formula?

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


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