desc_ts_info.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright (c) 2013-2014 - Mauro Carvalho Chehab <m.chehab@samsung.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation version 2
  7. * of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  18. *
  19. * Described on ARIB STD-B10 as TS information descriptor
  20. */
  21. /**
  22. * @file desc_ts_info.h
  23. * @ingroup descriptors
  24. * @brief Provides the descriptors for the ISDB TS information descriptor.
  25. * The TS information descriptor specifies the remote control key
  26. * identifier assigned to the applicable TS and indicates the relationship
  27. * between the service identifier and the transmission layer during
  28. * hierarchical transmission.
  29. *
  30. * @copyright GNU General Public License version 2 (GPLv2)
  31. * @author Mauro Carvalho Chehab
  32. *
  33. * @par Relevant specs
  34. * The descriptor described herein is defined at:
  35. * - ARIB STD-B10
  36. *
  37. * @par Bug Report
  38. * Please submit bug reports and patches to linux-media@vger.kernel.org
  39. */
  40. #ifndef _TS_INFO_H
  41. #define _TS_INFO_H
  42. #include <libdvbv5/descriptors.h>
  43. /**
  44. * @struct dvb_desc_ts_info_transmission_type
  45. * @ingroup descriptors
  46. * @brief ISDB TS information transmission type
  47. *
  48. * @param transmission_type_info transmission type info
  49. * @param num_of_service num of service
  50. */
  51. struct dvb_desc_ts_info_transmission_type {
  52. uint8_t transmission_type_info;
  53. uint8_t num_of_service;
  54. } __attribute__((packed));
  55. /**
  56. * @struct dvb_desc_ts_info
  57. * @ingroup descriptors
  58. * @brief Structure describing the ISDB TS information descriptor.
  59. *
  60. * @param type descriptor tag
  61. * @param length descriptor length
  62. * @param next pointer to struct dvb_desc
  63. * @param remote_control_key_id remote control key id
  64. * @param length_of_ts_name length of ts name
  65. * @param transmission_type_count transmission type count
  66. *
  67. * @param ts_name ts name string
  68. * @param ts_name_emph ts name emphasis string
  69. * @param transmission_type struct dvb_desc_ts_info_transmission_type content
  70. * @param service_id service id vector
  71. */
  72. struct dvb_desc_ts_info {
  73. uint8_t type;
  74. uint8_t length;
  75. struct dvb_desc *next;
  76. char *ts_name, *ts_name_emph;
  77. struct dvb_desc_ts_info_transmission_type transmission_type;
  78. uint16_t *service_id;
  79. union {
  80. uint16_t bitfield;
  81. struct {
  82. uint8_t transmission_type_count:2;
  83. uint8_t length_of_ts_name:6;
  84. uint8_t remote_control_key_id:8;
  85. } __attribute__((packed));
  86. };
  87. } __attribute__((packed));
  88. struct dvb_v5_fe_parms;
  89. #ifdef __cplusplus
  90. extern "C" {
  91. #endif
  92. /**
  93. * @brief Initializes and parses the ISDB TS information descriptor.
  94. * descriptor
  95. * @ingroup descriptors
  96. *
  97. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  98. * @param buf buffer containing the descriptor's raw data
  99. * @param desc pointer to struct dvb_desc to be allocated and filled
  100. *
  101. * This function allocates a the descriptor and fills the fields inside
  102. * the struct. It also makes sure that all fields will follow the CPU
  103. * endianness. Due to that, the content of the buffer may change.
  104. *
  105. * @return On success, it returns the size of the allocated struct.
  106. * A negative value indicates an error.
  107. */
  108. int dvb_desc_ts_info_init(struct dvb_v5_fe_parms *parms,
  109. const uint8_t *buf, struct dvb_desc *desc);
  110. /**
  111. * @brief Prints the content of the ISDB TS information descriptor.
  112. * descriptor
  113. * @ingroup descriptors
  114. *
  115. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  116. * @param desc pointer to struct dvb_desc
  117. */
  118. void dvb_desc_ts_info_print(struct dvb_v5_fe_parms *parms,
  119. const struct dvb_desc *desc);
  120. /**
  121. * @brief Frees all data allocated by the ISDB TS information descriptor.
  122. * descriptor
  123. * @ingroup descriptors
  124. *
  125. * @param desc pointer to struct dvb_desc to be freed
  126. */
  127. void dvb_desc_ts_info_free(struct dvb_desc *desc);
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif