1 .. -*- coding: utf-8; mode: rst -*-
3 ******************************
4 Single-planar format structure
5 ******************************
10 .. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}|
12 .. cssclass:: longtable
14 .. flat-table:: struct v4l2_pix_format
26 - Image width in pixels.
34 - Image height in pixels. If ``field`` is one of ``V4L2_FIELD_TOP``,
35 ``V4L2_FIELD_BOTTOM`` or ``V4L2_FIELD_ALTERNATE`` then height
36 refers to the number of lines in the field, otherwise it refers to
37 the number of lines in the frame (which is twice the field height
38 for interlaced formats).
42 - :cspan:`2` Applications set these fields to request an image
43 size, drivers return the closest possible values. In case of
44 planar formats the ``width`` and ``height`` applies to the largest
45 plane. To avoid ambiguities drivers must return values rounded up
46 to a multiple of the scale factor of any smaller planes. For
47 example when the image format is YUV 4:2:0, ``width`` and
48 ``height`` must be multiples of two.
56 - The pixel format or type of compression, set by the application.
57 This is a little endian
58 :ref:`four character code <v4l2-fourcc>`. V4L2 defines standard
59 RGB formats in :ref:`rgb-formats`, YUV formats in
60 :ref:`yuv-formats`, and reserved codes in
61 :ref:`reserved-formats`
65 - enum :ref:`v4l2_field <v4l2-field>`
69 - Video images are typically interlaced. Applications can request to
70 capture or output only the top or bottom field, or both fields
71 interlaced or sequentially stored in one buffer or alternating in
72 separate buffers. Drivers return the actual field order selected.
73 For more details on fields see :ref:`field-order`.
81 - Distance in bytes between the leftmost pixels in two adjacent
88 Both applications and drivers can set this field to request
89 padding bytes at the end of each line. Drivers however may ignore
90 the value requested by the application, returning ``width`` times
91 bytes per pixel or a larger value required by the hardware. That
92 implies applications can just set this field to zero to get a
95 Video hardware may access padding bytes, therefore they must
96 reside in accessible memory. Consider cases where padding bytes
97 after the last line of an image cross a system page boundary.
98 Input devices may write padding bytes, the value is undefined.
99 Output devices ignore the contents of padding bytes.
101 When the image format is planar the ``bytesperline`` value applies
102 to the first plane and is divided by the same factor as the
103 ``width`` field for the other planes. For example the Cb and Cr
104 planes of a YUV 4:2:0 image have half as many padding bytes
105 following each line as the Y plane. To avoid ambiguities drivers
106 must return a ``bytesperline`` value rounded up to a multiple of
109 For compressed formats the ``bytesperline`` value makes no sense.
110 Applications and drivers must set this to 0 in that case.
118 - Size in bytes of the buffer to hold a complete image, set by the
119 driver. Usually this is ``bytesperline`` times ``height``. When
120 the image consists of variable length compressed data this is the
121 maximum number of bytes required to hold an image.
125 - enum :ref:`v4l2_colorspace <v4l2-colorspace>`
129 - This information supplements the ``pixelformat`` and must be set
130 by the driver for capture streams and by the application for
131 output streams, see :ref:`colorspaces`.
139 - This field indicates whether the remaining fields of the
140 :ref:`struct v4l2_pix_format <v4l2-pix-format>` structure, also called the
141 extended fields, are valid. When set to
142 ``V4L2_PIX_FMT_PRIV_MAGIC``, it indicates that the extended fields
143 have been correctly initialized. When set to any other value it
144 indicates that the extended fields contain undefined values.
146 Applications that wish to use the pixel format extended fields
147 must first ensure that the feature is supported by querying the
148 device for the :ref:`V4L2_CAP_EXT_PIX_FORMAT <querycap>`
149 capability. If the capability isn't set the pixel format extended
150 fields are not supported and using the extended fields will lead
151 to undefined results.
153 To use the extended fields, applications must set the ``priv``
154 field to ``V4L2_PIX_FMT_PRIV_MAGIC``, initialize all the extended
155 fields and zero the unused bytes of the
156 :ref:`struct v4l2_format <v4l2-format>` ``raw_data`` field.
158 When the ``priv`` field isn't set to ``V4L2_PIX_FMT_PRIV_MAGIC``
159 drivers must act as if all the extended fields were set to zero.
160 On return drivers must set the ``priv`` field to
161 ``V4L2_PIX_FMT_PRIV_MAGIC`` and all the extended fields to
170 - Flags set by the application or driver, see :ref:`format-flags`.
174 - enum :ref:`v4l2_ycbcr_encoding <v4l2-ycbcr-encoding>`
178 - This information supplements the ``colorspace`` and must be set by
179 the driver for capture streams and by the application for output
180 streams, see :ref:`colorspaces`.
184 - enum :ref:`v4l2_quantization <v4l2-quantization>`
188 - This information supplements the ``colorspace`` and must be set by
189 the driver for capture streams and by the application for output
190 streams, see :ref:`colorspaces`.
194 - enum :ref:`v4l2_xfer_func <v4l2-xfer-func>`
198 - This information supplements the ``colorspace`` and must be set by
199 the driver for capture streams and by the application for output
200 streams, see :ref:`colorspaces`.