diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-07-04 10:09:32 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-07-04 10:09:32 -0400 |
commit | e78fcd46452fab3a868b833ef45f9d86daedfe57 (patch) | |
tree | b6f15887c9aa7fc020dd8196ee585fbcab1cf368 | |
parent | 1a722068d20f4d58ee457d4ba93d540a7d3cde45 (diff) |
Support enough YUV4MPEG2 that we can read a raw stream from vpxdec
-rw-r--r-- | simple-yuv.c | 8 | ||||
-rw-r--r-- | webcam.c | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/simple-yuv.c b/simple-yuv.c index 4a06ce0..1f99278 100644 --- a/simple-yuv.c +++ b/simple-yuv.c @@ -100,7 +100,9 @@ read_frame(struct window *window) { struct buffer *tmp; int size = window->width * window->height; + char buf[256]; + fgets(buf, sizeof buf, stdin); fread(window->back->y, 1, size, stdin); fread(window->back->u, 1, size / 4, stdin); fread(window->back->v, 1, size / 4, stdin); @@ -376,6 +378,8 @@ main(int argc, char **argv) struct display *display; struct window *window; int test_pattern = 1; + int width, height; + char buf[256]; if (argc == 2 && strcmp(argv[1], "-") == 0) test_pattern = 0; @@ -388,7 +392,9 @@ main(int argc, char **argv) window = create_window(display, 512, 512); redraw(window, NULL, 0); } else { - window = create_window(display, 640, 480); + fgets(buf, sizeof buf, stdin); + sscanf(buf, "YUV4MPEG2 C420jpeg W%d H%d", &width, &height); + window = create_window(display, width, height); } while (1) { @@ -80,7 +80,7 @@ process_image (const void * gah) const char *p; int i, j; - access("/dev/null", 0); + fprintf(stdout, "FRAME\n"); p = gah; for (i = 0; i < SIZE; i++) @@ -701,6 +701,8 @@ main (int argc, init_device (); + fprintf(stdout, "YUV4MPEG2 C420jpeg W640 H480 F30:1 Ip\n"); + start_capturing (); mainloop (); |