diff mbox series

[FFmpeg-devel,4/4] avformat/matroska: use named constants for ITU-T T.35 metadata

Message ID 20240312184435.7420-4-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/4] avcodec/av1dec: use named constants for ITU-T T.35 metadata | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer March 12, 2024, 6:44 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/matroskadec.c | 4 +++-
 libavformat/matroskaenc.c | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a35ca6ca5b..8897fd622c 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -54,6 +54,7 @@ 
 #include "libavcodec/bytestream.h"
 #include "libavcodec/defs.h"
 #include "libavcodec/flac.h"
+#include "libavcodec/itut35.h"
 #include "libavcodec/mpeg4audio.h"
 #include "libavcodec/packet_internal.h"
 
@@ -3884,7 +3885,8 @@  static int matroska_parse_block_additional(MatroskaDemuxContext *matroska,
         country_code  = bytestream2_get_byteu(&bc);
         provider_code = bytestream2_get_be16u(&bc);
 
-        if (country_code != 0xB5 || provider_code != 0x3C)
+        if (country_code != ITU_T_T35_COUNTRY_CODE_US ||
+            provider_code != ITU_T_T35_PROVIDER_CODE_SMTPE)
             break; // ignore
 
         provider_oriented_code = bytestream2_get_be16u(&bc);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 8ba0690f90..c2e172d5c0 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -63,6 +63,7 @@ 
 #include "libavcodec/codec_desc.h"
 #include "libavcodec/codec_par.h"
 #include "libavcodec/defs.h"
+#include "libavcodec/itut35.h"
 #include "libavcodec/xiph.h"
 #include "libavcodec/mpeg4audio.h"
 
@@ -2824,8 +2825,8 @@  static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
             uint8_t *payload = t35_buf;
             size_t payload_size = sizeof(t35_buf) - 6;
 
-            bytestream_put_byte(&payload, 0xB5); // country_code
-            bytestream_put_be16(&payload, 0x3C); // provider_code
+            bytestream_put_byte(&payload, ITU_T_T35_COUNTRY_CODE_US); // country_code
+            bytestream_put_be16(&payload, ITU_T_T35_PROVIDER_CODE_SMTPE); // provider_code
             bytestream_put_be16(&payload, 0x01); // provider_oriented_code
             bytestream_put_byte(&payload, 0x04); // application_identifier