* [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements
@ 2022-01-01 4:16 quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 1/5] avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing quietvoid
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: quietvoid @ 2022-01-01 4:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: quietvoid
This patch set adds support for reading/writing the Matroska BlockAdditionMapping
elements, as well as for reading/writing dvcC/dvvC blocks in Matroska.
Created utility functions to read/write Dolby Vision boxes for ISOM.
This was done to avoid duplicating the code, as the Matroska blocks and MOV boxes
follow the same specification, defined by Dolby.
Refactored the reading/writing in mov/movenc to use the new dovi_isom functions.
v10: https://ffmpeg.org/pipermail/ffmpeg-devel/2021-December/289645.html
Changes since v10:
- dovi_isom: Limited written values to fit into the amount of bits.
- matroskaenc: Corrected mkv_write_dovi to only allow profiles
that are valid for dvcC/dvvC configurations.
- mov: Improved code to be more concise.
quietvoid (5):
avformat/dovi_isom: Implement Dolby Vision configuration
parsing/writing
avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements
avformat/mov: Refactor mov_read_dvcc_dvvc to use
ff_isom_parse_dvcc_dvvc
avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use
ff_isom_put_dvcc_dvvc
fate/matroska: Add tests for reading/writing BlockAdditionMapping
elements
libavformat/Makefile | 4 +-
libavformat/dovi_isom.c | 118 ++++++++++
libavformat/dovi_isom.h | 35 +++
libavformat/matroska.h | 9 +
libavformat/matroskadec.c | 58 ++++-
libavformat/matroskaenc.c | 37 +++
libavformat/mov.c | 50 +----
libavformat/movenc.c | 24 +-
tests/fate/matroska.mak | 9 +
tests/ref/fate/matroska-dovi-config-profile5 | 13 ++
tests/ref/fate/matroska-dovi-write-config | 223 +++++++++++++++++++
11 files changed, 516 insertions(+), 64 deletions(-)
create mode 100644 libavformat/dovi_isom.c
create mode 100644 libavformat/dovi_isom.h
create mode 100644 tests/ref/fate/matroska-dovi-config-profile5
create mode 100644 tests/ref/fate/matroska-dovi-write-config
--
2.34.1
_______________________________________________
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] 9+ messages in thread
* [FFmpeg-devel] [PATCH v11 1/5] avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing
2022-01-01 4:16 [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements quietvoid
@ 2022-01-01 4:16 ` quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 2/5] avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements quietvoid
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: quietvoid @ 2022-01-01 4:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: quietvoid
Both parse/write implementations are based on mov/movenc.
This only adds support for the "Dolby Vision configuration box".
Other configuration boxes, such as
"Dolby Vision enhancement layer configuration box" are not supported.
The new functions will be used to implement parsing/writing the DOVI config
for Matroska, as well as to refactor both mov/movenc to use dovi_isom functions.
Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
libavformat/dovi_isom.c | 118 ++++++++++++++++++++++++++++++++++++++++
libavformat/dovi_isom.h | 35 ++++++++++++
2 files changed, 153 insertions(+)
create mode 100644 libavformat/dovi_isom.c
create mode 100644 libavformat/dovi_isom.h
diff --git a/libavformat/dovi_isom.c b/libavformat/dovi_isom.c
new file mode 100644
index 0000000000..76681b9451
--- /dev/null
+++ b/libavformat/dovi_isom.c
@@ -0,0 +1,118 @@
+/*
+ * DOVI ISO Media common code
+ *
+ * Copyright (c) 2020 Vacing Fang <vacingfang@tencent.com>
+ * Copyright (c) 2021 quietvoid
+ *
+ * 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
+ */
+
+#include "libavutil/dovi_meta.h"
+
+#include "libavcodec/put_bits.h"
+
+#include "avformat.h"
+#include "dovi_isom.h"
+
+int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf_ptr, uint64_t size)
+{
+ uint32_t buf;
+ AVDOVIDecoderConfigurationRecord *dovi;
+ size_t dovi_size;
+ int ret;
+
+ if (size > (1 << 30) || size < 4)
+ return AVERROR_INVALIDDATA;
+
+ dovi = av_dovi_alloc(&dovi_size);
+ if (!dovi)
+ return AVERROR(ENOMEM);
+
+ dovi->dv_version_major = *buf_ptr++; // 8 bits
+ dovi->dv_version_minor = *buf_ptr++; // 8 bits
+
+ buf = *buf_ptr++ << 8;
+ buf |= *buf_ptr++;
+
+ dovi->dv_profile = (buf >> 9) & 0x7f; // 7 bits
+ dovi->dv_level = (buf >> 3) & 0x3f; // 6 bits
+ dovi->rpu_present_flag = (buf >> 2) & 0x01; // 1 bit
+ dovi->el_present_flag = (buf >> 1) & 0x01; // 1 bit
+ dovi->bl_present_flag = buf & 0x01; // 1 bit
+
+ // Has enough remaining data
+ if (size >= 5) {
+ dovi->dv_bl_signal_compatibility_id = ((*buf_ptr++) >> 4) & 0x0f; // 4 bits
+ } else {
+ // 0 stands for None
+ // Dolby Vision V1.2.93 profiles and levels
+ dovi->dv_bl_signal_compatibility_id = 0;
+ }
+
+ ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF,
+ (uint8_t *)dovi, dovi_size);
+ if (ret < 0) {
+ av_free(dovi);
+ return ret;
+ }
+
+ av_log(s, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, "
+ "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
+ dovi->dv_version_major, dovi->dv_version_minor,
+ dovi->dv_profile, dovi->dv_level,
+ dovi->rpu_present_flag,
+ dovi->el_present_flag,
+ dovi->bl_present_flag,
+ dovi->dv_bl_signal_compatibility_id);
+
+ return 0;
+}
+
+void ff_isom_put_dvcc_dvvc(AVFormatContext *s, uint8_t out[ISOM_DVCC_DVVC_SIZE],
+ AVDOVIDecoderConfigurationRecord *dovi)
+{
+ PutBitContext pb;
+
+ init_put_bits(&pb, out, ISOM_DVCC_DVVC_SIZE);
+
+ put_bits(&pb, 8, dovi->dv_version_major);
+ put_bits(&pb, 8, dovi->dv_version_minor);
+ put_bits(&pb, 7, dovi->dv_profile & 0x7f);
+ put_bits(&pb, 6, dovi->dv_level & 0x3f);
+ put_bits(&pb, 1, !!dovi->rpu_present_flag);
+ put_bits(&pb, 1, !!dovi->el_present_flag);
+ put_bits(&pb, 1, !!dovi->bl_present_flag);
+ put_bits(&pb, 4, dovi->dv_bl_signal_compatibility_id & 0x0f);
+
+ put_bits(&pb, 28, 0); /* reserved */
+ put_bits32(&pb, 0); /* reserved */
+ put_bits32(&pb, 0); /* reserved */
+ put_bits32(&pb, 0); /* reserved */
+ put_bits32(&pb, 0); /* reserved */
+
+ flush_put_bits(&pb);
+
+ av_log(s, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, "
+ "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
+ dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"),
+ dovi->dv_version_major, dovi->dv_version_minor,
+ dovi->dv_profile, dovi->dv_level,
+ dovi->rpu_present_flag,
+ dovi->el_present_flag,
+ dovi->bl_present_flag,
+ dovi->dv_bl_signal_compatibility_id);
+}
diff --git a/libavformat/dovi_isom.h b/libavformat/dovi_isom.h
new file mode 100644
index 0000000000..1526164319
--- /dev/null
+++ b/libavformat/dovi_isom.h
@@ -0,0 +1,35 @@
+/*
+ * DOVI ISO Media common code
+ * Copyright (c) 2021 quietvoid
+ *
+ * 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 AVFORMAT_DOVI_ISOM_H
+#define AVFORMAT_DOVI_ISOM_H
+
+#include "libavutil/dovi_meta.h"
+
+#include "avformat.h"
+
+#define ISOM_DVCC_DVVC_SIZE 24
+
+int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf_ptr, uint64_t size);
+void ff_isom_put_dvcc_dvvc(AVFormatContext *s, uint8_t out[ISOM_DVCC_DVVC_SIZE],
+ AVDOVIDecoderConfigurationRecord *dovi);
+
+#endif /* AVFORMAT_DOVI_ISOM_H */
--
2.34.1
_______________________________________________
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] 9+ messages in thread
* [FFmpeg-devel] [PATCH v11 2/5] avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements
2022-01-01 4:16 [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 1/5] avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing quietvoid
@ 2022-01-01 4:16 ` quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc quietvoid
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: quietvoid @ 2022-01-01 4:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: quietvoid
Adds handling of dvcC/dvvC block addition mappings.
The parsing creates AVDOVIDecoderConfigurationRecord side data.
The configuration block is written when muxing into Matroska,
if DOVI side data is present for the track.
Most of the Matroska element parsing is based on Plex's FFmpeg source code.
Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
libavformat/Makefile | 4 +--
libavformat/matroska.h | 9 ++++++
libavformat/matroskadec.c | 58 +++++++++++++++++++++++++++++++++++++--
libavformat/matroskaenc.c | 37 +++++++++++++++++++++++++
4 files changed, 104 insertions(+), 4 deletions(-)
diff --git a/libavformat/Makefile b/libavformat/Makefile
index e31b248ac0..4464c2b049 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -316,11 +316,11 @@ OBJS-$(CONFIG_M4V_MUXER) += rawenc.o
OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
flac_picture.o isom_tags.o rmsipr.o \
oggparsevorbis.o vorbiscomment.o \
- qtpalette.o replaygain.o
+ qtpalette.o replaygain.o dovi_isom.o
OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \
av1.o avc.o hevc.o isom_tags.o \
flacenc_header.o avlanguage.o \
- vorbiscomment.o wv.o
+ vorbiscomment.o wv.o dovi_isom.o
OBJS-$(CONFIG_MCA_DEMUXER) += mca.o
OBJS-$(CONFIG_MCC_DEMUXER) += mccdec.o subtitles.o
OBJS-$(CONFIG_MD5_MUXER) += hashenc.o
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 2d04a6838b..16491aae22 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -111,6 +111,7 @@
#define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
#define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
+#define MATROSKA_ID_TRACKBLKADDMAPPING 0x41E4
/* IDs in the trackvideo master */
#define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
@@ -189,6 +190,12 @@
#define MATROSKA_ID_ENCODINGSIGKEYID 0x47E4
#define MATROSKA_ID_ENCODINGSIGNATURE 0x47E3
+/* IDs in the block addition mapping master */
+#define MATROSKA_ID_BLKADDIDVALUE 0x41F0
+#define MATROSKA_ID_BLKADDIDNAME 0x41A4
+#define MATROSKA_ID_BLKADDIDTYPE 0x41E7
+#define MATROSKA_ID_BLKADDIDEXTRADATA 0x41ED
+
/* ID in the cues master */
#define MATROSKA_ID_POINTENTRY 0xBB
@@ -385,4 +392,6 @@ extern const char * const ff_matroska_video_stereo_plane[MATROSKA_VIDEO_STEREO_P
int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode);
+#define DVCC_DVVC_BLOCK_TYPE_NAME "Dolby Vision configuration"
+
#endif /* AVFORMAT_MATROSKA_H */
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a4bbbe954e..6ce553205d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -53,6 +53,7 @@
#include "avformat.h"
#include "avio_internal.h"
+#include "dovi_isom.h"
#include "internal.h"
#include "isom.h"
#include "matroska.h"
@@ -239,6 +240,13 @@ typedef struct MatroskaTrackOperation {
EbmlList combine_planes;
} MatroskaTrackOperation;
+typedef struct MatroskaBlockAdditionMapping {
+ uint64_t value;
+ char *name;
+ uint64_t type;
+ EbmlBin extradata;
+} MatroskaBlockAdditionMapping;
+
typedef struct MatroskaTrack {
uint64_t num;
uint64_t uid;
@@ -269,6 +277,7 @@ typedef struct MatroskaTrack {
int ms_compat;
int needs_decoding;
uint64_t max_block_additional_id;
+ EbmlList block_addition_mappings;
uint32_t palette[AVPALETTE_COUNT];
int has_palette;
@@ -419,8 +428,8 @@ 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[32], matroska_track_encoding[6], matroska_track_encodings[2],
- matroska_track_combine_planes[2], matroska_track_operation[2], matroska_tracks[2],
+ matroska_track[33], matroska_track_encoding[6], matroska_track_encodings[2],
+ matroska_track_combine_planes[2], matroska_track_operation[2], matroska_block_addition_mapping[5], 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],
matroska_blockadditions[2], matroska_blockgroup[8], matroska_cluster_parsing[8];
@@ -570,6 +579,14 @@ static EbmlSyntax matroska_track_operation[] = {
CHILD_OF(matroska_track)
};
+static EbmlSyntax matroska_block_addition_mapping[] = {
+ { MATROSKA_ID_BLKADDIDVALUE, EBML_UINT, 0, 0, offsetof(MatroskaBlockAdditionMapping, value) },
+ { MATROSKA_ID_BLKADDIDNAME, EBML_STR, 0, 0, offsetof(MatroskaBlockAdditionMapping, name) },
+ { MATROSKA_ID_BLKADDIDTYPE, EBML_UINT, 0, 0, offsetof(MatroskaBlockAdditionMapping, type) },
+ { MATROSKA_ID_BLKADDIDEXTRADATA, EBML_BIN, 0, 0, offsetof(MatroskaBlockAdditionMapping, extradata) },
+ CHILD_OF(matroska_track)
+};
+
static EbmlSyntax matroska_track[] = {
{ MATROSKA_ID_TRACKNUMBER, EBML_UINT, 0, 0, offsetof(MatroskaTrack, num) },
{ MATROSKA_ID_TRACKNAME, EBML_UTF8, 0, 0, offsetof(MatroskaTrack, name) },
@@ -593,6 +610,7 @@ static EbmlSyntax matroska_track[] = {
{ MATROSKA_ID_TRACKOPERATION, EBML_NEST, 0, 0, offsetof(MatroskaTrack, operation), { .n = matroska_track_operation } },
{ MATROSKA_ID_TRACKCONTENTENCODINGS, EBML_NEST, 0, 0, 0, { .n = matroska_track_encodings } },
{ MATROSKA_ID_TRACKMAXBLKADDID, EBML_UINT, 0, 0, offsetof(MatroskaTrack, max_block_additional_id), { .u = 0 } },
+ { MATROSKA_ID_TRACKBLKADDMAPPING, EBML_NEST, 0, sizeof(MatroskaBlockAdditionMapping), offsetof(MatroskaTrack, block_addition_mappings), { .n = matroska_block_addition_mapping } },
{ MATROSKA_ID_SEEKPREROLL, EBML_UINT, 0, 0, offsetof(MatroskaTrack, seek_preroll), { .u = 0 } },
{ MATROSKA_ID_TRACKFLAGENABLED, EBML_NONE },
{ MATROSKA_ID_TRACKFLAGLACING, EBML_NONE },
@@ -2311,6 +2329,38 @@ static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track,
return 0;
}
+static int mkv_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const MatroskaTrack *track,
+ EbmlBin *bin)
+{
+ return ff_isom_parse_dvcc_dvvc(s, st, bin->data, bin->size);
+}
+
+static int mkv_parse_block_addition_mappings(AVFormatContext *s, AVStream *st, const MatroskaTrack *track)
+{
+ const EbmlList *mappings_list = &track->block_addition_mappings;
+ MatroskaBlockAdditionMapping *mappings = mappings_list->elem;
+ int ret;
+
+ for (int i = 0; i < mappings_list->nb_elem; i++) {
+ MatroskaBlockAdditionMapping *mapping = &mappings[i];
+
+ switch (mapping->type) {
+ case MKBETAG('d','v','c','C'):
+ case MKBETAG('d','v','v','C'):
+ if ((ret = mkv_parse_dvcc_dvvc(s, st, track, &mapping->extradata)) < 0)
+ return ret;
+
+ break;
+ default:
+ av_log(s, AV_LOG_DEBUG,
+ "Unknown block additional mapping type 0x%"PRIx64", value %"PRIu64", name \"%s\"\n",
+ mapping->type, mapping->value, mapping->name ? mapping->name : "");
+ }
+ }
+
+ return 0;
+}
+
static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum AVCodecID *codec_id)
{
const AVCodecTag *codec_tags;
@@ -2898,6 +2948,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
if (track->flag_textdescriptions)
st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
}
+
+ ret = mkv_parse_block_addition_mappings(s, st, track);
+ if (ret < 0)
+ return ret;
}
return 0;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 8c4cf4024a..5cc59dc9f8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -27,6 +27,7 @@
#include "avformat.h"
#include "avio_internal.h"
#include "avlanguage.h"
+#include "dovi_isom.h"
#include "flacenc.h"
#include "internal.h"
#include "isom.h"
@@ -1120,6 +1121,37 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
return 0;
}
+static void mkv_write_dovi(AVFormatContext *s, AVIOContext *pb, AVStream *st)
+{
+ AVDOVIDecoderConfigurationRecord *dovi = (AVDOVIDecoderConfigurationRecord *)
+ av_stream_get_side_data(st, AV_PKT_DATA_DOVI_CONF, NULL);
+
+ if (dovi && dovi->dv_profile <= 10) {
+ ebml_master mapping;
+ uint8_t buf[ISOM_DVCC_DVVC_SIZE];
+ uint32_t type;
+
+ uint64_t expected_size = (2 + 1 + (sizeof(DVCC_DVVC_BLOCK_TYPE_NAME) - 1))
+ + (2 + 1 + 4) + (2 + 1 + ISOM_DVCC_DVVC_SIZE);
+
+ if (dovi->dv_profile > 7) {
+ type = MKBETAG('d', 'v', 'v', 'C');
+ } else {
+ type = MKBETAG('d', 'v', 'c', 'C');
+ }
+
+ ff_isom_put_dvcc_dvvc(s, buf, dovi);
+
+ mapping = start_ebml_master(pb, MATROSKA_ID_TRACKBLKADDMAPPING, expected_size);
+
+ put_ebml_string(pb, MATROSKA_ID_BLKADDIDNAME, DVCC_DVVC_BLOCK_TYPE_NAME);
+ put_ebml_uint(pb, MATROSKA_ID_BLKADDIDTYPE, type);
+ put_ebml_binary(pb, MATROSKA_ID_BLKADDIDEXTRADATA, buf, sizeof(buf));
+
+ end_ebml_master(pb, mapping);
+ }
+}
+
static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
AVStream *st, mkv_track *track, AVIOContext *pb,
int is_default)
@@ -1319,6 +1351,11 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
mkv_write_video_projection(s, pb, st);
end_ebml_master(pb, subinfo);
+
+ if (mkv->mode != MODE_WEBM) {
+ mkv_write_dovi(s, pb, st);
+ }
+
break;
case AVMEDIA_TYPE_AUDIO:
--
2.34.1
_______________________________________________
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] 9+ messages in thread
* [FFmpeg-devel] [PATCH v11 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc
2022-01-01 4:16 [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 1/5] avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 2/5] avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements quietvoid
@ 2022-01-01 4:16 ` quietvoid
2022-01-01 7:30 ` Andreas Rheinhardt
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 4/5] avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements quietvoid
4 siblings, 1 reply; 9+ messages in thread
From: quietvoid @ 2022-01-01 4:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: quietvoid
To avoid duplicating code. The implementation in dovi_isom is identical.
Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
libavformat/mov.c | 50 +++++++----------------------------------------
1 file changed, 7 insertions(+), 43 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 351ecde770..ad5ab6b491 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -55,6 +55,7 @@
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
+#include "dovi_isom.h"
#include "riff.h"
#include "isom.h"
#include "libavcodec/get_bits.h"
@@ -7062,58 +7063,21 @@ static int mov_read_dmlp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
- uint32_t buf;
- AVDOVIDecoderConfigurationRecord *dovi;
- size_t dovi_size;
+ uint8_t buf[ISOM_DVCC_DVVC_SIZE];
int ret;
+ int64_t read_size = atom.size;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
- if ((uint64_t)atom.size > (1<<30) || atom.size < 4)
- return AVERROR_INVALIDDATA;
-
- dovi = av_dovi_alloc(&dovi_size);
- if (!dovi)
- return AVERROR(ENOMEM);
-
- dovi->dv_version_major = avio_r8(pb);
- dovi->dv_version_minor = avio_r8(pb);
-
- buf = avio_rb16(pb);
- dovi->dv_profile = (buf >> 9) & 0x7f; // 7 bits
- dovi->dv_level = (buf >> 3) & 0x3f; // 6 bits
- dovi->rpu_present_flag = (buf >> 2) & 0x01; // 1 bit
- dovi->el_present_flag = (buf >> 1) & 0x01; // 1 bit
- dovi->bl_present_flag = buf & 0x01; // 1 bit
- if (atom.size >= 24) { // 4 + 4 + 4 * 4
- buf = avio_r8(pb);
- dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 bits
- } else {
- // 0 stands for None
- // Dolby Vision V1.2.93 profiles and levels
- dovi->dv_bl_signal_compatibility_id = 0;
- }
+ // At most 24 bytes
+ read_size = FFMIN(read_size, ISOM_DVCC_DVVC_SIZE);
- ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF,
- (uint8_t *)dovi, dovi_size);
- if (ret < 0) {
- av_free(dovi);
+ if ((ret = ffio_read_size(pb, buf, read_size)) < 0)
return ret;
- }
- av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, "
- "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
- dovi->dv_version_major, dovi->dv_version_minor,
- dovi->dv_profile, dovi->dv_level,
- dovi->rpu_present_flag,
- dovi->el_present_flag,
- dovi->bl_present_flag,
- dovi->dv_bl_signal_compatibility_id
- );
-
- return 0;
+ return ff_isom_parse_dvcc_dvvc(c->fc, st, buf, read_size);
}
static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom)
--
2.34.1
_______________________________________________
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] 9+ messages in thread
* [FFmpeg-devel] [PATCH v11 4/5] avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc
2022-01-01 4:16 [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements quietvoid
` (2 preceding siblings ...)
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc quietvoid
@ 2022-01-01 4:16 ` quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements quietvoid
4 siblings, 0 replies; 9+ messages in thread
From: quietvoid @ 2022-01-01 4:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: quietvoid
Improves code legibility by not using bit shifts.
Also avoids duplicating the dvcC/dvvC ISOM box writing code.
Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
libavformat/movenc.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0f912dd012..f1fe43a79f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -27,6 +27,7 @@
#include "movenc.h"
#include "avformat.h"
#include "avio_internal.h"
+#include "dovi_isom.h"
#include "riff.h"
#include "avio.h"
#include "isom.h"
@@ -1911,6 +1912,8 @@ static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMa
static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDecoderConfigurationRecord *dovi)
{
+ uint8_t buf[ISOM_DVCC_DVVC_SIZE];
+
avio_wb32(pb, 32); /* size = 8 + 24 */
if (dovi->dv_profile > 10)
ffio_wfourcc(pb, "dvwC");
@@ -1918,23 +1921,10 @@ static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDe
ffio_wfourcc(pb, "dvvC");
else
ffio_wfourcc(pb, "dvcC");
- avio_w8(pb, dovi->dv_version_major);
- avio_w8(pb, dovi->dv_version_minor);
- avio_wb16(pb, (dovi->dv_profile << 9) | (dovi->dv_level << 3) |
- (dovi->rpu_present_flag << 2) | (dovi->el_present_flag << 1) |
- dovi->bl_present_flag);
- avio_wb32(pb, (dovi->dv_bl_signal_compatibility_id << 28) | 0);
-
- ffio_fill(pb, 0, 4 * 4); /* reserved */
- av_log(s, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, "
- "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
- dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"),
- dovi->dv_version_major, dovi->dv_version_minor,
- dovi->dv_profile, dovi->dv_level,
- dovi->rpu_present_flag,
- dovi->el_present_flag,
- dovi->bl_present_flag,
- dovi->dv_bl_signal_compatibility_id);
+
+ ff_isom_put_dvcc_dvvc(s, buf, dovi);
+ avio_write(pb, buf, sizeof(buf));
+
return 32; /* 8 + 24 */
}
--
2.34.1
_______________________________________________
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] 9+ messages in thread
* [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements
2022-01-01 4:16 [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements quietvoid
` (3 preceding siblings ...)
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 4/5] avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc quietvoid
@ 2022-01-01 4:16 ` quietvoid
2022-01-01 7:57 ` Andreas Rheinhardt
4 siblings, 1 reply; 9+ messages in thread
From: quietvoid @ 2022-01-01 4:16 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: quietvoid
Tests the parsing and writing of AVDOVIDecoderConfigurationRecord,
when it is present as a Dolby Vision configuration block addition mapping.
Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
The required regression test file is available here: https://0x0.st/-hWK.mkv
Should be moved to fate-suite/mkv/dovi-p5.mkv
It is a blank frame encoded with x265.
---
tests/fate/matroska.mak | 9 +
tests/ref/fate/matroska-dovi-config-profile5 | 13 ++
tests/ref/fate/matroska-dovi-write-config | 223 +++++++++++++++++++
3 files changed, 245 insertions(+)
create mode 100644 tests/ref/fate/matroska-dovi-config-profile5
create mode 100644 tests/ref/fate/matroska-dovi-write-config
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index e117a0f6a6..ec2a0607b2 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -138,6 +138,15 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL WEBVTT_DEMUXER \
+= fate-webm-webvtt-remux
fate-webm-webvtt-remux: CMD = transcode webvtt $(TARGET_SAMPLES)/sub/WebVTT_capability_tester.vtt webm "-map 0 -map 0 -map 0 -map 0 -c:s copy -disposition:0 original+descriptions+hearing_impaired -disposition:1 lyrics+default+metadata -disposition:2 comment+forced -disposition:3 karaoke+captions+dub" "-map 0:0 -map 0:1 -c copy" "" "-show_entries stream_disposition:stream=index,codec_name:packet=stream_index,pts:packet_side_data_list -show_data_hash CRC32"
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += fate-matroska-dovi-config-profile5
+fate-matroska-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mkv/dovi-p5.mkv
+
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \
+ MOV_DEMUXER MATROSKA_MUXER \
+ FRAMECRC_MUXER) \
+ += fate-matroska-dovi-write-config
+fate-matroska-dovi-write-config: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov matroska "-c:v copy" "-map 0 -c copy" "" "-show_entries stream_side_data_list -select_streams v -v 0"
+
FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes)
FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes)
diff --git a/tests/ref/fate/matroska-dovi-config-profile5 b/tests/ref/fate/matroska-dovi-config-profile5
new file mode 100644
index 0000000000..a27976b71a
--- /dev/null
+++ b/tests/ref/fate/matroska-dovi-config-profile5
@@ -0,0 +1,13 @@
+[STREAM]
+[SIDE_DATA]
+side_data_type=DOVI configuration record
+dv_version_major=1
+dv_version_minor=0
+dv_profile=5
+dv_level=4
+rpu_present_flag=1
+el_present_flag=0
+bl_present_flag=1
+dv_bl_signal_compatibility_id=0
+[/SIDE_DATA]
+[/STREAM]
diff --git a/tests/ref/fate/matroska-dovi-write-config b/tests/ref/fate/matroska-dovi-write-config
new file mode 100644
index 0000000000..a253db9f00
--- /dev/null
+++ b/tests/ref/fate/matroska-dovi-write-config
@@ -0,0 +1,223 @@
+47d2c151ff02720fff7bd37b3028097e *tests/data/fate/matroska-dovi-write-config.matroska
+3618445 tests/data/fate/matroska-dovi-write-config.matroska
+#extradata 0: 551, 0xa18acf66
+#tb 0: 1/1000
+#media_type 0: video
+#codec_id 0: hevc
+#dimensions 0: 1920x1080
+#sar 0: 0/1
+#tb 1: 1/1000
+#media_type 1: audio
+#codec_id 1: ac3
+#sample_rate 1: 44100
+#channel_layout 1: 3
+#channel_layout_name 1: stereo
+0, -67, 0, 33, 63375, 0xc76606ab, S=1, 8
+0, -34, 133, 33, 46706, 0x0e08a7e5, F=0x0
+0, 0, 73, 33, 29766, 0x753c031a, F=0x0
+1, 0, 0, 34, 834, 0x6740ac04
+1, 35, 35, 34, 836, 0xe29a9a24
+0, 39, 39, 33, 19409, 0x4b948b6c, F=0x0
+1, 70, 70, 34, 836, 0xf7329e5f
+0, 73, 106, 33, 21086, 0x1b9412ce, F=0x0
+1, 105, 105, 34, 836, 0x9622a243
+0, 106, 273, 33, 62043, 0xc2356b56, F=0x0
+0, 133, 206, 33, 36175, 0x0a7df38c, F=0x0
+1, 140, 140, 34, 836, 0xb2d497c5
+0, 173, 173, 33, 16028, 0xa57fcbe9, F=0x0
+1, 174, 174, 34, 836, 0x17c8980e
+0, 206, 239, 33, 15428, 0x9a91f357, F=0x0
+1, 209, 209, 34, 836, 0xfe288a7d
+0, 239, 406, 33, 66072, 0xa542b6d7, F=0x0
+1, 244, 244, 34, 836, 0x539e82b1
+0, 273, 339, 33, 34985, 0xbfd8ff45, F=0x0
+1, 279, 279, 34, 836, 0x166291cb
+0, 306, 306, 33, 16036, 0xfc39c6ea, F=0x0
+1, 314, 314, 34, 836, 0x30127c33
+0, 339, 373, 33, 19893, 0x7e746f4e, F=0x0
+1, 348, 348, 34, 836, 0x0584947f
+0, 373, 539, 33, 77576, 0xeba2e5c8, F=0x0
+1, 383, 383, 34, 836, 0xd8c4946a
+0, 406, 473, 33, 35400, 0xbe179462, F=0x0
+1, 418, 418, 34, 836, 0xe16aa067
+0, 439, 439, 33, 15962, 0x7703dcd8, F=0x0
+1, 453, 453, 34, 836, 0x23819964
+0, 473, 506, 33, 16136, 0x78a74880, F=0x0
+1, 488, 488, 34, 836, 0x50e5974b
+0, 506, 673, 33, 74990, 0xb6fc1da7, F=0x0
+1, 523, 523, 34, 836, 0x9bb98f18
+0, 539, 606, 33, 36594, 0xc3c61c3e, F=0x0
+1, 557, 557, 34, 836, 0x8d879235
+0, 573, 573, 33, 16524, 0xb297a886, F=0x0
+1, 592, 592, 34, 836, 0xed8d94ae
+0, 606, 639, 33, 17033, 0x31b3dd63, F=0x0
+1, 627, 627, 34, 836, 0xdce8a1bc
+0, 639, 806, 33, 66745, 0x5edee4b1, F=0x0
+1, 662, 662, 34, 836, 0x0ba6a147
+0, 673, 739, 33, 37648, 0x540b100f, F=0x0
+1, 697, 697, 34, 836, 0x056496b4
+0, 706, 706, 33, 16363, 0x569798e5, F=0x0
+1, 732, 732, 34, 836, 0xef178cba
+0, 739, 773, 33, 17112, 0x9f04002b, F=0x0
+1, 766, 766, 34, 836, 0x5072955e
+0, 773, 939, 33, 69462, 0x6ed4d0a2, F=0x0
+1, 801, 801, 34, 836, 0x93f07da3
+0, 806, 873, 33, 34772, 0x2baa0683, F=0x0
+1, 836, 836, 34, 836, 0xce1995ab
+0, 839, 839, 33, 14301, 0x8d69c797, F=0x0
+1, 871, 871, 34, 834, 0x3dd29b4e
+0, 873, 906, 33, 16355, 0x1ebb9962, F=0x0
+0, 906, 1073, 33, 107788, 0xcf28b065
+1, 906, 906, 34, 836, 0x4ee59927
+0, 939, 1006, 33, 35514, 0xa824dec0, F=0x0
+1, 941, 941, 34, 836, 0x00419cb1
+0, 973, 973, 33, 15937, 0x8c06a068, F=0x0
+1, 975, 975, 34, 836, 0x63089b3f
+0, 1006, 1039, 33, 15936, 0x1a01f3e9, F=0x0
+1, 1010, 1010, 34, 836, 0xc0f0949b
+0, 1039, 1208, 33, 79014, 0xef4c241e, F=0x0
+1, 1045, 1045, 34, 836, 0x2d78960d
+0, 1073, 1139, 33, 37293, 0xb32c9665, F=0x0
+1, 1080, 1080, 34, 836, 0x62829a96
+0, 1106, 1106, 33, 12826, 0xddc8ba8d, F=0x0
+1, 1115, 1115, 34, 836, 0xb7e293cd
+0, 1139, 1174, 33, 13376, 0x76fbc02f, F=0x0
+1, 1150, 1150, 34, 836, 0xe38a9af0
+0, 1174, 1341, 33, 68959, 0x5fdeaeac, F=0x0
+1, 1184, 1184, 34, 836, 0xdbb9a0cb
+0, 1208, 1274, 33, 35503, 0x15dbf810, F=0x0
+1, 1219, 1219, 34, 836, 0xf3fb8501
+0, 1241, 1241, 33, 12298, 0xbc12d96e, F=0x0
+1, 1254, 1254, 34, 836, 0x32d49155
+0, 1274, 1308, 33, 16357, 0x3bb3e5c9, F=0x0
+1, 1289, 1289, 34, 836, 0xdc078765
+0, 1308, 1474, 33, 69872, 0x643e0e8a, F=0x0
+1, 1324, 1324, 34, 836, 0xff8a9403
+0, 1341, 1408, 33, 35059, 0xab5881c4, F=0x0
+1, 1359, 1359, 34, 836, 0x65169eff
+0, 1374, 1374, 33, 17718, 0xe78b5150, F=0x0
+1, 1393, 1393, 34, 836, 0x6abe99ad
+0, 1408, 1441, 33, 17264, 0xd5297233, F=0x0
+1, 1428, 1428, 34, 836, 0x29f79594
+0, 1441, 1608, 33, 68258, 0xea19d5bb, F=0x0
+1, 1463, 1463, 34, 836, 0x1fe49345
+0, 1474, 1541, 33, 34019, 0x1c25277c, F=0x0
+1, 1498, 1498, 34, 836, 0xf62b922e
+0, 1508, 1508, 33, 16085, 0xfc5f1909, F=0x0
+1, 1533, 1533, 34, 836, 0x2658868c
+0, 1541, 1574, 33, 17133, 0xccd80c32, F=0x0
+1, 1568, 1568, 34, 836, 0x9ac1a1dd
+0, 1574, 1741, 33, 65478, 0x92adbcf5, F=0x0
+1, 1602, 1602, 34, 836, 0x72bf9a71
+0, 1608, 1674, 33, 35702, 0x85da366e, F=0x0
+1, 1637, 1637, 34, 836, 0x0d0a7dd1
+0, 1641, 1641, 33, 17729, 0x7c6037dd, F=0x0
+1, 1672, 1672, 34, 836, 0x3bcfaaae
+0, 1674, 1708, 33, 16400, 0x07509624, F=0x0
+1, 1707, 1707, 34, 834, 0xee2f8e6d
+0, 1708, 1874, 33, 65450, 0xc93a8591, F=0x0
+0, 1741, 1808, 33, 30572, 0xe4892d21, F=0x0
+1, 1742, 1742, 34, 836, 0x20d69f8f
+0, 1774, 1774, 33, 16836, 0x34466a29, F=0x0
+1, 1777, 1777, 34, 836, 0x44a99be1
+0, 1808, 1841, 33, 16615, 0x06f42746, F=0x0
+1, 1811, 1811, 34, 836, 0x99178de9
+0, 1841, 2008, 33, 61621, 0x455e8141, F=0x0
+1, 1846, 1846, 34, 836, 0xd9ee9576
+0, 1874, 1941, 33, 35393, 0x91e3f353, F=0x0
+1, 1881, 1881, 34, 836, 0x1d9e99d5
+0, 1908, 1908, 33, 16421, 0xb5a4a3fd, F=0x0
+1, 1916, 1916, 34, 836, 0x8ffaa153
+0, 1941, 1974, 33, 15874, 0x8a12e636, F=0x0
+1, 1951, 1951, 34, 836, 0x3a4e91d2
+0, 1974, 2141, 33, 108249, 0x74b9d9a5
+1, 1986, 1986, 34, 836, 0x7c4897f5
+0, 2008, 2074, 33, 32427, 0x1b4e36e9, F=0x0
+1, 2020, 2020, 34, 836, 0x31e78ae6
+0, 2041, 2041, 33, 15263, 0xc96d6375, F=0x0
+1, 2055, 2055, 34, 836, 0x05f4a020
+0, 2074, 2108, 33, 15124, 0x24bf4865, F=0x0
+1, 2090, 2090, 34, 836, 0x33f59dee
+0, 2108, 2274, 33, 66156, 0x9536eb3a, F=0x0
+1, 2125, 2125, 34, 836, 0x4bb589e8
+0, 2141, 2208, 33, 33590, 0x12693d54, F=0x0
+1, 2160, 2160, 34, 836, 0xc13189c1
+0, 2174, 2174, 33, 15633, 0xa1f67306, F=0x0
+1, 2194, 2194, 34, 836, 0x4444958c
+0, 2208, 2241, 33, 16075, 0x1ee82b38, F=0x0
+1, 2229, 2229, 34, 836, 0x0a208c8f
+0, 2241, 2408, 33, 63442, 0xb508621f, F=0x0
+1, 2264, 2264, 34, 836, 0x7fa897d1
+0, 2274, 2341, 33, 35773, 0xa79485e3, F=0x0
+1, 2299, 2299, 34, 836, 0x9b9983a9
+0, 2308, 2308, 33, 16970, 0x6fcf7d2c, F=0x0
+1, 2334, 2334, 34, 836, 0x7c62a39c
+0, 2341, 2374, 33, 17773, 0x3a10880d, F=0x0
+1, 2369, 2369, 34, 836, 0x20e59eac
+0, 2374, 2541, 33, 66942, 0x91535a55, F=0x0
+1, 2403, 2403, 34, 836, 0xba978958
+0, 2408, 2474, 33, 36289, 0xd1337338, F=0x0
+1, 2438, 2438, 34, 836, 0x5c318db6
+0, 2441, 2441, 33, 16878, 0x0c83a101, F=0x0
+1, 2473, 2473, 34, 836, 0xd4b097ae
+0, 2474, 2508, 33, 17452, 0x8c3cb218, F=0x0
+0, 2508, 2674, 33, 64256, 0x2243ae19, F=0x0
+1, 2508, 2508, 34, 836, 0xe00c9b03
+0, 2541, 2608, 33, 33995, 0x3634ef46, F=0x0
+1, 2543, 2543, 34, 836, 0xc5458206
+0, 2574, 2574, 33, 17505, 0xb70bdaef, F=0x0
+1, 2578, 2578, 34, 834, 0x2f958a79
+0, 2608, 2641, 33, 17420, 0x0a39d08d, F=0x0
+1, 2612, 2612, 34, 836, 0xd6959d9c
+0, 2641, 2808, 33, 64814, 0x52eba8da, F=0x0
+1, 2647, 2647, 34, 836, 0x44a085a8
+0, 2674, 2741, 33, 35168, 0x3bae1145, F=0x0
+1, 2682, 2682, 34, 836, 0x70218f40
+0, 2708, 2708, 33, 18363, 0x5aac8d0b, F=0x0
+1, 2717, 2717, 34, 836, 0xa5659884
+0, 2741, 2774, 33, 18577, 0x3ef410e2, F=0x0
+1, 2752, 2752, 34, 836, 0x8159a8ed
+0, 2774, 2941, 33, 65960, 0xd928efea, F=0x0
+1, 2787, 2787, 34, 836, 0x3355a68b
+0, 2808, 2874, 33, 35750, 0x1e6b3528, F=0x0
+1, 2821, 2821, 34, 836, 0x96429008
+0, 2841, 2841, 33, 18109, 0x04a60f42, F=0x0
+1, 2856, 2856, 34, 836, 0x22f9a207
+0, 2874, 2908, 33, 18965, 0xce88b8c2, F=0x0
+1, 2891, 2891, 34, 836, 0xc51e91aa
+0, 2908, 3074, 33, 64413, 0x0e2a7b8d, F=0x0
+1, 2926, 2926, 34, 836, 0xd05a910c
+0, 2941, 3008, 33, 36536, 0x1b69fcc7, F=0x0
+1, 2961, 2961, 34, 836, 0xd96693ca
+0, 2974, 2974, 33, 16823, 0xc226cdd8, F=0x0
+1, 2996, 2996, 34, 836, 0xe4c28e6f
+0, 3008, 3041, 33, 18254, 0xe28d2b32, F=0x0
+1, 3030, 3030, 34, 836, 0x912195c2
+0, 3041, 3208, 33, 108398, 0x04e8955a
+1, 3065, 3065, 34, 836, 0x04689871
+0, 3074, 3141, 33, 39214, 0xc82d25cc, F=0x0
+1, 3100, 3100, 34, 836, 0xef3c9d49
+0, 3108, 3108, 33, 17093, 0x81e01006, F=0x0
+1, 3135, 3135, 34, 836, 0x8d567cf2
+0, 3141, 3174, 33, 16220, 0xb8b86777, F=0x0
+1, 3170, 3170, 34, 836, 0x0b319c70
+0, 3174, 3308, 33, 60533, 0xc63d4419, F=0x0
+1, 3205, 3205, 34, 836, 0xd0e88e98
+0, 3208, 3274, 33, 27638, 0xcd9cb6d0, F=0x0
+1, 3239, 3239, 34, 836, 0xd528a79c
+0, 3241, 3241, 33, 16528, 0x5e9dc6fd, F=0x0
+1, 3274, 3274, 34, 836, 0x3a95a59f
+1, 3309, 3309, 34, 836, 0xb4c88ae3
+[STREAM]
+[SIDE_DATA]
+side_data_type=DOVI configuration record
+dv_version_major=1
+dv_version_minor=0
+dv_profile=8
+dv_level=4
+rpu_present_flag=1
+el_present_flag=0
+bl_present_flag=1
+dv_bl_signal_compatibility_id=4
+[/SIDE_DATA]
+[/STREAM]
--
2.34.1
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v11 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc quietvoid
@ 2022-01-01 7:30 ` Andreas Rheinhardt
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2022-01-01 7:30 UTC (permalink / raw)
To: ffmpeg-devel
quietvoid:
> To avoid duplicating code. The implementation in dovi_isom is identical.
>
> Signed-off-by: quietvoid <tcChlisop0@gmail.com>
> ---
> libavformat/mov.c | 50 +++++++----------------------------------------
> 1 file changed, 7 insertions(+), 43 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 351ecde770..ad5ab6b491 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -55,6 +55,7 @@
> #include "avformat.h"
> #include "internal.h"
> #include "avio_internal.h"
> +#include "dovi_isom.h"
> #include "riff.h"
> #include "isom.h"
> #include "libavcodec/get_bits.h"
> @@ -7062,58 +7063,21 @@ static int mov_read_dmlp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> {
> AVStream *st;
> - uint32_t buf;
> - AVDOVIDecoderConfigurationRecord *dovi;
> - size_t dovi_size;
> + uint8_t buf[ISOM_DVCC_DVVC_SIZE];
> int ret;
> + int64_t read_size = atom.size;
>
> if (c->fc->nb_streams < 1)
> return 0;
> st = c->fc->streams[c->fc->nb_streams-1];
>
> - if ((uint64_t)atom.size > (1<<30) || atom.size < 4)
> - return AVERROR_INVALIDDATA;
> -
> - dovi = av_dovi_alloc(&dovi_size);
> - if (!dovi)
> - return AVERROR(ENOMEM);
> -
> - dovi->dv_version_major = avio_r8(pb);
> - dovi->dv_version_minor = avio_r8(pb);
> -
> - buf = avio_rb16(pb);
> - dovi->dv_profile = (buf >> 9) & 0x7f; // 7 bits
> - dovi->dv_level = (buf >> 3) & 0x3f; // 6 bits
> - dovi->rpu_present_flag = (buf >> 2) & 0x01; // 1 bit
> - dovi->el_present_flag = (buf >> 1) & 0x01; // 1 bit
> - dovi->bl_present_flag = buf & 0x01; // 1 bit
> - if (atom.size >= 24) { // 4 + 4 + 4 * 4
> - buf = avio_r8(pb);
> - dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 bits
> - } else {
> - // 0 stands for None
> - // Dolby Vision V1.2.93 profiles and levels
> - dovi->dv_bl_signal_compatibility_id = 0;
> - }
> + // At most 24 bytes
> + read_size = FFMIN(read_size, ISOM_DVCC_DVVC_SIZE);
>
> - ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF,
> - (uint8_t *)dovi, dovi_size);
> - if (ret < 0) {
> - av_free(dovi);
> + if ((ret = ffio_read_size(pb, buf, read_size)) < 0)
> return ret;
> - }
>
> - av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, "
> - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
> - dovi->dv_version_major, dovi->dv_version_minor,
> - dovi->dv_profile, dovi->dv_level,
> - dovi->rpu_present_flag,
> - dovi->el_present_flag,
> - dovi->bl_present_flag,
> - dovi->dv_bl_signal_compatibility_id
> - );
> -
> - return 0;
> + return ff_isom_parse_dvcc_dvvc(c->fc, st, buf, read_size);
> }
>
> static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>
Patches 3 and 4 are missing Makefile changes similar to patch 2.
- Andreas
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements quietvoid
@ 2022-01-01 7:57 ` Andreas Rheinhardt
2022-01-01 16:54 ` quietvoid
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Rheinhardt @ 2022-01-01 7:57 UTC (permalink / raw)
To: ffmpeg-devel
quietvoid:
> Tests the parsing and writing of AVDOVIDecoderConfigurationRecord,
> when it is present as a Dolby Vision configuration block addition mapping.
>
> Signed-off-by: quietvoid <tcChlisop0@gmail.com>
> ---
> The required regression test file is available here: https://0x0.st/-hWK.mkv
> Should be moved to fate-suite/mkv/dovi-p5.mkv
>
> It is a blank frame encoded with x265.
> ---
> tests/fate/matroska.mak | 9 +
> tests/ref/fate/matroska-dovi-config-profile5 | 13 ++
> tests/ref/fate/matroska-dovi-write-config | 223 +++++++++++++++++++
> 3 files changed, 245 insertions(+)
> create mode 100644 tests/ref/fate/matroska-dovi-config-profile5
> create mode 100644 tests/ref/fate/matroska-dovi-write-config
>
> diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> index e117a0f6a6..ec2a0607b2 100644
> --- a/tests/fate/matroska.mak
> +++ b/tests/fate/matroska.mak
> @@ -138,6 +138,15 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL WEBVTT_DEMUXER \
> += fate-webm-webvtt-remux
> fate-webm-webvtt-remux: CMD = transcode webvtt $(TARGET_SAMPLES)/sub/WebVTT_capability_tester.vtt webm "-map 0 -map 0 -map 0 -map 0 -c:s copy -disposition:0 original+descriptions+hearing_impaired -disposition:1 lyrics+default+metadata -disposition:2 comment+forced -disposition:3 karaoke+captions+dub" "-map 0:0 -map 0:1 -c copy" "" "-show_entries stream_disposition:stream=index,codec_name:packet=stream_index,pts:packet_side_data_list -show_data_hash CRC32"
>
> +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += fate-matroska-dovi-config-profile5
This should be FATE_MATROSKA_FFPROBE, not FATE_MATROSKA_FFMPEG_FFPROBE.
And actually, you need the file protocol; if you don't check for it,
you can just use FATE_MATROSKA_FFPROBE-$(CONFIG_MATROSKA_DEMUXER).
> +fate-matroska-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mkv/dovi-p5.mkv
> +
> +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \
> + MOV_DEMUXER MATROSKA_MUXER \
> + FRAMECRC_MUXER) \
You will need the MATROSKA_DEMUXER, too; after all, the created file is
read and demuxed.
> + += fate-matroska-dovi-write-config
> +fate-matroska-dovi-write-config: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov matroska "-c:v copy" "-map 0 -c copy" "" "-show_entries stream_side_data_list -select_streams v -v 0"
> +
> FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
> FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes)
> FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes)
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements
2022-01-01 7:57 ` Andreas Rheinhardt
@ 2022-01-01 16:54 ` quietvoid
0 siblings, 0 replies; 9+ messages in thread
From: quietvoid @ 2022-01-01 16:54 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Jan 1, 2022 at 2:57 AM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> quietvoid:
> > Tests the parsing and writing of AVDOVIDecoderConfigurationRecord,
> > when it is present as a Dolby Vision configuration block addition mapping.
> >
> > Signed-off-by: quietvoid <tcChlisop0@gmail.com>
> > ---
> > The required regression test file is available here: https://0x0.st/-hWK.mkv
> > Should be moved to fate-suite/mkv/dovi-p5.mkv
> >
> > It is a blank frame encoded with x265.
> > ---
> > tests/fate/matroska.mak | 9 +
> > tests/ref/fate/matroska-dovi-config-profile5 | 13 ++
> > tests/ref/fate/matroska-dovi-write-config | 223 +++++++++++++++++++
> > 3 files changed, 245 insertions(+)
> > create mode 100644 tests/ref/fate/matroska-dovi-config-profile5
> > create mode 100644 tests/ref/fate/matroska-dovi-write-config
> >
> > diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
> > index e117a0f6a6..ec2a0607b2 100644
> > --- a/tests/fate/matroska.mak
> > +++ b/tests/fate/matroska.mak
> > @@ -138,6 +138,15 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL WEBVTT_DEMUXER \
> > += fate-webm-webvtt-remux
> > fate-webm-webvtt-remux: CMD = transcode webvtt $(TARGET_SAMPLES)/sub/WebVTT_capability_tester.vtt webm "-map 0 -map 0 -map 0 -map 0 -c:s copy -disposition:0 original+descriptions+hearing_impaired -disposition:1 lyrics+default+metadata -disposition:2 comment+forced -disposition:3 karaoke+captions+dub" "-map 0:0 -map 0:1 -c copy" "" "-show_entries stream_disposition:stream=index,codec_name:packet=stream_index,pts:packet_side_data_list -show_data_hash CRC32"
> >
> > +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += fate-matroska-dovi-config-profile5
>
> This should be FATE_MATROSKA_FFPROBE, not FATE_MATROSKA_FFMPEG_FFPROBE.
> And actually, you need the file protocol; if you don't check for it,
> you can just use FATE_MATROSKA_FFPROBE-$(CONFIG_MATROSKA_DEMUXER).
>
> > +fate-matroska-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mkv/dovi-p5.mkv
> > +
> > +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \
> > + MOV_DEMUXER MATROSKA_MUXER \
> > + FRAMECRC_MUXER) \
>
> You will need the MATROSKA_DEMUXER, too; after all, the created file is
> read and demuxed.
Thanks again. Fixed along with the other comments (for the other patches).
v12: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290630.html
> > + += fate-matroska-dovi-write-config
> > +fate-matroska-dovi-write-config: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov matroska "-c:v copy" "-map 0 -c copy" "" "-show_entries stream_side_data_list -select_streams v -v 0"
> > +
> > FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
> > FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes)
> > FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes)
> _______________________________________________
> 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".
_______________________________________________
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] 9+ messages in thread
end of thread, other threads:[~2022-01-01 16:54 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-01 4:16 [FFmpeg-devel] [PATCH v11 0/5] Add support for Matroska BlockAdditionMapping elements quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 1/5] avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 2/5] avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc quietvoid
2022-01-01 7:30 ` Andreas Rheinhardt
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 4/5] avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc quietvoid
2022-01-01 4:16 ` [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements quietvoid
2022-01-01 7:57 ` Andreas Rheinhardt
2022-01-01 16:54 ` quietvoid
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