Fix invalid format usage - Phase#2
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_videorec.c
index fea07bf..1acd72f 100644 (file)
@@ -559,7 +559,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                                &hcamcorder->video_encoder_resource);
                                if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
                                        _mmcam_dbg_err("could not prepare for encoder resource");
-                                       ret = MM_ERROR_CAMCORDER_INTERNAL;
+                                       ret = MM_ERROR_RESOURCE_INTERNAL;
                                        _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
                                        goto _ERR_CAMCORDER_VIDEO_COMMAND;
                                }
@@ -570,10 +570,9 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                        /* acquire resources */
                        ret = mm_resource_manager_commit(hcamcorder->resource_manager);
                        if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-                               _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
-
                                _mmcam_dbg_err("could not acquire resources");
-
+                               ret = MM_ERROR_RESOURCE_INTERNAL;
+                               _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
                                goto _ERR_CAMCORDER_VIDEO_COMMAND;
                        }
 
@@ -924,10 +923,10 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME) {
                                        break;
                                } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
-                                       _mmcam_dbg_err("Pause fail, frame count %llu", info->video_frame_count);
+                                       _mmcam_dbg_err("Pause fail, frame count %"G_GUINT64_FORMAT, info->video_frame_count);
                                        return MM_ERROR_CAMCORDER_INVALID_CONDITION;
                                } else {
-                                       _mmcam_dbg_warn("Waiting for enough video frame, retrial[%d], frame %llu", count, info->video_frame_count);
+                                       _mmcam_dbg_warn("Waiting for enough video frame, retrial[%d], frame %"G_GUINT64_FORMAT, count, info->video_frame_count);
                                }
 
                                usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
@@ -936,11 +935,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME && info->audio_frame_count) {
                                        break;
                                } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
-                                       _mmcam_dbg_err("Pause fail, frame count VIDEO[%llu], AUDIO [%llu]",
+                                       _mmcam_dbg_err("Pause fail, frame count VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"]",
                                                info->video_frame_count, info->audio_frame_count);
                                        return MM_ERROR_CAMCORDER_INVALID_CONDITION;
                                } else {
-                                       _mmcam_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%llu], AUDIO [%llu]",
+                                       _mmcam_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"]",
                                                count, info->video_frame_count, info->audio_frame_count);
                                }
 
@@ -1070,7 +1069,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                    hcamcorder->capture_in_recording == FALSE) {
                                        break;
                                } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
-                                       _mmcam_dbg_err("Commit fail, frame count is %llu, capturing %d",
+                                       _mmcam_dbg_err("Commit fail, frame count is %"G_GUINT64_FORMAT", capturing %d",
                                                info->video_frame_count, hcamcorder->capture_in_recording);
 
                                        if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME) {
@@ -1080,7 +1079,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                                return MM_ERROR_CAMCORDER_INVALID_CONDITION;
                                        }
                                } else {
-                                       _mmcam_dbg_warn("Waiting for enough video frame, retrial [%d], frame %llu, capturing %d",
+                                       _mmcam_dbg_warn("Waiting for enough video frame, retrial [%d], frame %"G_GUINT64_FORMAT", capturing %d",
                                                count, info->video_frame_count, hcamcorder->capture_in_recording);
                                }
                        } else {
@@ -1090,7 +1089,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                                    hcamcorder->capture_in_recording == FALSE) {
                                        break;
                                } else if (count == _MMCAMCORDER_RETRIAL_COUNT) {
-                                       _mmcam_dbg_err("Commit fail, VIDEO[%llu], AUDIO [%llu], capturing %d",
+                                       _mmcam_dbg_err("Commit fail, VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"], capturing %d",
                                                info->video_frame_count, info->audio_frame_count, hcamcorder->capture_in_recording);
 
                                        if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME && info->audio_frame_count) {
@@ -1102,7 +1101,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
 
                                        return MM_ERROR_CAMCORDER_INVALID_CONDITION;
                                } else {
-                                       _mmcam_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%llu], AUDIO [%llu], capturing %d",
+                                       _mmcam_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%"G_GUINT64_FORMAT"], AUDIO [%"G_GUINT64_FORMAT"], capturing %d",
                                                count, info->video_frame_count, info->audio_frame_count, hcamcorder->capture_in_recording);
                                }
                        }
@@ -1209,18 +1208,8 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
 
        _mmcam_dbg_err("");
 
-       if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS) {
-               /* Play record stop sound */
-               _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, FALSE);
-       } else {
-               _mmcam_dbg_warn("Play stop sound through pulseaudio");
-
-               _mmcamcorder_sound_init(handle);
-
-               _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, TRUE);
-
-               _mmcamcorder_sound_finalize(handle);
-       }
+       /* Play record stop sound */
+       _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, FALSE);
 
        /* remove blocking part */
        MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
@@ -1259,7 +1248,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
        /* Check file size */
        if (info->max_size > 0) {
                _mmcamcorder_get_file_size(info->filename, &file_size);
-               _mmcam_dbg_log("MAX size %lld byte - created filesize %lld byte",
+               _mmcam_dbg_log("MAX size %"G_GUINT64_FORMAT" byte - created filesize %"G_GUINT64_FORMAT" byte",
                                           info->max_size, file_size);
 
                if (file_size > info->max_size) {
@@ -1347,10 +1336,8 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle)
        info->filesize = 0;
        info->b_commiting = FALSE;
 
-       if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS) {
-               /* check recording stop sound */
-               _mmcamcorder_sound_solo_play_wait(handle);
-       }
+       /* check recording stop sound */
+       _mmcamcorder_sound_solo_play_wait(handle);
 
        _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end");
 
@@ -1958,7 +1945,7 @@ static gboolean __mmcamcorder_add_metadata_mp4(MMHandleType handle)
 
                nread = fread(&buf, sizeof(char), sizeof(buf), f);
 
-               _mmcam_dbg_log("recorded file fread %d", nread);
+               _mmcam_dbg_log("recorded file fread %zu", nread);
 
                udta_size = _mmcamcorder_get_container_size(buf);