[FFmpeg-cvslog] avformat/webpenc: preserve single image VP8X flags

Michael Niedermayer git at videolan.org
Fri Nov 7 04:15:45 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov  7 04:08:18 2014 +0100| [c11f731768568787c1c6333970ed40ae0f2ff4f4] | committer: Michael Niedermayer

avformat/webpenc: preserve single image VP8X flags

Fixes Ticket4087

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/webpenc.c |   38 ++++++++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index a9549cd..ee110de 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -58,25 +58,39 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts)
 
     if (w->last_pkt.size) {
         int skip = 0;
+        unsigned flags = 0;
+        int vp8x = 0;
 
         if (AV_RL32(w->last_pkt.data) == AV_RL32("RIFF"))
             skip = 12;
-        if (AV_RL32(w->last_pkt.data + skip) == AV_RL32("VP8X"))
+        if (AV_RL32(w->last_pkt.data + skip) == AV_RL32("VP8X")) {
+            flags |= w->last_pkt.data[skip + 4 + 4];
+            vp8x = 1;
             skip += AV_RL32(w->last_pkt.data + skip + 4) + 8;
+        }
 
         w->frame_count ++;
-        if (w->frame_count == 1 && !trailer) {
-            avio_write(s->pb, "VP8X", 4);
-            avio_wl32(s->pb, 10);
-            avio_w8(s->pb, 2+16);
-            avio_wl24(s->pb, 0);
-            avio_wl24(s->pb, st->codec->width - 1);
-            avio_wl24(s->pb, st->codec->height - 1);
 
-            avio_write(s->pb, "ANIM", 4);
-            avio_wl32(s->pb, 6);
-            avio_wl32(s->pb, 0xFFFFFFFF);
-            avio_wl16(s->pb, w->loop);
+        if (w->frame_count == 1) {
+            if (!trailer) {
+                vp8x = 1;
+                flags |= 2 + 16;
+            }
+
+            if (vp8x) {
+                avio_write(s->pb, "VP8X", 4);
+                avio_wl32(s->pb, 10);
+                avio_w8(s->pb, flags);
+                avio_wl24(s->pb, 0);
+                avio_wl24(s->pb, st->codec->width - 1);
+                avio_wl24(s->pb, st->codec->height - 1);
+            }
+            if (!trailer) {
+                avio_write(s->pb, "ANIM", 4);
+                avio_wl32(s->pb, 6);
+                avio_wl32(s->pb, 0xFFFFFFFF);
+                avio_wl16(s->pb, w->loop);
+            }
         }
 
         if (w->frame_count > trailer) {



More information about the ffmpeg-cvslog mailing list