This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 8add479cd3f3b39bd443d889c93dd33da4921f89
Author:     James Almer <[email protected]>
AuthorDate: Fri Mar 6 10:56:04 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Sat Mar 7 19:21:44 2026 -0300

    avcodec/parser: set avctx->pix_fmt for codecs with the enhancement prop set
    
    There will be no decoder for those, so the parser's derived value may be 
used.
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/parser.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 12fdc3bb58..28f4de5826 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -28,6 +28,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/mem.h"
 
+#include "codec_desc.h"
 #include "parser.h"
 #include "parser_internal.h"
 
@@ -125,6 +126,7 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
                      const uint8_t *buf, int buf_size,
                      int64_t pts, int64_t dts, int64_t pos)
 {
+    const AVCodecDescriptor *desc;
     int index, i;
     uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE];
 
@@ -139,6 +141,8 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
                avctx->codec_id == s->parser->codec_ids[5] ||
                avctx->codec_id == s->parser->codec_ids[6]);
 
+    desc = avcodec_descriptor_get(avctx->codec_id);
+
     if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) {
         s->next_frame_offset =
         s->cur_offset        = pos;
@@ -178,6 +182,8 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
         FILL(coded_height);
         FILL(width);
         FILL(height);
+        if (desc && (desc->props & AV_CODEC_PROP_ENHANCEMENT) &&
+            s->format >= 0 && avctx->pix_fmt < 0) avctx->pix_fmt = s->format;
     }
 
     /* update the file pointer */

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to