Michael, since before I started messing with the QuickTime palette, the palette has usually been used in conjunction with AVI, which uses little endian order of the entries (BGRA), here is a proposed patch that forces little-endian order when storing the QuickTime palette, in case the movenc.c patch won't work with "ffmpeg -i 8bpp_129.mov -vcodec rawvideo out.mov" on that mips machine, which I suspect will be the case without knowing beforehand.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From bf471c33a2e05c86410b5a8c22ec75dbcce70a2a Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Fri, 26 Feb 2016 07:02:57 +0100
Subject: [PATCH] lavf/qtpalette: Store the palette in little endian

---
 libavformat/qtpalette.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/qtpalette.c b/libavformat/qtpalette.c
index 666c6b7..d53093e 100644
--- a/libavformat/qtpalette.c
+++ b/libavformat/qtpalette.c
@@ -61,7 +61,7 @@ int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette)
             color_dec   = 256 / (color_count - 1);
             for (i = 0; i < color_count; i++) {
                 r = g = b = color_index;
-                palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b);
+                AV_WL32(&palette[i], (0xFFU << 24) | (r << 16) | (g << 8) | (b));
                 color_index -= color_dec;
                 if (color_index < 0)
                     color_index = 0;
@@ -84,7 +84,7 @@ int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette)
                 r = color_table[i * 3 + 0];
                 g = color_table[i * 3 + 1];
                 b = color_table[i * 3 + 2];
-                palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b);
+                AV_WL32(&palette[i], (0xFFU << 24) | (r << 16) | (g << 8) | (b));
             }
         } else {
             /* The color table ID is 0; the color table is in the sample
@@ -104,7 +104,7 @@ int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette)
                     avio_r8(pb);
                     b = avio_r8(pb);
                     avio_r8(pb);
-                    palette[i] = (a << 24 ) | (r << 16) | (g << 8) | (b);
+                    AV_WL32(&palette[i], (a << 24 ) | (r << 16) | (g << 8) | (b));
                 }
             }
         }
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to