* [FFmpeg-devel] [PATCH 1/4] avcodec/av1dec: use named constants for ITU-T T.35 metadata
@ 2024-03-12 18:44 James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec/h2645_sei: " James Almer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: James Almer @ 2024-03-12 18:44 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/av1dec.c | 12 +++++++-----
libavcodec/itut35.h | 28 ++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 5 deletions(-)
create mode 100644 libavcodec/itut35.h
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index e6346b51db..4d074c3908 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -34,6 +34,7 @@
#include "decode.h"
#include "hwaccel_internal.h"
#include "internal.h"
+#include "itut35.h"
#include "hwconfig.h"
#include "profiles.h"
#include "refstruct.h"
@@ -951,7 +952,7 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
provider_code = bytestream2_get_be16(&gb);
switch (provider_code) {
- case 0x31: { // atsc_provider_code
+ case ITU_T_T35_PROVIDER_CODE_ATSC: {
uint32_t user_identifier = bytestream2_get_be32(&gb);
switch (user_identifier) {
case MKBETAG('G', 'A', '9', '4'): { // closed captions
@@ -975,12 +976,12 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
}
break;
}
- case 0x3C: { // smpte_provider_code
+ case ITU_T_T35_PROVIDER_CODE_SMTPE: {
AVDynamicHDRPlus *hdrplus;
int provider_oriented_code = bytestream2_get_be16(&gb);
int application_identifier = bytestream2_get_byte(&gb);
- if (itut_t35->itu_t_t35_country_code != 0xB5 ||
+ if (itut_t35->itu_t_t35_country_code != ITU_T_T35_COUNTRY_CODE_US ||
provider_oriented_code != 1 || application_identifier != 4)
break;
@@ -994,9 +995,10 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
return ret;
break;
}
- case 0x3B: { // dolby_provider_code
+ case ITU_T_T35_PROVIDER_CODE_DOLBY: {
int provider_oriented_code = bytestream2_get_be32(&gb);
- if (itut_t35->itu_t_t35_country_code != 0xB5 || provider_oriented_code != 0x800)
+ if (itut_t35->itu_t_t35_country_code != ITU_T_T35_COUNTRY_CODE_US ||
+ provider_oriented_code != 0x800)
break;
ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer);
diff --git a/libavcodec/itut35.h b/libavcodec/itut35.h
new file mode 100644
index 0000000000..10063e6a9e
--- /dev/null
+++ b/libavcodec/itut35.h
@@ -0,0 +1,28 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_ITUT35_H
+#define AVCODEC_ITUT35_H
+
+#define ITU_T_T35_COUNTRY_CODE_US 0xB5
+
+#define ITU_T_T35_PROVIDER_CODE_ATSC 0x31
+#define ITU_T_T35_PROVIDER_CODE_DOLBY 0x3B
+#define ITU_T_T35_PROVIDER_CODE_SMTPE 0x3C
+
+#endif /* AVCODEC_ITUT35_H */
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] avcodec/h2645_sei: use named constants for ITU-T T.35 metadata
2024-03-12 18:44 [FFmpeg-devel] [PATCH 1/4] avcodec/av1dec: use named constants for ITU-T T.35 metadata James Almer
@ 2024-03-12 18:44 ` James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 3/4] avcodec/libdav1d: " James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 4/4] avformat/matroska: " James Almer
2 siblings, 0 replies; 4+ messages in thread
From: James Almer @ 2024-03-12 18:44 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/h2645_sei.c | 10 ++++++----
libavcodec/itut35.h | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index e60606f43f..e8eb15524f 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -40,6 +40,7 @@
#include "get_bits.h"
#include "golomb.h"
#include "h2645_sei.h"
+#include "itut35.h"
#define IS_H264(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_H264 : CONFIG_H264_SEI)
#define IS_HEVC(codec_id) (CONFIG_H264_SEI && CONFIG_HEVC_SEI ? codec_id == AV_CODEC_ID_HEVC : CONFIG_HEVC_SEI)
@@ -140,7 +141,8 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
bytestream2_skipu(gb, 1); // itu_t_t35_country_code_extension_byte
}
- if (country_code != 0xB5 && country_code != 0x26) { // usa_country_code and cn_country_code
+ if (country_code != ITU_T_T35_COUNTRY_CODE_US &&
+ country_code != ITU_T_T35_COUNTRY_CODE_CN) {
av_log(logctx, AV_LOG_VERBOSE,
"Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d)\n",
country_code);
@@ -151,7 +153,7 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
provider_code = bytestream2_get_be16u(gb);
switch (provider_code) {
- case 0x31: { // atsc_provider_code
+ case ITU_T_T35_PROVIDER_CODE_ATSC: {
uint32_t user_identifier;
if (bytestream2_get_bytes_left(gb) < 4)
@@ -172,7 +174,7 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
break;
}
#if CONFIG_HEVC_SEI
- case 0x04: { // cuva_provider_code
+ case ITU_T_T35_PROVIDER_CODE_CUVA: {
const uint16_t cuva_provider_oriented_code = 0x0005;
uint16_t provider_oriented_code;
@@ -188,7 +190,7 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
}
break;
}
- case 0x3C: { // smpte_provider_code
+ case ITU_T_T35_PROVIDER_CODE_SMTPE: {
// A/341 Amendment - 2094-40
const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
const uint8_t smpte2094_40_application_identifier = 0x04;
diff --git a/libavcodec/itut35.h b/libavcodec/itut35.h
index 10063e6a9e..ffa7024981 100644
--- a/libavcodec/itut35.h
+++ b/libavcodec/itut35.h
@@ -19,9 +19,11 @@
#ifndef AVCODEC_ITUT35_H
#define AVCODEC_ITUT35_H
+#define ITU_T_T35_COUNTRY_CODE_CN 0x26
#define ITU_T_T35_COUNTRY_CODE_US 0xB5
#define ITU_T_T35_PROVIDER_CODE_ATSC 0x31
+#define ITU_T_T35_PROVIDER_CODE_CUVA 0x04
#define ITU_T_T35_PROVIDER_CODE_DOLBY 0x3B
#define ITU_T_T35_PROVIDER_CODE_SMTPE 0x3C
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] avcodec/libdav1d: use named constants for ITU-T T.35 metadata
2024-03-12 18:44 [FFmpeg-devel] [PATCH 1/4] avcodec/av1dec: use named constants for ITU-T T.35 metadata James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec/h2645_sei: " James Almer
@ 2024-03-12 18:44 ` James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 4/4] avformat/matroska: " James Almer
2 siblings, 0 replies; 4+ messages in thread
From: James Almer @ 2024-03-12 18:44 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/libdav1d.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 1aa2d1f343..597944d88d 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -37,6 +37,7 @@
#include "decode.h"
#include "dovi_rpu.h"
#include "internal.h"
+#include "itut35.h"
#define FF_DAV1D_VERSION_AT_LEAST(x,y) \
(DAV1D_API_VERSION_MAJOR > (x) || DAV1D_API_VERSION_MAJOR == (x) && DAV1D_API_VERSION_MINOR >= (y))
@@ -542,7 +543,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
provider_code = bytestream2_get_be16(&gb);
switch (provider_code) {
- case 0x31: { // atsc_provider_code
+ case ITU_T_T35_PROVIDER_CODE_ATSC: {
uint32_t user_identifier = bytestream2_get_be32(&gb);
switch (user_identifier) {
case MKBETAG('G', 'A', '9', '4'): { // closed captions
@@ -566,12 +567,12 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
}
break;
}
- case 0x3C: { // smpte_provider_code
+ case ITU_T_T35_PROVIDER_CODE_SMTPE: {
AVDynamicHDRPlus *hdrplus;
int provider_oriented_code = bytestream2_get_be16(&gb);
int application_identifier = bytestream2_get_byte(&gb);
- if (itut_t35->country_code != 0xB5 ||
+ if (itut_t35->country_code != ITU_T_T35_COUNTRY_CODE_US ||
provider_oriented_code != 1 || application_identifier != 4)
break;
@@ -587,9 +588,10 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
goto fail;
break;
}
- case 0x3B: { // dolby_provider_code
+ case ITU_T_T35_PROVIDER_CODE_DOLBY: {
int provider_oriented_code = bytestream2_get_be32(&gb);
- if (itut_t35->country_code != 0xB5 || provider_oriented_code != 0x800)
+ if (itut_t35->country_code != ITU_T_T35_COUNTRY_CODE_US ||
+ provider_oriented_code != 0x800)
break;
res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer);
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] avformat/matroska: use named constants for ITU-T T.35 metadata
2024-03-12 18:44 [FFmpeg-devel] [PATCH 1/4] avcodec/av1dec: use named constants for ITU-T T.35 metadata James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec/h2645_sei: " James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 3/4] avcodec/libdav1d: " James Almer
@ 2024-03-12 18:44 ` James Almer
2 siblings, 0 replies; 4+ messages in thread
From: James Almer @ 2024-03-12 18:44 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/matroskadec.c | 4 +++-
libavformat/matroskaenc.c | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
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
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-12 18:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 18:44 [FFmpeg-devel] [PATCH 1/4] avcodec/av1dec: use named constants for ITU-T T.35 metadata James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 2/4] avcodec/h2645_sei: " James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 3/4] avcodec/libdav1d: " James Almer
2024-03-12 18:44 ` [FFmpeg-devel] [PATCH 4/4] avformat/matroska: " James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git