Looking at CTA-708 at the moment and noticed this. In the future we
might want to make it possible for the user to set the country code.
This patch makes finding usage of the US country code easier

Running FATE at the moment, but I don't expected it to fail from this
kind of change.

/Tomas
From 4ecfed10defcd1b2058ccde0ede517adc942ad3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <g...@haerdin.se>
Date: Mon, 3 Mar 2025 13:22:08 +0100
Subject: [PATCH] lavc: Replace 181 magic number with ITU_T_T35_COUNTRY_CODE_US

---
 libavcodec/atsc_a53.c           | 3 ++-
 libavcodec/vaapi_encode_h264.c  | 3 ++-
 libavcodec/vaapi_encode_h265.c  | 3 ++-
 libavcodec/vulkan_encode_h264.c | 3 ++-
 libavcodec/vulkan_encode_h265.c | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/atsc_a53.c b/libavcodec/atsc_a53.c
index 1e9ea15ae0..cb90f85427 100644
--- a/libavcodec/atsc_a53.c
+++ b/libavcodec/atsc_a53.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/mem.h"
 #include "atsc_a53.h"
+#include "itut35.h"
 #include "get_bits.h"
 
 int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
@@ -44,7 +45,7 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
     sei_data = (uint8_t*)*data + prefix_len;
 
     // country code
-    sei_data[0] = 181;
+    sei_data[0] = ITU_T_T35_COUNTRY_CODE_US;
     sei_data[1] = 0;
     sei_data[2] = 49;
 
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index ed20b9cd24..fc1e0d889d 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -28,6 +28,7 @@
 #include "libavutil/opt.h"
 
 #include "atsc_a53.h"
+#include "itut35.h"
 #include "avcodec.h"
 #include "cbs.h"
 #include "cbs_h264.h"
@@ -501,7 +502,7 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
         if (err < 0)
             return err;
         if (priv->sei_a53cc_data != NULL) {
-            priv->sei_a53cc.itu_t_t35_country_code = 181;
+            priv->sei_a53cc.itu_t_t35_country_code = ITU_T_T35_COUNTRY_CODE_US;
             priv->sei_a53cc.data = (uint8_t *)priv->sei_a53cc_data + 1;
             priv->sei_a53cc.data_length = sei_a53cc_len - 1;
 
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 44d9fdbbd5..e4ca1f695b 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -29,6 +29,7 @@
 #include "libavutil/mastering_display_metadata.h"
 
 #include "atsc_a53.h"
+#include "itut35.h"
 #include "avcodec.h"
 #include "cbs.h"
 #include "cbs_h265.h"
@@ -603,7 +604,7 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
         if (err < 0)
             return err;
         if (priv->sei_a53cc_data != NULL) {
-            priv->sei_a53cc.itu_t_t35_country_code = 181;
+            priv->sei_a53cc.itu_t_t35_country_code = ITU_T_T35_COUNTRY_CODE_US;
             priv->sei_a53cc.data = (uint8_t *)priv->sei_a53cc_data + 1;
             priv->sei_a53cc.data_length = sei_a53cc_len - 1;
 
diff --git a/libavcodec/vulkan_encode_h264.c b/libavcodec/vulkan_encode_h264.c
index cdc87fb4ca..42b7977db9 100644
--- a/libavcodec/vulkan_encode_h264.c
+++ b/libavcodec/vulkan_encode_h264.c
@@ -23,6 +23,7 @@
 #include "cbs.h"
 #include "cbs_h264.h"
 #include "atsc_a53.h"
+#include "itut35.h"
 
 #include "h264_levels.h"
 #include "h2645data.h"
@@ -233,7 +234,7 @@ static int vk_enc_h264_update_pic_info(AVCodecContext *avctx,
         if (err < 0)
             return err;
         if (enc->sei_a53cc_data != NULL) {
-            enc->sei_a53cc.itu_t_t35_country_code = 181;
+            enc->sei_a53cc.itu_t_t35_country_code = ITU_T_T35_COUNTRY_CODE_US;
             enc->sei_a53cc.data = (uint8_t *)enc->sei_a53cc_data + 1;
             enc->sei_a53cc.data_length = sei_a53cc_len - 1;
 
diff --git a/libavcodec/vulkan_encode_h265.c b/libavcodec/vulkan_encode_h265.c
index cd50f2f756..e67c9bb559 100644
--- a/libavcodec/vulkan_encode_h265.c
+++ b/libavcodec/vulkan_encode_h265.c
@@ -23,6 +23,7 @@
 #include "cbs.h"
 #include "cbs_h265.h"
 #include "atsc_a53.h"
+#include "itut35.h"
 #include "libavutil/mastering_display_metadata.h"
 
 #include "codec_internal.h"
@@ -280,7 +281,7 @@ static int vk_enc_h265_update_pic_info(AVCodecContext *avctx,
         if (err < 0)
             return err;
         if (enc->sei_a53cc_data != NULL) {
-            enc->sei_a53cc.itu_t_t35_country_code = 181;
+            enc->sei_a53cc.itu_t_t35_country_code = ITU_T_T35_COUNTRY_CODE_US;
             enc->sei_a53cc.data = (uint8_t *)enc->sei_a53cc_data + 1;
             enc->sei_a53cc.data_length = sei_a53cc_len - 1;
 
-- 
2.39.5

_______________________________________________
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