Bug#790931: libav-tools: mpjpeg output: add Content-Length header

Frank Heckenbach f.heckenbach at fh-soft.de
Fri Jul 3 06:28:23 UTC 2015

Package: libav-tools
Version: 6:11.4-1~deb8u1
Severity: wishlist
Tags: upstream patch

I suggest to add a Content-Length header to the mpjpeg output. This
makes it easier to parse the output, rather than relying on the
fixed boundary which, though very unlikely, could also occur within
an image. Since the size information is readily available, it's a
trivial change:

--- libav-0.8.17/libavformat/mpjpeg.c
+++ libav-0.8.17/libavformat/mpjpeg.c
@@ -38,7 +38,8 @@
     uint8_t buf1[256];
-    snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
+    snprintf(buf1, sizeof(buf1),
+             "Content-type: image/jpeg\nContent-length: %i\n\n", pkt->size);
     avio_write(s->pb, buf1, strlen(buf1));
     avio_write(s->pb, pkt->data, pkt->size);

More information about the pkg-multimedia-maintainers mailing list