media-ioc-enum-links.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. .. -*- coding: utf-8; mode: rst -*-
  2. .. _media_ioc_enum_links:
  3. **************************
  4. ioctl MEDIA_IOC_ENUM_LINKS
  5. **************************
  6. Name
  7. ====
  8. MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity
  9. Synopsis
  10. ========
  11. .. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp )
  12. :name: MEDIA_IOC_ENUM_LINKS
  13. Arguments
  14. =========
  15. ``fd``
  16. File descriptor returned by :ref:`open() <media-func-open>`.
  17. ``argp``
  18. Description
  19. ===========
  20. To enumerate pads and/or links for a given entity, applications set the
  21. entity field of a struct :c:type:`media_links_enum`
  22. structure and initialize the struct
  23. :c:type:`media_pad_desc` and struct
  24. :c:type:`media_link_desc` structure arrays pointed by
  25. the ``pads`` and ``links`` fields. They then call the
  26. MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
  27. If the ``pads`` field is not NULL, the driver fills the ``pads`` array
  28. with information about the entity's pads. The array must have enough
  29. room to store all the entity's pads. The number of pads can be retrieved
  30. with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
  31. If the ``links`` field is not NULL, the driver fills the ``links`` array
  32. with information about the entity's outbound links. The array must have
  33. enough room to store all the entity's outbound links. The number of
  34. outbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
  35. Only forward links that originate at one of the entity's source pads are
  36. returned during the enumeration process.
  37. .. c:type:: media_links_enum
  38. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
  39. .. flat-table:: struct media_links_enum
  40. :header-rows: 0
  41. :stub-columns: 0
  42. :widths: 1 1 2
  43. - .. row 1
  44. - __u32
  45. - ``entity``
  46. - Entity id, set by the application.
  47. - .. row 2
  48. - struct :c:type:`media_pad_desc`
  49. - \*\ ``pads``
  50. - Pointer to a pads array allocated by the application. Ignored if
  51. NULL.
  52. - .. row 3
  53. - struct :c:type:`media_link_desc`
  54. - \*\ ``links``
  55. - Pointer to a links array allocated by the application. Ignored if
  56. NULL.
  57. .. c:type:: media_pad_desc
  58. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
  59. .. flat-table:: struct media_pad_desc
  60. :header-rows: 0
  61. :stub-columns: 0
  62. :widths: 1 1 2
  63. - .. row 1
  64. - __u32
  65. - ``entity``
  66. - ID of the entity this pad belongs to.
  67. - .. row 2
  68. - __u16
  69. - ``index``
  70. - 0-based pad index.
  71. - .. row 3
  72. - __u32
  73. - ``flags``
  74. - Pad flags, see :ref:`media-pad-flag` for more details.
  75. .. c:type:: media_link_desc
  76. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
  77. .. flat-table:: struct media_link_desc
  78. :header-rows: 0
  79. :stub-columns: 0
  80. :widths: 1 1 2
  81. - .. row 1
  82. - struct :c:type:`media_pad_desc`
  83. - ``source``
  84. - Pad at the origin of this link.
  85. - .. row 2
  86. - struct :c:type:`media_pad_desc`
  87. - ``sink``
  88. - Pad at the target of this link.
  89. - .. row 3
  90. - __u32
  91. - ``flags``
  92. - Link flags, see :ref:`media-link-flag` for more details.
  93. Return Value
  94. ============
  95. On success 0 is returned, on error -1 and the ``errno`` variable is set
  96. appropriately. The generic error codes are described at the
  97. :ref:`Generic Error Codes <gen-errors>` chapter.
  98. EINVAL
  99. The struct :c:type:`media_links_enum` ``id``
  100. references a non-existing entity.