al_parent_control.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /**
  2. * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
  3. *
  4. * @file al_parent_control.h
  5. *
  6. * @brief this file defines atsc parent control api for up layer.
  7. *
  8. *
  9. * 1.This file not dispose RRT, because for RRT rating only support TV-Rating/MPAA static rating information.
  10. * 2.This file store DRRT information to cash for application get and set.
  11. * 3.This file provide check content advisory descriptor for current program and user setting rating value.
  12. */
  13. #ifndef __AL_PARENT_CONTROL_H__
  14. #define __AL_PARENT_CONTROL_H__
  15. #include "al_basictypes.h"
  16. #ifdef CONFIG_ATSC_SYSTEM
  17. #include "psip.h"
  18. #include "psip_dr.h"
  19. #endif
  20. #define MAX_DIMENNAME_LEN (20*2+1)
  21. #define MAX_RATINGNAME_LEN (8*2+1)
  22. #define MAX_RATING_DIM (20)
  23. #define MAX_NUM_OF_RATINGS (15)
  24. typedef enum
  25. {
  26. AL_PC_REG_NONE = 0,
  27. AL_PC_REG_USA,
  28. AL_PC_REG_CANADA,
  29. AL_PC_REG_TAIWAN,
  30. AL_PC_REG_KOREA,
  31. AL_PC_REG_DRRT
  32. } AL_PC_region_list_t;
  33. typedef enum
  34. {
  35. AL_PC_PRESET_OFF,
  36. AL_PC_PRESET_CHILD,
  37. AL_PC_PRESET_YOUTH,
  38. AL_PC_PRESET_ADULT,
  39. AL_PC_PRESET_CUSTOM
  40. } AL_PC_preset_mode_t;
  41. typedef enum
  42. {
  43. AL_PC_TV_Y_NULL,
  44. AL_PC_TV_Y,
  45. AL_PC_TV_Y7,
  46. AL_PC_TV_Y7_FV
  47. } AL_PC_us_child_t;
  48. typedef enum
  49. {
  50. AL_PC_TV_NULL,
  51. AL_PC_TV_G,
  52. AL_PC_TV_PG,
  53. AL_PC_TV_14,
  54. AL_PC_TV_MA,
  55. } AL_PC_us_tv_t;
  56. typedef enum
  57. {
  58. AL_PC_VIO_NULL,
  59. AL_PC_VIO_PG,
  60. AL_PC_VIO_14,
  61. AL_PC_VIO_MA,
  62. } AL_PC_us_vio_t;
  63. typedef enum
  64. {
  65. AL_PC_SEX_NULL,
  66. AL_PC_SEX_PG,
  67. AL_PC_SEX_14,
  68. AL_PC_SEX_MA,
  69. } AL_PC_us_sex_t;
  70. typedef enum
  71. {
  72. AL_PC_LAN_NULL,
  73. AL_PC_LAN_PG,
  74. AL_PC_LAN_14,
  75. AL_PC_LAN_MA,
  76. } AL_PC_us_lan_t;
  77. typedef enum
  78. {
  79. AL_PC_DIA_NULL,
  80. AL_PC_DIA_PG,
  81. AL_PC_DIA_14,
  82. AL_PC_DIA_NA,
  83. } AL_PC_us_dia_t;
  84. typedef enum
  85. {
  86. AL_PC_MPAA_NULL,
  87. AL_PC_MPAA_NA,
  88. AL_PC_MPAA_G,
  89. AL_PC_MPAA_PG,
  90. AL_PC_MPAA_PG_13,
  91. AL_PC_MPAA_R,
  92. AL_PC_MPAA_NC_17,
  93. AL_PC_MPAA_X,
  94. AL_PC_MPAA_NR,
  95. } AL_PC_us_mpaa_t;
  96. typedef enum
  97. {
  98. /* ADD FOR NULL */
  99. AL_PC_ENG_NULL = 0,
  100. AL_PC_ENG_EXEMPT = 0x8,
  101. AL_PC_ENG_CHILD = 0x1,
  102. AL_PC_ENG_8_P = 0x2,
  103. AL_PC_ENG_GENERAL = 0x3,
  104. AL_PC_ENG_PG = 0x4,
  105. AL_PC_ENG_14 = 0x5,
  106. AL_PC_ENG_18 = 0x6,
  107. } AL_PC_can_eng_t;
  108. typedef enum
  109. {
  110. /* ADD FOR NULL */
  111. AL_PC_FRA_NULL = 0,
  112. AL_PC_FRA_EXEMPT = 0x8,
  113. AL_PC_FRA_ALL = 0x1,
  114. AL_PC_FRA_8_P = 0x2,
  115. AL_PC_FRA_13 = 0x3,
  116. AL_PC_FRA_16 = 0x4,
  117. AL_PC_FRA_18 = 0x5,
  118. } AL_PC_can_fra_t;
  119. typedef struct
  120. {
  121. AL_PC_us_tv_t us_tv;
  122. AL_PC_us_dia_t us_dia;
  123. AL_PC_us_lan_t us_lan;
  124. AL_PC_us_sex_t us_sex;
  125. AL_PC_us_vio_t us_vio;
  126. AL_PC_us_child_t us_child;
  127. AL_PC_us_mpaa_t us_mpaa;
  128. } AL_PC_us_rat_t;
  129. #if 0
  130. typedef enum
  131. {
  132. AL_PC_US_TV = 0x10,
  133. AL_PC_US_DIA = 0x20,
  134. AL_PC_US_LAN = 0x30,
  135. AL_PC_US_SEX = 0x40,
  136. AL_PC_US_VIO = 0x50,
  137. AL_PC_US_CHILD = 0x60,
  138. AL_PC_US_MPAA = 0x70,
  139. AL_PC_CAN_ENG = 0x80,
  140. AL_PC_CAN_FRA = 0x90,
  141. } AL_PC_dimen_all_t;
  142. #else
  143. typedef enum
  144. {
  145. AL_PC_US_TV = 1<<4,
  146. AL_PC_US_DIA = 1<<5,
  147. AL_PC_US_LAN = 1<<6,
  148. AL_PC_US_SEX = 1<<7,
  149. AL_PC_US_VIO = 1<<8,
  150. AL_PC_US_CHILD = 1<<9,
  151. AL_PC_US_MPAA = 1<<10,
  152. AL_PC_CAN_ENG = 1<<11,
  153. AL_PC_CAN_FRA = 1<<12,
  154. } AL_PC_dimen_all_t;
  155. #endif
  156. typedef struct
  157. {
  158. AL_PC_can_eng_t can_eng;
  159. AL_PC_can_fra_t can_fra;
  160. } AL_PC_can_rat_t;
  161. typedef struct
  162. {
  163. AL_PC_region_list_t region;
  164. struct
  165. {
  166. AL_PC_us_rat_t us_mem;
  167. AL_PC_can_rat_t can_mem;
  168. };
  169. } AL_PC_dime_t;
  170. /**
  171. * @brief It defines the maximum dimension, it depends on settings in middleware.
  172. */
  173. #define AL_PARENTCONTROL_MAX_DIM (MAX_RATING_DIM)
  174. /**
  175. * @brief It defines the maximum rating, it depends on settings in middleware.
  176. */
  177. #define AL_PARENTCONTROL_MAX_RATING (MAX_NUM_OF_RATINGS)
  178. /**
  179. * @brief It keeps the UI status from UI.
  180. */
  181. typedef struct
  182. {
  183. /**< store all dimension's all rating value setting, one bit store one rating value setting, al_true: set/al_false: not set */
  184. al_uint8 u8aDrrtUserPerference[AL_PARENTCONTROL_MAX_DIM][(AL_PARENTCONTROL_MAX_RATING+7)/8];
  185. } AL_PC_DimenUserSet_t;
  186. /**
  187. * @brief get dimension details
  188. *
  189. * @param pstDime[output] pointer to the demension data.
  190. *
  191. * @return AL_SUCCESS if get demension success, AL_FAILURE otherwise.
  192. */
  193. AL_Return_t AL_PC_GetRating(AL_PC_dime_t *pstDime);
  194. /**
  195. * @brief API to Encode User Set Rating level
  196. *
  197. * @param pc_app[output] the demension data.
  198. *
  199. * @param RatingDime[input] specify which dimension
  200. *
  201. * @param DimeValue[input]demension value
  202. *
  203. * @Lock[input] al_true if locked, al_false if unlocked.
  204. *
  205. * @return AL_SUCCESS if encode success, AL_FAILURE otherwise.
  206. */
  207. AL_Return_t AL_PC_SetRating(AL_PC_dime_t *pc_app, AL_PC_dimen_all_t RatingDime,
  208. al_uint8 DimeValue, al_bool Lock);
  209. /**
  210. * @brief API to store User Set Rating level to flash
  211. *
  212. * @param pststDime[iutput] the demension data.
  213. *
  214. * @return AL_SUCCESS if encode success, AL_FAILURE otherwise.
  215. */
  216. AL_Return_t AL_PC_StoreRating(AL_PC_dime_t *pststDime);
  217. al_uint32 AL_PC_GetCurrRatingDimen(void);
  218. al_uint32 AL_PC_GetOriginalRatingDimen(void);
  219. #ifdef CONFIG_ATSC_SYSTEM
  220. /**
  221. * @brief get dimension number from DRRT information.
  222. *
  223. * @param pDimenNum[output] dimension total number.
  224. *
  225. * @return AL_SUCCESS if get dimension number success, AL_FAILURE otherwise.
  226. */
  227. AL_Return_t AL_PC_GetDRRTDimenNum(al_uint8 *pDimenNum);
  228. /**
  229. * @brief get one dimension information of Dimenindex.
  230. *
  231. * @param DimenIndex[input] dimension index.
  232. *
  233. * @param pGradScale[output] the garduated scale of the dimension of dimension index.
  234. *
  235. * @param pDimenName[output] the dimension name of the dimension of dimension index.
  236. *
  237. * @param pDimenNameLen[output] the dimension name length of the dimension of dimension index.
  238. *
  239. * @param pRatingNum[output] the rating value total number of the dimension of dimension index.
  240. *
  241. * @return AL_SUCCESS if get dimension information success, AL_FAILURE otherwise.
  242. */
  243. AL_Return_t AL_PC_GetDRRTDimenInfo(al_uint8 DimenIndex,
  244. al_bool *pGradScale, al_uint8 *pDimenName, al_uint8 *pDimenNameLen, al_uint8 *pRatingNum);
  245. /**
  246. * @brief get one rating value information of Dimenindex and rating index.
  247. *
  248. * @param DimenIndex[input] dimension index.
  249. *
  250. * @param RatingIndex[input] the rating index of the dimension of dimension index.
  251. *
  252. * @param pRatingName[output] the rating name of the rating of dimension index and rating index.
  253. *
  254. * @param pRatingNamLen[output] the rating name length of the rating of dimension index and rating index.
  255. *
  256. * @return AL_SUCCESS if get rating information success, AL_FAILURE otherwise.
  257. */
  258. AL_Return_t AL_PC_GetDRRTRatingInfo(al_uint8 DimenIndex,
  259. al_uint8 RatingIndex, al_uint8 *pRatingName, al_uint8 *pRatingNamLen);
  260. /**
  261. * @brief Set the lock flag for dimension index and rating index form user setting valuses.
  262. *
  263. * @param DrrtUserSeting[output] user setting valuses.
  264. *
  265. * @param DimenIndex[input] the dimension index
  266. *
  267. * @param RatingIndex[input] the rating index of the dimension of dimension index.
  268. *
  269. * @param bLock[input] the lock flag of the rating of dimension index and rating index.
  270. *
  271. * @return AL_SUCCESS if get demension success, AL_FAILURE otherwise.
  272. */
  273. AL_Return_t AL_PC_SetDRRTRatingLock(AL_PC_DimenUserSet_t *pDimenUserSeting,
  274. al_uint8 DimenIndex, al_uint8 RatingIndex, al_bool bLock);
  275. /**
  276. * @brief Get the lock flag for dimension index and rating index form user setting valuses.
  277. *
  278. * @param DrrtUserSeting[input] user setting valuses.
  279. *
  280. * @param DimenIndex[input] the dimension index
  281. *
  282. * @param RatingIndex[input] the rating index of the dimension of dimension index.
  283. *
  284. * @param bLock[output] the lock flag of the rating of dimension index and rating index.
  285. *
  286. * @return AL_SUCCESS if get demension success, AL_FAILURE otherwise.
  287. */
  288. AL_Return_t AL_PC_GetDRRTRatingLock(AL_PC_DimenUserSet_t DrrtUserSeting,
  289. al_uint8 DimenIndex, al_uint8 RatingIndex, al_bool *bLock);
  290. #endif
  291. AL_Return_t AL_PC_Reset(al_void);
  292. #ifdef CONFIG_ATSC_SYSTEM
  293. /**
  294. * @brief check rating value according to current program's content advisory descriptor.
  295. *
  296. * @param pstContentAdvDesc[input] the content advisory descriptor of current program.
  297. *
  298. * @param bLocked[output] geted lock state.
  299. *
  300. * @return AL_SUCCESS check rating successed, other value check rating failed.
  301. */
  302. AL_Return_t AL_PC_CheckRating(ContentAdvDesc_t *pstContentAdvDesc, al_bool *bLocked);
  303. #endif
  304. #endif