From e78fcd46452fab3a868b833ef45f9d86daedfe57 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 4 Jul 2012 10:09:32 -0400 Subject: Support enough YUV4MPEG2 that we can read a raw stream from vpxdec --- simple-yuv.c | 8 +++++++- 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) { diff --git a/webcam.c b/webcam.c index a396eb8..53dfa55 100644 --- a/webcam.c +++ b/webcam.c @@ -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 (); -- cgit v1.2.3