This source file includes following definitions.
- pwc_get_size
- pwc_construct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #include "pwc.h"
17
18 const int pwc_image_sizes[PSZ_MAX][2] =
19 {
20 { 128, 96 },
21 { 160, 120 },
22 { 176, 144 },
23 { 320, 240 },
24 { 352, 288 },
25 { 640, 480 },
26 };
27
28
29 int pwc_get_size(struct pwc_device *pdev, int width, int height)
30 {
31 int i;
32
33
34
35 for (i = PSZ_MAX - 1; i >= 0; i--) {
36 if (!(pdev->image_mask & (1 << i)))
37 continue;
38
39 if (pwc_image_sizes[i][0] <= width &&
40 pwc_image_sizes[i][1] <= height)
41 return i;
42 }
43
44
45 for (i = 0; i < PSZ_MAX; i++) {
46 if (pdev->image_mask & (1 << i))
47 return i;
48 }
49
50
51 return 0;
52 }
53
54
55 void pwc_construct(struct pwc_device *pdev)
56 {
57 if (DEVICE_USE_CODEC1(pdev->type)) {
58
59 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;
60 pdev->vcinterface = 2;
61 pdev->vendpoint = 4;
62 pdev->frame_header_size = 0;
63 pdev->frame_trailer_size = 0;
64
65 } else if (DEVICE_USE_CODEC3(pdev->type)) {
66
67 pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
68 pdev->vcinterface = 3;
69 pdev->vendpoint = 5;
70 pdev->frame_header_size = TOUCAM_HEADER_SIZE;
71 pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE;
72
73 } else {
74
75 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
76 pdev->vcinterface = 3;
77 pdev->vendpoint = 4;
78 pdev->frame_header_size = 0;
79 pdev->frame_trailer_size = 0;
80 }
81 }