Add code for checking compatibility between codec and file format. 32/91632/1 accepted/tizen/common/20161012.154203 accepted/tizen/ivi/20161012.065403 accepted/tizen/mobile/20161012.065246 accepted/tizen/tv/20161012.065314 accepted/tizen/wearable/20161012.065337 submit/tizen/20161012.010406
authorHaesu Gwon <haesu.gwon@samsung.com>
Mon, 10 Oct 2016 11:53:17 +0000 (20:53 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 10 Oct 2016 11:53:17 +0000 (20:53 +0900)
[Version] 0.10.79
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Dependency commit] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161010.1]

Change-Id: Ic97d74235b41c71ef630508f5faabdb3d6505158
Signed-off-by: Haesu Gwon <haesu.gwon@samsung.com>
packaging/libmm-camcorder.spec
src/include/mm_camcorder.h
src/include/mm_camcorder_gstcommon.h
src/mm_camcorder.c
src/mm_camcorder_gstcommon.c
src/mm_camcorder_internal.c

index 9325d17..febb659 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.78
+Version:    0.10.79
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index bd958ae..a762d53 100644 (file)
@@ -3282,6 +3282,9 @@ int mm_camcorder_stop_focusing(MMHandleType camcorder);
 void mm_camcorder_emit_signal(MMHandleType camcorder, const char *object_name,
        const char *interface_name, const char *signal_name, int value);
 
+/* check compatability between codec and file format */
+int mm_camcorder_check_codec_fileformat_compatibility(const char *codec_type, int codec, int file_format);
+
 /**
        @}
  */
index 2770d58..63f1058 100644 (file)
@@ -166,6 +166,7 @@ int _mmcamcorder_vframe_stablize(MMHandleType handle);
 gboolean _mmcamcorder_get_device_info(MMHandleType handle);
 int _mmcamcorder_get_eos_message(MMHandleType handle);
 void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int first_elem, int last_elem);
+int _mmcamcorder_check_codec_fileformat_compatibility(const char *codec_type, int codec, int file_format);
 int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle);
 int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle);
 bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate, int videosink_index);
index 20b1b73..ca60b9e 100644 (file)
@@ -430,3 +430,10 @@ void mm_camcorder_emit_signal(MMHandleType camcorder, const char *object_name,
 
        return;
 }
+
+int mm_camcorder_check_codec_fileformat_compatibility(const char *codec_type, int codec, int file_format)
+{
+       mmf_return_val_if_fail(codec_type, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+       return _mmcamcorder_check_codec_fileformat_compatibility(codec_type, codec, file_format);
+}
index 5f43faf..d2f7e1e 100644 (file)
@@ -2023,6 +2023,43 @@ void _mmcamcorder_remove_element_handle(MMHandleType handle, void *element, int
 }
 
 
+int _mmcamcorder_check_codec_fileformat_compatibility(const char *codec_type, int codec, int file_format)
+{
+       mmf_return_val_if_fail(codec_type, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+       /* Check compatibility between codec and file format */
+       if (!strcmp(codec_type, MMCAM_AUDIO_ENCODER)) {
+               if (codec > MM_AUDIO_CODEC_INVALID && codec < MM_AUDIO_CODEC_NUM &&
+                       file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
+                       if (audiocodec_fileformat_compatibility_table[codec][file_format] == 0) {
+                               _mmcam_dbg_err("Audio codec[%d] and file format[%d] compatibility FAILED.", codec, file_format);
+                               return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+                       }
+
+                       _mmcam_dbg_log("Audio codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format);
+               } else {
+                       _mmcam_dbg_err("Audio codec[%d] or file format[%d] is INVALID.", codec, file_format);
+                       return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+               }
+       } else if (!strcmp(codec_type, MMCAM_VIDEO_ENCODER)) {
+               if (codec > MM_VIDEO_CODEC_INVALID && codec < MM_VIDEO_CODEC_NUM &&
+                       file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
+                       if (videocodec_fileformat_compatibility_table[ codec][file_format] == 0) {
+                               _mmcam_dbg_err("Video codec[%d] and file format[%d] compatibility FAILED.", codec, file_format);
+                               return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+                       }
+
+                       _mmcam_dbg_log("Video codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format);
+               } else {
+                       _mmcam_dbg_err("Video codec[%d] or file format[%d] is INVALID.", codec, file_format);
+                       return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+               }
+       }
+
+       return MM_ERROR_NONE;
+}
+
+
 int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle)
 {
        int err = MM_ERROR_NONE;
@@ -2032,9 +2069,9 @@ int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle)
        char *err_name = NULL;
 
        err = mm_camcorder_get_attributes(handle, &err_name,
-                                                                         MMCAM_AUDIO_ENCODER, &audio_codec,
-                                                                         MMCAM_FILE_FORMAT, &file_format,
-                                                                         NULL);
+               MMCAM_AUDIO_ENCODER, &audio_codec,
+               MMCAM_FILE_FORMAT, &file_format,
+               NULL);
        if (err != MM_ERROR_NONE) {
                _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
                SAFE_FREE(err_name);
@@ -2042,23 +2079,9 @@ int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle)
        }
 
        /* Check compatibility between audio codec and file format */
-       if (audio_codec > MM_AUDIO_CODEC_INVALID && audio_codec < MM_AUDIO_CODEC_NUM &&
-           file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
-               if (audiocodec_fileformat_compatibility_table[audio_codec][file_format] == 0) {
-                       _mmcam_dbg_err("Audio codec[%d] and file format[%d] compatibility FAILED.",
-                               audio_codec, file_format);
-                       return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
-               }
+       err = _mmcamcorder_check_codec_fileformat_compatibility(MMCAM_AUDIO_ENCODER, audio_codec, file_format);
 
-               _mmcam_dbg_log("Audio codec[%d] and file format[%d] compatibility SUCCESS.",
-                       audio_codec, file_format);
-       } else {
-               _mmcam_dbg_err("Audio codec[%d] or file format[%d] is INVALID.",
-                       audio_codec, file_format);
-               return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
-       }
-
-       return MM_ERROR_NONE;
+       return err;
 }
 
 
@@ -2080,24 +2103,10 @@ int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle)
                return err;
        }
 
-       /* Check compatibility between audio codec and file format */
-       if (video_codec > MM_VIDEO_CODEC_INVALID && video_codec < MM_VIDEO_CODEC_NUM &&
-           file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
-               if (videocodec_fileformat_compatibility_table[video_codec][file_format] == 0) {
-                       _mmcam_dbg_err("Video codec[%d] and file format[%d] compatibility FAILED.",
-                               video_codec, file_format);
-                       return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
-               }
-
-               _mmcam_dbg_log("Video codec[%d] and file format[%d] compatibility SUCCESS.",
-                       video_codec, file_format);
-       } else {
-               _mmcam_dbg_err("Video codec[%d] or file format[%d] is INVALID.",
-                       video_codec, file_format);
-               return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
-       }
+       /* Check compatibility between video codec and file format */
+       err = _mmcamcorder_check_codec_fileformat_compatibility(MMCAM_VIDEO_ENCODER, video_codec, file_format);
 
-       return MM_ERROR_NONE;
+       return err;
 }
 
 
index 9ab89db..0b46d7c 100644 (file)
@@ -159,7 +159,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info)
        /* init for sound thread */
        g_mutex_init(&hcamcorder->task_thread_lock);
        g_cond_init(&hcamcorder->task_thread_cond);
-       hcamcorder->task_thread_state = _MMCAMCORDER_SOUND_STATE_NONE;
+       hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE;
 
        if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
                /* init for gdbus */