diff mbox

[FFmpeg-devel] avformat/movenc: correct ImageDescription depth for v210 v410

Message ID BFDF4535-7C91-47DB-948D-A59CFDBFA52B@dericed.com
State Superseded
Headers show

Commit Message

Dave Rice Nov. 16, 2017, 4:54 p.m. UTC
This corrects a few values in the Image Description for v210 and v410 in mov. Apple defines what the depth value for these uncompressed formats should be in https://developer.apple.com/library/content/technotes/tn2162/_index.html <https://developer.apple.com/library/content/technotes/tn2162/_index.html>.


From 47def189b270ac93245e002580463b254daf8484 Mon Sep 17 00:00:00 2001
From: Dave Rice <dave@dericed.com>
Date: Thu, 16 Nov 2017 11:53:32 -0500
Subject: [PATCH] avformat/movenc: correct ImageDescription depth for v210 v410

Per
https://developer.apple.com/library/content/technotes/tn2162/_index.html
.
---
 libavformat/movenc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Nov. 16, 2017, 11:08 p.m. UTC | #1
2017-11-16 17:54 GMT+01:00 Dave Rice <dave@dericed.com>:

> +    if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V410)
> +        avio_wb16(pb, 0x18);
> +    else if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V210)
> +        avio_wb16(pb, 0x18);

It appears you can merge the two cases.

Or maybe patch bits_per_coded_sample in the encoder...

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 18232e8ba3..f7b08e2885 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1885,7 +1885,11 @@  static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
     avio_w8(pb, strlen(compressor_name));
     avio_write(pb, compressor_name, 31);
 
-    if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
+    if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V410)
+        avio_wb16(pb, 0x18);
+    else if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_V210)
+        avio_wb16(pb, 0x18);
+    else if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
         avio_wb16(pb, track->par->bits_per_coded_sample |
                   (track->par->format == AV_PIX_FMT_GRAY8 ? 0x20 : 0));
     else