€•P&Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”ŒB/translations/zh_CN/userspace-api/media/v4l/selection-api-examples”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”ŒB/translations/zh_TW/userspace-api/media/v4l/selection-api-examples”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”ŒB/translations/it_IT/userspace-api/media/v4l/selection-api-examples”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”ŒB/translations/ja_JP/userspace-api/media/v4l/selection-api-examples”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”ŒB/translations/ko_KR/userspace-api/media/v4l/selection-api-examples”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”ŒB/translations/sp_SP/userspace-api/media/v4l/selection-api-examples”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later”h]”hŒ8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later”…””}”hh£sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1h¡hhhžhhŸŒ\/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/selection-api-examples.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒExamples”h]”hŒExamples”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ paragraph”“”)”}”(hŒ­(A video capture device is assumed; change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other devices; change target to ``V4L2_SEL_TGT_COMPOSE_*`` family to configure composing area)”h]”(hŒ+(A video capture device is assumed; change ”…””}”(hhËhžhhŸNh NubhŒliteral”“”)”}”(hŒ``V4L2_BUF_TYPE_VIDEO_CAPTURE``”h]”hŒV4L2_BUF_TYPE_VIDEO_CAPTURE”…””}”(hhÕhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÓhhËubhŒ% for other devices; change target to ”…””}”(hhËhžhhŸNh NubhÔ)”}”(hŒ``V4L2_SEL_TGT_COMPOSE_*``”h]”hŒV4L2_SEL_TGT_COMPOSE_*”…””}”(hhçhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÓhhËubhŒ$ family to configure composing area)”…””}”(hhËhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhµ)”}”(hhh]”(hº)”}”(hŒ*Example: Resetting the cropping parameters”h]”hŒ*Example: Resetting the cropping parameters”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hhÿhžhhŸh³h K ubhŒ literal_block”“”)”}”(hXstruct v4l2_selection sel = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, .target = V4L2_SEL_TGT_CROP_DEFAULT, }; ret = ioctl(fd, VIDIOC_G_SELECTION, &sel); if (ret) exit(-1); sel.target = V4L2_SEL_TGT_CROP; ret = ioctl(fd, VIDIOC_S_SELECTION, &sel); if (ret) exit(-1);”h]”hXstruct v4l2_selection sel = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, .target = V4L2_SEL_TGT_CROP_DEFAULT, }; ret = ioctl(fd, VIDIOC_G_SELECTION, &sel); if (ret) exit(-1); sel.target = V4L2_SEL_TGT_CROP; ret = ioctl(fd, VIDIOC_S_SELECTION, &sel); if (ret) exit(-1);”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”h±h²Œforce”‰Œlanguage”Œc”Œhighlight_args”}”uh1jhŸh³h KhhÿhžhubhÊ)”}”(hŒfSetting a composing area on output of size of *at most* half of limit placed at a center of a display.”h]”(hŒ.Setting a composing area on output of size of ”…””}”(hj%hžhhŸNh NubhŒemphasis”“”)”}”(hŒ *at most*”h]”hŒat most”…””}”(hj/hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j-hj%ubhŒ/ half of limit placed at a center of a display.”…””}”(hj%hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khhÿhžhubeh}”(h]”Œ)example-resetting-the-cropping-parameters”ah ]”h"]”Œ*example: resetting the cropping parameters”ah$]”h&]”uh1h´hh¶hžhhŸh³h K ubhµ)”}”(hhh]”(hº)”}”(hŒExample: Simple downscaling”h]”hŒExample: Simple downscaling”…””}”(hjRhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjOhžhhŸh³h K ubj)”}”(hXìstruct v4l2_selection sel = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .target = V4L2_SEL_TGT_COMPOSE_BOUNDS, }; struct v4l2_rect r; ret = ioctl(fd, VIDIOC_G_SELECTION, &sel); if (ret) exit(-1); /* setting smaller compose rectangle */ r.width = sel.r.width / 2; r.height = sel.r.height / 2; r.left = sel.r.width / 4; r.top = sel.r.height / 4; sel.r = r; sel.target = V4L2_SEL_TGT_COMPOSE; sel.flags = V4L2_SEL_FLAG_LE; ret = ioctl(fd, VIDIOC_S_SELECTION, &sel); if (ret) exit(-1);”h]”hXìstruct v4l2_selection sel = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .target = V4L2_SEL_TGT_COMPOSE_BOUNDS, }; struct v4l2_rect r; ret = ioctl(fd, VIDIOC_G_SELECTION, &sel); if (ret) exit(-1); /* setting smaller compose rectangle */ r.width = sel.r.width / 2; r.height = sel.r.height / 2; r.left = sel.r.width / 4; r.top = sel.r.height / 4; sel.r = r; sel.target = V4L2_SEL_TGT_COMPOSE; sel.flags = V4L2_SEL_FLAG_LE; ret = ioctl(fd, VIDIOC_S_SELECTION, &sel); if (ret) exit(-1);”…””}”hj`sbah}”(h]”h ]”h"]”h$]”h&]”h±h²j ‰j!j"j#}”uh1jhŸh³h K"hjOhžhubhÊ)”}”(hŒYA video output device is assumed; change ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` for other devices”h]”(hŒ)A video output device is assumed; change ”…””}”(hjohžhhŸNh NubhÔ)”}”(hŒ``V4L2_BUF_TYPE_VIDEO_OUTPUT``”h]”hŒV4L2_BUF_TYPE_VIDEO_OUTPUT”…””}”(hjwhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÓhjoubhŒ for other devices”…””}”(hjohžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K9hjOhžhubeh}”(h]”Œexample-simple-downscaling”ah ]”h"]”Œexample: simple downscaling”ah$]”h&]”uh1h´hh¶hžhhŸh³h K ubhµ)”}”(hhh]”(hº)”}”(hŒ%Example: Querying for scaling factors”h]”hŒ%Example: Querying for scaling factors”…””}”(hjšhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj—hžhhŸh³h K=ubj)”}”(hXstruct v4l2_selection compose = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .target = V4L2_SEL_TGT_COMPOSE, }; struct v4l2_selection crop = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .target = V4L2_SEL_TGT_CROP, }; double hscale, vscale; ret = ioctl(fd, VIDIOC_G_SELECTION, &compose); if (ret) exit(-1); ret = ioctl(fd, VIDIOC_G_SELECTION, &crop); if (ret) exit(-1); /* computing scaling factors */ hscale = (double)compose.r.width / crop.r.width; vscale = (double)compose.r.height / crop.r.height;”h]”hXstruct v4l2_selection compose = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .target = V4L2_SEL_TGT_COMPOSE, }; struct v4l2_selection crop = { .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .target = V4L2_SEL_TGT_CROP, }; double hscale, vscale; ret = ioctl(fd, VIDIOC_G_SELECTION, &compose); if (ret) exit(-1); ret = ioctl(fd, VIDIOC_G_SELECTION, &crop); if (ret) exit(-1); /* computing scaling factors */ hscale = (double)compose.r.width / crop.r.width; vscale = (double)compose.r.height / crop.r.height;”…””}”hj¨sbah}”(h]”h ]”h"]”h$]”h&]”h±h²j ‰j!j"j#}”uh1jhŸh³h K?hj—hžhubeh}”(h]”Œ$example-querying-for-scaling-factors”ah ]”h"]”Œ%example: querying for scaling factors”ah$]”h&]”uh1h´hh¶hžhhŸh³h K=ubeh}”(h]”Œexamples”ah ]”h"]”Œexamples”ah$]”h&]”uh1h´hhhžhhŸh³h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h³uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¹NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jêŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h³Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jÄjÁjLjIj”j‘j¼j¹uŒ nametypes”}”(jĉjL‰j”‰j¼‰uh}”(jÁh¶jIhÿj‘jOj¹j—uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.