desc_cable_delivery.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (c) 2011-2014 - 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. * Described at ETSI EN 300 468 V1.11.1 (2010-04)
  21. */
  22. /**
  23. * @file desc_cable_delivery.h
  24. * @ingroup descriptors
  25. * @brief Provides the descriptors for the cable delivery system descriptor
  26. * @copyright GNU General Public License version 2 (GPLv2)
  27. * @author Mauro Carvalho Chehab
  28. * @author Andre Roth
  29. *
  30. * @par Relevant specs
  31. * The descriptor described herein is defined at:
  32. * - ETSI EN 300 468 V1.11.1 (2010-04)
  33. *
  34. * @par Bug Report
  35. * Please submit bug reports and patches to linux-media@vger.kernel.org
  36. */
  37. #ifndef _CABLE_DELIVERY_H
  38. #define _CABLE_DELIVERY_H
  39. #include <libdvbv5/descriptors.h>
  40. /**
  41. * @struct dvb_desc_cable_delivery
  42. * @ingroup descriptors
  43. * @brief Structure containing the cable delivery system descriptor
  44. *
  45. * @param type descriptor tag
  46. * @param length descriptor length
  47. * @param next pointer to struct dvb_desc
  48. * @param frequency frequency, converted to Hz.
  49. * @param fec_outer FEC outer (typically, Viterbi)
  50. * @param modulation modulation
  51. * @param fec_inner FEC inner (convolutional code)
  52. * @param symbol_rate symbol rate, converted to symbols/sec (bauds)
  53. */
  54. struct dvb_desc_cable_delivery {
  55. uint8_t type;
  56. uint8_t length;
  57. struct dvb_desc *next;
  58. uint32_t frequency;
  59. union {
  60. uint16_t bitfield1;
  61. struct {
  62. uint16_t fec_outer:4;
  63. uint16_t reserved_future_use:12;
  64. } __attribute__((packed));
  65. } __attribute__((packed));
  66. uint8_t modulation;
  67. union {
  68. uint32_t bitfield2;
  69. struct {
  70. uint32_t fec_inner:4;
  71. uint32_t symbol_rate:28;
  72. } __attribute__((packed));
  73. } __attribute__((packed));
  74. } __attribute__((packed));
  75. struct dvb_v5_fe_parms;
  76. #ifdef __cplusplus
  77. extern "C" {
  78. #endif
  79. /**
  80. * @brief Initializes and parses the service location descriptor
  81. * @ingroup descriptors
  82. *
  83. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  84. * @param buf buffer containing the descriptor's raw data
  85. * @param desc pointer to struct dvb_desc to be allocated and filled
  86. *
  87. * This function initializes and makes sure that all fields will follow the CPU
  88. * endianness. Due to that, the content of the buffer may change.
  89. *
  90. * Currently, no memory is allocated internally.
  91. *
  92. * @return On success, it returns the size of the allocated struct.
  93. * A negative value indicates an error.
  94. */
  95. int dvb_desc_cable_delivery_init(struct dvb_v5_fe_parms *parms,
  96. const uint8_t *buf, struct dvb_desc *desc);
  97. /**
  98. * @brief Prints the content of the service location descriptor
  99. * @ingroup descriptors
  100. *
  101. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  102. * @param desc pointer to struct dvb_desc
  103. */
  104. void dvb_desc_cable_delivery_print(struct dvb_v5_fe_parms *parms,
  105. const struct dvb_desc *desc);
  106. /**
  107. * @brief converts from the descriptor's modulation into enum fe_modulation,
  108. * as defined by DVBv5 API.
  109. */
  110. extern const unsigned dvbc_modulation_table[];
  111. /**
  112. * @brief converts from the descriptor's FEC into enum fe_code_rate,
  113. * as defined by DVBv5 API.
  114. */
  115. extern const unsigned dvbc_fec_table[];
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119. #endif