[FFmpeg-devel] [PATCH 09/19] avformat/matroska, matroskadec: Support FlagCommentary
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Wed Feb 17 12:13:46 EET 2021
Hint: Matroska actually provides a way to distinguish the cases of
"track is no commentary track" and "it is unknown whether the track
is a commentary track", but our disposition flags do not. Therefore
we need not use a CountedElement.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavformat/matroska.h | 1 +
libavformat/matroskadec.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 6f198f06e6..191c4f6149 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -95,6 +95,7 @@
#define MATROSKA_ID_SEEKPREROLL 0x56BB
#define MATROSKA_ID_TRACKNAME 0x536E
#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
+#define MATROSKA_ID_TRACKFLAGCOMMENTARY 0x55AF
#define MATROSKA_ID_TRACKFLAGENABLED 0xB9
#define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
#define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index b9c6047f56..fa266fcaec 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -250,6 +250,7 @@ typedef struct MatroskaTrack {
uint64_t default_duration;
uint64_t flag_default;
uint64_t flag_forced;
+ uint64_t flag_comment;
uint64_t seek_preroll;
MatroskaTrackVideo video;
MatroskaTrackAudio audio;
@@ -409,7 +410,7 @@ typedef struct MatroskaDemuxContext {
// incomplete type (6.7.2 in C90, 6.9.2 in C99).
// Removing the sizes breaks MSVC.
static EbmlSyntax ebml_syntax[3], matroska_segment[9], matroska_track_video_color[15], matroska_track_video[19],
- matroska_track[27], matroska_track_encoding[6], matroska_track_encodings[2],
+ matroska_track[28], matroska_track_encoding[6], matroska_track_encodings[2],
matroska_track_combine_planes[2], matroska_track_operation[2], matroska_tracks[2],
matroska_attachments[2], matroska_chapter_entry[9], matroska_chapter[6], matroska_chapters[2],
matroska_index_entry[3], matroska_index[2], matroska_tag[3], matroska_tags[2], matroska_seekhead[2],
@@ -571,6 +572,7 @@ static EbmlSyntax matroska_track[] = {
{ MATROSKA_ID_TRACKLANGUAGE, EBML_STR, 0, 0, offsetof(MatroskaTrack, language), { .s = "eng" } },
{ MATROSKA_ID_TRACKDEFAULTDURATION, EBML_UINT, 0, 0, offsetof(MatroskaTrack, default_duration) },
{ MATROSKA_ID_TRACKTIMECODESCALE, EBML_FLOAT, 0, 0, offsetof(MatroskaTrack, time_scale), { .f = 1.0 } },
+ { MATROSKA_ID_TRACKFLAGCOMMENTARY, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_comment), { .u = 0 } },
{ MATROSKA_ID_TRACKFLAGDEFAULT, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_default), { .u = 1 } },
{ MATROSKA_ID_TRACKFLAGFORCED, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_forced), { .u = 0 } },
{ MATROSKA_ID_TRACKVIDEO, EBML_NEST, 0, 0, offsetof(MatroskaTrack, video), { .n = matroska_track_video } },
@@ -2742,6 +2744,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
st->disposition |= AV_DISPOSITION_DEFAULT;
if (track->flag_forced)
st->disposition |= AV_DISPOSITION_FORCED;
+ if (track->flag_comment)
+ st->disposition |= AV_DISPOSITION_COMMENT;
if (!st->codecpar->extradata) {
if (extradata) {
--
2.27.0
More information about the ffmpeg-devel
mailing list