desc_hierarchy.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
  3. * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation version 2
  8. * of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. *
  20. */
  21. /**
  22. * @file desc_hierarchy.h
  23. * @ingroup descriptors
  24. * @brief Provides the descriptors for the hierarchy descriptor
  25. * @copyright GNU General Public License version 2 (GPLv2)
  26. * @author Mauro Carvalho Chehab
  27. * @author Andre Roth
  28. *
  29. * @par Relevant specs
  30. * The descriptor described herein is defined at:
  31. * - ISO/IEC 13818-1
  32. *
  33. * @see
  34. *
  35. * @par Bug Report
  36. * Please submit bug reports and patches to linux-media@vger.kernel.org
  37. */
  38. #ifndef _HIERARCHY_H
  39. #define _HIERARCHY_H
  40. #include <libdvbv5/descriptors.h>
  41. /**
  42. * @struct dvb_desc_hierarchy
  43. * @ingroup descriptors
  44. * @brief Structure containing the hierarchy descriptor
  45. *
  46. * @param type descriptor tag
  47. * @param length descriptor length
  48. * @param next pointer to struct dvb_desc
  49. * @param hierarchy_type hierarchy type
  50. * @param layer hierarchy layer index
  51. * @param embedded_layer hierarchy embedded layer index
  52. * @param channel hierarchy channel
  53. */
  54. struct dvb_desc_hierarchy {
  55. uint8_t type;
  56. uint8_t length;
  57. struct dvb_desc *next;
  58. uint8_t hierarchy_type:4;
  59. uint8_t reserved:4;
  60. uint8_t layer:6;
  61. uint8_t reserved2:2;
  62. uint8_t embedded_layer:6;
  63. uint8_t reserved3:2;
  64. uint8_t channel:6;
  65. uint8_t reserved4:2;
  66. } __attribute__((packed));
  67. struct dvb_v5_fe_parms;
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71. /**
  72. * @brief Initializes and parses the hierarchy descriptor
  73. * @ingroup descriptors
  74. *
  75. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  76. * @param buf buffer containing the descriptor's raw data
  77. * @param desc pointer to struct dvb_desc to be allocated and filled
  78. *
  79. * This function initializes and makes sure that all fields will follow the CPU
  80. * endianness. Due to that, the content of the buffer may change.
  81. *
  82. * Currently, no memory is allocated internally.
  83. *
  84. * @return On success, it returns the size of the allocated struct.
  85. * A negative value indicates an error.
  86. */
  87. int dvb_desc_hierarchy_init (struct dvb_v5_fe_parms *parms,
  88. const uint8_t *buf, struct dvb_desc *desc);
  89. /**
  90. * @brief Prints the content of the hierarchy descriptor
  91. * @ingroup descriptors
  92. *
  93. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  94. * @param desc pointer to struct dvb_desc
  95. */
  96. void dvb_desc_hierarchy_print(struct dvb_v5_fe_parms *parms,
  97. const struct dvb_desc *desc);
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif