1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _VIDIOC_SUBDEV_G_ROUTING:
6 ******************************************************
7 ioctl VIDIOC_SUBDEV_G_ROUTING, VIDIOC_SUBDEV_S_ROUTING
8 ******************************************************
13 VIDIOC_SUBDEV_G_ROUTING - VIDIOC_SUBDEV_S_ROUTING - Get or set routing between streams of media pads in a media entity.
19 .. c:macro:: VIDIOC_SUBDEV_G_ROUTING
21 ``int ioctl(int fd, VIDIOC_SUBDEV_G_ROUTING, struct v4l2_subdev_routing *argp)``
23 .. c:macro:: VIDIOC_SUBDEV_S_ROUTING
25 ``int ioctl(int fd, VIDIOC_SUBDEV_S_ROUTING, struct v4l2_subdev_routing *argp)``
31 File descriptor returned by :ref:`open() <func-open>`.
34 Pointer to struct :c:type:`v4l2_subdev_routing`.
40 These ioctls are used to get and set the routing in a media entity.
41 The routing configuration determines the flows of data inside an entity.
43 Drivers report their current routing tables using the
44 ``VIDIOC_SUBDEV_G_ROUTING`` ioctl and application may enable or disable routes
45 with the ``VIDIOC_SUBDEV_S_ROUTING`` ioctl, by adding or removing routes and
46 setting or clearing flags of the ``flags`` field of a
47 struct :c:type:`v4l2_subdev_route`.
49 All stream configurations are reset when ``VIDIOC_SUBDEV_S_ROUTING`` is called. This
50 means that the userspace must reconfigure all streams after calling the ioctl
51 with e.g. ``VIDIOC_SUBDEV_S_FMT``.
53 Only subdevices which have both sink and source pads can support routing.
55 When inspecting routes through ``VIDIOC_SUBDEV_G_ROUTING`` and the application
56 provided ``num_routes`` is not big enough to contain all the available routes
57 the subdevice exposes, drivers return the ENOSPC error code and adjust the
58 value of the ``num_routes`` field. Application should then reserve enough memory
59 for all the route entries and call ``VIDIOC_SUBDEV_G_ROUTING`` again.
61 On a successful ``VIDIOC_SUBDEV_G_ROUTING`` call the driver updates the
62 ``num_routes`` field to reflect the actual number of routes returned.
64 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
66 .. c:type:: v4l2_subdev_routing
68 .. flat-table:: struct v4l2_subdev_routing
75 - Format to modified, from enum
76 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
77 * - struct :c:type:`v4l2_subdev_route`
79 - Array of struct :c:type:`v4l2_subdev_route` entries
82 - Number of entries of the routes array
85 - Reserved for future extensions. Applications and drivers must set
88 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
90 .. c:type:: v4l2_subdev_route
92 .. flat-table:: struct v4l2_subdev_route
102 - Sink pad stream number.
108 - Source pad stream number.
111 - Route enable/disable flags
112 :ref:`v4l2_subdev_routing_flags <v4l2-subdev-routing-flags>`.
115 - Reserved for future extensions. Applications and drivers must set
118 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
120 .. _v4l2-subdev-routing-flags:
122 .. flat-table:: enum v4l2_subdev_routing_flags
127 * - V4L2_SUBDEV_ROUTE_FL_ACTIVE
129 - The route is enabled. Set by applications.
134 On success 0 is returned, on error -1 and the ``errno`` variable is set
135 appropriately. The generic error codes are described at the
136 :ref:`Generic Error Codes <gen-errors>` chapter.
139 The application provided ``num_routes`` is not big enough to contain
140 all the available routes the subdevice exposes.
143 The sink or source pad identifiers reference a non-existing pad, or reference
144 pads of different types (ie. the sink_pad identifiers refers to a source pad).
147 The application provided ``num_routes`` for ``VIDIOC_SUBDEV_S_ROUTING`` is
148 larger than the number of routes the driver can handle.