summaryrefslogtreecommitdiff
path: root/libavformat/webpenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-07 04:08:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-07 04:15:01 +0100
commitc11f731768568787c1c6333970ed40ae0f2ff4f4 (patch)
treef9dece0b8d89f47ff2e22dd5b1e6bb83dc3a717d /libavformat/webpenc.c
parentb1c99f4c5f8f3dc07264cf8011a9635cd3321cc6 (diff)
downloadffmpeg-c11f731768568787c1c6333970ed40ae0f2ff4f4.tar.gz
avformat/webpenc: preserve single image VP8X flags
Fixes Ticket4087 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/webpenc.c')
-rw-r--r--libavformat/webpenc.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index a9549cdb74..ee110de2dd 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) {