blob: 6fdb0af2b13da12416fe591ed0771fb3cfdf5096 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3********************************
4Comparison with old cropping API
5********************************
6
7The selection API was introduced to cope with deficiencies of previous
8:ref:`API <crop>`, that was designed to control simple capture
9devices. Later the cropping API was adopted by video output drivers. The
10ioctls are used to select a part of the display were the video signal is
11inserted. It should be considered as an API abuse because the described
12operation is actually the composing. The selection API makes a clear
13distinction between composing and cropping operations by setting the
14appropriate targets. The V4L2 API lacks any support for composing to and
15cropping from an image inside a memory buffer. The application could
16configure a capture device to fill only a part of an image by abusing
17V4L2 API. Cropping a smaller image from a larger one is achieved by
18setting the field struct
19:ref:`v4l2_pix_format <v4l2-pix-format>```::bytesperline``.
20Introducing an image offsets could be done by modifying field struct
21:ref:`v4l2_buffer <v4l2-buffer>```::m_userptr`` before calling
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030022:ref:`VIDIOC_QBUF`. Those operations should be avoided because they are not
Markus Heiser5377d912016-06-30 15:18:56 +020023portable (endianness), and do not work for macroblock and Bayer formats
24and mmap buffers. The selection API deals with configuration of buffer
25cropping/composing in a clear, intuitive and portable way. Next, with
26the selection API the concepts of the padded target and constraints
27flags are introduced. Finally, struct :ref:`v4l2_crop <v4l2-crop>`
28and struct :ref:`v4l2_cropcap <v4l2-cropcap>` have no reserved
29fields. Therefore there is no way to extend their functionality. The new
30struct :ref:`v4l2_selection <v4l2-selection>` provides a lot of place
31for future extensions. Driver developers are encouraged to implement
32only selection API. The former cropping API would be simulated using the
33new one.
34
35
36.. ------------------------------------------------------------------------------
37.. This file was automatically converted from DocBook-XML with the dbxml
38.. library (https://github.com/return42/sphkerneldoc). The origin XML comes
39.. from the linux kernel, refer to:
40..
41.. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
42.. ------------------------------------------------------------------------------