From fe6ffa6feeec42aef6f18946e021f8bff79042e1 Mon Sep 17 00:00:00 2001
From: Jerome Martinez <jerome@mediaarea.net>
Date: Wed, 27 Aug 2025 13:36:36 +0200
Subject: [PATCH 11/18] decklink_dec: store timecode in 64-bit RFC 5484 format

---
 fftools/ffprobe.c            | 4 ++--
 libavdevice/decklink_dec.cpp | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 67111bc31f..a9435138c2 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -1357,8 +1357,8 @@ static void print_frame_side_data(AVTextFormatContext *tfc,
             char tcbuf[AV_TIMECODE_STR_SIZE];
             av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
             print_str("timecode", tcbuf);
-        } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size == 16) {
-            uint32_t *tc = (uint32_t*)sd->data;
+        } else if (sd->type == AV_FRAME_DATA_S12M_TIMECODE && sd->size >= 8) {
+            uint64_t *tc = (uint64_t*)sd->data;
             int m = FFMIN(tc[0],3);
             avtext_print_section_header(tfc, NULL, SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST);
             for (int j = 1; j <= m ; j++) {
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 8830779990..78ec0ee0d2 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -857,9 +857,9 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
                         uint8_t* packed_metadata;
 
                         if (av_cmp_q(ctx->video_st->r_frame_rate, av_make_q(60, 1)) < 1) {
-                            uint32_t tc_data = av_timecode_get_smpte_from_framenum(&tcr, 0);
-                            int size = sizeof(uint32_t) * 4;
-                            uint32_t *sd = (uint32_t *)av_packet_new_side_data(&pkt, AV_PKT_DATA_S12M_TIMECODE, size);
+                            uint64_t tc_data = av_timecode_expand_to_64bit(av_timecode_get_smpte_from_framenum(&tcr, 0));
+                            int size = sizeof(uint64_t) * 4;
+                            uint64_t *sd = (uint64_t *)av_packet_new_side_data(&pkt, AV_PKT_DATA_S12M_TIMECODE, size);
 
                             if (sd) {
                                 *sd       = 1;       // one TC
-- 
2.52.0

