Tizen Native API  5.0
Attributes

The Attributes API provides functions to fetch StreamRecorder attributes.

Required Header

#include <streamrecorder.h>

Overview

The StreamRecorder Attributes API provides functions to get/set basic StreamRecorder attributes.

With the StreamRecorder Attributes API you are able to set and get StreamRecorder attributes like:

Functions

int streamrecorder_set_filename (streamrecorder_h recorder, const char *path)
 Sets the file path to record.
int streamrecorder_get_filename (streamrecorder_h recorder, char **path)
 Gets the file path to record.
int streamrecorder_set_file_format (streamrecorder_h recorder, streamrecorder_file_format_e format)
 Sets the file format for recording media stream.
int streamrecorder_get_file_format (streamrecorder_h recorder, streamrecorder_file_format_e *format)
 Gets the file format for recording media stream.
int streamrecorder_set_audio_encoder (streamrecorder_h recorder, streamrecorder_audio_codec_e codec)
 Sets the audio codec for encoding an audio stream.
int streamrecorder_get_audio_encoder (streamrecorder_h recorder, streamrecorder_audio_codec_e *codec)
 Gets the audio codec for encoding an audio stream.
int streamrecorder_set_video_resolution (streamrecorder_h recorder, int width, int height)
 Sets the resolution of the video recording.
int streamrecorder_get_video_resolution (streamrecorder_h recorder, int *width, int *height)
 Gets the resolution of the video recording.
int streamrecorder_set_video_encoder (streamrecorder_h recorder, streamrecorder_video_codec_e codec)
 Sets the video codec for encoding video stream.
int streamrecorder_get_video_encoder (streamrecorder_h recorder, streamrecorder_video_codec_e *codec)
 Gets the video codec for encoding video stream.
int streamrecorder_set_video_framerate (streamrecorder_h recorder, int framerate)
 Sets the recording frame rate.
int streamrecorder_get_video_framerate (streamrecorder_h recorder, int *framerate)
 Gets the recording frame rate.
int streamrecorder_set_video_source_format (streamrecorder_h recorder, streamrecorder_video_source_format_e format)
 Sets the video source format.
int streamrecorder_get_video_source_format (streamrecorder_h recorder, streamrecorder_video_source_format_e *format)
 Gets the video source format.
int streamrecorder_set_recording_limit (streamrecorder_h recorder, streamrecorder_recording_limit_type_e type, int limit)
 Sets the maximum size of a recording file.
int streamrecorder_get_recording_limit (streamrecorder_h recorder, streamrecorder_recording_limit_type_e type, int *limit)
 Gets the maximum size of a recording file.
int streamrecorder_set_audio_samplerate (streamrecorder_h recorder, int samplerate)
 Sets the sampling rate of an audio stream.
int streamrecorder_get_audio_samplerate (streamrecorder_h recorder, int *samplerate)
 Gets the sampling rate of an audio stream.
int streamrecorder_set_audio_encoder_bitrate (streamrecorder_h recorder, int bitrate)
 Sets the bitrate of an audio encoder.
int streamrecorder_set_video_encoder_bitrate (streamrecorder_h recorder, int bitrate)
 Sets the bitrate of a video encoder.
int streamrecorder_get_audio_encoder_bitrate (streamrecorder_h recorder, int *bitrate)
 Gets the bitrate of an audio encoder.
int streamrecorder_get_video_encoder_bitrate (streamrecorder_h recorder, int *bitrate)
 Gets the bitrate of a video encoder.
int streamrecorder_set_audio_channel (streamrecorder_h recorder, int channel_count)
 Sets the number of the audio channel.
int streamrecorder_get_audio_channel (streamrecorder_h recorder, int *channel_count)
 Gets the number of the audio channel.

Function Documentation

int streamrecorder_get_audio_channel ( streamrecorder_h  recorder,
int *  channel_count 
)

Gets the number of the audio channel.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]channel_countThe number of the audio channel
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_audio_channel()

Gets the audio codec for encoding an audio stream.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]codecThe audio codec
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_audio_encoder()
streamrecorder_foreach_supported_audio_encoder()
int streamrecorder_get_audio_encoder_bitrate ( streamrecorder_h  recorder,
int *  bitrate 
)

Gets the bitrate of an audio encoder.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]bitrateThe bitrate in bits per second
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_audio_encoder_bitrate()
int streamrecorder_get_audio_samplerate ( streamrecorder_h  recorder,
int *  samplerate 
)

Gets the sampling rate of an audio stream.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]samplerateThe sample rate in Hertz
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_audio_samplerate()

Gets the file format for recording media stream.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]formatThe media file format
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_file_format()
streamrecorder_foreach_supported_file_format()
int streamrecorder_get_filename ( streamrecorder_h  recorder,
char **  path 
)

Gets the file path to record.

Since :
3.0
Remarks:
You must release path using free().
Parameters:
[in]recorderThe handle to the streamrecorder
[out]pathThe recording file path
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_filename()

Gets the maximum size of a recording file.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[in]typeThe recording limit type
[out]limitIf limit type is STREAMRECORDER_RECORDING_LIMIT_TYPE_SIZE, the limit value is the maximum size of the recording file(KB),
otherwise limit value is the maximum time of the recording file (in seconds)
0 means unlimited recording size or time.
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_recording_limit()

Gets the video codec for encoding video stream.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]codecThe video codec
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_video_encoder()
streamrecorder_foreach_supported_video_encoder()
int streamrecorder_get_video_encoder_bitrate ( streamrecorder_h  recorder,
int *  bitrate 
)

Gets the bitrate of a video encoder.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]bitrateThe bitrate in bits per second
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_audio_encoder_bitrate()
int streamrecorder_get_video_framerate ( streamrecorder_h  recorder,
int *  framerate 
)

Gets the recording frame rate.

Since :
3.0
Parameters:
[in]recorderThe handle to the camera
[out]framerateThe frame rate for recording that already is set
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_video_framerate()
int streamrecorder_get_video_resolution ( streamrecorder_h  recorder,
int *  width,
int *  height 
)

Gets the resolution of the video recording.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[out]widthThe video width
[out]heightThe video height
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_set_video_resolution()
streamrecorder_foreach_supported_video_resolution()

Gets the video source format.

Since :
3.0
Remarks:
This function should be called before prepared state.
Parameters:
[in]recorderThe handle to the streamrecorder
[out]formatThe color type of video source that already is set
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
See also:
streamrecorder_set_video_source_format()
int streamrecorder_set_audio_channel ( streamrecorder_h  recorder,
int  channel_count 
)

Sets the number of the audio channel.

Since :
3.0
Remarks:
This attribute is applied only in STREAMRECORDER_STATE_CREATED state.
For mono recording, setting channel to 1.
For stereo recording, setting channel to 2.
Parameters:
[in]recorderThe handle to the streamrecorder
[in]channel_countThe number of the audio channel
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_audio_channel()

Sets the audio codec for encoding an audio stream.

Since :
3.0
Remarks:
You can get available audio encoders by using streamrecorder_foreach_supported_audio_encoder().
Parameters:
[in]recorderThe handle to the streamrecorder
[in]codecThe audio codec
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
STREAMRECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
STREAMRECORDER_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_audio_encoder()
streamrecorder_foreach_supported_audio_encoder()
int streamrecorder_set_audio_encoder_bitrate ( streamrecorder_h  recorder,
int  bitrate 
)

Sets the bitrate of an audio encoder.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[in]bitrateThe bitrate (for mms : 12200[bps], normal : 288000[bps])
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_audio_encoder_bitrate()
int streamrecorder_set_audio_samplerate ( streamrecorder_h  recorder,
int  samplerate 
)

Sets the sampling rate of an audio stream.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[in]samplerateThe sample rate in Hertz
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_audio_samplerate()

Sets the file format for recording media stream.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[in]formatThe media file format
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
STREAMRECORDER_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_file_format()
streamrecorder_foreach_supported_file_format()
int streamrecorder_set_filename ( streamrecorder_h  recorder,
const char *  path 
)

Sets the file path to record.

This function sets file path which defines where newly recorded data should be stored.

Since :
3.0
Remarks:
If the same file already exists in the file system, then old file will be overwritten.
Parameters:
[in]recorderThe handle to the streamrecorder
[in]pathThe recording file path
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_filename()

Sets the maximum size of a recording file.

Since :
3.0
Remarks:
After reaching the limitation, the recording data is discarded and not written in the recording file.
Parameters:
[in]recorderThe handle to the streamrecorder
[in]typeThe recording limit type
[in]limitIf limit type is STREAMRECORDER_RECORDING_LIMIT_TYPE_SIZE, the limit value is the maximum size of the recording file(KB),
otherwise limit value is the maximum time of the recording file (in seconds)
0 means unlimited recording size or time.
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_recording_limit()

Sets the video codec for encoding video stream.

Since :
3.0
Remarks:
You can get available video encoders by using recorder_foreach_supported_video_encoder().
Parameters:
[in]recorderThe handle to the streamrecorder
[in]codecThe video codec
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
STREAMRECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_video_encoder()
streamrecorder_foreach_supported_video_encoder()
int streamrecorder_set_video_encoder_bitrate ( streamrecorder_h  recorder,
int  bitrate 
)

Sets the bitrate of a video encoder.

Since :
3.0
Parameters:
[in]recorderThe handle to the streamrecorder
[in]bitrateThe bitrate in bits per second
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_get_video_encoder_bitrate()
int streamrecorder_set_video_framerate ( streamrecorder_h  recorder,
int  framerate 
)

Sets the recording frame rate.

Since :
3.0
Remarks:
This function should be called before prepared state.
Parameters:
[in]recorderThe handle to the streamrecorder
[in]framerateThe frame rate for recording
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
See also:
streamrecorder_get_video_framerate()
int streamrecorder_set_video_resolution ( streamrecorder_h  recorder,
int  width,
int  height 
)

Sets the resolution of the video recording.

Since :
3.0
Remarks:
This function should be called before recording (streamrecorder_start()).
Parameters:
[in]recorderThe handle to the streamrecorder
[in]widthThe input width
[in]heightThe input height
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
STREAMRECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
Precondition:
The streamrecorder state must be STREAMRECORDER_STATE_CREATED.
streamrecorder_enable_source_buffer() should be invoked before this function.
See also:
streamrecorder_start()
streamrecorder_get_video_resolution()
streamrecorder_foreach_supported_video_resolution()

Sets the video source format.

Since :
3.0
Remarks:
This function should be called before prepared state.
Parameters:
[in]recorderThe handle to the streamrecorder
[in]formatThe color type of video source
Returns:
0 on success, otherwise a negative error value
Return values:
STREAMRECORDER_ERROR_NONESuccessful
STREAMRECORDER_ERROR_INVALID_PARAMETERInvalid parameter
STREAMRECORDER_ERROR_INVALID_STATEInvalid state
See also:
streamrecorder_get_video_source_format()