blind

suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log | Files | Refs | README | LICENSE

blind-flip.c (637B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include "common.h"
      3 
      4 USAGE("")
      5 
      6 int
      7 main(int argc, char *argv[])
      8 {
      9 	struct stream stream;
     10 	size_t ptr;
     11 	char *buf;
     12 
     13 	UNOFLAGS(argc);
     14 
     15 	eopen_stream(&stream, NULL);
     16 	echeck_dimensions(&stream, WIDTH | HEIGHT, NULL);
     17 	fprint_stream_head(stdout, &stream);
     18 	efflush(stdout, "<stdout>");
     19 	buf = emalloc(stream.frame_size);
     20 
     21 	while (eread_frame(&stream, buf))
     22 		for (ptr = stream.frame_size; ptr;)
     23 			ewriteall(STDOUT_FILENO, buf + (ptr -= stream.row_size),
     24 			          stream.row_size, "<stdout>");
     25 	/* ewriteall is faster than writev(3) and vmsplice(3) */
     26 
     27 	free(buf);
     28 	return 0;
     29 }