desc_partial_reception.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (c) 2013 - 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 IEC/CENELEC DS/EN 62216-1:2011
  20. *
  21. * I couldn't find the original version, so I used what's there at:
  22. * http://tdt.telecom.pt/recursos/apresentacoes/Signalling Specifications for DTT deployment in Portugal.pdf
  23. */
  24. /**
  25. * @file desc_partial_reception.h
  26. * @ingroup descriptors
  27. * @brief Provides the descriptors for the ISDB partial reception descriptor
  28. * @copyright GNU General Public License version 2 (GPLv2)
  29. * @author Mauro Carvalho Chehab
  30. * @author Andre Roth
  31. *
  32. * @par Relevant specs
  33. * The descriptor described herein is defined at:
  34. * - IEC/CENELEC DS/EN 62216-1:2011
  35. *
  36. * @see http://tdt.telecom.pt/recursos/apresentacoes/Signalling Specifications for DTT deployment in Portugal.pdf
  37. *
  38. * @par Bug Report
  39. * Please submit bug reports and patches to linux-media@vger.kernel.org
  40. */
  41. #ifndef _PARTIAL_RECEPTION_H
  42. #define _PARTIAL_RECEPTION_H
  43. #include <libdvbv5/descriptors.h>
  44. /**
  45. * @struct isdb_partial_reception_service_id
  46. * @ingroup descriptors
  47. * @brief Service ID that uses partial reception
  48. *
  49. * @param service_id service id
  50. */
  51. struct isdb_partial_reception_service_id {
  52. uint16_t service_id;
  53. } __attribute__((packed));
  54. /**
  55. * @struct isdb_desc_partial_reception
  56. * @ingroup descriptors
  57. * @brief Structure containing the partial reception descriptor
  58. *
  59. * @param type descriptor tag
  60. * @param length descriptor length
  61. * @param next pointer to struct dvb_desc
  62. * @param partial_reception vector of struct isdb_partial_reception_service_id.
  63. * The length of the vector is given by:
  64. * length / sizeof(struct isdb_partial_reception_service_id).
  65. */
  66. struct isdb_desc_partial_reception {
  67. uint8_t type;
  68. uint8_t length;
  69. struct dvb_desc *next;
  70. struct isdb_partial_reception_service_id *partial_reception;
  71. } __attribute__((packed));
  72. struct dvb_v5_fe_parms;
  73. #ifdef __cplusplus
  74. extern "C" {
  75. #endif
  76. /**
  77. * @brief Initializes and parses the ISDB-T partial reception descriptor
  78. * @ingroup descriptors
  79. *
  80. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  81. * @param buf buffer containing the descriptor's raw data
  82. * @param desc pointer to struct dvb_desc to be allocated and filled
  83. *
  84. * This function allocates a the descriptor and fills the fields inside
  85. * the struct. It also makes sure that all fields will follow the CPU
  86. * endianness. Due to that, the content of the buffer may change.
  87. *
  88. * @return On success, it returns the size of the allocated struct.
  89. * A negative value indicates an error.
  90. */
  91. int isdb_desc_partial_reception_init(struct dvb_v5_fe_parms *parms,
  92. const uint8_t *buf, struct dvb_desc *desc);
  93. /**
  94. * @brief Prints the content of the ISDB-T partial reception descriptor
  95. * @ingroup descriptors
  96. *
  97. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  98. * @param desc pointer to struct dvb_desc
  99. */
  100. void isdb_desc_partial_reception_print(struct dvb_v5_fe_parms *parms,
  101. const struct dvb_desc *desc);
  102. /**
  103. * @brief Frees all data allocated by the ISDB-T partial reception descriptor
  104. * @ingroup descriptors
  105. *
  106. * @param desc pointer to struct dvb_desc to be freed
  107. */
  108. void isdb_desc_partial_reception_free(struct dvb_desc *desc);
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif