aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorquietvoid <tcchlisop0@gmail.com>2022-01-01 17:51:52 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 04:29:36 +0100
commitf0fb005f59f6febcf2ffc8140bdb7f136ac56add (patch)
tree102212d5a7429ab64e4aeb64ea359ed3d08234ef
parent9906f9ae3b678d95b413dd4320e334ea3e2cf70a (diff)
downloadffmpeg-f0fb005f59f6febcf2ffc8140bdb7f136ac56add.tar.gz
avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc
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> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavformat/Makefile3
-rw-r--r--libavformat/movenc.c24
2 files changed, 9 insertions, 18 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cd9810ba01..a9afb9c042 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -342,7 +342,8 @@ OBJS-$(CONFIG_MOV_DEMUXER) += mov.o mov_chan.o mov_esds.o \
qtpalette.o replaygain.o dovi_isom.o
OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o \
movenchint.o mov_chan.o rtp.o \
- movenccenc.o movenc_ttml.o rawutils.o
+ movenccenc.o movenc_ttml.o rawutils.o \
+ dovi_isom.o
OBJS-$(CONFIG_MP2_MUXER) += rawenc.o
OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o replaygain.o
OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 40ad4f8642..04cf2f777d 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 */
}