diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-01-14 05:27:50 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-01-14 05:27:50 +0100 |
| commit | 4125cc7cee7817ec5c7e2e0328011f3e234a4b46 (patch) | |
| tree | 16f15834f48d69a4bc2deb95d274a48c1ec8e119 /src | |
| parent | Fix blind-transpose (diff) | |
| download | blind-4125cc7cee7817ec5c7e2e0328011f3e234a4b46.tar.gz blind-4125cc7cee7817ec5c7e2e0328011f3e234a4b46.tar.bz2 blind-4125cc7cee7817ec5c7e2e0328011f3e234a4b46.tar.xz | |
Fix blind-stack and blind-concate
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
| -rw-r--r-- | src/blind-concat.c | 15 | ||||
| -rw-r--r-- | src/blind-stack.c | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/blind-concat.c b/src/blind-concat.c index e8ed00d..d789a5a 100644 --- a/src/blind-concat.c +++ b/src/blind-concat.c @@ -34,10 +34,10 @@ concat_to_stdout(int argc, char *argv[]) fprint_stream_head(stdout, streams); efflush(stdout, "<stdout>"); - for (; argc--; streams++) { - for (; eread_stream(streams, SIZE_MAX); streams->ptr = 0) - ewriteall(STDOUT_FILENO, streams->buf, streams->ptr, "<stdout>"); - close(streams->fd); + for (i = 0; i < argc; i++) { + for (; eread_stream(streams + i, SIZE_MAX); streams[i].ptr = 0) + ewriteall(STDOUT_FILENO, streams[i].buf, streams[i].ptr, "<stdout>"); + close(streams[i].fd); } free(streams); @@ -47,7 +47,7 @@ static void concat_to_file(int argc, char *argv[], char *output_file) { struct stream stream, refstream; - int first = 0; + int first = 1; int fd = eopen(output_file, O_RDWR | O_CREAT | O_TRUNC, 0666); char head[STREAM_HEAD_MAX]; ssize_t headlen, size = 0; @@ -59,7 +59,8 @@ concat_to_file(int argc, char *argv[], char *output_file) einit_stream(&stream); if (first) { - stream = refstream; + refstream = stream; + first = 1; } else { if (refstream.frames > SIZE_MAX - stream.frames) eprintf("resulting video is too long\n"); @@ -68,7 +69,7 @@ concat_to_file(int argc, char *argv[], char *output_file) } for (; eread_stream(&stream, SIZE_MAX); stream.ptr = 0) { - ewriteall(STDOUT_FILENO, stream.buf, stream.ptr, "<stdout>"); + ewriteall(fd, stream.buf, stream.ptr, output_file); size += stream.ptr; } close(stream.fd); diff --git a/src/blind-stack.c b/src/blind-stack.c index a03fd91..7093e93 100644 --- a/src/blind-stack.c +++ b/src/blind-stack.c @@ -66,6 +66,7 @@ main(int argc, char *argv[]) for (i = 0; i < n_streams; i++) { streams[i].file = argv[i]; streams[i].fd = eopen(streams[i].file, O_RDONLY); + einit_stream(streams + i); } if (!strcmp(streams->pixfmt, "xyza")) @@ -73,6 +74,8 @@ main(int argc, char *argv[]) else eprintf("pixel format %s is not supported, try xyza\n", streams->pixfmt); + fprint_stream_head(stdout, streams); + efflush(stdout, "<stdout>"); process_multiple_streams(streams, n_streams, STDOUT_FILENO, "<stdout>", process); free(streams); |
