From: quietvoid <tcchlisop0@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: quietvoid <tcChlisop0@gmail.com>
Subject: [FFmpeg-devel] [PATCH v11 4/5] avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc
Date: Sat, 1 Jan 2022 05:16:20 +0100
Message-ID: <20220101041621.427012-5-tcChlisop0@gmail.com> (raw)
In-Reply-To: <20220101041621.427012-1-tcChlisop0@gmail.com>
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".
next prev parent reply other threads:[~2022-01-01 4:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` quietvoid [this message]
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
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=20220101041621.427012-5-tcChlisop0@gmail.com \
--to=tcchlisop0@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