From: Haesu Gwon Date: Tue, 12 Jul 2022 09:20:25 +0000 (+0900) Subject: media_editor_clip : Change default clip resolution to its original size X-Git-Tag: submit/tizen/20220713.055803^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F277716%2F2;p=platform%2Fcore%2Fapi%2Fmediaeditor.git media_editor_clip : Change default clip resolution to its original size [Version] 0.0.15 [Issue Type] Bug fix Change-Id: I989ee672879fcee47515a5c2c51fe93278c93e13 --- diff --git a/include/media_editor.h b/include/media_editor.h index 3eaedde..25e396e 100644 --- a/include/media_editor.h +++ b/include/media_editor.h @@ -1001,7 +1001,7 @@ int mediaeditor_set_clip_in_point(mediaeditor_h editor, unsigned int clip_id, un * @brief Gets the resolution of clip. * @since_tizen 7.0 * @remarks If the clip doesn't have video, #MEDIAEDITOR_ERROR_INVALID_OPERATION will be returned.\n - * @a width and @a height will return 0 before set clip resolution by mediaeditor_set_clip_resolution(). + * @a width and @a height will return its original size if it's not changed by mediaeditor_set_clip_resolution(). * @param[in] editor The media editor handle * @param[in] clip_id The clip ID * @param[out] width The width diff --git a/packaging/capi-media-editor.spec b/packaging/capi-media-editor.spec index 9a799ad..5638bf5 100644 --- a/packaging/capi-media-editor.spec +++ b/packaging/capi-media-editor.spec @@ -1,6 +1,6 @@ Name: capi-media-editor Summary: A Tizen Media Editor API -Version: 0.0.14 +Version: 0.0.15 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_editor_clip.c b/src/media_editor_clip.c index 4e566d2..13d4a54 100644 --- a/src/media_editor_clip.c +++ b/src/media_editor_clip.c @@ -204,23 +204,6 @@ static bool __has_video_track(GESClip *clip) return false; } -static void __mediaeditor_add_child_properties_resolution(GESClip *clip) -{ - GValue val = G_VALUE_INIT; - - g_value_init(&val, G_TYPE_INT); - - if (!ges_timeline_element_get_child_property(GES_TIMELINE_ELEMENT(clip), "width", &val)) { - GObjectClass *eklass = G_OBJECT_GET_CLASS(clip); - - if (ges_timeline_element_add_child_property(GES_TIMELINE_ELEMENT(clip), g_object_class_find_property(eklass, "width"), G_OBJECT(clip))) - LOG_DEBUG("width property is added in URI clip"); - - if (ges_timeline_element_add_child_property(GES_TIMELINE_ELEMENT(clip), g_object_class_find_property(eklass, "height"), G_OBJECT(clip))) - LOG_DEBUG("height property is added in URI clip"); - } -} - int _mediaeditor_create_clip_common(mediaeditor_s *editor, GESClip *clip, mediaeditor_effect_type_e effect_type, unsigned int *clip_id) { mediaeditor_clip_s *clip_data = NULL; @@ -281,8 +264,19 @@ int _mediaeditor_add_clip(mediaeditor_s *editor, const char *path, unsigned int ret = _mediaeditor_create_clip_common(editor, clip, MEDIAEDITOR_EFFECT_TYPE_NONE, clip_id); RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to create clip common"); - if (__has_video_track(clip)) + if (__has_video_track(clip)) { + gint width = 0; + gint height = 0; + + GESTrackElement *track_element = ges_clip_find_track_element(clip, NULL, GES_TYPE_VIDEO_SOURCE); + RET_VAL_IF(track_element == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to get track element from clip[%p]", clip); + + gboolean result = ges_video_source_get_natural_size(GES_VIDEO_SOURCE(track_element), &width, &height); + RET_VAL_IF(!result, MEDIAEDITOR_ERROR_NONE, "failed to get natural size"); + + ges_timeline_element_set_child_properties(GES_TIMELINE_ELEMENT(clip), "width", width, "height", height, NULL); ges_timeline_element_set_child_properties(GES_TIMELINE_ELEMENT(clip), "posx", 0, "posy", 0, NULL); + } return MEDIAEDITOR_ERROR_NONE; } @@ -540,8 +534,6 @@ int _mediaeditor_get_clip_resolution(mediaeditor_s *editor, unsigned int clip_id RET_VAL_IF(clip == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "invalid clip id"); RET_VAL_IF(!__has_video_track(clip), MEDIAEDITOR_ERROR_INVALID_OPERATION, "Not video clip"); - __mediaeditor_add_child_properties_resolution(clip); - ges_timeline_element_get_child_properties(GES_TIMELINE_ELEMENT(clip), "width", width, "height", height, NULL); return MEDIAEDITOR_ERROR_NONE; @@ -550,17 +542,19 @@ int _mediaeditor_get_clip_resolution(mediaeditor_s *editor, unsigned int clip_id int _mediaeditor_set_clip_resolution(mediaeditor_s *editor, unsigned int clip_id, unsigned int width, unsigned int height) { + mediaeditor_clip_s *clip_data = NULL; GESClip *clip = NULL; RET_VAL_IF(editor == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "editor is NULL"); RET_VAL_IF(clip_id >= editor->clip_id, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "invalid id"); - clip = __mediaeditor_find_clip(editor->clips, clip_id); + clip_data = _mediaeditor_find_clip_data(editor->clips, clip_id); + RET_VAL_IF(clip_data == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "invalid clip id"); + + clip = clip_data->clip; RET_VAL_IF(clip == NULL, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "invalid clip id"); RET_VAL_IF(!__has_video_track(clip), MEDIAEDITOR_ERROR_INVALID_OPERATION, "Not video clip"); - __mediaeditor_add_child_properties_resolution(clip); - ges_timeline_element_set_child_properties(GES_TIMELINE_ELEMENT(clip), "width", width, "height", height, NULL); return MEDIAEDITOR_ERROR_NONE;