[FFmpeg-devel] libavformat/movenc.c: Correct color range when writing DNxHD atoms

jon morley jon at tweaksoftware.com
Tue Jan 27 20:15:40 CET 2015


From 0097277471810ab1d9d737c64a57c2278a039153 Mon Sep 17 00:00:00 2001
From: Jon Morley <jon at tweaksoftware.com>
Date: Tue, 27 Jan 2015 11:10:27 -0800
Subject: [PATCH] libavformat/movenc.c: Correct color range when writing DNxHD
 atoms

The meaning of the color range values in the AVdn.ACLR atom was swapped.
This change makes the selection explicit and correctly mapped.
---
 libavformat/movenc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d7ae5f0..dfe4c27 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1039,10 +1039,13 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
     ffio_wfourcc(pb, "ACLR");
     ffio_wfourcc(pb, "0001");
     if (track->enc->color_range == AVCOL_RANGE_MPEG) { /* Legal range (16-235) */
-        avio_wb32(pb, 1); /* Corresponds to 709 in official encoder */
-    } else { /* Full range (0-255) */
-        avio_wb32(pb, 2); /* Corresponds to RGB in official encoder */
+        avio_wb32(pb, 2); /* Corresponds to 709 in official encoder */
+    } else if (track->enc->color_range == AVCOL_RANGE_JPEG) { /* Full range (0-255) */
+        avio_wb32(pb, 1); /* Corresponds to RGB in official encoder */
+    } else {
+        avio_wb32(pb, 0); /* Unspecified */
     }
+
     avio_wb32(pb, 0); /* unknown */
 
     avio_wb32(pb, 24); /* size */
-- 
1.8.5.2 (Apple Git-48)


More information about the ffmpeg-devel mailing list