From 4674ec0e4b833ab0d0365225ba99228df14abe87 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 13 Jan 2017 09:05:08 +0100 Subject: Rename to blind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/vu-cut.c | 70 ------------------------------------------------------------ 1 file changed, 70 deletions(-) delete mode 100644 src/vu-cut.c (limited to 'src/vu-cut.c') diff --git a/src/vu-cut.c b/src/vu-cut.c deleted file mode 100644 index e229cf1..0000000 --- a/src/vu-cut.c +++ /dev/null @@ -1,70 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include "stream.h" -#include "util.h" - -#include -#include -#include -#include -#include - -USAGE("start-point (end-point | 'end') file") - -int -main(int argc, char *argv[]) -{ - struct stream stream; - size_t frame_size, start = 0, end = 0, ptr, max; - ssize_t r; - char buf[BUFSIZ]; - int to_end = 0; - - ENOFLAGS(argc != 3); - - if (!strcmp(argv[0], "end")) - eprintf("refusing to create video with zero frames\n"); - else - start = etozu_arg("the start point", argv[1], 0, SIZE_MAX); - - if (!strcmp(argv[1], "end")) - to_end = 1; - else - end = etozu_arg("the end point", argv[1], 0, SIZE_MAX); - - stream.file = argv[2]; - stream.fd = eopen(stream.file, O_RDONLY); - einit_stream(&stream); - if (to_end) - end = stream.frames; - else if (end > stream.frames) - eprintf("end point is after end of video\n"); - stream.frames = end - start; - fprint_stream_head(stdout, &stream); - efflush(stdout, ""); - echeck_frame_size(stream.width, stream.height, stream.pixel_size, 0, stream.file); - frame_size = stream.width * stream.height * stream.pixel_size; - if (stream.frames > SSIZE_MAX / frame_size) - eprintf("%s: video is too large\n", stream.file); - - if (start >= end) - eprintf("%s\n", start > end ? - "start point is after end point" : - "refusing to create video with zero frames"); - end = end * frame_size + stream.headlen; - start = start * frame_size + stream.headlen; - - posix_fadvise(stream.fd, start, end - start, POSIX_FADV_SEQUENTIAL); - for (ptr = start; ptr < end; ptr += (size_t)r) { - max = end - ptr; - max = max < sizeof(buf) ? max : sizeof(buf); - r = pread(stream.fd, buf, max, ptr); - if (r < 0) - eprintf("pread %s:", stream.file); - if (r == 0) - eprintf("%s: file is shorter than expected\n", stream.file); - ewriteall(STDOUT_FILENO, buf, (size_t)r, ""); - } - - close(stream.fd); - return 0; -} -- cgit v1.2.3-70-g09d2