File: 04_change_window_size.patch

package info (click to toggle)
dv4l 1.0-6
  • links: PTS
  • area: main
  • in suites: sid
  • size: 568 kB
  • sloc: ansic: 7,541; makefile: 320; sh: 260
file content (87 lines) | stat: -rw-r--r-- 2,484 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
## 03_change_window_size.dpatch by Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add resize stuff

diff -urNad dv4l-1.0~/interdv4l.c dv4l-1.0/interdv4l.c
--- dv4l-1.0~/interdv4l.c	2008-11-28 22:52:19.000000000 +0900
+++ dv4l-1.0/interdv4l.c	2008-11-28 22:53:15.000000000 +0900
@@ -85,6 +85,8 @@
     int vnoredir;
     int vminor;
     int vrgbonly;
+	int rsize_w;
+	int rsize_h;
     time_t vtime;
 } vid_context_t;
 
@@ -391,6 +393,14 @@
 
 	dv4l_env = getenv("DV4L_RGBONLY");
 	vctx.vrgbonly = (dv4l_env != NULL);
+
+	dv4l_env = getenv("DV4L_WIDTH");
+	if (dv4l_env != NULL)
+		vctx.rsize_w = atoi(dv4l_env);
+
+	dv4l_env = getenv("DV4L_HEIGHT");
+	if (dv4l_env != NULL)
+		vctx.rsize_h = atoi(dv4l_env);
     }
 
     if(strcmp(name, "LD_PRELOAD") == 0) {
@@ -726,8 +736,19 @@
 	vctx.vcap.maxheight = 0; \
 log("#2 dv4l open vfd %d fake_fd %d\n", vctx.vfd, fake_fd); \
 	get_camsize(&vctx); \
-	vctx.vwin.width = vctx.vcap.maxwidth; \
-	vctx.vwin.height = vctx.vcap.maxheight; \
+	/* window rsize */ \
+	if ((vctx.rsize_w > 0) && \
+		(vctx.rsize_w < vctx.vcap.maxwidth)) \
+		vctx.vwin.width = vctx.rsize_w; \
+	else \
+		vctx.vwin.width = vctx.vcap.maxwidth; \
+	\
+	if ((vctx.rsize_h > 0) && \
+		(vctx.rsize_h < vctx.vcap.maxheight)) \
+		vctx.vwin.height = vctx.rsize_h; \
+	else \
+		vctx.vwin.height = vctx.vcap.maxheight; \
+	\
 debug("#3 dv4l open\n"); \
 	iec61883_dv_set_buffers(iec61883_dv_fb_get_dv(vctx.viec), 1000); \
 	if(iec61883_dv_fb_start(vctx.viec, 63) < 0) { \
diff -urNad dv4l-1.0~/mkdv4lstart dv4l-1.0/mkdv4lstart
--- dv4l-1.0~/mkdv4lstart	2008-11-28 22:52:39.000000000 +0900
+++ dv4l-1.0/mkdv4lstart	2008-11-28 22:52:39.000000000 +0900
@@ -25,6 +25,12 @@
     echo "        choosing YUV palettes. Try this option if you get low"
     echo "        frame rates."
     echo
+    echo "    -w, --width"
+    echo "        Set window width."
+    echo
+    echo "    -h, --height"
+    echo "        Set window height."
+    echo
     echo "    -v, --verbose <level>"
     echo "        Set the amount of debugging messages. A level of 0 means no"
     echo "        output at all, 1 is the default, 3 enables all messages."
@@ -46,6 +52,16 @@
 	DV4L_RGBONLY=1
 	export DV4L_RGBONLY
 	;;
+	-w | --width)
+	shift
+	DV4L_WIDTH=\$1
+	export DV4L_WIDTH
+	;;
+	-h | --height)
+	shift
+	DV4L_HEIGHT=\$1
+	export DV4L_HEIGHT
+	;;
     -v | --verbose)
         shift
         DV4L_VERBOSE=\$1