summaryrefslogtreecommitdiff
path: root/gst/videocrop
diff options
context:
space:
mode:
authorDaniel Molkentin <daniel@molkentin.de>2020-01-03 15:16:02 +0100
committerDaniel Molkentin <daniel@molkentin.de>2020-01-03 15:16:02 +0100
commitbb1ce82e39bd3821d7d52047bec6550b0fb3a300 (patch)
treed6cba749e9e8a90be22922c01e0e345bdd6610bd /gst/videocrop
parent09d4514814932373f5c993a2d7091afe2de352b0 (diff)
downloadgstreamer-plugins-good-bb1ce82e39bd3821d7d52047bec6550b0fb3a300.tar.gz
videocrop: allow properties to be animated by GstController
Diffstat (limited to 'gst/videocrop')
-rw-r--r--gst/videocrop/gstvideocrop.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
index 104522a9b..4722ec797 100644
--- a/gst/videocrop/gstvideocrop.c
+++ b/gst/videocrop/gstvideocrop.c
@@ -104,6 +104,8 @@ static void gst_video_crop_set_property (GObject * object, guint prop_id,
static void gst_video_crop_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
+static void gst_video_crop_before_transform (GstBaseTransform * trans,
+ GstBuffer * in);
static GstCaps *gst_video_crop_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps);
static gboolean gst_video_crop_src_event (GstBaseTransform * trans,
@@ -188,22 +190,22 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
g_param_spec_int ("left", "Left",
"Pixels to crop at left (-1 to auto-crop)", -1, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
- GST_PARAM_MUTABLE_PLAYING));
+ GST_PARAM_MUTABLE_PLAYING | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_RIGHT,
g_param_spec_int ("right", "Right",
"Pixels to crop at right (-1 to auto-crop)", -1, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
- GST_PARAM_MUTABLE_PLAYING));
+ GST_PARAM_MUTABLE_PLAYING | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_TOP,
g_param_spec_int ("top", "Top", "Pixels to crop at top (-1 to auto-crop)",
-1, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
- GST_PARAM_MUTABLE_PLAYING));
+ GST_PARAM_MUTABLE_PLAYING | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BOTTOM,
g_param_spec_int ("bottom", "Bottom",
"Pixels to crop at bottom (-1 to auto-crop)", -1, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
- GST_PARAM_MUTABLE_PLAYING));
+ GST_PARAM_MUTABLE_PLAYING | GST_PARAM_CONTROLLABLE));
gst_element_class_add_static_pad_template (element_class, &sink_template);
gst_element_class_add_static_pad_template (element_class, &src_template);
@@ -212,6 +214,8 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
"Crops video into a user-defined region",
"Tim-Philipp Müller <tim centricular net>");
+ basetransform_class->before_transform =
+ GST_DEBUG_FUNCPTR (gst_video_crop_before_transform);
basetransform_class->transform_ip_on_passthrough = FALSE;
basetransform_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_video_crop_transform_caps);
@@ -504,6 +508,23 @@ gst_video_crop_propose_allocation (GstBaseTransform * trans,
decide_query, query);
}
+static void
+gst_video_crop_before_transform (GstBaseTransform * trans, GstBuffer * in)
+{
+ GstVideoCrop *video_crop = GST_VIDEO_CROP (trans);
+ GstClockTime timestamp, stream_time;
+
+ timestamp = GST_BUFFER_TIMESTAMP (in);
+ stream_time =
+ gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
+
+ GST_DEBUG_OBJECT (video_crop, "sync to %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (timestamp));
+
+ if (GST_CLOCK_TIME_IS_VALID (stream_time))
+ gst_object_sync_values (GST_OBJECT (video_crop), stream_time);
+}
+
static GstFlowReturn
gst_video_crop_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{