Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH v3 4/7] avformat/matroska: add a few more Block Addition ID Type enum values
Date: Wed, 29 Mar 2023 23:04:45 -0300
Message-ID: <20230330020448.9146-4-jamrial@gmail.com> (raw)
In-Reply-To: <20230330020448.9146-1-jamrial@gmail.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
Changes since v2: Renamed an enum and define to make it shorter, and added
informative comments to others.

 libavformat/matroska.h    | 4 ++++
 libavformat/matroskadec.c | 6 +++---
 libavformat/matroskaenc.c | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index b39517709c..ead7c085b9 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -360,9 +360,13 @@ typedef enum {
 
 typedef enum {
   MATROSKA_BLOCK_ADD_ID_TYPE_DEFAULT                = 0,
+  MATROSKA_BLOCK_ADD_ID_TYPE_OPAQUE                 = 1,
   MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35              = 4,
+  MATROSKA_BLOCK_ADD_ID_TYPE_DVCC                   = 0x64766343, // MKBETAG('d','v','c','C')
+  MATROSKA_BLOCK_ADD_ID_TYPE_DVVC                   = 0x64767643, // MKBETAG('d','v','v','C')
 } MatroskaBlockAddIDType;
 
+#define MATROSKA_BLOCK_ADD_ID_OPAQUE 1
 #define MATROSKA_BLOCK_ADD_ID_ITU_T_T35 4
 
 /*
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 32907f413a..3c7c2b7c70 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -767,7 +767,7 @@ static EbmlSyntax matroska_segments[] = {
 };
 
 static EbmlSyntax matroska_blockmore[] = {
-    { MATROSKA_ID_BLOCKADDID,      EBML_UINT, 0, 0, offsetof(MatroskaBlockMore,additional_id), { .u = 1 } },
+    { MATROSKA_ID_BLOCKADDID,      EBML_UINT, 0, 0, offsetof(MatroskaBlockMore,additional_id), { .u = MATROSKA_BLOCK_ADD_ID_OPAQUE } },
     { MATROSKA_ID_BLOCKADDITIONAL, EBML_BIN,  0, 0, offsetof(MatroskaBlockMore,additional) },
     CHILD_OF(matroska_blockadditions)
 };
@@ -2404,8 +2404,8 @@ static int mkv_parse_block_addition_mappings(AVFormatContext *s, AVStream *st, M
             }
             track->blockaddid_itu_t_t35 = 1;
             break;
-        case MKBETAG('d','v','c','C'):
-        case MKBETAG('d','v','v','C'):
+        case MATROSKA_BLOCK_ADD_ID_TYPE_DVCC:
+        case MATROSKA_BLOCK_ADD_ID_TYPE_DVVC:
             if ((ret = mkv_parse_dvcc_dvvc(s, st, track, &mapping->extradata)) < 0)
                 return ret;
 
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 954b7d828f..6b24d26d59 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1612,9 +1612,9 @@ static void mkv_write_dovi(AVFormatContext *s, AVIOContext *pb, AVStream *st)
                                 + (2 + 1 + 4) + (2 + 1 + ISOM_DVCC_DVVC_SIZE);
 
         if (dovi->dv_profile > 7) {
-            type = MKBETAG('d', 'v', 'v', 'C');
+            type = MATROSKA_BLOCK_ADD_ID_TYPE_DVVC;
         } else {
-            type = MKBETAG('d', 'v', 'c', 'C');
+            type = MATROSKA_BLOCK_ADD_ID_TYPE_DVCC;
         }
 
         ff_isom_put_dvcc_dvvc(s, buf, dovi);
@@ -2657,7 +2657,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
                                         &side_data_size);
     if (side_data && side_data_size >= 8 &&
         // Only the Codec-specific BlockMore (id == 1) is currently supported.
-        (additional_id = AV_RB64(side_data)) == 1) {
+        (additional_id = AV_RB64(side_data)) == MATROSKA_BLOCK_ADD_ID_TYPE_OPAQUE) {
         ebml_writer_open_master(&writer, MATROSKA_ID_BLOCKADDITIONS);
         ebml_writer_open_master(&writer, MATROSKA_ID_BLOCKMORE);
         /* Until dbc50f8a our demuxer used a wrong default value
-- 
2.40.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".

  parent reply	other threads:[~2023-03-30  2:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  2:04 [FFmpeg-devel] [PATCH v3 1/7] avformat/matroskadec: support parsing more than one BlockMore element James Almer
2023-03-30  2:04 ` [FFmpeg-devel] [PATCH v3 2/7] avformat/matroskadec: set the default value for BlockAddIDType James Almer
2023-03-30  2:04 ` [FFmpeg-devel] [PATCH v3 3/7] avformat/matroskadec: export Dynamic HDR10+ packet side data James Almer
2023-03-30  2:04 ` James Almer [this message]
2023-03-30  2:04 ` [FFmpeg-devel] [PATCH v4 5/7] avformat/matroskaenc: write a MaxBlockAdditionID element James Almer
2023-03-30  2:04 ` [FFmpeg-devel] [PATCH v5 6/7] avformat/matroskaenc: support writing Dynamic HDR10+ packet side data James Almer
2023-03-30  2:04 ` [FFmpeg-devel] [PATCH v4 7/7] fate/matroska: add HDR10+ muxing tests James Almer
2023-04-04 11:39 ` [FFmpeg-devel] [PATCH v3 1/7] avformat/matroskadec: support parsing more than one BlockMore element James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330020448.9146-4-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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