[FFmpeg-cvslog] avformat/movenc: don't hardcode the colr box size

James Almer git at videolan.org
Fri Sep 20 03:57:51 EEST 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Sep 19 21:32:40 2019 -0300| [179e15dc976510993ba28d7e41559d257b53aff6] | committer: James Almer

avformat/movenc: don't hardcode the colr box size

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=179e15dc976510993ba28d7e41559d257b53aff6
---

 libavformat/movenc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index edddfeeb00..c824ff5ba1 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1867,6 +1867,8 @@ static int mov_write_gama_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
 
 static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track)
 {
+    int64_t pos = avio_tell(pb);
+
     // Ref (MOV): https://developer.apple.com/library/mac/technotes/tn2162/_index.html#//apple_ref/doc/uid/DTS40013070-CH1-TNTAG9
     // Ref (MP4): ISO/IEC 14496-12:2012
 
@@ -1903,7 +1905,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track)
     /* We should only ever be called by MOV or MP4. */
     av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4);
 
-    avio_wb32(pb, 18 + (track->mode == MODE_MP4));
+    avio_wb32(pb, 0); /* size */
     ffio_wfourcc(pb, "colr");
     if (track->mode == MODE_MP4)
         ffio_wfourcc(pb, "nclx");
@@ -1940,10 +1942,9 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track)
     if (track->mode == MODE_MP4) {
         int full_range = track->par->color_range == AVCOL_RANGE_JPEG;
         avio_w8(pb, full_range << 7);
-        return 19;
-    } else {
-        return 18;
     }
+
+    return update_size(pb, pos);
 }
 
 static void find_compressor(char * compressor_name, int len, MOVTrack *track)



More information about the ffmpeg-cvslog mailing list