section.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * section and descriptor parser
  3. *
  4. * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
  5. * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  20. */
  21. #include <libucsi/section.h>
  22. #include <libucsi/atsc/mgt_section.h>
  23. #include <libucsi/atsc/tvct_section.h>
  24. #include <libucsi/atsc/cvct_section.h>
  25. #include <libucsi/atsc/rrt_section.h>
  26. #include <libucsi/atsc/eit_section.h>
  27. #include <libucsi/atsc/ett_section.h>
  28. #include <libucsi/atsc/stt_section.h>
  29. #include <libucsi/atsc/dcct_section.h>
  30. #include <libucsi/atsc/dccsct_section.h>
  31. #ifndef _UCSI_ATSC_SECTION_H
  32. #define _UCSI_ATSC_SECTION_H 1
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif
  37. #define ATSC_BASE_PID 0x1ffb
  38. /**
  39. * Enumeration of ATSC section tags.
  40. */
  41. enum atsc_section_tag {
  42. stag_atsc_master_guide = 0xc7,
  43. stag_atsc_terrestrial_virtual_channel = 0xc8,
  44. stag_atsc_cable_virtual_channel = 0xc9,
  45. stag_atsc_rating_region = 0xca,
  46. stag_atsc_event_information = 0xcb,
  47. stag_atsc_extended_text = 0xcc,
  48. stag_atsc_system_time = 0xcd,
  49. };
  50. /**
  51. * ATSC specific PSIP section structure.
  52. */
  53. struct atsc_section_psip {
  54. struct section_ext ext_head;
  55. uint8_t protocol_version;
  56. } __ucsi_packed;
  57. /**
  58. * Decode a PSIP section structure.
  59. *
  60. * @param section_ext Pointer to the processed section_ext structure.
  61. * @return Pointer to the parsed section_psip structure, or NULL if invalid.
  62. */
  63. static inline struct atsc_section_psip *atsc_section_psip_decode(struct section_ext *section_ext)
  64. {
  65. size_t len = section_ext_length(section_ext);
  66. if (len < sizeof(struct atsc_section_psip)) {
  67. return NULL;
  68. }
  69. return (struct atsc_section_psip *) section_ext;
  70. }
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif