summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/recorder.h54
-rw-r--r--include/recorder_private.h2
-rw-r--r--packaging/capi-media-recorder.spec2
-rw-r--r--src/recorder.c94
-rw-r--r--test/recorder_test.c38
5 files changed, 180 insertions, 10 deletions
diff --git a/include/recorder.h b/include/recorder.h
index f6b566c..b6241f1 100644
--- a/include/recorder.h
+++ b/include/recorder.h
@@ -64,6 +64,7 @@ typedef enum {
RECORDER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< The access to the resources can not be granted */
RECORDER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */
RECORDER_ERROR_RESOURCE_CONFLICT = RECORDER_ERROR_CLASS | 0x0c, /**< Blocked by resource conflict (Since 3.0) */
+ RECORDER_ERROR_SERVICE_DISCONNECTED = RECORDER_ERROR_CLASS | 0x0d, /**< Socket connection lost (Since 3.0) */
} recorder_error_e;
/**
@@ -410,6 +411,7 @@ int recorder_destroy(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state should be #RECORDER_STATE_CREATED by recorder_create_videorecorder(), recorder_create_audiorecorder() or recorder_unprepare().
* @post The recorder state will be #RECORDER_STATE_READY.
* @post If recorder handle is created by recorder_create_videorecorder(), the camera state will be changed to #CAMERA_STATE_PREVIEW.
@@ -435,6 +437,7 @@ int recorder_prepare(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state should be #RECORDER_STATE_READY set by recorder_prepare(), recorder_cancel() or recorder_commit().
* @post The recorder state will be #RECORDER_STATE_CREATED.
* @post If the recorder handle is created by recorder_create_videorecorder(), camera state will be changed to #CAMERA_STATE_CREATED.
@@ -464,6 +467,7 @@ int recorder_unprepare(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_READY by recorder_prepare() or #RECORDER_STATE_PAUSED by recorder_pause(). \n
* The filename should be set by recorder_set_filename().
* @post The recorder state will be #RECORDER_STATE_RECORDING.
@@ -492,6 +496,7 @@ int recorder_start(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_RECORDING.
* @post The recorder state will be #RECORDER_STATE_PAUSED.
* @see recorder_pause()
@@ -516,6 +521,7 @@ int recorder_pause(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_RECORDING set by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause().
* @post The recorder state will be #RECORDER_STATE_READY.
* @see recorder_pause()
@@ -542,6 +548,7 @@ int recorder_commit(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_RECORDING set by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause().
* @post The recorder state will be #RECORDER_STATE_READY.
* @see recorder_pause()
@@ -561,6 +568,7 @@ int recorder_cancel(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
*/
int recorder_get_state(recorder_h recorder, recorder_state_e *state);
@@ -576,6 +584,7 @@ int recorder_get_state(recorder_h recorder, recorder_state_e *state);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_RECORDING or #RECORDER_STATE_PAUSED.
*/
int recorder_get_audio_level(recorder_h recorder, double *dB);
@@ -593,6 +602,7 @@ int recorder_get_audio_level(recorder_h recorder, double *dB);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_get_filename()
*/
@@ -609,6 +619,7 @@ int recorder_set_filename(recorder_h recorder, const char *path);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_filename()
*/
int recorder_get_filename(recorder_h recorder, char **path);
@@ -628,6 +639,7 @@ int recorder_get_filename(recorder_h recorder, char **path);
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
* @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
* Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
* @see recorder_get_file_format()
@@ -646,6 +658,7 @@ int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format)
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_file_format()
* @see recorder_foreach_supported_file_format()
*/
@@ -692,6 +705,7 @@ int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stre
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post recorder_supported_file_format_cb() will be invoked.
* @see recorder_get_file_format()
* @see recorder_set_file_format()
@@ -725,6 +739,7 @@ int recorder_foreach_supported_file_format(recorder_h recorder, recorder_support
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
* @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_get_audio_encoder()
* @see recorder_foreach_supported_audio_encoder()
@@ -741,6 +756,7 @@ int recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_audio_encoder()
* @see recorder_foreach_supported_audio_encoder()
*/
@@ -766,6 +782,7 @@ int recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *code
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post recorder_supported_audio_encoder_cb() will be invoked.
* @see recorder_set_audio_encoder()
* @see recorder_get_audio_encoder()
@@ -795,6 +812,7 @@ int recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_suppo
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_start()
* @see recorder_get_video_resolution()
@@ -813,6 +831,7 @@ int recorder_set_video_resolution(recorder_h recorder, int width, int height);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_video_resolution()
* @see recorder_foreach_supported_video_resolution()
*/
@@ -838,6 +857,7 @@ int recorder_get_video_resolution(recorder_h recorder, int *width, int *height);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post This function invokes recorder_supported_video_resolution_cb() repeatedly to retrieve each supported video resolution.
* @see recorder_set_video_resolution()
* @see recorder_get_video_resolution()
@@ -866,6 +886,7 @@ int recorder_foreach_supported_video_resolution(recorder_h recorder, recorder_su
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_get_video_encoder()
* @see recorder_foreach_supported_video_encoder()
@@ -882,6 +903,7 @@ int recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_video_encoder()
* @see recorder_foreach_supported_video_encoder()
*/
@@ -907,6 +929,7 @@ int recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *code
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post recorder_supported_video_encoder_cb() will be invoked.
* @see recorder_set_video_encoder()
* @see recorder_get_video_encoder()
@@ -934,6 +957,7 @@ int recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_suppo
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post recorder_state_changed_cb() will be invoked.
* @see recorder_unset_state_changed_cb()
* @see recorder_state_changed_cb()
@@ -949,6 +973,7 @@ int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_state_changed_cb()
*/
int recorder_unset_state_changed_cb(recorder_h recorder);
@@ -964,6 +989,7 @@ int recorder_unset_state_changed_cb(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_unset_interrupted_cb()
* @see recorder_interrupted_cb()
*/
@@ -979,6 +1005,7 @@ int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb cal
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_interrupted_cb()
*/
int recorder_unset_interrupted_cb(recorder_h recorder);
@@ -999,6 +1026,7 @@ int recorder_unset_interrupted_cb(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
* @see recorder_unset_audio_stream_cb()
* @see recorder_audio_stream_cb()
@@ -1014,6 +1042,7 @@ int recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb c
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_audio_stream_cb()
*/
int recorder_unset_audio_stream_cb(recorder_h recorder);
@@ -1029,6 +1058,7 @@ int recorder_unset_audio_stream_cb(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post recorder_recording_status_cb() will be invoked.
* @see recorder_unset_recording_status_cb()
* @see recorder_recording_status_cb()
@@ -1044,6 +1074,7 @@ int recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_sta
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_recording_status_cb()
*/
int recorder_unset_recording_status_cb(recorder_h recorder);
@@ -1059,6 +1090,7 @@ int recorder_unset_recording_status_cb(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post recorder_recording_limit_reached_cb() will be invoked.
* @see recorder_unset_recording_limit_reached_cb()
* @see recorder_attr_set_size_limit()
@@ -1076,6 +1108,7 @@ int recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_record
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_recording_limit_reached_cb()
*/
int recorder_unset_recording_limit_reached_cb(recorder_h recorder);
@@ -1097,6 +1130,7 @@ int recorder_unset_recording_limit_reached_cb(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @post This function will invoke recorder_error_cb() when an asynchronous operation error occur.
* @see recorder_unset_error_cb()
* @see recorder_error_cb()
@@ -1113,6 +1147,7 @@ int recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_set_error_cb()
*/
int recorder_unset_error_cb(recorder_h recorder);
@@ -1141,6 +1176,7 @@ int recorder_unset_error_cb(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_attr_get_size_limit()
* @see recorder_attr_set_time_limit()
@@ -1158,6 +1194,7 @@ int recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_size_limit()
* @see recorder_attr_get_time_limit()
*/
@@ -1176,6 +1213,7 @@ int recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_attr_get_time_limit()
* @see recorder_attr_set_size_limit()
@@ -1194,6 +1232,7 @@ int recorder_attr_set_time_limit(recorder_h recorder, int second);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_time_limit()
* @see recorder_attr_get_size_limit()
*/
@@ -1210,6 +1249,7 @@ int recorder_attr_get_time_limit(recorder_h recorder, int *second);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
* Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
* @see recorder_attr_get_audio_device()
@@ -1226,6 +1266,7 @@ int recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_audio_device()
*/
int recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
@@ -1241,6 +1282,7 @@ int recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
* Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
* @see recorder_attr_get_audio_samplerate()
@@ -1257,6 +1299,7 @@ int recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_audio_samplerate()
*/
int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
@@ -1272,6 +1315,7 @@ int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_attr_get_audio_encoder_bitrate()
*/
@@ -1288,6 +1332,7 @@ int recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
* @retval #RECORDER_ERROR_INVALID_STATE Invalid state
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_attr_get_video_encoder_bitrate()
*/
@@ -1303,6 +1348,7 @@ int recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_audio_encoder_bitrate()
*/
int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
@@ -1317,6 +1363,7 @@ int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_audio_encoder_bitrate()
*/
int recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
@@ -1331,6 +1378,7 @@ int recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_is_muted()
*/
int recorder_attr_set_mute(recorder_h recorder, bool enable);
@@ -1366,6 +1414,7 @@ bool recorder_attr_is_muted(recorder_h recorder);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
* @see recorder_attr_get_recording_motion_rate()
*/
@@ -1387,6 +1436,7 @@ int recorder_attr_set_recording_motion_rate(recorder_h recorder , double rate);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_recording_motion_rate()
*/
int recorder_attr_get_recording_motion_rate(recorder_h recorder , double *rate);
@@ -1404,6 +1454,7 @@ int recorder_attr_get_recording_motion_rate(recorder_h recorder , double *rate);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
* Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
* @see recorder_attr_get_audio_channel()
@@ -1420,6 +1471,7 @@ int recorder_attr_set_audio_channel(recorder_h recorder, int channel_count);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_audio_channel()
*/
int recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
@@ -1435,6 +1487,7 @@ int recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_get_orientation_tag()
*/
int recorder_attr_set_orientation_tag(recorder_h recorder, recorder_rotation_e orientation);
@@ -1449,6 +1502,7 @@ int recorder_attr_set_orientation_tag(recorder_h recorder, recorder_rotation_e
* @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
+ * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
* @see recorder_attr_set_orientation_tag()
*/
int recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation);
diff --git a/include/recorder_private.h b/include/recorder_private.h
index 1bef1f3..0785d81 100644
--- a/include/recorder_private.h
+++ b/include/recorder_private.h
@@ -61,6 +61,8 @@ enum {
typedef struct _recorder_cb_info_s {
gint fd;
+ gboolean is_server_connected;
+
GThread *msg_recv_thread;
GThread *msg_handler_thread;
gint msg_recv_running;
diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec
index 50f130e..2488a1e 100644
--- a/packaging/capi-media-recorder.spec
+++ b/packaging/capi-media-recorder.spec
@@ -1,6 +1,6 @@
Name: capi-media-recorder
Summary: A Recorder API
-Version: 0.2.32
+Version: 0.2.33
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/recorder.c b/src/recorder.c
index 14746cc..ca37160 100644
--- a/src/recorder.c
+++ b/src/recorder.c
@@ -683,8 +683,10 @@ static void *_recorder_msg_recv_func(gpointer data)
int str_pos = 0;
int prev_pos = 0;
char *recv_msg = NULL;
+ char *error_msg = NULL;
char **parse_str = NULL;
recorder_cb_info_s *cb_info = (recorder_cb_info_s *)data;
+ recorder_message_s *rec_msg = NULL;
if (cb_info == NULL) {
LOGE("cb_info NULL");
@@ -711,8 +713,12 @@ static void *_recorder_msg_recv_func(gpointer data)
while (g_atomic_int_get(&cb_info->msg_recv_running)) {
ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
- if (ret <= 0)
+ if (ret <= 0) {
+ cb_info->is_server_connected = FALSE;
+ LOGE("receive msg failed - server disconnected");
break;
+ }
+
recv_msg[ret] = '\0';
str_pos = 0;
@@ -795,7 +801,7 @@ static void *_recorder_msg_recv_func(gpointer data)
g_mutex_unlock(&cb_info->api_mutex[api]);
} else if (api_class == MUSE_RECORDER_API_CLASS_THREAD_SUB ||
api == MUSE_RECORDER_CB_EVENT) {
- recorder_message_s *rec_msg = g_new0(recorder_message_s, 1);
+ rec_msg = g_new0(recorder_message_s, 1);
if (rec_msg == NULL) {
LOGE("failed to alloc rec_msg");
continue;
@@ -810,15 +816,56 @@ static void *_recorder_msg_recv_func(gpointer data)
g_queue_push_tail(cb_info->msg_queue, (gpointer)rec_msg);
g_cond_signal(&cb_info->msg_handler_cond);
g_mutex_unlock(&cb_info->msg_handler_mutex);
+
+ rec_msg = NULL;
} else {
LOGW("unknown recorder api %d and api_class %d", api, api_class);
}
}
}
- LOGD("client cb exit");
+ LOGD("client cb exit - server connected %d", cb_info->is_server_connected);
+
+ if (!cb_info->is_server_connected) {
+ /* send error msg for server disconnection */
+ error_msg = muse_core_msg_json_factory_new(MUSE_RECORDER_CB_EVENT,
+ MUSE_TYPE_INT, PARAM_EVENT, MUSE_RECORDER_EVENT_TYPE_ERROR,
+ MUSE_TYPE_INT, PARAM_EVENT_CLASS, MUSE_RECORDER_EVENT_CLASS_THREAD_MAIN,
+ MUSE_TYPE_INT, "error", RECORDER_ERROR_SERVICE_DISCONNECTED,
+ MUSE_TYPE_INT, "current_state", RECORDER_STATE_NONE,
+ NULL);
+ if (!error_msg) {
+ LOGE("error_msg failed");
+ goto CB_HANDLER_EXIT;
+ }
+
+ rec_msg = g_new0(recorder_message_s, 1);
+ if (rec_msg == NULL) {
+ LOGE("failed to alloc rec_msg");
+ goto CB_HANDLER_EXIT;
+ }
+
+ rec_msg->api = MUSE_RECORDER_CB_EVENT;
+ memcpy(rec_msg->recv_msg, error_msg, sizeof(rec_msg->recv_msg));
+
+ /*LOGD("add recorder message to queue : api %d", api);*/
+
+ g_mutex_lock(&cb_info->msg_handler_mutex);
+ g_queue_push_tail(cb_info->msg_queue, (gpointer)rec_msg);
+ g_cond_signal(&cb_info->msg_handler_cond);
+ g_mutex_unlock(&cb_info->msg_handler_mutex);
+
+ rec_msg = NULL;
+
+ LOGE("add error msg for service disconnection done");
+ }
CB_HANDLER_EXIT:
+ if (error_msg) {
+ muse_core_msg_json_factory_free(error_msg);
+ error_msg = NULL;
+ }
+
if (parse_str) {
for (i = 0 ; i < RECORDER_PARSE_STRING_SIZE ; i++) {
if (parse_str[i]) {
@@ -897,6 +944,8 @@ static recorder_cb_info_s *_recorder_client_callback_new(gint sockfd)
goto ErrorExit;
}
+ cb_info->is_server_connected = TRUE;
+
return cb_info;
ErrorExit:
@@ -950,6 +999,11 @@ static int _recorder_client_wait_for_cb_return(muse_recorder_api_e api, recorder
/*LOGD("Enter api : %d", api);*/
+ if (!cb_info->is_server_connected) {
+ LOGE("server is disconnected");
+ return RECORDER_ERROR_SERVICE_DISCONNECTED;
+ }
+
g_mutex_lock(&(cb_info->api_mutex[api]));
if (cb_info->api_activating[api] == 0) {
@@ -990,6 +1044,7 @@ static int _recorder_client_wait_for_cb_return(muse_recorder_api_e api, recorder
static int _recorder_msg_send(int api, recorder_cb_info_s *cb_info, int *ret)
{
+ int send_ret = 0;
char *msg = NULL;
if (!cb_info || !ret) {
@@ -1005,7 +1060,10 @@ static int _recorder_msg_send(int api, recorder_cb_info_s *cb_info, int *ret)
/*LOGD("send msg %s", msg);*/
- if (muse_core_ipc_send_msg(cb_info->fd, msg) < 0) {
+ if (cb_info->is_server_connected)
+ send_ret = muse_core_ipc_send_msg(cb_info->fd, msg);
+
+ if (send_ret < 0) {
LOGE("message send failed");
*ret = RECORDER_ERROR_INVALID_OPERATION;
} else {
@@ -1020,6 +1078,7 @@ static int _recorder_msg_send(int api, recorder_cb_info_s *cb_info, int *ret)
static int _recorder_msg_send_param1(int api, recorder_cb_info_s *cb_info, int *ret, recorder_msg_param *param)
{
+ int send_ret = 0;
char *msg = NULL;
if (!cb_info || !ret || !param) {
@@ -1052,7 +1111,10 @@ static int _recorder_msg_send_param1(int api, recorder_cb_info_s *cb_info, int *
/*LOGD("send msg %s", msg);*/
- if (muse_core_ipc_send_msg(cb_info->fd, msg) < 0) {
+ if (cb_info->is_server_connected)
+ send_ret = muse_core_ipc_send_msg(cb_info->fd, msg);
+
+ if (send_ret < 0) {
LOGE("message send failed");
*ret = RECORDER_ERROR_INVALID_OPERATION;
} else {
@@ -1398,7 +1460,10 @@ int recorder_destroy(recorder_h recorder)
LOGD("ENTER");
- _recorder_msg_send(api, pc->cb_info, &ret);
+ if (pc->cb_info->is_server_connected)
+ _recorder_msg_send(api, pc->cb_info, &ret);
+ else
+ LOGW("server disconnected. release resource without send message.");
if (ret == RECORDER_ERROR_NONE) {
_recorder_remove_idle_event_all(pc->cb_info);
@@ -1622,6 +1687,7 @@ int recorder_cancel(recorder_h recorder)
int recorder_set_video_resolution(recorder_h recorder, int width, int height)
{
int ret = RECORDER_ERROR_NONE;
+ int send_ret = 0;
char *send_msg = NULL;
muse_recorder_api_e api = MUSE_RECORDER_API_SET_VIDEO_RESOLUTION;
recorder_cli_s *pc = (recorder_cli_s *)recorder;
@@ -1638,7 +1704,10 @@ int recorder_set_video_resolution(recorder_h recorder, int width, int height)
MUSE_TYPE_INT, "height", height,
NULL);
if (send_msg) {
- if (muse_core_ipc_send_msg(pc->cb_info->fd, send_msg) <= 0) {
+ if (pc->cb_info->is_server_connected)
+ send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, send_msg);
+
+ if (send_ret < 0) {
LOGE("message send failed");
ret = RECORDER_ERROR_INVALID_OPERATION;
} else {
@@ -1859,6 +1928,7 @@ int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stre
int stream_index = 0;
char *stream_type = NULL;
char *send_msg = NULL;
+ int send_ret = 0;
if (!pc || !pc->cb_info || stream_info == NULL) {
LOGE("NULL handle");
@@ -1889,7 +1959,10 @@ int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stre
MUSE_TYPE_INT, "stream_index", stream_index,
NULL);
if (send_msg) {
- if (muse_core_ipc_send_msg(pc->cb_info->fd, send_msg) <= 0) {
+ if (pc->cb_info->is_server_connected)
+ send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, send_msg);
+
+ if (send_ret < 0) {
LOGE("message send failed");
ret = RECORDER_ERROR_INVALID_OPERATION;
} else {
@@ -2716,7 +2789,10 @@ bool recorder_attr_is_muted(recorder_h recorder)
_recorder_msg_send(api, pc->cb_info, &ret);
- LOGD("ret : 0x%x", ret);
+ if (ret == RECORDER_ERROR_SERVICE_DISCONNECTED)
+ ret = false;
+
+ LOGD("ret : %d", ret);
return (bool)ret;
}
diff --git a/test/recorder_test.c b/test/recorder_test.c
index b74ff81..46360c6 100644
--- a/test/recorder_test.c
+++ b/test/recorder_test.c
@@ -552,6 +552,43 @@ static inline void flush_stdin()
while ((ch = getchar()) != EOF && ch != '\n');
}
+static bool _release_idle_event_callback(void *data)
+{
+ printf("destroy recorder handle\n\n");
+
+ recorder_destroy(hcamcorder->recorder);
+ hcamcorder->recorder = NULL;
+
+ hcamcorder->menu_state = MENU_STATE_MAIN;
+ mode_change();
+
+ return 0;
+}
+
+static void _recorder_error_cb(int error, recorder_state_e current_state, void *user_data)
+{
+ printf("\n\n\tERROR [0x%x], current state %d\n", error, current_state);
+
+ switch (error) {
+ case RECORDER_ERROR_RESOURCE_CONFLICT:
+ printf("\t\t[RECORDER_ERROR_RESOURCE_CONFLICT]\n\n");
+ break;
+ case RECORDER_ERROR_SECURITY_RESTRICTED:
+ printf("\t\t[RECORDER_ERROR_SECURITY_RESTRICTED]\n\n");
+ break;
+ case RECORDER_ERROR_SERVICE_DISCONNECTED:
+ printf("\t\t[RECORDER_ERROR_SERVICE_DISCONNECTED]\n\n");
+ g_idle_add_full(G_PRIORITY_DEFAULT,
+ (GSourceFunc)_release_idle_event_callback,
+ NULL, NULL);
+ break;
+ default:
+ break;
+ }
+
+ return;
+}
+
static void print_menu()
{
@@ -1354,6 +1391,7 @@ static gboolean init(int type)
}
}
+ recorder_set_error_cb(hcamcorder->recorder, _recorder_error_cb, NULL);
recorder_set_state_changed_cb(hcamcorder->recorder, _state_changed_cb, NULL);
recorder_set_recording_status_cb(hcamcorder->recorder, _recording_status_cb, NULL);
recorder_set_recording_limit_reached_cb(hcamcorder->recorder, _recording_limit_reached_cb, NULL);