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;
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;
}
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;
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;