gbsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftargetG/translations/zh_CN/userspace-api/media/v4l/selection-api-configurationmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetG/translations/zh_TW/userspace-api/media/v4l/selection-api-configurationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetG/translations/it_IT/userspace-api/media/v4l/selection-api-configurationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetG/translations/ja_JP/userspace-api/media/v4l/selection-api-configurationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetG/translations/ko_KR/userspace-api/media/v4l/selection-api-configurationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetG/translations/sp_SP/userspace-api/media/v4l/selection-api-configurationmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-laterh]h8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhha/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/selection-api-configuration.rsthKubhsection)}(hhh](htitle)}(h Configurationh]h Configuration}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hApplications can use the :ref:`selection API ` to select an area in a video signal or a buffer, and to query for default settings and hardware limits.h](hApplications can use the }(hhhhhNhNubh)}(h):ref:`selection API `h]hinline)}(hhh]h selection API}(hhhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]refdoc3userspace-api/media/v4l/selection-api-configuration refdomainhreftyperef refexplicitrefwarn reftargetvidioc_g_selectionuh1hhhhKhhubhh to select an area in a video signal or a buffer, and to query for default settings and hardware limits.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXVideo hardware can have various cropping, composing and scaling limitations. It may only scale up or down, support only discrete scaling factors, or have different scaling abilities in the horizontal and vertical directions. Also it may not support scaling at all. At the same time the cropping/composing rectangles may have to be aligned, and both the source and the sink may have arbitrary upper and lower size limits. Therefore, as usual, drivers are expected to adjust the requested parameters and return the actual values selected. An application can control the rounding behaviour using :ref:`constraint flags `.h](hXQVideo hardware can have various cropping, composing and scaling limitations. It may only scale up or down, support only discrete scaling factors, or have different scaling abilities in the horizontal and vertical directions. Also it may not support scaling at all. At the same time the cropping/composing rectangles may have to be aligned, and both the source and the sink may have arbitrary upper and lower size limits. Therefore, as usual, drivers are expected to adjust the requested parameters and return the actual values selected. An application can control the rounding behaviour using }(hjhhhNhNubh)}(h.:ref:`constraint flags `h]h)}(hj h]hconstraint flags}(hjhhhNhNubah}(h]h ](hstdstd-refeh"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]refdoch refdomainjreftyperef refexplicitrefwarnhv4l2-selection-flagsuh1hhhhK hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(hConfiguration of video captureh]hConfiguration of video capture}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj4hhhhhKubh)}(hSee figure :ref:`sel-targets-capture` for examples of the selection targets available for a video capture device. It is recommended to configure the cropping targets before to the composing targets.h](h See figure }(hjEhhhNhNubh)}(h:ref:`sel-targets-capture`h]h)}(hjOh]hsel-targets-capture}(hjQhhhNhNubah}(h]h ](hstdstd-refeh"]h$]h&]uh1hhjMubah}(h]h ]h"]h$]h&]refdoch refdomainj[reftyperef refexplicitrefwarnhsel-targets-captureuh1hhhhKhjEubh for examples of the selection targets available for a video capture device. It is recommended to configure the cropping targets before to the composing targets.}(hjEhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj4hhubh)}(hX&The range of coordinates of the top left corner, width and height of areas that can be sampled is given by the ``V4L2_SEL_TGT_CROP_BOUNDS`` target. It is recommended for the driver developers to put the top/left corner at position ``(0,0)``. The rectangle's coordinates are expressed in pixels.h](hoThe range of coordinates of the top left corner, width and height of areas that can be sampled is given by the }(hjwhhhNhNubhliteral)}(h``V4L2_SEL_TGT_CROP_BOUNDS``h]hV4L2_SEL_TGT_CROP_BOUNDS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh\ target. It is recommended for the driver developers to put the top/left corner at position }(hjwhhhNhNubj)}(h ``(0,0)``h]h(0,0)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh8. The rectangle’s coordinates are expressed in pixels.}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj4hhubh)}(hXThe top left corner, width and height of the source rectangle, that is the area actually sampled, is given by the ``V4L2_SEL_TGT_CROP`` target. It uses the same coordinate system as ``V4L2_SEL_TGT_CROP_BOUNDS``. The active cropping area must lie completely inside the capture boundaries. The driver may further adjust the requested size and/or position according to hardware limitations.h](hrThe top left corner, width and height of the source rectangle, that is the area actually sampled, is given by the }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_CROP``h]hV4L2_SEL_TGT_CROP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/ target. It uses the same coordinate system as }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_CROP_BOUNDS``h]hV4L2_SEL_TGT_CROP_BOUNDS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh. The active cropping area must lie completely inside the capture boundaries. The driver may further adjust the requested size and/or position according to hardware limitations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK$hj4hhubh)}(hX#Each capture device has a default source rectangle, given by the ``V4L2_SEL_TGT_CROP_DEFAULT`` target. This rectangle shall cover what the driver writer considers the complete picture. Drivers shall set the active crop rectangle to the default when the driver is first loaded, but not later.h](hAEach capture device has a default source rectangle, given by the }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_CROP_DEFAULT``h]hV4L2_SEL_TGT_CROP_DEFAULT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh target. This rectangle shall cover what the driver writer considers the complete picture. Drivers shall set the active crop rectangle to the default when the driver is first loaded, but not later.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK+hj4hhubh)}(hXSThe composing targets refer to a memory buffer. The limits of composing coordinates are obtained using ``V4L2_SEL_TGT_COMPOSE_BOUNDS``. All coordinates are expressed in pixels. The rectangle's top/left corner must be located at position ``(0,0)``. The width and height are equal to the image size set by :ref:`VIDIOC_S_FMT `.h](hgThe composing targets refer to a memory buffer. The limits of composing coordinates are obtained using }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE_BOUNDS``h]hV4L2_SEL_TGT_COMPOSE_BOUNDS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhi. All coordinates are expressed in pixels. The rectangle’s top/left corner must be located at position }(hjhhhNhNubj)}(h ``(0,0)``h]h(0,0)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:. The width and height are equal to the image size set by }(hjhhhNhNubh)}(h":ref:`VIDIOC_S_FMT `h]h)}(hj+h]h VIDIOC_S_FMT}(hj-hhhNhNubah}(h]h ](hstdstd-refeh"]h$]h&]uh1hhj)ubah}(h]h ]h"]h$]h&]refdoch refdomainj7reftyperef refexplicitrefwarnh vidioc_g_fmtuh1hhhhK1hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK1hj4hhubh)}(hX/The part of a buffer into which the image is inserted by the hardware is controlled by the ``V4L2_SEL_TGT_COMPOSE`` target. The rectangle's coordinates are also expressed in the same coordinate system as the bounds rectangle. The composing rectangle must lie completely inside bounds rectangle. The driver must adjust the composing rectangle to fit to the bounding limits. Moreover, the driver can perform other adjustments according to hardware limitations. The application can control rounding behaviour using :ref:`constraint flags `.h](h[The part of a buffer into which the image is inserted by the hardware is controlled by the }(hjShhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE``h]hV4L2_SEL_TGT_COMPOSE}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjSubhX target. The rectangle’s coordinates are also expressed in the same coordinate system as the bounds rectangle. The composing rectangle must lie completely inside bounds rectangle. The driver must adjust the composing rectangle to fit to the bounding limits. Moreover, the driver can perform other adjustments according to hardware limitations. The application can control rounding behaviour using }(hjShhhNhNubh)}(h.:ref:`constraint flags `h]h)}(hjoh]hconstraint flags}(hjqhhhNhNubah}(h]h ](hstdstd-refeh"]h$]h&]uh1hhjmubah}(h]h ]h"]h$]h&]refdoch refdomainj{reftyperef refexplicitrefwarnhv4l2-selection-flagsuh1hhhhK7hjSubh.}(hjShhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK7hj4hhubh)}(hFor capture devices the default composing rectangle is queried using ``V4L2_SEL_TGT_COMPOSE_DEFAULT``. It is usually equal to the bounding rectangle.h](hEFor capture devices the default composing rectangle is queried using }(hjhhhNhNubj)}(h ``V4L2_SEL_TGT_COMPOSE_DEFAULT``h]hV4L2_SEL_TGT_COMPOSE_DEFAULT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh0. It is usually equal to the bounding rectangle.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKAhj4hhubh)}(hX The part of a buffer that is modified by the hardware is given by ``V4L2_SEL_TGT_COMPOSE_PADDED``. It contains all pixels defined using ``V4L2_SEL_TGT_COMPOSE`` plus all padding data modified by hardware during insertion process. All pixels outside this rectangle *must not* be changed by the hardware. The content of pixels that lie inside the padded area but outside active area is undefined. The application can use the padded and active rectangles to detect where the rubbish pixels are located and remove them if needed.h](hBThe part of a buffer that is modified by the hardware is given by }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE_PADDED``h]hV4L2_SEL_TGT_COMPOSE_PADDED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh'. It contains all pixels defined using }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE``h]hV4L2_SEL_TGT_COMPOSE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhh plus all padding data modified by hardware during insertion process. All pixels outside this rectangle }(hjhhhNhNubhemphasis)}(h *must not*h]hmust not}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh be changed by the hardware. The content of pixels that lie inside the padded area but outside active area is undefined. The application can use the padded and active rectangles to detect where the rubbish pixels are located and remove them if needed.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKEhj4hhubeh}(h]configuration-of-video-captureah ]h"]configuration of video captureah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hConfiguration of video outputh]hConfiguration of video output}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKPubh)}(hX-For output devices targets and ioctls are used similarly to the video capture case. The *composing* rectangle refers to the insertion of an image into a video signal. The cropping rectangles refer to a memory buffer. It is recommended to configure the composing targets before to the cropping targets.h](hXFor output devices targets and ioctls are used similarly to the video capture case. The }(hjhhhNhNubj)}(h *composing*h]h composing}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh rectangle refers to the insertion of an image into a video signal. The cropping rectangles refer to a memory buffer. It is recommended to configure the composing targets before to the cropping targets.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKRhjhhubh)}(hXThe cropping targets refer to the memory buffer that contains an image to be inserted into a video signal or graphical screen. The limits of cropping coordinates are obtained using ``V4L2_SEL_TGT_CROP_BOUNDS``. All coordinates are expressed in pixels. The top/left corner is always point ``(0,0)``. The width and height is equal to the image size specified using :ref:`VIDIOC_S_FMT ` ioctl.h](hThe cropping targets refer to the memory buffer that contains an image to be inserted into a video signal or graphical screen. The limits of cropping coordinates are obtained using }(hj6hhhNhNubj)}(h``V4L2_SEL_TGT_CROP_BOUNDS``h]hV4L2_SEL_TGT_CROP_BOUNDS}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6ubhO. All coordinates are expressed in pixels. The top/left corner is always point }(hj6hhhNhNubj)}(h ``(0,0)``h]h(0,0)}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6ubhB. The width and height is equal to the image size specified using }(hj6hhhNhNubh)}(h":ref:`VIDIOC_S_FMT `h]h)}(hjdh]h VIDIOC_S_FMT}(hjfhhhNhNubah}(h]h ](hstdstd-refeh"]h$]h&]uh1hhjbubah}(h]h ]h"]h$]h&]refdoch refdomainjpreftyperef refexplicitrefwarnh vidioc_g_fmtuh1hhhhKXhj6ubh ioctl.}(hj6hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhjhhubh)}(hXThe top left corner, width and height of the source rectangle, that is the area from which image date are processed by the hardware, is given by the ``V4L2_SEL_TGT_CROP``. Its coordinates are expressed in the same coordinate system as the bounds rectangle. The active cropping area must lie completely inside the crop boundaries and the driver may further adjust the requested size and/or position according to hardware limitations.h](hThe top left corner, width and height of the source rectangle, that is the area from which image date are processed by the hardware, is given by the }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_CROP``h]hV4L2_SEL_TGT_CROP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX. Its coordinates are expressed in the same coordinate system as the bounds rectangle. The active cropping area must lie completely inside the crop boundaries and the driver may further adjust the requested size and/or position according to hardware limitations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hjhhubh)}(hFor output devices the default cropping rectangle is queried using ``V4L2_SEL_TGT_CROP_DEFAULT``. It is usually equal to the bounding rectangle.h](hCFor output devices the default cropping rectangle is queried using }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_CROP_DEFAULT``h]hV4L2_SEL_TGT_CROP_DEFAULT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh0. It is usually equal to the bounding rectangle.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKghjhhubh)}(hXThe part of a video signal or graphics display where the image is inserted by the hardware is controlled by ``V4L2_SEL_TGT_COMPOSE`` target. The rectangle's coordinates are expressed in pixels. The composing rectangle must lie completely inside the bounds rectangle. The driver must adjust the area to fit to the bounding limits. Moreover, the driver can perform other adjustments according to hardware limitations.h](hlThe part of a video signal or graphics display where the image is inserted by the hardware is controlled by }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE``h]hV4L2_SEL_TGT_COMPOSE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX target. The rectangle’s coordinates are expressed in pixels. The composing rectangle must lie completely inside the bounds rectangle. The driver must adjust the area to fit to the bounding limits. Moreover, the driver can perform other adjustments according to hardware limitations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKkhjhhubh)}(hXxThe device has a default composing rectangle, given by the ``V4L2_SEL_TGT_COMPOSE_DEFAULT`` target. This rectangle shall cover what the driver writer considers the complete picture. It is recommended for the driver developers to put the top/left corner at position ``(0,0)``. Drivers shall set the active composing rectangle to the default one when the driver is first loaded.h](h;The device has a default composing rectangle, given by the }(hjhhhNhNubj)}(h ``V4L2_SEL_TGT_COMPOSE_DEFAULT``h]hV4L2_SEL_TGT_COMPOSE_DEFAULT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh target. This rectangle shall cover what the driver writer considers the complete picture. It is recommended for the driver developers to put the top/left corner at position }(hjhhhNhNubj)}(h ``(0,0)``h]h(0,0)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhf. Drivers shall set the active composing rectangle to the default one when the driver is first loaded.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKrhjhhubh)}(hXThe devices may introduce additional content to video signal other than an image from memory buffers. It includes borders around an image. However, such a padded area is driver-dependent feature not covered by this document. Driver developers are encouraged to keep padded rectangle equal to active one. The padded target is accessed by the ``V4L2_SEL_TGT_COMPOSE_PADDED`` identifier. It must contain all pixels from the ``V4L2_SEL_TGT_COMPOSE`` target.h](hXUThe devices may introduce additional content to video signal other than an image from memory buffers. It includes borders around an image. However, such a padded area is driver-dependent feature not covered by this document. Driver developers are encouraged to keep padded rectangle equal to active one. The padded target is accessed by the }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE_PADDED``h]hV4L2_SEL_TGT_COMPOSE_PADDED}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh1 identifier. It must contain all pixels from the }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE``h]hV4L2_SEL_TGT_COMPOSE}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh target.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKyhjhhubeh}(h]configuration-of-video-outputah ]h"]configuration of video outputah$]h&]uh1hhhhhhhhKPubh)}(hhh](h)}(hScaling controlh]hScaling control}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjXhhhhhKubh)}(hX'An application can detect if scaling is performed by comparing the width and the height of rectangles obtained using ``V4L2_SEL_TGT_CROP`` and ``V4L2_SEL_TGT_COMPOSE`` targets. If these are not equal then the scaling is applied. The application can compute the scaling ratios using these values.h](huAn application can detect if scaling is performed by comparing the width and the height of rectangles obtained using }(hjihhhNhNubj)}(h``V4L2_SEL_TGT_CROP``h]hV4L2_SEL_TGT_CROP}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjiubh and }(hjihhhNhNubj)}(h``V4L2_SEL_TGT_COMPOSE``h]hV4L2_SEL_TGT_COMPOSE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjiubh targets. If these are not equal then the scaling is applied. The application can compute the scaling ratios using these values.}(hjihhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjXhhubeh}(h]scaling-controlah ]h"]scaling controlah$]h&]uh1hhhhhhhhKubeh}(h] configurationah ]h"] configurationah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjjjUjRjju nametypes}(jjjUjuh}(jhjj4jRjjjXu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.