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