ciplus_record.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #ifndef _CIPLUS_RECORD_H_
  2. #define _CIPLUS_RECORD_H_
  3. #include "types.h"
  4. #include "middleware/dtv/dtvci/mid_dtvci.h"
  5. /*****************************************************************************
  6. ***************************functions for record******************************
  7. *****************************************************************************/
  8. /*****************************************************************************
  9. * Function Name: ciplus_record_event
  10. * Description: Used to update current event if any event had been arrived.
  11. * The new-arrived events are stored in local memory, and need
  12. * to be stored elsewhere in some moment
  13. * Parameters: none
  14. * Returns: 0 if no new event, 1 if new event arrived, -1 if error happened
  15. *****************************************************************************/
  16. int ciplus_record_event(int next_file_index);
  17. /*****************************************************************************
  18. * Function Name: ciplus_record_register_blankAV_callback
  19. * Description: Register callback function which will be call when live AV blanking
  20. * is required.
  21. * Parameters: callback funcion to be registered
  22. * Returns: 0 if success, -1 if error happened
  23. *****************************************************************************/
  24. int ciplus_record_register_blankAV_callback(void* callback);
  25. /*****************************************************************************
  26. * Function Name: ciplus_is_record_start_send
  27. * Description: Check whether record_start has been send or not
  28. * Parameters: none
  29. * Returns: TRUE if record start had been send in this recording,
  30. * FALSE otherwise
  31. *****************************************************************************/
  32. BOOL ciplus_is_record_start_send(void);
  33. /*****************************************************************************
  34. * Function Name: ciplus_reset_record_start_flag
  35. * Description: Reset record start flag, need to be called before recording
  36. * Parameters: none
  37. * Returns: 0 if success, -1 otherwise
  38. *****************************************************************************/
  39. int ciplus_reset_record_start_flag(void);
  40. /*****************************************************************************
  41. * Function Name: ciplus_record_send_record_start
  42. * Description: Send record start to CAM to signal CI+ protected content recording.
  43. * Need to be called once when CI+ protected contetn is to be recorded.
  44. * Parameters: mode - record mode: PVR, timeshift, unattended mode etc.
  45. * program_number - program number to be recorded
  46. * pin_data - pin code to be cached which may be used during recording
  47. * file_index - file index to record ciplus default URI
  48. * status - return by CAM to notice validation of recording
  49. * Returns: TRUE if success, FALSE otherwise
  50. *****************************************************************************/
  51. BOOL ciplus_record_send_record_start(E_STB_CI_OPERATING_MODE mode, U16BIT program_number,
  52. U8BIT *pin_data, int file_index, U8BIT *status);
  53. /*****************************************************************************
  54. * Function Name: ciplus_record_send_record_stop
  55. * Description: Send record stop to CAM to signal CI+ protected content recording.
  56. * Need to be called, if ciplus_record_send_record_start had been called,
  57. * in order to release previously allocated resource
  58. * Parameters: program_number - program number currently recording
  59. * status - return by CAM to notice status of record stop
  60. * Returns: TRUE if success, FALSE otherwise
  61. *****************************************************************************/
  62. BOOL ciplus_record_send_record_stop(U16BIT program_number, U8BIT *status);
  63. /*****************************************************************************
  64. * Function Name: ciplus_record_mode_change
  65. * Description: Send record stop to CAM to info that record mode had been changed
  66. * Parameters: mode - PVR, timeshift, unattended mode etc.
  67. * program_number - program number currently recording
  68. * Returns: TRUE if success, FALSE otherwise
  69. *****************************************************************************/
  70. BOOL ciplus_record_mode_change(E_STB_CI_OPERATING_MODE mode,U16BIT program_number);
  71. /*****************************************************************************
  72. * Function Name: ciplus_record_create_event_data
  73. * Description: Construct ciplus record event, which should be used when playback.
  74. * Parameter *data need to be freed by caller after used.
  75. * Parameters: data - returned value, pointer of data buffer start position
  76. * length - returned value, length of data
  77. * Returns: 0 if success, -1 otherwise
  78. *****************************************************************************/
  79. int ciplus_record_create_event_data(char** data, int* length);
  80. /*****************************************************************************
  81. * Function Name: print_record_event
  82. * Description: Print out total record event currently stored
  83. * Parameters: none
  84. * Returns: 0 if success, -1 if error happened
  85. *****************************************************************************/
  86. int print_record_events(void);
  87. /*****************************************************************************
  88. ***************************functions for playback****************************
  89. *****************************************************************************/
  90. /*****************************************************************************
  91. * Function Name: unblankAV_callback
  92. * Description: Callback function which will be called if AV blanking is not
  93. * required anymore.
  94. * Parameters: unblank - TRUE if AV blanking is required , FALSE otherwise
  95. * Returns: None
  96. *****************************************************************************/
  97. typedef void (*unblankAV_callback)(BOOL unblank);
  98. /*****************************************************************************
  99. * Function Name: data_update_callback
  100. * Description: Callback function which will be called if previous stored CI+
  101. * record event need to be updated.
  102. * Parameters: data - data buffer start position
  103. * length - length of data
  104. * Returns: None
  105. *****************************************************************************/
  106. typedef void (*data_update_callback)(void* data, int length);
  107. /*****************************************************************************
  108. * Function Name: ciplus_playback_initialize
  109. * Description: Initial function used to allocate resource
  110. * This function should be called before whenver ci+ protect
  111. * content is to be playbacked
  112. * Parameters: data - pointer to the start of event list data
  113. * length - length of data
  114. * unblankAV - callback function used to notice host to unblank AV
  115. * data_update - callback function used to notice host to update stored event list data
  116. * Returns: 0 if success, -1 if failed
  117. *****************************************************************************/
  118. int ciplus_playback_initialize(char* data, int length, unblankAV_callback unblankAV, data_update_callback data_update);
  119. /*****************************************************************************
  120. * Function Name: ciplus_playback_stop
  121. * Description: Function used to release resources which have been allocated
  122. * This function should be called whenver playback is terminate
  123. * if ciplus_playback_initialize has bee called.
  124. * Parameters: none
  125. * Returns: 0 if success, -1 if failed
  126. *****************************************************************************/
  127. int ciplus_playback_stop(void);
  128. /*****************************************************************************
  129. * Function Name: ciplus_playback_control_trick_mode
  130. * Description: Used to check whether this file portion need to control trick mode or not
  131. * Parameters: file_index - index of file to be check
  132. * Returns: TREU if control trick mode is enabled, FALSE otherwise
  133. *****************************************************************************/
  134. BOOL ciplus_playback_control_trick_mode(int file_index);
  135. /*****************************************************************************
  136. * Function Name: ciplus_playback_need_blankAV
  137. * Description: Used to check whether this file portion need to blank AV or not
  138. * Parameters: file_index - index of file to be check
  139. * Returns: TREU if AV blanking is needed, FALSE otherwise
  140. *****************************************************************************/
  141. BOOL ciplus_playback_need_blankAV(int file_index);
  142. /*****************************************************************************
  143. * Function Name: ciplus_playback_retention_limit
  144. * Description: Used to check whether this file portion has retension limit or not
  145. * Parameters: file_index - index of file to be check
  146. * days - returned value, number of days to live for this file
  147. * from the moment it was recorded
  148. * half_hours - returned value, number of half_hours(30mins) to live
  149. * for this file from the moment it was recorded
  150. * Returns: TREU if retension limit exist, FALSE otherwise
  151. *****************************************************************************/
  152. BOOL ciplus_playback_retention_limit(int file_index, int* days, int* half_hours);
  153. /*****************************************************************************
  154. * Function Name: print_playback_event
  155. * Description: Print out total playback event
  156. * Parameters: none
  157. * Returns: 0 if success, -1 if error happened
  158. *****************************************************************************/
  159. int print_playback_event(void);
  160. /*****************************************************************************
  161. * Function Name: ciplus_playback_have_event
  162. * Description: Detemine whether this file is ci plus protected content or not
  163. * Parameters: file_index
  164. * Returns: TRUE if CI plus protected content, FALSE if FTA file
  165. *****************************************************************************/
  166. BOOL ciplus_playback_have_event(int file_index);
  167. /*****************************************************************************
  168. * Function Name: ciplus_playback_get_license_playcount
  169. * Description: Obtain number of play count of a particular license specified
  170. * by file index.
  171. * Parameters: file_index - file index
  172. * play_count - pointer to license play count to be got
  173. * Returns: TRUE if play count got, FALSE otherwise
  174. *****************************************************************************/
  175. BOOL ciplus_playback_get_license_playcount(int file_index, int* play_count);
  176. #endif