aboutsummaryrefslogtreecommitdiffstats
path: root/src/vu-concat.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-01-09 03:51:26 +0100
committerMattias Andrée <maandree@kth.se>2017-01-09 03:51:26 +0100
commit76cdf509b36bb0012cde9bc1760cdf3b26874af2 (patch)
treecc984bb82eaf9911d6173343a9e90bb20e9ddffb /src/vu-concat.c
parentReadme: add format (diff)
downloadblind-76cdf509b36bb0012cde9bc1760cdf3b26874af2.tar.gz
blind-76cdf509b36bb0012cde9bc1760cdf3b26874af2.tar.bz2
blind-76cdf509b36bb0012cde9bc1760cdf3b26874af2.tar.xz
Use CIE XYZ instead of sRGB
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/vu-concat.c')
-rw-r--r--src/vu-concat.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/vu-concat.c b/src/vu-concat.c
new file mode 100644
index 0000000..3ad9222
--- /dev/null
+++ b/src/vu-concat.c
@@ -0,0 +1,65 @@
+/* See LICENSE file for copyright and license details. */
+#include "arg.h"
+#include "stream.h"
+#include "util.h"
+
+#include <fcntl.h>
+#include <inttypes.h>
+#include <string.h>
+#include <unistd.h>
+
+static void
+usage(void)
+{
+ eprintf("usage: %s first-stream ... last-stream\n", argv0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct stream stream, refstream;
+ size_t ptr;
+ ssize_t r;
+ int i;
+
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND;
+
+ if (argc < 2)
+ usage();
+
+ for (i = 0; i < argc; i++) {
+ stream.file = argv[i];
+ stream.fd = open(stream.file, O_RDONLY);
+ if (stream.fd < 0)
+ eprintf("open %s:", stream.file);
+ einit_stream(&stream);
+
+ if (!i) {
+ memcpy(&refstream, &stream, sizeof(stream));
+ fprint_stream_head(stdout, &stream);
+ fflush(stdout);
+ if (ferror(stdout))
+ eprintf("<stdout>:");
+ } else {
+ if (stream.width != refstream.width || stream.height != refstream.height)
+ eprintf("videos do not have the same geometry\n");
+ if (strcmp(stream.pixfmt, refstream.pixfmt))
+ eprintf("videos use incompatible pixel formats\n");
+ }
+
+ for (; eread_stream(&stream, SIZE_MAX); stream.ptr = 0) {
+ for (ptr = 0;; ptr += (size_t)r) {
+ r = write(STDOUT_FILENO, stream.buf + ptr, stream.ptr - ptr);
+ if (r < 0)
+ eprintf("write <stdout>");
+ }
+ }
+
+ close(stream.fd);
+ }
+
+ return 0;
+}