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

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-09-19 21:32:40 -03:00
parent f9f9d5943f
commit 179e15dc97
1 changed files with 5 additions and 4 deletions

View File

@ -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)