[empathy] Add resultion and framerate changing to video src
- From: Sjoerd Simons <sjoerds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Add resultion and framerate changing to video src
- Date: Mon, 7 Nov 2011 20:07:35 +0000 (UTC)
commit 8b9fd6cc4b679d81e5d4ec962dd148c264017881
Author: Nicolas Dufresne <nicolas dufresne collabora com>
Date: Wed Jul 6 18:12:40 2011 -0400
Add resultion and framerate changing to video src
src/empathy-video-src.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
src/empathy-video-src.h | 6 +++++
2 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-video-src.c b/src/empathy-video-src.c
index ca8370d..bfff30d 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 6a88b79..e49c79a 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__*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]