18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: MC 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _media_ioc_setup_link: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci************************** 78c2ecf20Sopenharmony_ciioctl MEDIA_IOC_SETUP_LINK 88c2ecf20Sopenharmony_ci************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciMEDIA_IOC_SETUP_LINK - Modify the properties of a link 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: MEDIA_IOC_SETUP_LINK 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, MEDIA_IOC_SETUP_LINK, struct media_link_desc *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to struct :c:type:`media_link_desc`. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciDescription 328c2ecf20Sopenharmony_ci=========== 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciTo change link properties applications fill a struct 358c2ecf20Sopenharmony_ci:c:type:`media_link_desc` with link identification 368c2ecf20Sopenharmony_ciinformation (source and sink pad) and the new requested link flags. They 378c2ecf20Sopenharmony_cithen call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to that 388c2ecf20Sopenharmony_cistructure. 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciThe only configurable property is the ``ENABLED`` link flag to 418c2ecf20Sopenharmony_cienable/disable a link. Links marked with the ``IMMUTABLE`` link flag can 428c2ecf20Sopenharmony_cinot be enabled or disabled. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciLink configuration has no side effect on other links. If an enabled link 458c2ecf20Sopenharmony_ciat the sink pad prevents the link from being enabled, the driver returns 468c2ecf20Sopenharmony_ciwith an ``EBUSY`` error code. 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciOnly links marked with the ``DYNAMIC`` link flag can be enabled/disabled 498c2ecf20Sopenharmony_ciwhile streaming media data. Attempting to enable or disable a streaming 508c2ecf20Sopenharmony_cinon-dynamic link will return an ``EBUSY`` error code. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciIf the specified link can't be found the driver returns with an ``EINVAL`` 538c2ecf20Sopenharmony_cierror code. 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciReturn Value 568c2ecf20Sopenharmony_ci============ 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 598c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 608c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciEINVAL 638c2ecf20Sopenharmony_ci The struct :c:type:`media_link_desc` references a 648c2ecf20Sopenharmony_ci non-existing link, or the link is immutable and an attempt to modify 658c2ecf20Sopenharmony_ci its configuration was made. 66