gst-atsc-section.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /*
  2. * mpegtspacketizer.h -
  3. * Copyright (C) 2013 Edward Hervey
  4. *
  5. * Authors:
  6. * Edward Hervey <[email protected]>
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Library General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Library General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public
  19. * License along with this library; if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  21. * Boston, MA 02110-1301, USA.
  22. */
  23. #ifndef GST_ATSC_SECTION_H
  24. #define GST_ATSC_SECTION_H
  25. #include <gst/gst.h>
  26. #include <gst/mpegts/gstmpegtssection.h>
  27. #include <gst/mpegts/gstmpegtsdescriptor.h>
  28. G_BEGIN_DECLS
  29. /**
  30. * GstMpegtsSectionATSCTableID:
  31. *
  32. * Values for a #GstMpegtsSection table_id.
  33. *
  34. * These are the registered ATSC table_id variants.
  35. *
  36. * see also: #GstMpegtsSectionTableID
  37. */
  38. typedef enum {
  39. /* ATSC (A/65) */
  40. GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE = 0xC7,
  41. GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL = 0xC8,
  42. GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL = 0xC9,
  43. GST_MTS_TABLE_ID_ATSC_RATING_REGION = 0xCA,
  44. GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION = 0xCB,
  45. GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT = 0xCC,
  46. GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME = 0xCD,
  47. /* ATSC (A/90) */
  48. GST_MTS_TABLE_ID_ATSC_DATA_EVENT = 0xCE,
  49. GST_MTS_TABLE_ID_ATSC_DATA_SERVICE = 0xCF,
  50. /* 0xD0 ?? */
  51. GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE = 0xD1,
  52. GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE = 0xD2,
  53. GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE = 0xD3,
  54. GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE = 0xD4,
  55. /* 0xD5 ?? */
  56. GST_MTS_TABLE_ID_ATSC_AGGREGATE_EVENT_INFORMATION = 0xD6,
  57. GST_MTS_TABLE_ID_ATSC_AGGREGATE_EXTENDED_TEXT = 0xD7,
  58. /* 0xD8 ?? */
  59. GST_MTS_TABLE_ID_ATSC_AGGREGATE_DATA_EVENT = 0xD9,
  60. GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL = 0xDA,
  61. } GstMpegtsSectionATSCTableID;
  62. /* TVCT/CVCT */
  63. #define GST_TYPE_MPEGTS_ATSC_VCT (gst_mpegts_atsc_vct_get_type ())
  64. #define GST_TYPE_MPEGTS_ATSC_VCT_SOURCE (gst_mpegts_atsc_vct_source_get_type ())
  65. typedef struct _GstMpegtsAtscVCTSource GstMpegtsAtscVCTSource;
  66. typedef struct _GstMpegtsAtscVCT GstMpegtsAtscVCT;
  67. /**
  68. * GstMpegtsAtscVCTSource:
  69. * @descriptors: (element-type GstMpegtsDescriptor): descriptors
  70. *
  71. * Source from a @GstMpegtsAtscVCT, can be used both for TVCT and CVCT tables
  72. */
  73. struct _GstMpegtsAtscVCTSource
  74. {
  75. gchar *short_name;
  76. guint16 major_channel_number;
  77. guint16 minor_channel_number;
  78. guint8 modulation_mode;
  79. guint32 carrier_frequency;
  80. guint16 channel_TSID;
  81. guint16 program_number;
  82. /* FIXME: */
  83. guint8 ETM_location;
  84. gboolean access_controlled;
  85. gboolean hidden;
  86. gboolean path_select; /* CVCT only - reserved bit in TVCT */
  87. gboolean out_of_band; /* CVCT only - reserved bit in TVCT */
  88. gboolean hide_guide;
  89. /* FIXME: */
  90. guint8 service_type;
  91. guint16 source_id;
  92. GPtrArray *descriptors;
  93. };
  94. /**
  95. * GstMpegtsAtscVCT:
  96. * @sources: (element-type GstMpegtsAtscVCTSource): sources
  97. * @descriptors: (element-type GstMpegtsDescriptor): descriptors
  98. *
  99. * Represents both:
  100. * Terrestrial Virtual Channel Table (A65)
  101. * Cable Virtual Channel Table (A65)
  102. *
  103. */
  104. struct _GstMpegtsAtscVCT
  105. {
  106. guint16 transport_stream_id;
  107. guint8 protocol_version;
  108. GPtrArray *sources;
  109. GPtrArray *descriptors;
  110. };
  111. GType gst_mpegts_atsc_vct_get_type (void);
  112. GType gst_mpegts_atsc_vct_source_get_type (void);
  113. const GstMpegtsAtscVCT * gst_mpegts_section_get_atsc_tvct (GstMpegtsSection * section);
  114. const GstMpegtsAtscVCT * gst_mpegts_section_get_atsc_cvct (GstMpegtsSection * section);
  115. /* MGT */
  116. #define GST_TYPE_MPEGTS_ATSC_MGT (gst_mpegts_atsc_mgt_get_type ())
  117. #define GST_TYPE_MPEGTS_ATSC_MGT_TABLE (gst_mpegts_atsc_mgt_table_get_type ())
  118. typedef struct _GstMpegtsAtscMGTTable GstMpegtsAtscMGTTable;
  119. typedef struct _GstMpegtsAtscMGT GstMpegtsAtscMGT;
  120. typedef enum {
  121. GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT0 = 0x0100,
  122. GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT127 = 0x017F,
  123. GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT0 = 0x0200,
  124. GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT127 = 0x027F
  125. } GstMpegtsAtscMGTTableType;
  126. /**
  127. * GstMpegtsAtscMGTTable:
  128. * @descriptors: (element-type GstMpegtsDescriptor): descriptors
  129. *
  130. * Source from a @GstMpegtsAtscMGT
  131. */
  132. struct _GstMpegtsAtscMGTTable
  133. {
  134. guint16 table_type;
  135. guint16 pid;
  136. guint8 version_number;
  137. guint32 number_bytes;
  138. GPtrArray *descriptors;
  139. };
  140. /**
  141. * GstMpegtsAtscMGT:
  142. * @tables: (element-type GstMpegtsAtscMGTTable): the tables
  143. * @descriptors: (element-type GstMpegtsDescriptor): descriptors
  144. *
  145. * Master Guide Table (A65)
  146. *
  147. */
  148. struct _GstMpegtsAtscMGT
  149. {
  150. guint8 protocol_version;
  151. guint16 tables_defined;
  152. GPtrArray *tables;
  153. GPtrArray *descriptors;
  154. };
  155. GType gst_mpegts_atsc_mgt_get_type (void);
  156. GType gst_mpegts_atsc_mgt_table_get_type (void);
  157. const GstMpegtsAtscMGT * gst_mpegts_section_get_atsc_mgt (GstMpegtsSection * section);
  158. /* Multiple string structure (used in ETT and EIT */
  159. #define GST_TYPE_MPEGTS_ATSC_STRING_SEGMENT (gst_mpegts_atsc_string_segment_get_type())
  160. #define GST_TYPE_MPEGTS_ATSC_MULT_STRING (gst_mpegts_atsc_mult_string_get_type())
  161. typedef struct _GstMpegtsAtscStringSegment GstMpegtsAtscStringSegment;
  162. typedef struct _GstMpegtsAtscMultString GstMpegtsAtscMultString;
  163. struct _GstMpegtsAtscStringSegment {
  164. guint8 compression_type;
  165. guint8 mode;
  166. guint8 compressed_data_size;
  167. guint8 *compressed_data;
  168. gchar *cached_string;
  169. };
  170. const gchar * gst_mpegts_atsc_string_segment_get_string (GstMpegtsAtscStringSegment * seg);
  171. /**
  172. * GstMpegtsAtscMultString:
  173. * @segments: (element-type GstMpegtsAtscStringSegment)
  174. *
  175. */
  176. struct _GstMpegtsAtscMultString {
  177. gchar iso_639_langcode[4];
  178. GPtrArray *segments;
  179. };
  180. GType gst_mpegts_atsc_string_segment_get_type (void);
  181. GType gst_mpegts_atsc_mult_string_get_type (void);
  182. /* EIT */
  183. #define GST_TYPE_MPEGTS_ATSC_EIT_EVENT (gst_mpegts_atsc_eit_event_get_type())
  184. #define GST_TYPE_MPEGTS_ATSC_EIT (gst_mpegts_atsc_eit_get_type())
  185. typedef struct _GstMpegtsAtscEITEvent GstMpegtsAtscEITEvent;
  186. typedef struct _GstMpegtsAtscEIT GstMpegtsAtscEIT;
  187. /**
  188. * GstMpegtsAtscEITEvent:
  189. * @titles: (element-type GstMpegtsAtscMultString): the titles
  190. * @descriptors: (element-type GstMpegtsDescriptor): descriptors
  191. *
  192. * An ATSC EIT Event
  193. */
  194. struct _GstMpegtsAtscEITEvent {
  195. guint16 event_id;
  196. guint32 start_time;
  197. guint8 etm_location;
  198. guint32 length_in_seconds;
  199. GPtrArray *titles;
  200. GPtrArray *descriptors;
  201. };
  202. /**
  203. * GstMpegtsAtscEIT:
  204. * @events: (element-type GstMpegtsAtscEITEvent): Events
  205. *
  206. * Event Information Table (ATSC)
  207. *
  208. */
  209. struct _GstMpegtsAtscEIT
  210. {
  211. guint16 source_id;
  212. guint8 protocol_version;
  213. GPtrArray *events;
  214. };
  215. GType gst_mpegts_atsc_eit_event_get_type (void);
  216. GType gst_mpegts_atsc_eit_get_type (void);
  217. const GstMpegtsAtscEIT *gst_mpegts_section_get_atsc_eit (GstMpegtsSection *section);
  218. /* ETT */
  219. #define GST_TYPE_MPEGTS_ATSC_ETT (gst_mpegts_atsc_ett_get_type())
  220. typedef struct _GstMpegtsAtscETT GstMpegtsAtscETT;
  221. /**
  222. * GstMpegtsAtscETT:
  223. * @messages: (element-type GstMpegtsAtscMultString): List of texts
  224. *
  225. * Extended Text Table (ATSC)
  226. *
  227. */
  228. struct _GstMpegtsAtscETT
  229. {
  230. guint16 ett_table_id_extension;
  231. guint16 protocol_version;
  232. guint32 etm_id;
  233. GPtrArray *messages;
  234. };
  235. GType gst_mpegts_atsc_ett_get_type (void);
  236. const GstMpegtsAtscETT *gst_mpegts_section_get_atsc_ett (GstMpegtsSection *section);
  237. /* STT */
  238. #define GST_TYPE_MPEGTS_ATSC_STT (gst_mpegts_atsc_stt_get_type ())
  239. typedef struct _GstMpegtsAtscSTT GstMpegtsAtscSTT;
  240. /**
  241. * GstMpegtsAtscSTT:
  242. * @descriptors: (element-type GstMpegtsDescriptor): descriptors
  243. *
  244. * System Time Table (A65)
  245. *
  246. */
  247. struct _GstMpegtsAtscSTT
  248. {
  249. guint8 protocol_version;
  250. guint32 system_time;
  251. guint8 gps_utc_offset;
  252. gboolean ds_status;
  253. guint8 ds_dayofmonth;
  254. guint8 ds_hour;
  255. GPtrArray *descriptors;
  256. GstDateTime *utc_datetime;
  257. };
  258. GType gst_mpegts_atsc_stt_get_type (void);
  259. const GstMpegtsAtscSTT * gst_mpegts_section_get_atsc_stt (GstMpegtsSection * section);
  260. /* FIXME receive a non-const parameter but we only provide a const getter */
  261. GstDateTime * gst_mpegts_atsc_stt_get_datetime_utc (GstMpegtsAtscSTT * stt);
  262. G_END_DECLS
  263. #endif /* GST_MPEGTS_SECTION_H */