|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* These are the MJPEG API extensions for the Video4Linux API, |
|
18 first introduced by the Iomega Buz driver by Rainer Johanni |
|
19 <rainer@johanni.de> |
|
20 */ |
|
21 |
|
22 #ifndef __VIDEODEV_MJPEG_H__ |
|
23 #define __VIDEODEV_MJPEG_H__ |
|
24 |
|
25 /* This is identical with the mgavideo internal params struct, |
|
26 please tell me if you change this struct here ! <gz@lysator.liu.se) */ |
|
27 struct mjpeg_params |
|
28 { |
|
29 |
|
30 /* The following parameters can only be queried */ |
|
31 |
|
32 int major_version; /* Major version number of driver */ |
|
33 int minor_version; /* Minor version number of driver */ |
|
34 |
|
35 /* Main control parameters */ |
|
36 |
|
37 int input; /* Input channel: 0 = Composite, 1 = S-VHS */ |
|
38 int norm; /* Norm: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ |
|
39 int decimation; /* decimation of captured video, |
|
40 enlargement of video played back. |
|
41 Valid values are 1, 2, 4 or 0. |
|
42 0 is a special value where the user |
|
43 has full control over video scaling */ |
|
44 |
|
45 /* The following parameters only have to be set if decimation==0, |
|
46 for other values of decimation they provide the data how the image is captured */ |
|
47 |
|
48 int HorDcm; /* Horizontal decimation: 1, 2 or 4 */ |
|
49 int VerDcm; /* Vertical decimation: 1 or 2 */ |
|
50 int TmpDcm; /* Temporal decimation: 1 or 2, |
|
51 if TmpDcm==2 in capture every second frame is dropped, |
|
52 in playback every frame is played twice */ |
|
53 int field_per_buff; /* Number of fields per buffer: 1 or 2 */ |
|
54 int img_x; /* start of image in x direction */ |
|
55 int img_y; /* start of image in y direction */ |
|
56 int img_width; /* image width BEFORE decimation, |
|
57 must be a multiple of HorDcm*16 */ |
|
58 int img_height; /* image height BEFORE decimation, |
|
59 must be a multiple of VerDcm*8 */ |
|
60 |
|
61 /* --- End of parameters for decimation==0 only --- */ |
|
62 |
|
63 /* JPEG control parameters */ |
|
64 |
|
65 int quality; /* Measure for quality of compressed images. |
|
66 Scales linearly with the size of the compressed images. |
|
67 Must be beetween 0 and 100, 100 is a compression |
|
68 ratio of 1:4 */ |
|
69 |
|
70 int odd_even; /* Which field should come first ??? |
|
71 This is more aptly named "top_first", |
|
72 i.e. (odd_even==1) --> top-field-first */ |
|
73 |
|
74 int APPn; /* Number of APP segment to be written, must be 0..15 */ |
|
75 int APP_len; /* Length of data in JPEG APPn segment */ |
|
76 char APP_data[60]; /* Data in the JPEG APPn segment. */ |
|
77 |
|
78 int COM_len; /* Length of data in JPEG COM segment */ |
|
79 char COM_data[60]; /* Data in JPEG COM segment */ |
|
80 |
|
81 unsigned long jpeg_markers; /* Which markers should go into the JPEG output. |
|
82 Unless you exactly know what you do, leave them untouched. |
|
83 Inluding less markers will make the resulting code |
|
84 smaller, but there will be fewer applications |
|
85 which can read it. |
|
86 The presence of the APP and COM marker is |
|
87 influenced by APP0_len and COM_len ONLY! */ |
|
88 #define JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ |
|
89 #define JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ |
|
90 #define JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ |
|
91 #define JPEG_MARKER_COM (1<<6) /* Comment segment */ |
|
92 #define JPEG_MARKER_APP (1<<7) /* App segment, driver will allways use APP0 */ |
|
93 |
|
94 int VFIFO_FB; /* Flag for enabling Video Fifo Feedback. |
|
95 If this flag is turned on and JPEG decompressing |
|
96 is going to the screen, the decompress process |
|
97 is stopped every time the Video Fifo is full. |
|
98 This enables a smooth decompress to the screen |
|
99 but the video output signal will get scrambled */ |
|
100 |
|
101 /* Misc */ |
|
102 |
|
103 char reserved[312]; /* Makes 512 bytes for this structure */ |
|
104 }; |
|
105 |
|
106 struct mjpeg_requestbuffers |
|
107 { |
|
108 unsigned long count; /* Number of buffers for MJPEG grabbing */ |
|
109 unsigned long size; /* Size PER BUFFER in bytes */ |
|
110 }; |
|
111 |
|
112 struct mjpeg_sync |
|
113 { |
|
114 unsigned long frame; /* Frame (0 - n) for double buffer */ |
|
115 unsigned long length; /* number of code bytes in buffer (capture only) */ |
|
116 unsigned long seq; /* frame sequence number */ |
|
117 struct timeval timestamp; /* timestamp */ |
|
118 }; |
|
119 |
|
120 struct mjpeg_status |
|
121 { |
|
122 int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */ |
|
123 int signal; /* Returned: 1 if valid video signal detected */ |
|
124 int norm; /* Returned: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ |
|
125 int color; /* Returned: 1 if color signal detected */ |
|
126 }; |
|
127 |
|
128 /* |
|
129 Private IOCTL to set up for displaying MJPEG |
|
130 */ |
|
131 #define MJPIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct mjpeg_params) |
|
132 #define MJPIOC_S_PARAMS _IOWR('v', BASE_VIDIOCPRIVATE+1, struct mjpeg_params) |
|
133 #define MJPIOC_REQBUFS _IOWR('v', BASE_VIDIOCPRIVATE+2, struct mjpeg_requestbuffers) |
|
134 #define MJPIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+3, int) |
|
135 #define MJPIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOCPRIVATE+4, int) |
|
136 #define MJPIOC_SYNC _IOR ('v', BASE_VIDIOCPRIVATE+5, struct mjpeg_sync) |
|
137 #define MJPIOC_G_STATUS _IOWR('v', BASE_VIDIOCPRIVATE+6, struct mjpeg_status) |
|
138 |
|
139 #endif /* __VIDEODEV_MJPEG_H__ */ |