return group_data->group;
}
+static int __init_track_resolution(GESTrack *track)
+{
+ GstCaps *caps = NULL;
+
+ caps = gst_caps_new_simple("video/x-raw",
+ "width", G_TYPE_INT, 0,
+ "height", G_TYPE_INT, 0,
+ NULL);
+ RET_VAL_IF(caps == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to create caps");
+
+ PRINT_CAPS(caps, "track_video");
+ ges_track_update_restriction_caps(track, caps);
+ gst_caps_unref(caps);
+
+ return MEDIAEDITOR_ERROR_NONE;
+}
+
+static int __update_track_resolution(mediaeditor_s *editor, int width, int height)
+{
+ GESTrack *video_track = NULL;
+ GstCaps *caps = NULL;
+ GstCaps *video_caps = NULL;
+ int track_width = 0;
+ int track_height = 0;
+
+ NULL_PARAM_CHECK(editor);
+
+ int ret = _get_track(editor, TRACK_VIDEO, &video_track);
+ RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to get video track");
+
+ /* If first clip is added, we should initialize track resolution */
+ if (g_list_length(editor->clips) == 1)
+ __init_track_resolution(video_track);
+
+ caps = ges_track_get_restriction_caps(video_track);
+ RET_VAL_IF(caps == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to get caps from video track");
+ PRINT_CAPS(caps, "video_track");
+
+ if (!gst_structure_get_int(gst_caps_get_structure(caps, 0), "width", &track_width) ||
+ !gst_structure_get_int(gst_caps_get_structure(caps, 0), "height", &track_height)) {
+ LOG_ERROR("no width/height information in video track or invalid type");
+ gst_caps_unref(caps);
+ return MEDIAEDITOR_ERROR_INVALID_OPERATION;
+ }
+ gst_caps_unref(caps);
+
+ if (track_width < width) {
+ video_caps = gst_caps_new_simple("video/x-raw",
+ "width", G_TYPE_INT, width,
+ NULL);
+ RET_VAL_IF(video_caps == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to create video_caps");
+ }
+
+ if (track_height < height) {
+ if (video_caps == NULL) {
+ video_caps = gst_caps_new_simple("video/x-raw",
+ "height", G_TYPE_INT, height,
+ NULL);
+ RET_VAL_IF(video_caps == NULL, MEDIAEDITOR_ERROR_INVALID_OPERATION, "failed to create video_caps");
+ } else {
+ gst_caps_set_simple(video_caps, "height", G_TYPE_INT, height, NULL);
+ }
+ }
+
+ if (video_caps) {
+ PRINT_CAPS(video_caps, "track_video");
+ ges_track_update_restriction_caps(video_track, video_caps);
+ }
+
+ gst_caps_unref(video_caps);
+ gst_object_unref(video_track);
+
+ return MEDIAEDITOR_ERROR_NONE;
+}
+
static bool __has_audio_track(GESClip *clip)
{
RET_VAL_IF(clip == NULL, false, "clip is NULL");
ret = _mediaeditor_get_layer_end_time(editor, layer_id, &end_time);
RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to get layer end time");
- LOG_INFO("start point[%d] is changed to [%d]ms of layer_id[%d]", start, end_time, layer_id);
+ LOG_INFO("start time[%d] is changed to [%d]ms of layer_id[%d]", start, end_time, layer_id);
start = end_time;
}
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);
+
+ ret = __update_track_resolution(editor, width, height);
+ RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to update track resolution");
}
return MEDIAEDITOR_ERROR_NONE;
editor->clips = g_list_remove(editor->clips, clip_data);
+ //TODO: update resolution if rightmost or bottommost clip is removed.
+
return MEDIAEDITOR_ERROR_NONE;
}
int _mediaeditor_set_clip_resolution(mediaeditor_s *editor, unsigned int clip_id,
unsigned int width, unsigned int height)
{
+ int ret = MEDIAEDITOR_ERROR_NONE;
mediaeditor_clip_s *clip_data = NULL;
GESClip *clip = NULL;
+ unsigned int pos_x = 0;
+ unsigned int pos_y = 0;
NULL_PARAM_CHECK(editor);
RET_VAL_IF(clip_id >= editor->clip_id, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "invalid id");
ges_timeline_element_set_child_properties(GES_TIMELINE_ELEMENT(clip), "width", width, "height", height, NULL);
+ ret = _mediaeditor_get_clip_position(editor, clip_id, &pos_x, &pos_y);
+ RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to get clip position");
+
+ ret = __update_track_resolution(editor, (int)(pos_x + width), (int)(pos_y + height));
+ RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to update track resolution");
+
return MEDIAEDITOR_ERROR_NONE;
}
int _mediaeditor_set_clip_position(mediaeditor_s *editor, unsigned int clip_id,
unsigned int pos_x, unsigned int pos_y)
{
+ int ret = MEDIAEDITOR_ERROR_NONE;
GESClip *clip = NULL;
+ unsigned int width = 0;
+ unsigned int height = 0;
NULL_PARAM_CHECK(editor);
RET_VAL_IF(clip_id >= editor->clip_id, MEDIAEDITOR_ERROR_INVALID_PARAMETER, "invalid id");
ges_timeline_element_set_child_properties(GES_TIMELINE_ELEMENT(clip), "posx", pos_x, "posy", pos_y, NULL);
+ ret = _mediaeditor_get_clip_resolution(editor, clip_id, &width, &height);
+ RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to get clip resolution");
+
+ ret = __update_track_resolution(editor, (int)(pos_x + width), (int)(pos_y + height));
+ RET_VAL_IF(ret != MEDIAEDITOR_ERROR_NONE, ret, "failed to update track resolution");
+
return MEDIAEDITOR_ERROR_NONE;
}