desc_isdbt_delivery.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 Terrestrial delivery system descriptor
  20. */
  21. /**
  22. * @file desc_isdbt_delivery.h
  23. * @ingroup descriptors
  24. * @brief Provides the descriptors for the ISDB-T terrestrial delivery system
  25. * @copyright GNU General Public License version 2 (GPLv2)
  26. * @author Mauro Carvalho Chehab
  27. *
  28. * @par Relevant specs
  29. * The descriptor described herein is defined at:
  30. * - ARIB STD-B10
  31. *
  32. * @par Bug Report
  33. * Please submit bug reports and patches to linux-media@vger.kernel.org
  34. */
  35. #ifndef _ISDBT_DELIVERY_H
  36. #define _ISDBT_DELIVERY_H
  37. #include <libdvbv5/descriptors.h>
  38. /**
  39. * @struct isdbt_desc_terrestrial_delivery_system
  40. * @ingroup descriptors
  41. * @brief Struct containing the ISDB-T terrestrial delivery system
  42. *
  43. * @param type descriptor tag
  44. * @param length descriptor length
  45. * @param next pointer to struct dvb_desc
  46. * @param area_code area code. The area code definition varies from
  47. * Country to Country.
  48. * @param guard_interval guard interval
  49. * @param transmission_mode transmission mode
  50. * @param frequency vector with center frequencies
  51. * @param num_freqs number of frequencies at the
  52. * isdbt_desc_terrestrial_delivery_system::frequency vector
  53. */
  54. struct isdbt_desc_terrestrial_delivery_system {
  55. uint8_t type;
  56. uint8_t length;
  57. struct dvb_desc *next;
  58. uint32_t *frequency;
  59. unsigned num_freqs;
  60. union {
  61. uint16_t bitfield;
  62. struct {
  63. uint16_t transmission_mode:2;
  64. uint16_t guard_interval:2;
  65. uint16_t area_code:12;
  66. } __attribute__((packed));
  67. } __attribute__((packed));
  68. } __attribute__((packed));
  69. struct dvb_v5_fe_parms;
  70. #ifdef __cplusplus
  71. extern "C" {
  72. #endif
  73. /**
  74. * @brief Initializes and parses the ISDB-T terrestrial delivery system
  75. * descriptor
  76. * @ingroup descriptors
  77. *
  78. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  79. * @param buf buffer containing the descriptor's raw data
  80. * @param desc pointer to struct dvb_desc to be allocated and filled
  81. *
  82. * This function allocates a the descriptor and fills the fields inside
  83. * the struct. It also makes sure that all fields will follow the CPU
  84. * endianness. Due to that, the content of the buffer may change.
  85. *
  86. * @return On success, it returns the size of the allocated struct.
  87. * A negative value indicates an error.
  88. */
  89. int isdbt_desc_delivery_init(struct dvb_v5_fe_parms *parms,
  90. const uint8_t *buf, struct dvb_desc *desc);
  91. /**
  92. * @brief Prints the content of the ISDB-T terrestrial delivery system
  93. * descriptor
  94. * @ingroup descriptors
  95. *
  96. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  97. * @param desc pointer to struct dvb_desc
  98. */
  99. void isdbt_desc_delivery_print(struct dvb_v5_fe_parms *parms,
  100. const struct dvb_desc *desc);
  101. /**
  102. * @brief Frees all data allocated by the ISDB-T terrestrial delivery system
  103. * descriptor
  104. * @ingroup descriptors
  105. *
  106. * @param desc pointer to struct dvb_desc to be freed
  107. */
  108. void isdbt_desc_delivery_free(struct dvb_desc *desc);
  109. /**
  110. * Converts an ISDB-T Interval code into a string
  111. */
  112. extern const uint32_t isdbt_interval[];
  113. /**
  114. * Converts an ISDB-T mode into a string
  115. */
  116. extern const uint32_t isdbt_mode[];
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif