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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 491e0d1cfb avformat/matroskaenc: write LCEVC payloads as ITU-T T35 
block additional
491e0d1cfb is described below

commit 491e0d1cfb27f24b4bc5fb85154e20ce1c591e1a
Author:     James Almer <[email protected]>
AuthorDate: Tue Jun 9 20:13:32 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Tue Jun 16 10:20:33 2026 -0300

    avformat/matroskaenc: write LCEVC payloads as ITU-T T35 block additional
    
    Signed-off-by: James Almer <[email protected]>
---
 libavformat/matroskaenc.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c9386db6a0..7aa78754f3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2871,6 +2871,7 @@ static int mkv_write_block(void *logctx, 
MatroskaMuxContext *mkv,
     uint8_t t35_buf[6 + AV_HDR_PLUS_MAX_PAYLOAD_SIZE];
 #define SMPTE_2094_APP5_MAX_SIZE 855
     uint8_t smpte_2094_app5_buf[5 + SMPTE_2094_APP5_MAX_SIZE];
+    uint8_t *lcevc = NULL;
     uint8_t *side_data;
     size_t side_data_size;
     uint64_t additional_id;
@@ -2879,7 +2880,7 @@ static int mkv_write_block(void *logctx, 
MatroskaMuxContext *mkv,
     // and BlockAdditions with three elements per BlockMore
     // Don't forget to increment the number of BlockMore when adding
     // support for writing a new blockadditional.
-    EBML_WRITER(5 + (1 + 3 * 3));
+    EBML_WRITER(5 + (1 + 4 /* BlockMore */ * 3));
     int ret;
 
     mkv->cur_block.track  = track;
@@ -2987,6 +2988,25 @@ static int mkv_write_block(void *logctx, 
MatroskaMuxContext *mkv,
             track->max_blockaddid = FFMAX(track->max_blockaddid,
                                           MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
         }
+        side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_LCEVC,
+                                            &side_data_size);
+        if (side_data) {
+            size_t payload_size = side_data_size + 4;
+
+            lcevc = av_malloc(payload_size);
+            if (!lcevc)
+                return ret;
+
+            AV_WB8 (lcevc + 0, ITU_T_T35_COUNTRY_CODE_UK);
+            AV_WB8 (lcevc + 1, 0); // t35_uk_country_code_second_octet
+            AV_WB16(lcevc + 2, ITU_T_T35_PROVIDER_CODE_VNOVA);
+            memcpy (lcevc + 4, side_data, side_data_size);
+
+            mkv_write_blockadditional(&writer, lcevc, payload_size,
+                                      MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
+            track->max_blockaddid = FFMAX(track->max_blockaddid,
+                                          MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
+        }
     }
 
     ebml_writer_close_or_discard_master(&writer);
@@ -3003,7 +3023,11 @@ static int mkv_write_block(void *logctx, 
MatroskaMuxContext *mkv,
         ebml_writer_add_sint(&writer, MATROSKA_ID_BLOCKREFERENCE,
                              track->last_timestamp - ts);
 
-    return ebml_writer_write(&writer, pb);
+    ret = ebml_writer_write(&writer, pb);
+
+    av_free(lcevc);
+
+    return ret;
 }
 
 static int mkv_end_cluster(AVFormatContext *s)

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

Reply via email to