The branch, release/8.0 has been updated
       via  4f8b3891ee0f3a9ed1d6064ebce1305f190d42ed (commit)
       via  e0a971a8fa106ea2c500a802cc6679cf7719d8eb (commit)
      from  7cc24cee1678932496f7dacd6064f45a3cf39c14 (commit)


- Log -----------------------------------------------------------------
commit 4f8b3891ee0f3a9ed1d6064ebce1305f190d42ed
Author:     James Almer <[email protected]>
AuthorDate: Mon Aug 18 12:22:09 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Thu Sep 11 23:24:00 2025 -0300

    fftools/ffmpeg_demux: ensure the display_rotation option is honored
    
    If requested, it should have priotity over any coded value.
    Fixes ticket #11649.
    
    Signed-off-by: James Almer <[email protected]>
    (cherry picked from commit 70a6ad6c743e8f36921755cacff2726825021b8a)

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 78d8ff6b7d..d2f0017aeb 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -67,6 +67,7 @@ typedef struct DemuxStream {
     int                      reinit_filters;
     int                      autorotate;
     int                      apply_cropping;
+    int                      force_display_matrix;
     int                      drop_changed;
 
 
@@ -1183,6 +1184,7 @@ static int add_display_matrix_to_stream(const 
OptionsContext *o,
                                         AVFormatContext *ctx, InputStream *ist)
 {
     AVStream *st = ist->st;
+    DemuxStream *ds = ds_from_ist(ist);
     AVPacketSideData *sd;
     double rotation = DBL_MAX;
     int hflip = -1, vflip = -1;
@@ -1217,6 +1219,8 @@ static int add_display_matrix_to_stream(const 
OptionsContext *o,
                            hflip_set ? hflip : 0,
                            vflip_set ? vflip : 0);
 
+    ds->force_display_matrix = 1;
+
     return 0;
 }
 
@@ -1455,6 +1459,15 @@ static int ist_add(const OptionsContext *o, Demuxer *d, 
AVStream *st, AVDictiona
     av_dict_set_int(&ds->decoder_opts, "apply_cropping",
                     ds->apply_cropping && ds->apply_cropping != 
CROP_CONTAINER, 0);
 
+    if (ds->force_display_matrix) {
+        char buf[32];
+        if (av_dict_get(ds->decoder_opts, "side_data_prefer_packet", NULL, 0))
+            buf[0] = ',';
+        else
+            buf[0] = '\0';
+        av_strlcat(buf, "displaymatrix", sizeof(buf));
+        av_dict_set(&ds->decoder_opts, "side_data_prefer_packet", buf, 
AV_DICT_APPEND);
+    }
     /* Attached pics are sparse, therefore we would not want to delay their 
decoding
      * till EOF. */
     if (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)

commit e0a971a8fa106ea2c500a802cc6679cf7719d8eb
Author:     James Almer <[email protected]>
AuthorDate: Wed Sep 10 09:31:48 2025 -0300
Commit:     James Almer <[email protected]>
CommitDate: Thu Sep 11 23:23:54 2025 -0300

    avcodec/mjpegdec: use ff_frame_new_side_data() to export display matrix
    
    Otherwise, the user requested priority of packet side data will be ignored.
    
    Signed-off-by: James Almer <[email protected]>

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 15a4ebc7f1..858b5be1af 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2875,15 +2875,15 @@ the_end:
             AVFrameSideData *sd = NULL;
 
             if (orientation >= 2 && orientation <= 8) {
-                int32_t *matrix;
-
-                sd = av_frame_new_side_data(frame, 
AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9);
-                if (!sd) {
+                ret = ff_frame_new_side_data(avctx, frame, 
AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9, &sd);
+                if (ret < 0) {
                     av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side 
data\n");
-                    return AVERROR(ENOMEM);
+                    return ret;
                 }
+            }
 
-                matrix = (int32_t *)sd->data;
+            if (sd) {
+                int32_t *matrix = (int32_t *)sd->data;
 
                 switch (orientation) {
                 case 2:

-----------------------------------------------------------------------

Summary of changes:
 fftools/ffmpeg_demux.c | 13 +++++++++++++
 libavcodec/mjpegdec.c  | 12 ++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)


hooks/post-receive
-- 

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

Reply via email to