Tizen Native API  5.5
Attributes

The Attributes API provides functions for getting and setting recorder attributes.

Required Header

#include <recorder.h>

Overview

The Media Recorder API provides basic recorder attribute manipulators.

The Recorder Attributes API provides functions to set and get basic recorder attributes:

  • File size limit
  • Recording time limit
  • Audio recording device
  • Audio sample rate
  • Audio encoder bit rate
  • Video encoder bit rate

Each of these attributes have a get/set pair of functions. For example, recorder_attr_set_time_limit() and recorder_attr_get_time_limit(). For more detailed information and programming examples for this API, see the Multimedia Tutorial.

Related Features

This API is related with the following features:

It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.

Functions

int recorder_attr_set_size_limit (recorder_h recorder, int kbyte)
 Sets the maximum size of a recording file.
int recorder_attr_get_size_limit (recorder_h recorder, int *kbyte)
 Gets the maximum size of a recording file.
int recorder_attr_set_time_limit (recorder_h recorder, int second)
 Sets the time limit of a recording file.
int recorder_attr_get_time_limit (recorder_h recorder, int *second)
 Gets the time limit of a recording file.
int recorder_attr_set_audio_device (recorder_h recorder, recorder_audio_device_e device)
 Sets the audio device for recording.
int recorder_attr_get_audio_device (recorder_h recorder, recorder_audio_device_e *device)
 Gets the audio device for recording.
int recorder_attr_set_audio_samplerate (recorder_h recorder, int samplerate)
 Sets the sampling rate of an audio stream.
int recorder_attr_get_audio_samplerate (recorder_h recorder, int *samplerate)
 Gets the sampling rate of an audio stream.
int recorder_attr_set_audio_encoder_bitrate (recorder_h recorder, int bitrate)
 Sets the bitrate of an audio encoder.
int recorder_attr_set_video_encoder_bitrate (recorder_h recorder, int bitrate)
 Sets the bitrate of a video encoder.
int recorder_attr_get_audio_encoder_bitrate (recorder_h recorder, int *bitrate)
 Gets the bitrate of an audio encoder.
int recorder_attr_get_video_encoder_bitrate (recorder_h recorder, int *bitrate)
 Gets the bitrate of a video encoder.
int recorder_attr_set_mute (recorder_h recorder, bool enable)
 Sets the mute state of a recorder.
bool recorder_attr_is_muted (recorder_h recorder)
 Gets the mute state of a recorder.
int recorder_attr_set_recording_motion_rate (recorder_h recorder, double rate)
 Sets the recording motion rate.
int recorder_attr_get_recording_motion_rate (recorder_h recorder, double *rate)
 Gets the recording motion rate.
int recorder_attr_set_audio_channel (recorder_h recorder, int channel_count)
 Sets the number of the audio channel.
int recorder_attr_get_audio_channel (recorder_h recorder, int *channel_count)
 Gets the number of the audio channel.
int recorder_attr_set_orientation_tag (recorder_h recorder, recorder_rotation_e orientation)
 Sets the video orientation in a video metadata tag.
int recorder_attr_get_orientation_tag (recorder_h recorder, recorder_rotation_e *orientation)
 Gets the video orientation in a video metadata tag.

Function Documentation

int recorder_attr_get_audio_channel ( recorder_h  recorder,
int *  channel_count 
)

Gets the number of the audio channel.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]channel_countThe number of the audio channel
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_audio_channel()

Gets the audio device for recording.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]deviceThe type of an audio device
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_audio_device()
int recorder_attr_get_audio_encoder_bitrate ( recorder_h  recorder,
int *  bitrate 
)

Gets the bitrate of an audio encoder.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]bitrateThe bitrate in bits per second
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_audio_encoder_bitrate()
int recorder_attr_get_audio_samplerate ( recorder_h  recorder,
int *  samplerate 
)

Gets the sampling rate of an audio stream.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]samplerateThe sample rate in Hertz
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_audio_samplerate()
int recorder_attr_get_orientation_tag ( recorder_h  recorder,
recorder_rotation_e orientation 
)

Gets the video orientation in a video metadata tag.

Since :
2.3
Parameters:
[in]recorderThe handle to a media recorder
[out]orientationThe information of the video orientation
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_orientation_tag()
int recorder_attr_get_recording_motion_rate ( recorder_h  recorder,
double *  rate 
)

Gets the recording motion rate.

Since :
2.3
Remarks:
This attribute is valid only in a video recorder.
If the rate bigger than 0 and smaller than 1, video is recorded in a slow motion mode.
If the rate bigger than 1, video is recorded in a fast motion mode (time lapse recording).
Audio data is not recorded.
To reset slow motion recording, set the rate to 1.
Parameters:
[in]recorderThe handle to the media recorder
[out]rateThe recording motion rate
It is computed with fps.
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_recording_motion_rate()
int recorder_attr_get_size_limit ( recorder_h  recorder,
int *  kbyte 
)

Gets the maximum size of a recording file.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]kbyteThe maximum size of recording file (KB)
0 means unlimited recording size.
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_size_limit()
recorder_attr_get_time_limit()
int recorder_attr_get_time_limit ( recorder_h  recorder,
int *  second 
)

Gets the time limit of a recording file.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]secondThe time limit of the recording file (in seconds)
0 means unlimited recording time.
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_time_limit()
recorder_attr_get_size_limit()
int recorder_attr_get_video_encoder_bitrate ( recorder_h  recorder,
int *  bitrate 
)

Gets the bitrate of a video encoder.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[out]bitrateThe bitrate in bits per second
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_set_audio_encoder_bitrate()
bool recorder_attr_is_muted ( recorder_h  recorder)

Gets the mute state of a recorder.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Returns:
true if the recorder is not recording any sound, otherwise false if the recorder is recording
Exceptions:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
See also:
recorder_attr_set_mute()
int recorder_attr_set_audio_channel ( recorder_h  recorder,
int  channel_count 
)

Sets the number of the audio channel.

Since :
2.3
Remarks:
This attribute is applied only in RECORDER_STATE_CREATED state.
For mono recording, setting channel to 1.
For stereo recording, setting channel to 2.
Parameters:
[in]recorderThe handle to the media recorder
[in]channel_countThe number of the audio channel
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY (for video recorder only).
Since 2.3.1, this API also works for audio recorder when its state is RECORDER_STATE_READY.
See also:
recorder_attr_get_audio_channel()

Sets the audio device for recording.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[in]deviceThe type of an audio device
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY (for video recorder only).
Since 2.3.1, this API also works for audio recorder when its state is RECORDER_STATE_READY.
See also:
recorder_attr_get_audio_device()
int recorder_attr_set_audio_encoder_bitrate ( recorder_h  recorder,
int  bitrate 
)

Sets the bitrate of an audio encoder.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[in]bitrateThe bitrate (for mms : 12200[bps], normal : 288000[bps])
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_attr_get_audio_encoder_bitrate()
int recorder_attr_set_audio_samplerate ( recorder_h  recorder,
int  samplerate 
)

Sets the sampling rate of an audio stream.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[in]samplerateThe sample rate in Hertz
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY (for video recorder only).
Since 2.3.1, this API also works for audio recorder when its state is RECORDER_STATE_READY.
See also:
recorder_attr_get_audio_samplerate()
int recorder_attr_set_mute ( recorder_h  recorder,
bool  enable 
)

Sets the mute state of a recorder.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[in]enableThe mute state
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_is_muted()

Sets the video orientation in a video metadata tag.

Since :
2.3
Parameters:
[in]recorderThe handle to a media recorder
[in]orientationThe information of the video orientation
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
See also:
recorder_attr_get_orientation_tag()
int recorder_attr_set_recording_motion_rate ( recorder_h  recorder,
double  rate 
)

Sets the recording motion rate.

Since :
2.3
Remarks:
This attribute is valid only in a video recorder.
If the rate bigger than 0 and smaller than 1, video is recorded in a slow motion mode.
If the rate bigger than 1, video is recorded in a fast motion mode (time lapse recording).
Audio data is not recorded.
To reset slow motion recording, set the rate to 1.
Parameters:
[in]recorderThe handle to the media recorder
[in]rateThe recording motion rate
It is computed with fps. (0<rate<1 for slow motion, 1<rate for fast motion(time lapse recording), 1 to reset).
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_attr_get_recording_motion_rate()
int recorder_attr_set_size_limit ( recorder_h  recorder,
int  kbyte 
)

Sets the maximum size of a recording file.

Since :
2.3
Remarks:
After reaching the limitation, the recording data is discarded and not written in the recording file.
Parameters:
[in]recorderThe handle to the media recorder
[in]kbyteThe maximum size of the recording file(KB)
0 means unlimited recording size.
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_attr_get_size_limit()
recorder_attr_set_time_limit()
int recorder_attr_set_time_limit ( recorder_h  recorder,
int  second 
)

Sets the time limit of a recording file.

Since :
2.3
Remarks:
After reaching the limitation, the recording data is discarded and not written in the recording file.
Parameters:
[in]recorderThe handle to the media recorder
[in]secondThe time limit of the recording file (in seconds)
0 means unlimited recording size.
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_attr_get_time_limit()
recorder_attr_set_size_limit()
int recorder_attr_set_video_encoder_bitrate ( recorder_h  recorder,
int  bitrate 
)

Sets the bitrate of a video encoder.

Since :
2.3
Parameters:
[in]recorderThe handle to the media recorder
[in]bitrateThe bitrate in bits per second
Returns:
0 on success, otherwise a negative error value
Return values:
RECORDER_ERROR_NONESuccessful
RECORDER_ERROR_INVALID_PARAMETERInvalid parameter
RECORDER_ERROR_INVALID_STATEInvalid state
RECORDER_ERROR_PERMISSION_DENIEDThe access to the resources can not be granted
RECORDER_ERROR_NOT_SUPPORTEDThe feature is not supported
RECORDER_ERROR_SERVICE_DISCONNECTEDThe socket to multimedia server is disconnected
Precondition:
The recorder state must be RECORDER_STATE_CREATED or RECORDER_STATE_READY.
See also:
recorder_attr_get_video_encoder_bitrate()