| Tizen Native API
    4.0
    | 
The Callback API Callbacks from the StreamRecorder frameworks.
Required Header
#include <streamrecorder.h>
Overview
The StreamRecorder Callback API provides functions status.
| Functions | |
| int | streamrecorder_set_notify_cb (streamrecorder_h recorder, streamrecorder_notify_cb callback, void *user_data) | 
| Registers the callback function that will be invoked when the streamrecorder get some notification. | |
| int | streamrecorder_unset_notify_cb (streamrecorder_h recorder) | 
| Unregisters the callback function. | |
| int | streamrecorder_set_recording_status_cb (streamrecorder_h recorder, streamrecorder_recording_status_cb callback, void *user_data) | 
| Registers a callback function to be invoked when the recording information changes. | |
| int | streamrecorder_unset_recording_status_cb (streamrecorder_h recorder) | 
| Unregisters the callback function. | |
| int | streamrecorder_set_recording_limit_reached_cb (streamrecorder_h recorder, streamrecorder_recording_limit_reached_cb callback, void *user_data) | 
| Registers the callback function to be run when reached the recording limit. | |
| int | streamrecorder_unset_recording_limit_reached_cb (streamrecorder_h recorder) | 
| Unregisters the callback function. | |
| int | streamrecorder_set_error_cb (streamrecorder_h recorder, streamrecorder_error_cb callback, void *user_data) | 
| Registers a callback function to be called when an asynchronous operation error occurred. | |
| int | streamrecorder_unset_error_cb (streamrecorder_h recorder) | 
| Unregisters the callback function. | |
| int | streamrecorder_set_buffer_consume_completed_cb (streamrecorder_h recorder, streamrecorder_consume_completed_cb callback, void *user_data) | 
| Registers a callback function to be called when asynchronous buffers are consumed. | |
| int | streamrecorder_unset_buffer_consume_completed_cb (streamrecorder_h recorder) | 
| Unregisters the callback function. | |
| Typedefs | |
| typedef void(* | streamrecorder_recording_limit_reached_cb )(streamrecorder_recording_limit_type_e type, void *user_data) | 
| Called when limitation error occurs while recording. | |
| typedef void(* | streamrecorder_recording_status_cb )(unsigned long long elapsed_time, unsigned long long file_size, void *user_data) | 
| Called to indicate the recording status. | |
| typedef void(* | streamrecorder_notify_cb )(streamrecorder_state_e previous, streamrecorder_state_e current, streamrecorder_notify_e notification, void *user_data) | 
| Called when the streamrecorder gets some notifications. | |
| typedef void(* | streamrecorder_error_cb )(streamrecorder_error_e error, streamrecorder_state_e current_state, void *user_data) | 
| Called when the error occurred. | |
| typedef void(* | streamrecorder_consume_completed_cb )(void *buffer, void *user_data) | 
| Called iteratively to notify about the buffer has been consumed. | |
Typedef Documentation
| typedef void(* streamrecorder_consume_completed_cb)(void *buffer, void *user_data) | 
Called iteratively to notify about the buffer has been consumed.
- Since :
- 3.0
- Remarks:
- The user needs to release consumed buffer if buffer is allocated by user including media packet
- Parameters:
- 
  [in] buffer The consumed buffer that user pushed [in] user_data The user data passed 
- See also:
- streamrecorder_set_buffer_consume_completed_cb() will invoke this callback.
- streamrecorder_unset_buffer_consume_completed_cb()
| typedef void(* streamrecorder_error_cb)(streamrecorder_error_e error, streamrecorder_state_e current_state, void *user_data) | 
Called when the error occurred.
- Since :
- 3.0
- Remarks:
- This callback informs about the critical error situation. 
 When being invoked, user should release the resource and terminate the application.
 This error code will be reported.
 STREAMRECORDER_ERROR_INVALID_OPERATION
 STREAMRECORDER_ERROR_OUT_OF_MEMORY
- Parameters:
- 
  [in] error The error code [in] current_state The current state of the streamrecorder [in] user_data The user data passed from the callback registration function 
- Precondition:
- This callback function is invoked if you register this callback using streamrecorder_set_error_cb().
| typedef void(* streamrecorder_notify_cb)(streamrecorder_state_e previous, streamrecorder_state_e current, streamrecorder_notify_e notification, void *user_data) | 
Called when the streamrecorder gets some notifications.
- Since :
- 3.0
- Parameters:
- 
  [in] previous The previous state of the streamrecorder [in] current The current state of the streamrecorder [in] notification The notification type of the streamrecorder [in] user_data The user data passed from the callback registration function 
- Precondition:
- This function is required to register a callback using streamrecorder_set_notify_cb().
| typedef void(* streamrecorder_recording_limit_reached_cb)(streamrecorder_recording_limit_type_e type, void *user_data) | 
Called when limitation error occurs while recording.
The callback function is possible to receive three types of limits: time and size.
- Since :
- 3.0
- Remarks:
- After being called, recording data except present recorded data will be discarded and not written in the recording file. Also the state of streamrecorder is not changed.
- Parameters:
- 
  [in] type The imitation type [in] user_data The user data passed from the callback registration function 
- Precondition:
- You have to register a callback using streamrecorder_set_recording_limit_reached_cb().
| typedef void(* streamrecorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data) | 
Called to indicate the recording status.
- Since :
- 3.0
- Remarks:
- This callback function is repeatedly invoked during the STREAMRECORDER_STATE_RECORDING state.
- Parameters:
- 
  [in] elapsed_time The time of the recording (milliseconds) [in] file_size The size of the recording file (KB) [in] user_data The user data passed from the callback registration function 
- Precondition:
- streamrecorder_start() will invoke this callback if you register it using streamrecorder_set_recording_status_cb().
Function Documentation
| int streamrecorder_set_buffer_consume_completed_cb | ( | streamrecorder_h | recorder, | 
| streamrecorder_consume_completed_cb | callback, | ||
| void * | user_data | ||
| ) | 
Registers a callback function to be called when asynchronous buffers are consumed.
- Since :
- 3.0
- Remarks:
- This callback informs to user dealloc buffer.
 When this callback is invoked, user should release the buffer or media packet.
 
- Parameters:
- 
  [in] recorder The handle to the streamrecorder [in] callback The callback function to register [in] user_data The user data to be passed to the callback function 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
| int streamrecorder_set_error_cb | ( | streamrecorder_h | recorder, | 
| streamrecorder_error_cb | callback, | ||
| void * | user_data | ||
| ) | 
Registers a callback function to be called when an asynchronous operation error occurred.
- Since :
- 3.0
- Remarks:
- This callback informs critical error situation.
 When this callback is invoked, user should release the resource and terminate the application.
 These error codes will occur.
 STREAMRECORDER_ERROR_INVALID_OPERATION
 STREAMRECORDER_ERROR_OUT_OF_MEMORY
- Parameters:
- 
  [in] recorder The handle to the streamrecorder [in] callback The callback function to register [in] user_data The user data to be passed to the callback function 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
- Postcondition:
- This function will invoke streamrecorder_error_cb() when an asynchronous operation error occur.
| int streamrecorder_set_notify_cb | ( | streamrecorder_h | recorder, | 
| streamrecorder_notify_cb | callback, | ||
| void * | user_data | ||
| ) | 
Registers the callback function that will be invoked when the streamrecorder get some notification.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder [in] callback The function pointer of user callback [in] user_data The user data to be passed to the callback function 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
- Postcondition:
- streamrecorder_notify_cb() will be invoked.
| int streamrecorder_set_recording_limit_reached_cb | ( | streamrecorder_h | recorder, | 
| streamrecorder_recording_limit_reached_cb | callback, | ||
| void * | user_data | ||
| ) | 
Registers the callback function to be run when reached the recording limit.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to streamrecorder [in] callback The function pointer of user callback [in] user_data The user data to be passed to the callback function 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
- Postcondition:
- streamrecorder_recording_limit_reached_cb() will be invoked.
- See also:
- streamrecorder_unset_recording_limit_reached_cb()
- streamrecorder_set_size_limit()
- streamrecorder_set_time_limit()
- streamrecorder_recording_limit_reached_cb()
| int streamrecorder_set_recording_status_cb | ( | streamrecorder_h | recorder, | 
| streamrecorder_recording_status_cb | callback, | ||
| void * | user_data | ||
| ) | 
Registers a callback function to be invoked when the recording information changes.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder [in] callback The function pointer of user callback [in] user_data The user data to be passed to the callback function 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
- Postcondition:
- streamrecorder_recording_status_cb() will be invoked.
| int streamrecorder_unset_buffer_consume_completed_cb | ( | streamrecorder_h | recorder | ) | 
Unregisters the callback function.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder 
- Returns:
- onsuccess, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
| int streamrecorder_unset_error_cb | ( | streamrecorder_h | recorder | ) | 
Unregisters the callback function.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder 
- Returns:
- onsuccess, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
- See also:
- streamrecorder_set_error_cb()
| int streamrecorder_unset_notify_cb | ( | streamrecorder_h | recorder | ) | 
Unregisters the callback function.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
- See also:
- streamrecorder_set_notify_cb()
| int streamrecorder_unset_recording_limit_reached_cb | ( | streamrecorder_h | recorder | ) | 
Unregisters the callback function.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter 
| int streamrecorder_unset_recording_status_cb | ( | streamrecorder_h | recorder | ) | 
Unregisters the callback function.
- Since :
- 3.0
- Parameters:
- 
  [in] recorder The handle to the streamrecorder 
- Returns:
- 0on success, otherwise a negative error value
- Return values:
- 
  STREAMRECORDER_ERROR_NONE Successful STREAMRECORDER_ERROR_INVALID_PARAMETER Invalid parameter