Remove duplicated code 53/276653/6 submit/tizen/20220629.002040
authorHaesu Gwon <haesu.gwon@samsung.com>
Thu, 23 Jun 2022 00:02:51 +0000 (09:02 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Thu, 23 Jun 2022 08:13:15 +0000 (08:13 +0000)
- Extract a method
- Remove useless log
- Move common test code(add clip & layer) to SetUp of gtest

[Version] 0.0.12
[Issue Type] Improvement

Change-Id: Ia63d71dd5418d3721e3d710ae7c30ba601b8bc35

gtest/testbase.hpp
gtest/ut_clip.cpp
include/media_editor_private.h
packaging/capi-media-editor.spec
src/media_editor.c
src/media_editor_layer.c

index 74241b94a8a0d2cdb8ca7e9eca9ea812159a3a6f..2e8bb0ecd56489704927d1241f4bda82f863aeb9 100644 (file)
@@ -37,7 +37,7 @@ public:
         LOGD("Enter");
 
         int ret = mediaeditor_create(&_editor);
-        ASSERT_TRUE(ret == MEDIAEDITOR_ERROR_NONE);
+        ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
         LOGD("Leave");
     }
@@ -47,7 +47,7 @@ public:
 
         if (_editor) {
             int ret = mediaeditor_destroy(_editor);
-            ASSERT_TRUE(ret == MEDIAEDITOR_ERROR_NONE);
+            ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
         }
 
         LOGD("Leave");
@@ -60,9 +60,10 @@ public:
     const std::string& GetProjectPath(int idx) { return _projectPath[idx]; }
     const std::string& GetOutputPath() { return _outputPath; }
 
-private:
+protected:
     mediaeditor_h _editor;
 
+private:
     const std::string _basePath = "/tmp/";
     const std::string _jpgPath = _basePath + "test.jpg";
     const std::string _mp3Path = _basePath + "test.mp3";
index 32abe9f348d8c7a1c1c27eb4347e85eab52a3ea1..18f2889ae4e204d1e86243c2c2b5c43d3af87204 100644 (file)
@@ -22,6 +22,35 @@ class MediaeditorClipTest : public MediaeditorTestBase {
 public:
     MediaeditorClipTest() {}
 
+    void SetUp() override {
+        LOGD("Enter");
+
+        int ret = MEDIAEDITOR_ERROR_NONE;
+        unsigned int layer_priority = 0;
+
+        ret = mediaeditor_create(&_editor);
+        ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+
+        ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
+        ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+
+        ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, 0, duration, 0, &clip_id);
+        ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+
+        LOGD("Leave");
+    }
+
+    void TearDown() override {
+        LOGD("Enter");
+
+        if (_editor) {
+            int ret = mediaeditor_destroy(_editor);
+            ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+        }
+
+        LOGD("Leave");
+    }
+
     static void RenderCompletedCb(void *user_data)
     {
         LOGD("Render completed");
@@ -59,39 +88,16 @@ public:
         g_main_loop_unref(mainloop);
         mainloop = NULL;
     }
-};
 
-TEST_F(MediaeditorClipTest, DISABLED_clip_create)
-{
-    int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
+public:
     unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-}
-
-TEST_F(MediaeditorClipTest, DISABLED_clip_delete)
-{
-    int ret = MEDIAEDITOR_ERROR_NONE;
     unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+    const unsigned int duration = 100;
+};
 
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
+TEST_F(MediaeditorClipTest, DISABLED_clip_add_move_remove)
+{
+    int ret = mediaeditor_move_clip_layer(GetHandle(), clip_id, 0);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
     ret = mediaeditor_remove_clip(GetHandle(), clip_id);
@@ -100,39 +106,21 @@ TEST_F(MediaeditorClipTest, DISABLED_clip_delete)
 
 TEST_F(MediaeditorClipTest, DISABLED_clip_split)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
     unsigned int new_clip_id = 0;
     unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
 
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_split_clip(GetHandle(), clip_id, (start + duration) / 2, &new_clip_id);
+    int ret = mediaeditor_split_clip(GetHandle(), clip_id, (start + duration) / 2, &new_clip_id);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 }
 
 TEST_F(MediaeditorClipTest, DISABLED_clip_group_ungroup)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
     unsigned int src_ids[5] = { 0 };
     g_autofree unsigned int *dst_ids = NULL;
     unsigned int group_id = 0;
     unsigned int ungroup_size = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+    unsigned int start = 100;
 
     for (int i = 0; i < 5; i++) {
         ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, i * 100, &src_ids[i]);
@@ -158,71 +146,29 @@ TEST_F(MediaeditorClipTest, DISABLED_clip_group_ungroup)
     }
 }
 
-TEST_F(MediaeditorClipTest, DISABLED_clip_move)
-{
-    int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-    LOGD("clip id : %d", clip_id);
-
-    ret = mediaeditor_move_clip_layer(GetHandle(), clip_id, 0);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-}
-
 TEST_F(MediaeditorClipTest, DISABLED_clip_set_duration)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
-    unsigned int set_duration = 200;
     unsigned int get_duration = 0;
 
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
     LOGD("original duration : %d", duration);
 
-    ret = mediaeditor_set_clip_duration(GetHandle(), clip_id, set_duration);
+    ret = mediaeditor_set_clip_duration(GetHandle(), clip_id, 200);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-    LOGD("set_duration : %d", set_duration);
+    LOGD("set_duration : %d", 200);
 
     ret = mediaeditor_get_clip_duration(GetHandle(), clip_id, &get_duration);
-    ASSERT_EQ(set_duration, get_duration);
+    ASSERT_EQ(200, get_duration);
     LOGD("get_duration : %d", get_duration);
 }
 
 TEST_F(MediaeditorClipTest, DISABLED_clip_position)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 1000;
-    unsigned int in_point = 0;
     unsigned int pos_x = 0;
     unsigned int pos_y = 0;
 
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetJpgPath().c_str(), layer_id, start, duration, in_point, &clip_id);
+    ret = mediaeditor_add_clip(GetHandle(), GetJpgPath().c_str(), layer_id, duration, duration, 0, &clip_id);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
     ret = mediaeditor_get_clip_position(GetHandle(), clip_id, &pos_x, &pos_y);
@@ -242,19 +188,10 @@ TEST_F(MediaeditorClipTest, DISABLED_clip_position)
 TEST_F(MediaeditorClipTest, DISABLED_audio_clip_set_get_resolution)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
     unsigned int width = 0;
     unsigned int height = 0;
 
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp3Path().c_str(), layer_id, start, duration, in_point, &clip_id);
+    ret = mediaeditor_add_clip(GetHandle(), GetMp3Path().c_str(), layer_id, duration, duration, 0, &clip_id);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
     ret = mediaeditor_get_clip_resolution(GetHandle(), clip_id, &width, &height);
@@ -265,20 +202,8 @@ TEST_F(MediaeditorClipTest, DISABLED_audio_clip_set_get_resolution)
 TEST_F(MediaeditorClipTest, DISABLED_volume)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
     double volume = 0.0;
 
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
     ret = mediaeditor_get_clip_volume(GetHandle(), clip_id, &volume);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
     ASSERT_EQ(volume, 1.0);
@@ -294,51 +219,32 @@ TEST_F(MediaeditorClipTest, DISABLED_volume)
 
 TEST_F(MediaeditorClipTest, DISABLED_transition)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 100;
-    unsigned int in_point = 0;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
+    // A clip is already added int SetUp
 
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
+    int ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(1).c_str(), layer_id, duration / 2, duration, 0, &clip_id);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(1).c_str(), layer_id, start + (duration / 2), duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_transition(GetHandle(), MEDIAEDITOR_TRANSITION_TYPE_CROSSFADE, layer_id, start + (duration / 2), duration / 2);
+    ret = mediaeditor_add_transition(GetHandle(), MEDIAEDITOR_TRANSITION_TYPE_CROSSFADE, layer_id, duration / 2, duration / 2);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 }
 
 TEST_F(MediaeditorClipTest, DISABLED_transition_n)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 1000;
-    unsigned int in_point = 0;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
     ret = mediaeditor_set_error_cb(GetHandle(), ErrorCb, GetHandle());
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
-    /* Test for no overlapped area */
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(1).c_str(), layer_id, start + (duration * 2), duration, in_point, &clip_id);
+    // Test for no overlapped area between clips. Error callback should be occurred.
+    // A clip1 is already added int SetUp.
+    // 0            100     150   200           300
+    // |<---Clip1--->|             |             |
+    // |             |             |<---Clip2--->|
+    // |             |<Trans>      |             |
+    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(1).c_str(), layer_id, duration * 2, duration, 0, &clip_id);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
-    ret = mediaeditor_add_transition(GetHandle(), MEDIAEDITOR_TRANSITION_TYPE_CROSSFADE, layer_id, start + duration, duration / 2);
+    ret = mediaeditor_add_transition(GetHandle(), MEDIAEDITOR_TRANSITION_TYPE_CROSSFADE, layer_id, duration, duration / 2);
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
     ret = mediaeditor_start_render(GetHandle(), GetOutputPath().c_str(), RenderCompletedCb, GetHandle());
@@ -350,23 +256,10 @@ TEST_F(MediaeditorClipTest, DISABLED_transition_n)
 TEST_F(MediaeditorClipTest, DISABLED_cancel_render)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
-    unsigned int layer_id = 0;
-    unsigned int layer_priority = 0;
-    unsigned int clip_id = 0;
-    unsigned int start = 0;
-    unsigned int duration = 10000;
-    unsigned int in_point = 0;
-
-    ret = mediaeditor_add_layer(GetHandle(), &layer_id, &layer_priority);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
     ret = mediaeditor_set_state_changed_cb(GetHandle(), StateChangedCb, GetHandle());
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
-    /* Test for no overlapped area */
-    ret = mediaeditor_add_clip(GetHandle(), GetMp4Path(0).c_str(), layer_id, start, duration, in_point, &clip_id);
-    ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
-
     ret = mediaeditor_start_render(GetHandle(), GetOutputPath().c_str(), RenderCompletedCb, GetHandle());
     ASSERT_EQ(ret, MEDIAEDITOR_ERROR_NONE);
 
index 764014711cbb247feb9f601fa0588a7a5f773e14..0481f7cbe8beaf9de1c0fb131cc28fc4be0ace23 100644 (file)
@@ -336,8 +336,7 @@ int _mediaeditor_get_layer(mediaeditor_s *editor, unsigned int layer_id, GESLaye
 int _mediaeditor_add_layer(mediaeditor_s *editor, unsigned int *layer_id, unsigned int *layer_priority);
 int _mediaeditor_remove_layer(mediaeditor_s *editor, unsigned int layer_id);
 int _mediaeditor_move_layer(mediaeditor_s *editor, unsigned int layer_id, unsigned int layer_priority);
-int _mediaeditor_activate_layer(mediaeditor_s *editor, unsigned int layer_id);
-int _mediaeditor_deactivate_layer(mediaeditor_s *editor, unsigned int layer_id);
+int _mediaeditor_set_layer_activation(mediaeditor_s *editor, unsigned int layer_id, bool activate);
 int _mediaeditor_get_layer_priority(mediaeditor_s *editor, unsigned int layer_id, unsigned int *layer_priority);
 int _mediaeditor_get_layer_lowest_priority(mediaeditor_s *editor, unsigned int *layer_priority);
 int _mediaeditor_get_layer_id(mediaeditor_s *editor, unsigned int layer_priority, unsigned int *layer_id);
index b23b13019b2763791709104535237b3596c72173..4aae0ecb39b381f51d505aa2153968f5f84009d7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-editor
 Summary:    A Tizen Media Editor API
-Version:    0.0.11
+Version:    0.0.12
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 1ccab0c662cdfc6974c24622512c5b5c3347f90b..fb0f47289e1824c5621ba2f6153c9d49ffe3235f 100644 (file)
@@ -31,8 +31,6 @@ int mediaeditor_create(mediaeditor_h *editor)
 
     RET_VAL_IF(editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     _editor = g_new0(mediaeditor_s, 1);
 
     g_mutex_init(&_editor->mutex);
@@ -87,8 +85,6 @@ int mediaeditor_destroy(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", _editor);
-
     _remove_remained_event_sources(_editor);
 
     ret = _gst_pipeline_set_state(_editor, GST_STATE_NULL);
@@ -120,14 +116,11 @@ int mediaeditor_destroy(mediaeditor_h editor)
 
     SAFE_G_FREE(_editor);
 
-    LOG_DEBUG("Leave");
-
     return MEDIAEDITOR_ERROR_NONE;
 }
 
 int mediaeditor_set_display(mediaeditor_h editor, mediaeditor_display_type_e type, mediaeditor_display_h display)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -139,16 +132,12 @@ int mediaeditor_set_display(mediaeditor_h editor, mediaeditor_display_type_e typ
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], type[%d], display[%p]", editor, type, display);
+    LOG_DEBUG("editor[%p], type[%d], display[%p]", editor, type, display);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_display(_editor, type, display);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_display(_editor, type, display);
 }
 
 int mediaeditor_get_state(mediaeditor_h editor, mediaeditor_state_e *state)
@@ -159,13 +148,11 @@ int mediaeditor_get_state(mediaeditor_h editor, mediaeditor_state_e *state)
     RET_VAL_IF(_editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
     RET_VAL_IF(state == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "state is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     *state = _editor->state;
 
-    LOG_DEBUG("Leave editor[%p], state[%d]", editor, *state);
+    LOG_DEBUG("editor[%p], state[%d]", editor, *state);
 
     return MEDIAEDITOR_ERROR_NONE;
 }
@@ -184,24 +171,17 @@ int mediaeditor_start_render(mediaeditor_h editor, const char* path, mediaeditor
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
     _editor->render_completed_cb.callback = callback;
     _editor->render_completed_cb.user_data = user_data;
 
-    ret = _mediaeditor_start_render(_editor, path);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_start_render(_editor, path);
 }
 
 int mediaeditor_cancel_render(mediaeditor_h editor)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -209,21 +189,14 @@ int mediaeditor_cancel_render(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_RENDERING, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be RENDERING");
 
-    ret = _mediaeditor_cancel_render(_editor);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_cancel_render(_editor);
 }
 
 int mediaeditor_start_preview(mediaeditor_h editor)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -232,21 +205,14 @@ int mediaeditor_start_preview(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_start_preview(_editor);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_start_preview(_editor);
 }
 
 int mediaeditor_stop_preview(mediaeditor_h editor)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -255,21 +221,14 @@ int mediaeditor_stop_preview(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], state [%d], pend_state[%d]", editor, _editor->state, _editor->pend_state);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_PREVIEW, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be PREVIEW");
 
-    ret = _mediaeditor_stop_preview(_editor);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_stop_preview(_editor);
 }
 
 int mediaeditor_add_layer(mediaeditor_h editor, unsigned int *layer_id, unsigned int *layer_priority)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -279,21 +238,14 @@ int mediaeditor_add_layer(mediaeditor_h editor, unsigned int *layer_id, unsigned
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_add_layer(_editor, layer_id, layer_priority);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_add_layer(_editor, layer_id, layer_priority);
 }
 
 int mediaeditor_remove_layer(mediaeditor_h editor, unsigned int layer_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -301,21 +253,14 @@ int mediaeditor_remove_layer(mediaeditor_h editor, unsigned int layer_id)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_remove_layer(_editor, layer_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_remove_layer(_editor, layer_id);
 }
 
 int mediaeditor_move_layer(mediaeditor_h editor, unsigned int layer_id, unsigned int layer_priority)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -323,21 +268,14 @@ int mediaeditor_move_layer(mediaeditor_h editor, unsigned int layer_id, unsigned
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_move_layer(_editor, layer_id, layer_priority);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_move_layer(_editor, layer_id, layer_priority);
 }
 
 int mediaeditor_activate_layer(mediaeditor_h editor, unsigned int layer_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -345,21 +283,14 @@ int mediaeditor_activate_layer(mediaeditor_h editor, unsigned int layer_id)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_activate_layer(_editor, layer_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_layer_activation(_editor, layer_id, true);
 }
 
 int mediaeditor_deactivate_layer(mediaeditor_h editor, unsigned int layer_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -367,16 +298,10 @@ int mediaeditor_deactivate_layer(mediaeditor_h editor, unsigned int layer_id)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_deactivate_layer(_editor, layer_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_layer_activation(_editor, layer_id, false);
 }
 
 int mediaeditor_get_layer_priority(mediaeditor_h editor, unsigned int layer_id, unsigned int *layer_priority)
@@ -390,11 +315,9 @@ int mediaeditor_get_layer_priority(mediaeditor_h editor, unsigned int layer_id,
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     ret = _mediaeditor_get_layer_priority(_editor, layer_id, layer_priority);
 
-    LOG_DEBUG("Leave editor[%p], layer_id[%d], priority[%d]", editor, layer_id, *layer_priority);
+    LOG_DEBUG("editor[%p], layer_id[%d], priority[%d]", editor, layer_id, *layer_priority);
 
     return ret;
 }
@@ -410,11 +333,9 @@ int mediaeditor_get_layer_lowest_priority(mediaeditor_h editor, unsigned int *la
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     ret = _mediaeditor_get_layer_lowest_priority(_editor, layer_priority);
 
-    LOG_DEBUG("Leave editor[%p], priority[%d]", editor, *layer_priority);
+    LOG_DEBUG("editor[%p], priority[%d]", editor, *layer_priority);
 
     return ret;
 }
@@ -430,11 +351,9 @@ int mediaeditor_get_layer_id(mediaeditor_h editor, unsigned int layer_priority,
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     ret = _mediaeditor_get_layer_id(_editor, layer_priority, layer_id);
 
-    LOG_DEBUG("Leave editor[%p], priority[%d], layer_id[%d]", editor, layer_priority, *layer_id);
+    LOG_DEBUG("editor[%p], priority[%d], layer_id[%d]", editor, layer_priority, *layer_id);
 
     return ret;
 }
@@ -453,21 +372,14 @@ int mediaeditor_add_clip(mediaeditor_h editor, const char *path, unsigned int la
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_add_clip(_editor, path, layer_id, start, duration, in_point, clip_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_add_clip(_editor, path, layer_id, start, duration, in_point, clip_id);
 }
 
 int mediaeditor_remove_clip(mediaeditor_h editor, unsigned int clip_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -475,22 +387,15 @@ int mediaeditor_remove_clip(mediaeditor_h editor, unsigned int clip_id)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_remove_clip(_editor, clip_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_remove_clip(_editor, clip_id);
 }
 
 int mediaeditor_split_clip(mediaeditor_h editor, unsigned int src_clip_id, unsigned int position,
   unsigned int *new_clip_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -498,21 +403,14 @@ int mediaeditor_split_clip(mediaeditor_h editor, unsigned int src_clip_id, unsig
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_split_clip(_editor, src_clip_id, position, new_clip_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_split_clip(_editor, src_clip_id, position, new_clip_id);
 }
 
 int mediaeditor_group_clip(mediaeditor_h editor, unsigned int *clip_ids, unsigned int size, unsigned int *group_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -520,21 +418,14 @@ int mediaeditor_group_clip(mediaeditor_h editor, unsigned int *clip_ids, unsigne
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_group_clip(_editor, clip_ids, size, group_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_group_clip(_editor, clip_ids, size, group_id);
 }
 
 int mediaeditor_ungroup_clip(mediaeditor_h editor, unsigned int group_id, unsigned int **clip_ids, unsigned int *size)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -542,21 +433,14 @@ int mediaeditor_ungroup_clip(mediaeditor_h editor, unsigned int group_id, unsign
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_ungroup_clip(_editor, group_id, clip_ids, size);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_ungroup_clip(_editor, group_id, clip_ids, size);
 }
 
 int mediaeditor_move_clip_layer(mediaeditor_h editor, unsigned int clip_id, unsigned int layer_priority)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -564,16 +448,10 @@ int mediaeditor_move_clip_layer(mediaeditor_h editor, unsigned int clip_id, unsi
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_move_clip_layer(_editor, clip_id, layer_priority);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_move_clip_layer(_editor, clip_id, layer_priority);
 }
 
 int mediaeditor_get_clip_start(mediaeditor_h editor, unsigned int clip_id, unsigned int *start)
@@ -585,22 +463,17 @@ int mediaeditor_get_clip_start(mediaeditor_h editor, unsigned int clip_id, unsig
     RET_VAL_IF(_editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
     RET_VAL_IF(start == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "start is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     ret = _mediaeditor_get_clip_start(_editor, clip_id, start);
 
-    g_mutex_unlock(&_editor->mutex);
-
-    LOG_DEBUG("Leave editor[%p], clip_id[%d], start[%d]", editor, clip_id, *start);
+    LOG_DEBUG("editor[%p], clip_id[%d], start[%d]", editor, clip_id, *start);
 
     return ret;
 }
 
 int mediaeditor_set_clip_start(mediaeditor_h editor, unsigned int clip_id, unsigned int start)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -608,16 +481,12 @@ int mediaeditor_set_clip_start(mediaeditor_h editor, unsigned int clip_id, unsig
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], clip_id[%d], start[%d]", editor, clip_id, start);
+    LOG_DEBUG("editor[%p], clip_id[%d], start[%d]", editor, clip_id, start);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_clip_start(_editor, clip_id, start);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_clip_start(_editor, clip_id, start);
 }
 
 int mediaeditor_get_clip_duration(mediaeditor_h editor, unsigned int clip_id, unsigned int *duration)
@@ -629,20 +498,17 @@ int mediaeditor_get_clip_duration(mediaeditor_h editor, unsigned int clip_id, un
     RET_VAL_IF(_editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
     RET_VAL_IF(duration == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "duration is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     ret = _mediaeditor_get_clip_duration(_editor, clip_id, duration);
 
-    LOG_DEBUG("Leave editor[%p], clip_id[%d], duration[%d]", editor, clip_id, *duration);
+    LOG_DEBUG("editor[%p], clip_id[%d], duration[%d]", editor, clip_id, *duration);
 
     return ret;
 }
 
 int mediaeditor_set_clip_duration(mediaeditor_h editor, unsigned int clip_id, unsigned int duration)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -650,16 +516,12 @@ int mediaeditor_set_clip_duration(mediaeditor_h editor, unsigned int clip_id, un
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], clip_id[%d], duration[%d]", editor, clip_id, duration);
+    LOG_DEBUG("editor[%p], clip_id[%d], duration[%d]", editor, clip_id, duration);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_clip_duration(_editor, clip_id, duration);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_clip_duration(_editor, clip_id, duration);
 }
 
 int mediaeditor_get_clip_in_point(mediaeditor_h editor, unsigned int clip_id, unsigned int *in_point)
@@ -671,20 +533,17 @@ int mediaeditor_get_clip_in_point(mediaeditor_h editor, unsigned int clip_id, un
     RET_VAL_IF(_editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
     RET_VAL_IF(in_point == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "in_point is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     ret = _mediaeditor_get_clip_in_point(_editor, clip_id, in_point);
 
-    LOG_DEBUG("Leave editor[%p], clip_id[%d], in_point[%d]", editor, clip_id, *in_point);
+    LOG_DEBUG("editor[%p], clip_id[%d], in_point[%d]", editor, clip_id, *in_point);
 
     return ret;
 }
 
 int mediaeditor_set_clip_in_point(mediaeditor_h editor, unsigned int clip_id, unsigned int in_point)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -692,16 +551,12 @@ int mediaeditor_set_clip_in_point(mediaeditor_h editor, unsigned int clip_id, un
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], clip_id[%d], in_point[%d]", editor, clip_id, in_point);
+    LOG_DEBUG("editor[%p], clip_id[%d], in_point[%d]", editor, clip_id, in_point);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_clip_in_point(_editor, clip_id, in_point);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_clip_in_point(_editor, clip_id, in_point);
 }
 
 int mediaeditor_get_clip_resolution(mediaeditor_h editor, unsigned int clip_id, unsigned int *width, unsigned int *height)
@@ -714,20 +569,17 @@ int mediaeditor_get_clip_resolution(mediaeditor_h editor, unsigned int clip_id,
     RET_VAL_IF(width == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "width is NULL");
     RET_VAL_IF(height == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "height is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     ret = _mediaeditor_get_clip_resolution(_editor, clip_id, width, height);
 
-    LOG_DEBUG("Leave editor[%p], clip_id[%d], width[%d], height[%d]", editor, clip_id, *width, *height);
+    LOG_DEBUG("editor[%p], clip_id[%d], width[%d], height[%d]", editor, clip_id, *width, *height);
 
     return ret;
 }
 
 int mediaeditor_set_clip_resolution(mediaeditor_h editor, unsigned int clip_id, unsigned int width, unsigned int height)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -735,16 +587,12 @@ int mediaeditor_set_clip_resolution(mediaeditor_h editor, unsigned int clip_id,
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], clip_id[%d], width[%d], height[%d]", editor, clip_id, width, height);
+    LOG_DEBUG("editor[%p], clip_id[%d], width[%d], height[%d]", editor, clip_id, width, height);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_clip_resolution(_editor, clip_id, width, height);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_clip_resolution(_editor, clip_id, width, height);
 }
 
 int mediaeditor_get_clip_position(mediaeditor_h editor, unsigned int clip_id, unsigned int *pos_x, unsigned int *pos_y)
@@ -757,20 +605,17 @@ int mediaeditor_get_clip_position(mediaeditor_h editor, unsigned int clip_id, un
     RET_VAL_IF(pos_x == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "pos_x is NULL");
     RET_VAL_IF(pos_y == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "pos_y is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     ret = _mediaeditor_get_clip_position(_editor, clip_id, pos_x, pos_y);
 
-    LOG_DEBUG("Leave editor[%p], clip_id[%d], pos_x[%d], pos_x[%d]", editor, clip_id, *pos_x, *pos_y);
+    LOG_DEBUG("editor[%p], clip_id[%d], pos_x[%d], pos_x[%d]", editor, clip_id, *pos_x, *pos_y);
 
     return ret;
 }
 
 int mediaeditor_set_clip_position(mediaeditor_h editor, unsigned int clip_id, unsigned int pos_x, unsigned int pos_y)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -778,16 +623,12 @@ int mediaeditor_set_clip_position(mediaeditor_h editor, unsigned int clip_id, un
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], clip_id[%d], pos_x[%d], pos_y[%d]", editor, clip_id, pos_x, pos_y);
+    LOG_DEBUG("editor[%p], clip_id[%d], pos_x[%d], pos_y[%d]", editor, clip_id, pos_x, pos_y);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_clip_position(_editor, clip_id, pos_x, pos_y);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_clip_position(_editor, clip_id, pos_x, pos_y);
 }
 
 int mediaeditor_get_clip_volume(mediaeditor_h editor, unsigned int clip_id, double *volume)
@@ -799,20 +640,17 @@ int mediaeditor_get_clip_volume(mediaeditor_h editor, unsigned int clip_id, doub
     RET_VAL_IF(_editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
     RET_VAL_IF(volume == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "volume is NULL");
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     locker = g_mutex_locker_new(&_editor->mutex);
 
     ret = _mediaeditor_get_clip_volume(_editor, clip_id, volume);
 
-    LOG_DEBUG("Leave editor[%p], clip_id[%d], volumd[%f]", editor, clip_id, *volume);
+    LOG_DEBUG("editor[%p], clip_id[%d], volumd[%f]", editor, clip_id, *volume);
 
     return ret;
 }
 
 int mediaeditor_set_clip_volume(mediaeditor_h editor, unsigned int clip_id, double volume)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -821,22 +659,17 @@ int mediaeditor_set_clip_volume(mediaeditor_h editor, unsigned int clip_id, doub
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], clip_id[%d], volume[%f]", editor, clip_id, volume);
+    LOG_DEBUG("editor[%p], clip_id[%d], volume[%f]", editor, clip_id, volume);
 
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_set_clip_volume(_editor, clip_id, volume);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_set_clip_volume(_editor, clip_id, volume);
 }
 
 int mediaeditor_add_transition(mediaeditor_h editor, mediaeditor_transition_type_e type, unsigned int layer_id,
     unsigned int start, unsigned int duration)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -846,22 +679,15 @@ int mediaeditor_add_transition(mediaeditor_h editor, mediaeditor_transition_type
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_add_transition(_editor, type, layer_id, start, duration);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_add_transition(_editor, type, layer_id, start, duration);
 }
 
 int mediaeditor_add_effect(mediaeditor_h editor, mediaeditor_effect_type_e type, unsigned int layer_id,
     unsigned int start, unsigned int duration, unsigned int *effect_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -871,21 +697,14 @@ int mediaeditor_add_effect(mediaeditor_h editor, mediaeditor_effect_type_e type,
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_add_effect(_editor, type, layer_id, start, duration, effect_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_add_effect(_editor, type, layer_id, start, duration, effect_id);
 }
 
 int mediaeditor_remove_effect(mediaeditor_h editor, unsigned int effect_id)
 {
-    int ret = MEDIAEDITOR_ERROR_NONE;
     g_autoptr(GMutexLocker) locker = NULL;
     mediaeditor_s *_editor = (mediaeditor_s *)editor;
 
@@ -893,16 +712,10 @@ int mediaeditor_remove_effect(mediaeditor_h editor, unsigned int effect_id)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_remove_effect(_editor, effect_id);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_remove_effect(_editor, effect_id);
 }
 
 int mediaeditor_create_project(mediaeditor_h editor, const char *path)
@@ -918,16 +731,10 @@ int mediaeditor_create_project(mediaeditor_h editor, const char *path)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_create_project(_editor, path);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_create_project(_editor, path);
 }
 
 int mediaeditor_load_project(mediaeditor_h editor, const char *path, mediaeditor_project_loaded_cb callback, void *user_data)
@@ -944,19 +751,13 @@ int mediaeditor_load_project(mediaeditor_h editor, const char *path, mediaeditor
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
     _editor->project_loaded_cb.callback = callback;
     _editor->project_loaded_cb.user_data = user_data;
 
-    ret = _mediaeditor_load_project(_editor, path);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_load_project(_editor, path);
 }
 
 int mediaeditor_save_project(mediaeditor_h editor)
@@ -976,16 +777,10 @@ int mediaeditor_save_project(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
-    ret = _mediaeditor_save_project(_editor, uri);
-
-    LOG_DEBUG("Leave editor[%p]", editor);
-
-    return ret;
+    return _mediaeditor_save_project(_editor, uri);
 }
 
 int mediaeditor_set_error_cb(mediaeditor_h editor, mediaeditor_error_cb callback, void *user_data)
@@ -998,15 +793,13 @@ int mediaeditor_set_error_cb(mediaeditor_h editor, mediaeditor_error_cb callback
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], callback[%p]", editor, callback);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
     _editor->error_cb.callback = callback;
     _editor->error_cb.user_data = user_data;
 
-    LOG_DEBUG("Leave editor[%p], callback[%p], user_data[%p]", editor, callback, user_data);
+    LOG_DEBUG("editor[%p], callback[%p], user_data[%p]", editor, callback, user_data);
 
     return MEDIAEDITOR_ERROR_NONE;
 }
@@ -1020,8 +813,6 @@ int mediaeditor_unset_error_cb(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
     RET_VAL_IF(_editor->error_cb.callback == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION,
@@ -1030,8 +821,6 @@ int mediaeditor_unset_error_cb(mediaeditor_h editor)
     _editor->error_cb.callback = NULL;
     _editor->error_cb.user_data = NULL;
 
-    LOG_DEBUG("Leave editor[%p]", editor);
-
     return MEDIAEDITOR_ERROR_NONE;
 }
 
@@ -1045,15 +834,13 @@ int mediaeditor_set_state_changed_cb(mediaeditor_h editor, mediaeditor_state_cha
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], callback[%p]", editor, callback);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
     _editor->state_changed_cb.callback = callback;
     _editor->state_changed_cb.user_data = user_data;
 
-    LOG_DEBUG("Leave editor[%p], callback[%p], user_data[%p]", editor, callback, user_data);
+    LOG_DEBUG("editor[%p], callback[%p], user_data[%p]", editor, callback, user_data);
 
     return MEDIAEDITOR_ERROR_NONE;
 }
@@ -1067,8 +854,6 @@ int mediaeditor_unset_state_changed_cb(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
     RET_VAL_IF(_editor->state_changed_cb.callback == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION,
@@ -1077,8 +862,6 @@ int mediaeditor_unset_state_changed_cb(mediaeditor_h editor)
     _editor->state_changed_cb.callback = NULL;
     _editor->state_changed_cb.user_data = NULL;
 
-    LOG_DEBUG("Leave editor[%p]", editor);
-
     return MEDIAEDITOR_ERROR_NONE;
 }
 
@@ -1092,15 +875,13 @@ int mediaeditor_set_layer_priority_changed_cb(mediaeditor_h editor, mediaeditor_
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p], callback[%p]", editor, callback);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
 
     _editor->layer_priority_changed_cb.callback = callback;
     _editor->layer_priority_changed_cb.user_data = user_data;
 
-    LOG_DEBUG("Leave editor[%p], callback[%p], user_data[%p]", editor, callback, user_data);
+    LOG_DEBUG("editor[%p], callback[%p], user_data[%p]", editor, callback, user_data);
 
     return MEDIAEDITOR_ERROR_NONE;
 }
@@ -1114,8 +895,6 @@ int mediaeditor_unset_layer_priority_changed_cb(mediaeditor_h editor)
 
     locker = g_mutex_locker_new(&_editor->mutex);
 
-    LOG_DEBUG("Enter editor[%p]", editor);
-
     RET_VAL_IF(_editor->state != MEDIAEDITOR_STATE_IDLE, MEDIAEDITOR_ERROR_INVALID_STATE,
         "the state should be IDLE");
     RET_VAL_IF(_editor->layer_priority_changed_cb.callback == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION,
@@ -1124,7 +903,5 @@ int mediaeditor_unset_layer_priority_changed_cb(mediaeditor_h editor)
     _editor->layer_priority_changed_cb.callback = NULL;
     _editor->layer_priority_changed_cb.user_data = NULL;
 
-    LOG_DEBUG("Leave editor[%p]", editor);
-
     return MEDIAEDITOR_ERROR_NONE;
 }
\ No newline at end of file
index 42dd1121e10bd30cab1a9fa886bdb24405517b11..92b6bdcf4e8afa7738b826d1bea442cd1555552b 100644 (file)
@@ -339,35 +339,14 @@ int _mediaeditor_move_layer(mediaeditor_s *editor, unsigned int layer_id, unsign
     return MEDIAEDITOR_ERROR_NONE;
 }
 
-int _mediaeditor_activate_layer(mediaeditor_s *editor, unsigned int layer_id)
+int _mediaeditor_set_layer_activation(mediaeditor_s *editor, unsigned int layer_id, bool activate)
 {
     int ret = MEDIAEDITOR_ERROR_NONE;
     GESLayer *layer = NULL;
     GList *tracks = NULL;
     gboolean result = FALSE;
 
-    RET_VAL_IF(editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
-
-    tracks = ges_timeline_get_tracks(editor->gst.timeline);
-    RET_VAL_IF(tracks == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "tracks is NULL");
-
-    ret = _mediaeditor_get_layer(editor, layer_id, &layer);
-    RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to get layer");
-
-    result = ges_layer_set_active_for_tracks(layer, true, tracks);
-    RET_VAL_IF(result == FALSE, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to set active");
-
-    return MEDIAEDITOR_ERROR_NONE;
-}
-
-int _mediaeditor_deactivate_layer(mediaeditor_s *editor, unsigned int layer_id)
-{
-    int ret = MEDIAEDITOR_ERROR_NONE;
-    GESLayer *layer = NULL;
-    GList *tracks = NULL;
-    gboolean result = FALSE;
-
-    RET_VAL_IF(editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL");
+    RET_VAL_IF(editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is null");
 
     tracks = ges_timeline_get_tracks(editor->gst.timeline);
     RET_VAL_IF(tracks == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "tracks is NULL");
@@ -375,7 +354,7 @@ int _mediaeditor_deactivate_layer(mediaeditor_s *editor, unsigned int layer_id)
     ret = _mediaeditor_get_layer(editor, layer_id, &layer);
     RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to get layer");
 
-    result = ges_layer_set_active_for_tracks(layer, false, tracks);
+    result = ges_layer_set_active_for_tracks(layer, activate, tracks);
     RET_VAL_IF(result == FALSE, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to set active");
 
     return MEDIAEDITOR_ERROR_NONE;