al_teletext.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. /**
  2. * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
  3. *
  4. * @file
  5. *
  6. * @brief this file defines teletext interface for app layer.
  7. *
  8. * The file supports the teletext functions by used for app layer, and the datas related
  9. * teletext functions are "EBU teletext" datas. "EBU teletext" datas includes teletext
  10. * subtitles, since these are carried on a particular teletext magazine/page. So the
  11. * function in the file includes teletext subtitle function.
  12. *
  13. */
  14. #ifndef __AL_TELETEXT_H__
  15. #define __AL_TELETEXT_H__
  16. #include "al_basictypes.h"
  17. //#include "region.h"
  18. #ifdef __cplusplus
  19. extern "C"{
  20. #endif
  21. //#ifdef CONFIG_SUPPORT_TTX
  22. /**
  23. * @brief define teletext descriptor language code size.
  24. */
  25. #define LANG_CODE_SIZE (3)
  26. /**
  27. * @brief structure definition for teletext descriptor information.
  28. *
  29. * After one teletext descriptor from the PMT is parsed, the information
  30. * will be stored to teletext descriptor buffer with the structure. \n
  31. * The parsing descriptor information includes the information:
  32. * @li Pid: specify the pid of the transport stream packets which carry the
  33. * associated program element.
  34. * @li Language: contain charater language code of language of teletext.
  35. * @li Type: contain the teletext type.
  36. * @li MagazineNum: contain the teletext magazine number.
  37. * @li PageNum: contain the teletext page number.
  38. */
  39. typedef struct _AL_TTX_Desc_t
  40. {
  41. al_int id; /**< teletext id by used when play recorded file*/
  42. al_uint16 Pid; /**< teletext pid */
  43. al_uint8 Language[LANG_CODE_SIZE]; /**< teletext language */
  44. al_uint8 Type; /**< teletext type */
  45. al_uint8 MagazineNum; /**< teletext magazine number */
  46. al_uint8 PageNum; /**< teletext page number */
  47. }AL_TTX_Desc_Info_t;
  48. /**
  49. * @brief type definition for the teletext page.
  50. *
  51. * @li PageNum: teletext page number.
  52. * @li SubPageNum: teletext subpage number.
  53. */
  54. typedef struct _AL_TTX_Page_t
  55. {
  56. al_uint16 PageNum;
  57. al_uint16 SubPageNum;
  58. }AL_TTX_Page_t;
  59. /**
  60. * @brief type definition for the teletext page.
  61. *
  62. * When starting to display teletext on the screen, it needs select the displayed
  63. * teletext page type with spec.
  64. */
  65. typedef enum
  66. {
  67. AL_TTX_PAGE_TYPE_CURRENT_PAGE = 0, /**< current page type that is the last displayed page */
  68. AL_TTX_PAGE_TYPE_INITIAL_PAGE, /**< initial page type */
  69. AL_TTX_PAGE_TYPE_SUTITLE_PAGE, /**< subtitle page type */
  70. AL_TTX_PAGE_TYPE_MAX /**< invalid page type */
  71. }AL_TTX_Page_Type_t;
  72. /**
  73. * @brief type definition for the teletext descriptor.
  74. *
  75. */
  76. typedef enum
  77. {
  78. AL_TTX_DESC_TYPE = 0, /**< teletext descriptor type */
  79. AL_TTX_SUB_DESC_TYPE, /**< teletext subtitle descriptor type */
  80. AL_TTX_DESC_MAX /**< invalid descriptor type */
  81. }AL_TTX_Desc_Type_t;
  82. /**
  83. * @brief area language definition for analogue teletext.
  84. *
  85. * If the user can set the analogue teletext language on the mainmenu,
  86. * the set teletext language will be stored to EEPROM or FLASH.
  87. * If analogue teletext needs be displayed on the screen, the stored
  88. * teletext language will be set to teletext decoder module. The teletext
  89. * decoder thread starts to parse data with the set teletext language,
  90. * otherwise parse data with the initial teletext language.
  91. */
  92. typedef enum
  93. {
  94. AL_TTX_LANG_WEST_EUROPEAN = 0,/**< west european language */
  95. AL_TTX_LANG_GREEK, /**< greek language */
  96. AL_TTX_LANG_EAST_EUROPEAN, /**< east european language */
  97. AL_TTX_LANG_ARABIC, /**< arabic language */
  98. AL_TTX_LANG_CYRILLIC, /**< cyrillic language */
  99. AL_TTX_LANG_RUSSIAN, /**< russian language */
  100. AL_TTX_LANG_HEBREW, /**< hebrew language */
  101. AL_TTX_LANG_FARSI, /**< farsi language */
  102. AL_TTX_LANG_CENTRAL_EUROPEAN, /**< central language */
  103. AL_TTX_LANG_WEST_EUROPEAN_TURKISH, /**< west european turkish language */
  104. AL_TTX_LANG_RUSSIA2,
  105. AL_TTX_LANG_BYELORUSSIAN,
  106. AL_TTX_LANG_THAI,
  107. AL_TTX_LANG_MAX /**< invalid language */
  108. }AL_TTX_LANG_t;
  109. /**
  110. * @brief type definition for search page direction.
  111. *
  112. * When pressing the key to search page, it needs direct the search mode.
  113. * Then the subtitle datas from subtitle buffer are gotten with the search
  114. * mode.\n
  115. * For example, when the teletext is displaying on the screen and the search
  116. * mode is "AL_TT_DIRECTION_UP", if the user presses subtitle key, the
  117. * display mode will be changed to subtitle display mode and the subtitle
  118. * datas will be gotten by searching minimal to maximum subtitle page.
  119. */
  120. typedef enum
  121. {
  122. AL_TTX_DIRECTION_DOWN = 0, /**< down direction */
  123. AL_TTX_DIRECTION_UP, /**< up direction */
  124. AL_TTX_DIRECTION_DISP, /**< display specific page*/
  125. AL_TTX_DIRECTION_MAX /**< invalid direction */
  126. }AL_TTX_Search_Direction_t;
  127. /**
  128. * @brief type definition for teletext source.
  129. *
  130. * At present, the condition that gets the analog teletext data and the digital
  131. * teletext data is different. When teletext function starting, the different
  132. * settings are requested with different teletext sources. \n
  133. * For example: if the source type is analog source type, the interrupt
  134. * needs be enable.
  135. */
  136. typedef enum
  137. {
  138. AL_TTX_SOURCE_TYPE_DIGITAL = 0, /**< digital source type */
  139. AL_TTX_SOURCE_TYPE_ANALOG, /**< analog source type */
  140. AL_TTX_SOURCE_TYPE_MEDIA, /**< media source type */
  141. AL_TTX_SOURCE_TYPE_MAX /**< invalid source type */
  142. } AL_TTX_Source_Type_t;
  143. /**
  144. * @brief function definition for teletext key.
  145. *
  146. * When the user presses the keys of teletext, api layer will set the
  147. * involved function to decoder layer, and the teletext decoder thread
  148. * will start to parse data with the function.
  149. */
  150. typedef enum
  151. {
  152. AL_TTX_FUN_TEXT_ON_MODE = 0, /**< teletext on mode */
  153. AL_TTX_FUN_TEXT_OFF_MODE, /**< teletext off mode */
  154. AL_TTX_FUN_MIX_ON_MODE, /**< teletext mix on mode */
  155. AL_TTX_FUN_MIX_OFF_MODE, /**< teletext mix off mode */
  156. AL_TTX_FUN_REVEAL_ON_MODE, /**< teletext reveal on mode */
  157. AL_TTX_FUN_REVEAL_OFF_MODE, /**< teletext reveal off mode */
  158. AL_TTX_FUN_SUBTITLE_ON_MODE, /**< teletext subtitle on mode */
  159. AL_TTX_FUN_SUBTITLE_OFF_MODE, /**< teletext subtitle off mode */
  160. AL_TTX_FUN_SIZE_UP, /**< teletext top size mode */
  161. AL_TTX_FUN_SIZE_DOWN, /**< teletext bottom size mode */
  162. AL_TTX_FUN_SIZE_LEFT, /**< teletext TAP mode */
  163. AL_TTX_FUN_SIZE_RIGHT, /**< teletext PAT mode */
  164. AL_TTX_FUN_SIZE_RIGHT_UP, /**< teletext PAT and top size mode */
  165. AL_TTX_FUN_SIZE_RIGHT_DOWN, /**< teletext PAT and bottom size mode */
  166. AL_TTX_FUN_SIZE_NORMAL, /**< teletext normal mode */
  167. AL_TTX_FUN_HOLD_ON, /**< teletext hold on mode */
  168. AL_TTX_FUN_HOLD_OFF, /**< teletext hold off mode */
  169. AL_TTX_FUN_CONCEAL_ON, /**< teletext conceal on mode */
  170. AL_TTX_FUN_CONCEAL_OFF, /**< teletext conceal off mode */
  171. AL_TTX_FUN_SUBTITLE_CONCEAL_ON, /**< teletext subtitle conceal on mode */
  172. AL_TTX_FUN_SUBTITLE_CONCEAL_OFF, /**< teletext subtitle conceal off mode */
  173. AL_TTX_FUN_RED, /**< teletext red key being operated mode */
  174. AL_TTX_FUN_GREEN, /**< teletext green key being operated mode */
  175. AL_TTX_FUN_YELLOW, /**< teletext yellow key being operated mode */
  176. AL_TTX_FUN_BLUE, /**< teletext blue key being operated mode */
  177. AL_TTX_FUN_INDEX, /**< teletext index mode */
  178. AL_TTX_FUN_SUBCODE_MENU_ON, /**< teletext subcode menu on mode */
  179. AL_TTX_FUN_SUBCODE_MENU_OFF, /**< teletext subcode menu off mode */
  180. AL_TTX_FUN_PAGE_UP, /**< teletext page up mode */
  181. AL_TTX_FUN_PAGE_DOWN, /**< teletext page down mode */
  182. AL_TTX_FUN_SUBCODE_PAGE_UP, /**< teletext subpage up mode */
  183. AL_TTX_FUN_SUBCODE_PAGE_DOWN, /**< teletext subpage down mode */
  184. AL_TTX_FUN_LIKE_PAGE_ON, /**< teletext like page on mode */
  185. AL_TTX_FUN_LIKE_PAGE_OFF, /**< teletext like page off mode */
  186. AL_TTX_FUN_TOP_ON_MODE, /**< teletext TOP on mode */
  187. AL_TTX_FUN_TOP_OFF_MODE,/**< teletext TOP off mode */
  188. AL_TTX_FUN_MAX /**< invalid function */
  189. }AL_TTX_FUNC_t;
  190. /**
  191. * @brief select the teletext data type for gotten the teletext data.
  192. */
  193. typedef enum
  194. {
  195. AL_TTX_DEMUX_CHAN = 0, /**< data comes from demux channel for TS */
  196. AL_TTX_PE_CHAN, /**< data comes from PE channel for recorded TS */
  197. AL_TTX_MAX /**<invalid data source */
  198. }AL_TTX_Data_Source_t;
  199. /**
  200. * @brief teletext start function.
  201. *
  202. * The function will create teletext decoder thread, and init slicer
  203. * param. If the teletext type is analogue teletext, the interrupt function will be enable.
  204. * The channel of teletext will be opened with teletext pid and the parsing task will start
  205. * to decode teletext page.
  206. *
  207. * @param SourceTyped teletext source type.
  208. *
  209. * @param DigitialLang digitial TTX language gotten from eeprom/flash if user setting
  210. * on the main menu.
  211. *
  212. * @param TTXLang teletext language type.
  213. *
  214. * @return AL_SUCCESS if starting is successful, AL_FAILURE
  215. * otherwise.
  216. */
  217. AL_Return_t AL_TTX_Start(AL_TTX_Source_Type_t SourceType, al_uint8 *TTXLanguage);
  218. /**
  219. * @brief teletext stop function.
  220. *
  221. * The function will suspend teletext decoder thread, reset slicer
  222. * function. If the teletext type is analogue teletext, the interrupt
  223. * function will be disable.
  224. *
  225. * @param al_void.
  226. *
  227. * @return AL_SUCCESS if stopping is successful, AL_FAILURE otherwise.
  228. */
  229. AL_Return_t AL_TTX_Stop(al_void);
  230. /**
  231. * @brief the function will reset teletext module, following initialization
  232. * or a programe change.
  233. *
  234. * @param void.
  235. *
  236. * @return AL_SUCCESS if reseting is successful, AL_FAILURE
  237. * therwise.
  238. */
  239. AL_Return_t AL_TTX_Reset(al_void);
  240. /**
  241. * @brief the function will get teletext subtitle being exist or not.
  242. *
  243. * @param al_void.
  244. *
  245. * @return AL_SUCCESS if teletext subtitle is exist , AL_FAILURE
  246. * otherwise.
  247. */
  248. AL_Return_t AL_TTX_SubtitleExistStatus(al_void);
  249. /**
  250. * @brief the function will set key functions.
  251. *
  252. * If the user presses keys of teletext, the function wil be used for setting
  253. * key function to middleware layer.
  254. *
  255. * @param KeyFun the functions can be set by the user pressing key.
  256. *
  257. * @return AL_SUCCESS if setting key function is successful, AL_FAILURE
  258. * otherwise.
  259. */
  260. AL_Return_t AL_TTX_SetKeyFunc(AL_TTX_FUNC_t KeyFun);
  261. /**
  262. * @brief search subtitle page function.
  263. *
  264. * When starting to display subtitle on the screen with pressing subtitle key,
  265. * it needs direct the search mode.
  266. * For example: when the teletext is displaying on the screen and the search
  267. * mode is "AL_TT_DIRECTION_UP", if the user presses subtitle key, the
  268. * display mode will be changed to subtitle mode and the subtitle data
  269. * will be gotten by searching minimal to maximum subtitle page.
  270. *
  271. * @param Direct the search mode.
  272. * @param *DisplayPage
  273. * when mode is AL_TTX_DIRECTION_DISP, DisplayPage is page number by user.
  274. * otherwise gotten current display teletext subtitle page number.
  275. *
  276. * @return AL_SUCCESS if searching subtitle page is successful, AL_FAILURE
  277. * otherwise.
  278. */
  279. AL_Return_t AL_TTX_SearchSubtitlePage(AL_TTX_Search_Direction_t Direct, AL_TTX_Page_t *DisplayPage);
  280. /**
  281. * @brief set digital entry function.
  282. *
  283. * If the user presses the "0-9" keys while teletext is displaying on the screen,
  284. * displayed teletext page number will be changed to the number by user setting.
  285. *
  286. * @param DigitalEntry the "0-9" keys.
  287. *
  288. * @return AL_SUCCESS if setting digital entry is successful, AL_FAILURE otherwise.
  289. */
  290. AL_Return_t AL_TTX_SetDigitalEntry(al_uint8 DigitalEntry);
  291. /**
  292. * @brief set analog teletext language function.
  293. *
  294. * If the user can set analogue teletext language on the mainmenu, the set
  295. * teletext language will be stored to EEPROM or FLASH. If analogue teletext
  296. * needs be displayed on the screen, the stored analogue teletext language will
  297. * be set to teletext decoder module. The teletext decoder thread
  298. * starts to parse data with the set analogue teletext language, otherwise parse
  299. * data with the initial analogue teletext language.
  300. *
  301. * @param TeletextLang set analog teletext language.
  302. *
  303. * @return AL_SUCCESS if setting language is successful, AL_FAILURE otherwise.
  304. */
  305. AL_Return_t AL_TTX_SetLanguage(AL_TTX_LANG_t TeletextLang);
  306. /**
  307. * @brief the function will get teletext data being valid or not.
  308. *
  309. * Before teletext parsing, teletext needs be preparsing. If gotten datas
  310. * are some errors, the datas with preparsing don't be stored
  311. * to cache buffer, and the teletext function of sysapp layer don't work.
  312. *
  313. * @param *Status gotten the signal status value. if the preparsing is
  314. * successful, the gotten signal status is al_true, else if the preparsing
  315. * is false, the gotten signal status is al_false.
  316. *
  317. * @return AL_SUCCESS if gotten signal is successful, AL_FAILURE
  318. * therwise.
  319. */
  320. AL_Return_t AL_TTX_GetSignalStatus(al_bool *Status);
  321. /**
  322. * @brief the function can get the parsed teletext descriptor information.
  323. *
  324. * After creating subtitle menu with pressing subtitle key, the subtitle menu
  325. * with all subtitle types is shown on the screen. So when displayed information
  326. * is inited, the parsed teletext subtitle descriptor information will be gotten.
  327. *
  328. * @param TTXDescType teletext descriptor type.
  329. *
  330. * @param Index using the index can get special teletext subtitle descriptor information
  331. * from the buffer.
  332. *
  333. * @param *TeletextDescInfo it will store the gotten teletext subtitle descriptor
  334. * information.
  335. *
  336. * @return AL_SUCCESS if getting teletext subtitle descriptor information is successful,
  337. * AL_FAILURE otherwise.
  338. */
  339. AL_Return_t AL_TTX_GetDescInfo(AL_TTX_Desc_Type_t TTXDescType, al_int Index, AL_TTX_Desc_Info_t *TTXDescInfo);
  340. /**
  341. * @brief the function can get file ts teletext information from pe module
  342. *
  343. * when play recorded file, if need to display teletext on the screen, the file ts
  344. * teletext information need to be gotten from pe module.
  345. *
  346. * @param al_void.
  347. *
  348. * @return AL_SUCCESS if getting file ts teletext information is successful,
  349. * AL_FAILURE otherwise.
  350. */
  351. AL_Return_t AL_TTX_GetFileTsTTXInfo(al_void);
  352. /**
  353. * @brief the function can get the valid teletext or teletext subtitle descriptor total number.
  354. *
  355. * Before the teletext subtitle module starts to work, it needs get the subtitle descpritor
  356. * total number. If the total number is more than 0, the subtitle module will start
  357. * to work, otherwise stop to work.
  358. *
  359. * @param TTXDescType teletext descriptor type.
  360. *
  361. * @param *GetTotalNum get the teletext or teletext subtitle descriptor total number.
  362. *
  363. * @return AL_SUCCESS if getting total number is successful,
  364. * AL_FAILURE otherwise.
  365. */
  366. AL_Return_t AL_TTX_GetTotalNum(AL_TTX_Desc_Type_t TTXDescType, al_uint32 *GetTotalNum);
  367. /**
  368. * @brief get TTX time data
  369. *
  370. * @param buff: data buffer
  371. *
  372. * @param buff_size: buffer size
  373. *
  374. * @return AL_SUCCESS if getting time string is successful,
  375. * AL_FAILURE otherwise.
  376. */
  377. AL_Return_t AI_TTX_GetTimeData(al_uint8 *buff, al_uint8 buff_size);
  378. /**
  379. * @brief refresh page
  380. *
  381. * @param al_void.
  382. *
  383. * @return AL_SUCCESS if refresh page successful,
  384. * AL_FAILURE otherwise.
  385. */
  386. AL_Return_t AL_TTX_RefreshPage(al_void);
  387. //#endif
  388. #ifdef __cplusplus
  389. }
  390. #endif
  391. #endif