1 /*
2  * Copyright (C) 2005-2006 Micronas USA Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and the associated README documentation file (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
14  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
15  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
16  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18  */
19 
20 /* DEPRECATED -- use V4L2_PIX_FMT_MPEG and then call GO7007IOC_S_MPEG_PARAMS
21  * to select between MPEG1, MPEG2, and MPEG4 */
22 #define V4L2_PIX_FMT_MPEG4     v4l2_fourcc('M', 'P', 'G', '4') /* MPEG4 */
23 
24 /* These will be replaced with a better interface
25  * soon, so don't get too attached to them */
26 #define	GO7007IOC_S_BITRATE	_IOW('V', BASE_VIDIOC_PRIVATE + 0, int)
27 #define	GO7007IOC_G_BITRATE	_IOR('V', BASE_VIDIOC_PRIVATE + 1, int)
28 
29 enum go7007_aspect_ratio {
30 	GO7007_ASPECT_RATIO_1_1 = 0,
31 	GO7007_ASPECT_RATIO_4_3_NTSC = 1,
32 	GO7007_ASPECT_RATIO_4_3_PAL = 2,
33 	GO7007_ASPECT_RATIO_16_9_NTSC = 3,
34 	GO7007_ASPECT_RATIO_16_9_PAL = 4,
35 };
36 
37 /* Used to set generic compression parameters */
38 struct go7007_comp_params {
39 	__u32 gop_size;
40 	__u32 max_b_frames;
41 	enum go7007_aspect_ratio aspect_ratio;
42 	__u32 flags;
43 	__u32 reserved[8];
44 };
45 
46 #define GO7007_COMP_CLOSED_GOP		0x00000001
47 #define GO7007_COMP_OMIT_SEQ_HEADER	0x00000002
48 
49 enum go7007_mpeg_video_standard {
50 	GO7007_MPEG_VIDEO_MPEG1 = 0,
51 	GO7007_MPEG_VIDEO_MPEG2 = 1,
52 	GO7007_MPEG_VIDEO_MPEG4 = 2,
53 };
54 
55 /* Used to set parameters for V4L2_PIX_FMT_MPEG format */
56 struct go7007_mpeg_params {
57 	enum go7007_mpeg_video_standard mpeg_video_standard;
58 	__u32 flags;
59 	__u32 pali;
60 	__u32 reserved[8];
61 };
62 
63 #define GO7007_MPEG_FORCE_DVD_MODE	0x00000001
64 #define GO7007_MPEG_OMIT_GOP_HEADER	0x00000002
65 #define GO7007_MPEG_REPEAT_SEQHEADER	0x00000004
66 
67 #define GO7007_MPEG_PROFILE(format, pali)	(((format)<<24)|(pali))
68 
69 #define GO7007_MPEG2_PROFILE_MAIN_MAIN		GO7007_MPEG_PROFILE(2, 0x48)
70 
71 #define GO7007_MPEG4_PROFILE_S_L0		GO7007_MPEG_PROFILE(4, 0x08)
72 #define GO7007_MPEG4_PROFILE_S_L1		GO7007_MPEG_PROFILE(4, 0x01)
73 #define GO7007_MPEG4_PROFILE_S_L2		GO7007_MPEG_PROFILE(4, 0x02)
74 #define GO7007_MPEG4_PROFILE_S_L3		GO7007_MPEG_PROFILE(4, 0x03)
75 #define GO7007_MPEG4_PROFILE_ARTS_L1		GO7007_MPEG_PROFILE(4, 0x91)
76 #define GO7007_MPEG4_PROFILE_ARTS_L2		GO7007_MPEG_PROFILE(4, 0x92)
77 #define GO7007_MPEG4_PROFILE_ARTS_L3		GO7007_MPEG_PROFILE(4, 0x93)
78 #define GO7007_MPEG4_PROFILE_ARTS_L4		GO7007_MPEG_PROFILE(4, 0x94)
79 #define GO7007_MPEG4_PROFILE_AS_L0		GO7007_MPEG_PROFILE(4, 0xf0)
80 #define GO7007_MPEG4_PROFILE_AS_L1		GO7007_MPEG_PROFILE(4, 0xf1)
81 #define GO7007_MPEG4_PROFILE_AS_L2		GO7007_MPEG_PROFILE(4, 0xf2)
82 #define GO7007_MPEG4_PROFILE_AS_L3		GO7007_MPEG_PROFILE(4, 0xf3)
83 #define GO7007_MPEG4_PROFILE_AS_L4		GO7007_MPEG_PROFILE(4, 0xf4)
84 #define GO7007_MPEG4_PROFILE_AS_L5		GO7007_MPEG_PROFILE(4, 0xf5)
85 
86 struct go7007_md_params {
87 	__u16 region;
88 	__u16 trigger;
89 	__u16 pixel_threshold;
90 	__u16 motion_threshold;
91 	__u32 reserved[8];
92 };
93 
94 struct go7007_md_region {
95 	__u16 region;
96 	__u16 flags;
97 	struct v4l2_clip *clips;
98 	__u32 reserved[8];
99 };
100 
101 #define	GO7007IOC_S_MPEG_PARAMS	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, \
102 					struct go7007_mpeg_params)
103 #define	GO7007IOC_G_MPEG_PARAMS	_IOR('V', BASE_VIDIOC_PRIVATE + 3, \
104 					struct go7007_mpeg_params)
105 #define	GO7007IOC_S_COMP_PARAMS	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, \
106 					struct go7007_comp_params)
107 #define	GO7007IOC_G_COMP_PARAMS	_IOR('V', BASE_VIDIOC_PRIVATE + 5, \
108 					struct go7007_comp_params)
109 #define	GO7007IOC_S_MD_PARAMS	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, \
110 					struct go7007_md_params)
111 #define	GO7007IOC_G_MD_PARAMS	_IOR('V', BASE_VIDIOC_PRIVATE + 7, \
112 					struct go7007_md_params)
113 #define	GO7007IOC_S_MD_REGION	_IOW('V', BASE_VIDIOC_PRIVATE + 8, \
114 					struct go7007_md_region)
115