desc_event_short.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. */
  21. /**
  22. * @file desc_event_short.h
  23. * @ingroup descriptors
  24. * @brief Provides the descriptors for the short event 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. * - ETSI EN 300 468 V1.11.1
  32. *
  33. * @par Bug Report
  34. * Please submit bug reports and patches to linux-media@vger.kernel.org
  35. */
  36. #ifndef _DESC_EVENT_SHORT_H
  37. #define _DESC_EVENT_SHORT_H
  38. #include <libdvbv5/descriptors.h>
  39. /**
  40. * @struct dvb_desc_event_short
  41. * @ingroup descriptors
  42. * @brief Structure containing the short event descriptor
  43. *
  44. * @param type descriptor tag
  45. * @param length descriptor length
  46. * @param next pointer to struct dvb_desc
  47. * @param language ISO 639 language code
  48. * @param name event name string
  49. * @param name_emph event name emphasis string
  50. * @param text event text string
  51. * @param text_emph event text emphasis string
  52. *
  53. * @details
  54. * The emphasis text is the one that uses asterisks. For example, in the text:
  55. * "the quick *fox* jumps over the lazy table" the emphasis would be "fox".
  56. */
  57. struct dvb_desc_event_short {
  58. uint8_t type;
  59. uint8_t length;
  60. struct dvb_desc *next;
  61. unsigned char language[4];
  62. char *name;
  63. char *name_emph;
  64. char *text;
  65. char *text_emph;
  66. } __attribute__((packed));
  67. struct dvb_v5_fe_parms;
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71. /**
  72. * @brief Initializes and parses the short event 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 allocates a the descriptor and fills the fields inside
  80. * the struct. It also makes sure that all fields will follow the CPU
  81. * endianness. Due to that, the content of the buffer may change.
  82. *
  83. * @return On success, it returns the size of the allocated struct.
  84. * A negative value indicates an error.
  85. */
  86. int dvb_desc_event_short_init(struct dvb_v5_fe_parms *parms,
  87. const uint8_t *buf, struct dvb_desc *desc);
  88. /**
  89. * @brief Prints the content of the short event descriptor
  90. * @ingroup descriptors
  91. *
  92. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  93. * @param desc pointer to struct dvb_desc
  94. */
  95. void dvb_desc_event_short_print(struct dvb_v5_fe_parms *parms,
  96. const struct dvb_desc *desc);
  97. /**
  98. * @brief Frees all data allocated by the short event descriptor
  99. * @ingroup descriptors
  100. *
  101. * @param desc pointer to struct dvb_desc to be freed
  102. */
  103. void dvb_desc_event_short_free(struct dvb_desc *desc);
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif