}
static void
-gst_frame_positionner_update_properties (GstFramePositionner * pos)
+gst_frame_positionner_update_properties (GstFramePositionner * pos,
+ gint old_track_width, gint old_track_height)
{
GstCaps *caps;
gint final_width;
if (pos->capsfilter == NULL)
return;
- final_width = (pos->width > 0) ? pos->width : pos->track_width;
- final_height = (pos->height > 0) ? pos->height : pos->track_height;
+ if ((old_track_width && pos->width == old_track_width &&
+ old_track_width && pos->width == old_track_width) ||
+ (pos->width <= 0 && pos->height <= 0)) {
+ GST_DEBUG_OBJECT (pos, "FOLLOWING track size width old_track: %d -- pos: %d"
+ "height, old_track %d -- pos: %d",
+ old_track_width, pos->width, old_track_height, pos->height);
+
+ final_width = pos->track_width;
+ final_height = pos->track_height;
+ } else {
+ GST_DEBUG_OBJECT (pos, "Keeping previous sizes");
+ final_width = pos->width;
+ final_height = pos->height;
+ }
if (final_width == 0 && final_height == 0)
caps = gst_caps_new_empty_simple ("video/x-raw");
g_object_notify (G_OBJECT (pos), "width");
g_object_notify (G_OBJECT (pos), "height");
+ pos->width = final_width;
+ pos->height = final_height;
gst_caps_unref (caps);
}
sync_properties_from_caps (GstFramePositionner * pos, GstCaps * caps)
{
gint width, height;
+ gint old_track_width, old_track_height;
width = height = 0;
pos->fps_n = -1;
}
+ old_track_width = pos->track_width;
+ old_track_height = pos->track_height;
+
pos->track_width = width;
pos->track_height = height;
GST_DEBUG_OBJECT (pos, "syncing framerate from caps : %d/%d", pos->fps_n,
pos->fps_d);
- gst_frame_positionner_update_properties (pos);
+ gst_frame_positionner_update_properties (pos, old_track_width,
+ old_track_height);
}
static void
break;
case PROP_WIDTH:
framepositionner->width = g_value_get_int (value);
- gst_frame_positionner_update_properties (framepositionner);
+ gst_frame_positionner_update_properties (framepositionner, 0, 0);
break;
case PROP_HEIGHT:
framepositionner->height = g_value_get_int (value);
- gst_frame_positionner_update_properties (framepositionner);
+ gst_frame_positionner_update_properties (framepositionner, 0, 0);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
real_width = g_value_get_int (&val_width);
real_height = g_value_get_int (&val_height);
+ assert_equals_int (real_width, width);
+ assert_equals_int (real_height, height);
+
return (width == real_width && height == real_height);
}
/* Clip width was set to 0 so it has to use natural clip width */
/* Clip height was set to 0 so it has to use natural clip height */
fail_unless (check_frame_positionner_size (clip, 0, 0));
+
+
+ /**
+ * Our timeline : 320 * 240
+ *
+ * 0--------------0
+ * | width : 320 |
+ * | height: 240 |
+ * 0--------------2
+ */
+
+ /* We set the restriction caps video size to the same as the video source
+ * size. */
+ caps = gst_caps_from_string ("video/x-raw,height=240,width=320");
+ ges_track_set_restriction_caps (trackv, caps);
+ gst_caps_unref (caps);
+ _set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, 320,
+ 240);
+
+ /* As the video source as the same size as the track restriction caps, changing
+ * the track size through restriction caps should also change the video source
+ * size */
+ caps = gst_caps_from_string ("video/x-raw,height=1080,width=1920");
+ ges_track_set_restriction_caps (trackv, caps);
+ fail_unless (check_frame_positionner_size (clip, 1920, 1080));
+
+ gst_object_unref (timeline);
}
GST_END_TEST;