[FFmpeg-cvslog] avformat/movenc: add support for writing lhvC boxes
James Almer
git at videolan.org
Sun Jul 7 18:42:20 EEST 2024
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Jun 15 15:35:52 2024 -0300| [d4e2af414437cb5250fb73524c4139b45a4b421b] | committer: James Almer
avformat/movenc: add support for writing lhvC boxes
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4e2af414437cb5250fb73524c4139b45a4b421b
---
libavformat/movenc.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3991be0ad4..4bd9d32b15 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1557,6 +1557,26 @@ static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
return update_size(pb, pos);
}
+static int mov_write_lhvc_tag(AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ int ret;
+
+ avio_wb32(pb, 0);
+ ffio_wfourcc(pb, "lhvC");
+ if (track->tag == MKTAG('h','v','c','1'))
+ ret = ff_isom_write_lhvc(pb, track->vos_data, track->vos_len, 1);
+ else
+ ret = ff_isom_write_lhvc(pb, track->vos_data, track->vos_len, 0);
+
+ if (ret < 0) {
+ avio_seek(pb, pos, SEEK_SET);
+ return ret;
+ }
+
+ return update_size(pb, pos);
+}
+
static int mov_write_evcc_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
@@ -2523,9 +2543,14 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
} else if (track->par->codec_id == AV_CODEC_ID_DNXHD) {
mov_write_avid_tag(pb, track);
avid = 1;
- } else if (track->par->codec_id == AV_CODEC_ID_HEVC)
+ } else if (track->par->codec_id == AV_CODEC_ID_HEVC) {
mov_write_hvcc_tag(pb, track);
- else if (track->par->codec_id == AV_CODEC_ID_VVC)
+ if (track->st->disposition & AV_DISPOSITION_MULTILAYER) {
+ ret = mov_write_lhvc_tag(pb, track);
+ if (ret < 0)
+ av_log(mov->fc, AV_LOG_WARNING, "Not writing 'lhvC' atom for multilayer stream.\n");
+ }
+ } else if (track->par->codec_id == AV_CODEC_ID_VVC)
mov_write_vvcc_tag(pb, track);
else if (track->par->codec_id == AV_CODEC_ID_H264 && !TAG_IS_AVCI(track->tag)) {
mov_write_avcc_tag(pb, track);
More information about the ffmpeg-cvslog
mailing list