aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-01-15 17:15:47 +0100
committerMattias Andrée <maandree@kth.se>2017-01-15 17:15:47 +0100
commitd6c07e7fa021e13b5b9914cb15f13c711ecd387d (patch)
tree75fd767b2078a786c6bdb6729c45a63fd3b81979 /src/stream.h
parentblind-config: fix -j (diff)
downloadblind-d6c07e7fa021e13b5b9914cb15f13c711ecd387d.tar.gz
blind-d6c07e7fa021e13b5b9914cb15f13c711ecd387d.tar.bz2
blind-d6c07e7fa021e13b5b9914cb15f13c711ecd387d.tar.xz
Use macros to write the head
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/stream.h')
-rw-r--r--src/stream.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stream.h b/src/stream.h
index 027db4a..53b7113 100644
--- a/src/stream.h
+++ b/src/stream.h
@@ -4,6 +4,18 @@
#define STREAM_HEAD_MAX (3 * 3 * sizeof(size_t) + sizeof(((struct stream *)0)->pixfmt) + 10)
+#define SPRINTF_HEAD_ZN(BUF, FRAMES, WIDTH, HEIGHT, PIXFMT, LENP)\
+ sprintf(BUF, "%zu %zu %zu %s\n%cuivf%zn",\
+ FRAMES, WIDTH, HEIGHT, PIXFMT, 0, LENP)
+
+#define SPRINTF_HEAD(BUF, FRAMES, WIDTH, HEIGHT, PIXFMT)\
+ sprintf(BUF, "%zu %zu %zu %s\n%cuivf",\
+ FRAMES, WIDTH, HEIGHT, PIXFMT, 0)
+
+#define FPRINTF_HEAD(FP, FRAMES, WIDTH, HEIGHT, PIXFMT)\
+ fprintf(fp, "%zu %zu %zu %s\n%cuivf",\
+ FRAMES, WIDTH, HEIGHT, PIXFMT, 0)
+
#define einit_stream(...) eninit_stream(1, __VA_ARGS__)
#define eset_pixel_size(...) enset_pixel_size(1, __VA_ARGS__)
#define eread_stream(...) enread_stream(1, __VA_ARGS__)