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