Tizen Native API  3.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 nofications.
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]bufferThe consumed buffer that user pushed
[in]user_dataThe 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]errorThe error code
[in]current_stateThe current state of the streamrecorder
[in]user_dataThe user data passed from the callback registration function
Precondition:
This callback function is invoked if you register this callback using streamrecorder_set_error_cb().
See also:
streamrecorder_set_error_cb()
streamrecorder_unset_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 nofications.

Since :
3.0
Parameters:
[in]previousThe previous state of the streamrecorder
[in]currentThe current state of the streamrecorder
[in]notificationThe notification type of the srecorder
[in]user_dataThe user data passed from the callback registration function
Precondition:
This function is required to register a callback using streamrecorder_set_notify_cb().
See also:
streamrecorder_set_notify_cb()
streamrecorder_prepare()
streamrecorder_unprepare()
streamrecorder_start()
streamrecorder_pause()
streamrecorder_commit()
streamrecorder_cancel()

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]typeThe imitation type
[in]user_dataThe user data passed from the callback registration function
Precondition:
You have to register a callback using streamrecorder_set_recording_limit_reached_cb().
See also:
streamrecorder_set_recording_status_cb()
streamrecorder_set_recording_limit_reached_cb()
streamrecorder_unset_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_timeThe time of the recording (milliseconds)
[in]file_sizeThe size of the recording file (KB)
[in]user_dataThe 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().
See also:
streamrecorder_set_recording_status_cb()
streamrecorder_unset_recording_status_cb()
streamrecorder_start()

Function Documentation

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]recorderThe handle to the streamrecorder
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_unset_buffer_consume_completed_cb()
streamrecorder_push_stream_buffer()
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]recorderThe handle to the streamrecorder
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Postcondition:
This function will invoke streamrecorder_error_cb() when an asynchronous operation error occur.
See also:
streamrecorder_unset_error_cb()
streamrecorder_error_cb()
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]recorderThe handle to the streamrecorder
[in]callbackThe function pointer of user callback
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Postcondition:
streamrecorder_notify_cb() will be invoked.
See also:
streamrecorder_unset_notify_cb()
streamrecorder_notify_cb()

Registers the callback function to be run when reached the recording limit.

Since :
3.0
Parameters:
[in]recorderThe handle to treamrecorder
[in]callbackThe function pointer of user callback
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid 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()

Registers a callback function to be invoked when the recording information changes.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[in]callbackThe function pointer of user callback
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Postcondition:
streamrecorder_recording_status_cb() will be invoked.
See also:
streamrecorder_unset_recording_status_cb()
streamrecorder_recording_status_cb()

Unregisters the callback function.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
Returns:
on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_buffer_consume_completed_cb()

Unregisters the callback function.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
Returns:
on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_error_cb()

Unregisters the callback function.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_notify_cb()

Unregisters the callback function.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_recording_limit_reached_cb()

Unregisters the callback function.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_recording_status_cb()