Patches attached.

- Andreas
From c0dbda4a3a63a451618e4578c779cd999d365819 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:11:50 +0200
Subject: [PATCH 1/7] avformat/apvenc: Only allow APV

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavformat/apvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/apvenc.c b/libavformat/apvenc.c
index 9c4d33fdae..c7827cd5b5 100644
--- a/libavformat/apvenc.c
+++ b/libavformat/apvenc.c
@@ -35,6 +35,6 @@ const FFOutputFormat ff_apv_muxer = {
     .p.audio_codec    = AV_CODEC_ID_NONE,
     .p.video_codec    = AV_CODEC_ID_APV,
     .p.subtitle_codec = AV_CODEC_ID_NONE,
-    .flags_internal   = FF_OFMT_FLAG_MAX_ONE_OF_EACH,
+    .flags_internal   = FF_OFMT_FLAG_MAX_ONE_OF_EACH | FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
     .write_packet     = apv_write_packet,
 };
-- 
2.45.2

From c7eca20695decf6ed5a2d48fdc51bb3e4dc154f9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:12:19 +0200
Subject: [PATCH 2/7] avformat/apvenc: Remove unused header

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavformat/apvenc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/apvenc.c b/libavformat/apvenc.c
index c7827cd5b5..823cc0e601 100644
--- a/libavformat/apvenc.c
+++ b/libavformat/apvenc.c
@@ -16,8 +16,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcodec/apv.h"
-
 #include "avformat.h"
 #include "mux.h"
 
-- 
2.45.2

From 8fd6d853835e053a9617a28b7024ec9ce3abfddc Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:14:35 +0200
Subject: [PATCH 3/7] avformat/apvdec: Use ffio_read_size()

Fixes potential use of uninitialized data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavformat/apvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c
index e1ac34b003..9f94a901ec 100644
--- a/libavformat/apvdec.c
+++ b/libavformat/apvdec.c
@@ -164,7 +164,7 @@ static int apv_read_header(AVFormatContext *s)
     err = ffio_ensure_seekback(s->pb, sizeof(buffer));
     if (err < 0)
         return err;
-    size = avio_read(s->pb, buffer, sizeof(buffer));
+    size = ffio_read_size(s->pb, buffer, sizeof(buffer));
     if (size < 0)
         return size;
 
-- 
2.45.2

From 8132d6218d5945dc2267627b36deb3a191552ed9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:20:02 +0200
Subject: [PATCH 4/7] avformat/apvdec: Remove inappropriate flags

The init-cleanup flag makes no sense for a demuxer without
a read_close() function; and the generic index is wrong, as
the packet positions are off by four (they point to the actual
packet data, not to the access unit size field).

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavformat/apvdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c
index 9f94a901ec..85e875a0d4 100644
--- a/libavformat/apvdec.c
+++ b/libavformat/apvdec.c
@@ -240,8 +240,7 @@ const FFInputFormat ff_apv_demuxer = {
     .p.name         = "apv",
     .p.long_name    = NULL_IF_CONFIG_SMALL("APV raw bitstream"),
     .p.extensions   = "apv",
-    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
-    .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
+    .p.flags        = AVFMT_NOTIMESTAMPS,
     .read_probe     = apv_probe,
     .read_header    = apv_read_header,
     .read_packet    = apv_read_packet,
-- 
2.45.2

From a0b0e7796c85d4b77d5ead8cf8baccb4c75e1523 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:23:23 +0200
Subject: [PATCH 5/7] avformat/apvenc: Add AVFMT_NOTIMESTAMPS flag

This is a raw format.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavformat/apvenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/apvenc.c b/libavformat/apvenc.c
index 823cc0e601..1e58ca8903 100644
--- a/libavformat/apvenc.c
+++ b/libavformat/apvenc.c
@@ -33,6 +33,7 @@ const FFOutputFormat ff_apv_muxer = {
     .p.audio_codec    = AV_CODEC_ID_NONE,
     .p.video_codec    = AV_CODEC_ID_APV,
     .p.subtitle_codec = AV_CODEC_ID_NONE,
+    .p.flags          = AVFMT_NOTIMESTAMPS,
     .flags_internal   = FF_OFMT_FLAG_MAX_ONE_OF_EACH | FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
     .write_packet     = apv_write_packet,
 };
-- 
2.45.2

From d65d8f934d8b66509f20ff279d7343ffc90f01d8 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:25:21 +0200
Subject: [PATCH 6/7] avcodec/apv_decode: Fix shadowing

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavcodec/apv_decode.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/apv_decode.c b/libavcodec/apv_decode.c
index e28bc29c8f..3b638795ea 100644
--- a/libavcodec/apv_decode.c
+++ b/libavcodec/apv_decode.c
@@ -313,11 +313,11 @@ static int apv_decode_metadata(AVCodecContext *avctx, AVFrame *frame,
                     return err;
 
                 if (mdm) {
-                    for (int i = 0; i < 3; i++) {
-                        mdm->display_primaries[i][0] =
-                            av_make_q(mdcv->primary_chromaticity_x[i], 1 << 16);
-                        mdm->display_primaries[i][1] =
-                            av_make_q(mdcv->primary_chromaticity_y[i], 1 << 16);
+                    for (int j = 0; j < 3; j++) {
+                        mdm->display_primaries[j][0] =
+                            av_make_q(mdcv->primary_chromaticity_x[j], 1 << 16);
+                        mdm->display_primaries[j][1] =
+                            av_make_q(mdcv->primary_chromaticity_y[j], 1 << 16);
                     }
 
                     mdm->white_point[0] =
-- 
2.45.2

From 1b608bef36141eb6cef0d98042a2db1b9234ed08 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 27 Apr 2025 20:29:53 +0200
Subject: [PATCH 7/7] avcodec/apv_decode: Remove redundant log message

ff_thread_get_buffer() already emits its own logmessage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavcodec/apv_decode.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/apv_decode.c b/libavcodec/apv_decode.c
index 3b638795ea..6fe52ffd84 100644
--- a/libavcodec/apv_decode.c
+++ b/libavcodec/apv_decode.c
@@ -277,10 +277,8 @@ static int apv_decode(AVCodecContext *avctx, AVFrame *output,
     }
 
     err = ff_thread_get_buffer(avctx, output, 0);
-    if (err) {
-        av_log(avctx, AV_LOG_ERROR, "No output frame supplied.\n");
+    if (err < 0)
         return err;
-    }
 
     apv->output_frame = output;
 
-- 
2.45.2

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

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

Reply via email to