aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2011-07-07 06:12:40 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-08 04:07:19 +0800
commit8b9fd6cc4b679d81e5d4ec962dd148c264017881 (patch)
treeac8ac40d3d6a9643ccf5d824bb7840827538c42a /src
parentdd3a57dfb3466de4207ed5233db504ad20ef54e6 (diff)
downloadgsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.tar
gsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.tar.gz
gsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.tar.bz2
gsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.tar.lz
gsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.tar.xz
gsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.tar.zst
gsoc2013-empathy-8b9fd6cc4b679d81e5d4ec962dd148c264017881.zip
Add resultion and framerate changing to video src
Diffstat (limited to 'src')
-rw-r--r--src/empathy-video-src.c52
-rw-r--r--src/empathy-video-src.h6
2 files changed, 58 insertions, 0 deletions
diff --git a/src/empathy-video-src.c b/src/empathy-video-src.c
index ca8370d82..bfff30d18 100644
--- a/src/empathy-video-src.c
+++ b/src/empathy-video-src.c
@@ -54,6 +54,11 @@ struct _EmpathyGstVideoSrcPrivate
GstElement *src;
/* Element implementing a ColorBalance interface */
GstElement *balance;
+ /* Element for resolution and framerate adjustment */
+ GstElement *capsfilter;
+ guint width;
+ guint height;
+ guint framerate;
};
#define EMPATHY_GST_VIDEO_SRC_GET_PRIVATE(o) \
@@ -162,6 +167,7 @@ empathy_video_src_init (EmpathyGstVideoSrc *obj)
g_error (
"Failed to add \"capsfilter\" (gstreamer core elements missing?)");
+ priv->capsfilter = element;
g_object_set (G_OBJECT (element), "caps", caps, NULL);
@@ -393,3 +399,49 @@ empathy_video_src_dup_device (EmpathyGstVideoSrc *self)
return device;
}
+
+void
+empathy_video_src_set_framerate (GstElement *src,
+ guint framerate)
+{
+ EmpathyGstVideoSrcPrivate *priv = EMPATHY_GST_VIDEO_SRC_GET_PRIVATE (src);
+ GstCaps *caps;
+
+ g_return_if_fail (priv->capsfilter != NULL);
+
+ g_object_get (priv->capsfilter, "caps", &caps, NULL);
+ caps = gst_caps_make_writable (caps);
+
+ gst_caps_set_simple (caps,
+ "framerate", GST_TYPE_FRACTION, framerate, 1,
+ NULL);
+
+ g_object_set (priv->capsfilter, "caps", caps, NULL);
+}
+
+void
+empathy_video_src_set_resolution (GstElement *src,
+ guint width,
+ guint height)
+{
+ EmpathyGstVideoSrcPrivate *priv = EMPATHY_GST_VIDEO_SRC_GET_PRIVATE (src);
+ GstCaps *caps;
+
+ g_return_if_fail (priv->capsfilter != NULL);
+
+ gst_element_set_locked_state (priv->src, TRUE);
+ gst_element_set_state (priv->src, GST_STATE_NULL);
+
+ g_object_get (priv->capsfilter, "caps", &caps, NULL);
+ caps = gst_caps_make_writable (caps);
+
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ NULL);
+
+ g_object_set (priv->capsfilter, "caps", caps, NULL);
+
+ gst_element_set_locked_state (priv->src, FALSE);
+ gst_element_sync_state_with_parent (priv->src);
+}
diff --git a/src/empathy-video-src.h b/src/empathy-video-src.h
index 6a88b79eb..e49c79a00 100644
--- a/src/empathy-video-src.h
+++ b/src/empathy-video-src.h
@@ -85,6 +85,12 @@ void empathy_video_src_change_device (EmpathyGstVideoSrc *self,
const gchar *device);
gchar * empathy_video_src_dup_device (EmpathyGstVideoSrc *self);
+void empathy_video_src_set_framerate (GstElement *src,
+ guint framerate);
+
+void empathy_video_src_set_resolution (GstElement *src,
+ guint width, guint height);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_GST_VIDEO_SRC_H__*/