ges: framepositioner: Make zorder controllable and expose it
And add a test for it Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5987>
This commit is contained in:
parent
a1faec5f47
commit
84580ebf08
@ -116,7 +116,7 @@ ges_video_source_create_filters (GESVideoSource * self, GPtrArray * elements,
|
||||
GstElement *positioner, *videoflip, *capsfilter, *videorate;
|
||||
const gchar *positioner_props[]
|
||||
= { "alpha", "posx", "fposx", "posy", "fposy", "width", "fwidth",
|
||||
"height", "fheight", "operator", NULL
|
||||
"height", "fheight", "operator", "zorder", NULL
|
||||
};
|
||||
const gchar *videoflip_props[] = { "video-direction", NULL };
|
||||
gchar *ename = NULL;
|
||||
|
@ -595,8 +595,12 @@ gst_frame_positioner_class_init (GstFramePositionerClass * klass)
|
||||
* The desired z order for the stream.
|
||||
*/
|
||||
properties[PROP_ZORDER] =
|
||||
g_param_spec_uint ("zorder", "zorder", "z order of the stream", 0,
|
||||
G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_param_spec_uint ("zorder", "zorder",
|
||||
"z order of the stream.\n\n"
|
||||
"**WARNING**: Setting it manually overrides the "
|
||||
"#GESLayer:priority and should be used very carefully", 0,
|
||||
G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE);
|
||||
|
||||
/**
|
||||
* gesframepositioner:width:
|
||||
|
@ -287,6 +287,8 @@ G_STMT_START { \
|
||||
continue; \
|
||||
if (g_strcmp0 (prop->name, "parent") == 0) \
|
||||
continue; \
|
||||
if (g_strcmp0 (prop->name, "zorder") == 0) \
|
||||
continue; \
|
||||
g_value_init (&val1, prop->value_type); \
|
||||
g_value_init (&val2, prop->value_type); \
|
||||
ges_timeline_element_get_child_property_by_pspec ( \
|
||||
|
@ -102,6 +102,7 @@ if gstvalidate_dep.found() and not get_option('tools').disabled()
|
||||
'check_keyframes_in_compositor_two_sources': true,
|
||||
'check-clip-positioning': true,
|
||||
'set-layer-on-command-line': true,
|
||||
'check-zorder': true,
|
||||
}
|
||||
|
||||
foreach scenario, is_validatetest: scenarios
|
||||
|
@ -0,0 +1,61 @@
|
||||
meta,
|
||||
tool = "ges-launch-$(gst_api_version)",
|
||||
handles-states=true,
|
||||
args = {
|
||||
--track-types, video,
|
||||
--videosink, "fakevideosink name=videosink sync=true",
|
||||
--video-caps, "video/x-raw,format=I420,width=320,height=240,framerate=10/1",
|
||||
}
|
||||
|
||||
remove-feature, name=queue
|
||||
|
||||
# Add two overlapping clips on different layers
|
||||
add-clip, name=c0, asset-id="pattern=red", layer-priority=0, type=GESTestClip, start=0, duration=2.0
|
||||
add-clip, name=c1, asset-id="pattern=blue", layer-priority=1, type=GESTestClip, start=0, duration=2.0
|
||||
|
||||
# Set initial properties for both clips
|
||||
set-child-properties, element-name=c0, width=200, height=150, posx=0, posy=0, pattern=red
|
||||
set-child-properties, element-name=c1, width=200, height=150, posx=120, posy=90, pattern=blue
|
||||
|
||||
play
|
||||
crank-clock
|
||||
wait, on-clock=true
|
||||
|
||||
# Now manually set zorder to reverse the stacking
|
||||
# Make c0 appear on top by giving it a lower zorder value
|
||||
set-child-properties, element-name=c0, zorder=1
|
||||
set-child-properties, element-name=c1, zorder=2
|
||||
|
||||
# Verify the zorder values were set
|
||||
check-child-properties, element-name=c0, zorder=1
|
||||
check-child-properties, element-name=c1, zorder=2
|
||||
|
||||
# Test controllable aspect - set up keyframes for zorder
|
||||
set-control-source, element-name=c0, property-name=zorder, binding-type=direct-absolute
|
||||
set-control-source, element-name=c1, property-name=zorder, binding-type=direct-absolute
|
||||
|
||||
# At 1 second, swap the zorder values
|
||||
add-keyframe, element-name=c0, timestamp=0.0, property-name=zorder, value=1
|
||||
add-keyframe, element-name=c0, timestamp=1.0, property-name=zorder, value=2
|
||||
add-keyframe, element-name=c1, timestamp=0.0, property-name=zorder, value=2
|
||||
add-keyframe, element-name=c1, timestamp=1.0, property-name=zorder, value=1
|
||||
|
||||
crank-clock, repeat=8
|
||||
wait, on-clock=true
|
||||
|
||||
# Should now be at 0.8 seconds
|
||||
check-position, expected-position=0.8
|
||||
check-properties,
|
||||
gessmartmixer0-compositor.sink_0::zorder=2,
|
||||
gessmartmixer0-compositor.sink_1::zorder=1
|
||||
|
||||
# Crank 3 more times to reach 1.1 seconds (past the 1.0s keyframe)
|
||||
crank-clock, repeat=3
|
||||
wait, on-clock=true
|
||||
|
||||
# Should now be at 1.1 seconds, verify the zorder values swapped after 1 second animation
|
||||
check-properties,
|
||||
gessmartmixer0-compositor.sink_0::zorder=2,
|
||||
gessmartmixer0-compositor.sink_1::zorder=1
|
||||
|
||||
stop
|
Loading…
x
Reference in New Issue
Block a user