aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorAlexey Fisher <bug-track@fisher-privat.net>2010-09-10 04:28:21 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-13 23:16:17 +0800
commitdac42b77124239862e31b2b5d23df362b4ce2f91 (patch)
treec8900ecfc68b8f3b85d4eac0b6ad8777b09081b0 /libempathy-gtk
parent4815a75a72a0ebacc7e2f29e7026b8493c6ea320 (diff)
downloadgsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.tar
gsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.tar.gz
gsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.tar.bz2
gsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.tar.lz
gsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.tar.xz
gsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.tar.zst
gsoc2013-empathy-dac42b77124239862e31b2b5d23df362b4ce2f91.zip
Add two optional filter to video src
Add videomaxrate and postproc_tmpnoise as optional filters to empathy_video_src_init. Thay will used if thay are installed. videomaxrate will set maximal framerate to 15fps if some haw webcam will get more than 15fps it will not kill empathy-av with high CPU load. postproc_tmpnoise will reduce video noise produced by most (all) webcams. This will add smoll overhead for load but reduce CPU load of video encoder. Also this should reduce network load (for theoraenc x2) Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net>
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-video-src.c67
1 files changed, 51 insertions, 16 deletions
diff --git a/libempathy-gtk/empathy-video-src.c b/libempathy-gtk/empathy-video-src.c
index 2beb469b2..b7dea70c3 100644
--- a/libempathy-gtk/empathy-video-src.c
+++ b/libempathy-gtk/empathy-video-src.c
@@ -105,36 +105,71 @@ static void
empathy_video_src_init (EmpathyGstVideoSrc *obj)
{
EmpathyGstVideoSrcPrivate *priv = EMPATHY_GST_VIDEO_SRC_GET_PRIVATE (obj);
- GstElement *scale, *colorspace, *capsfilter;
+ GstElement *element, *element_back;
GstPad *ghost, *src;
GstCaps *caps;
+ gchar *str;
+
+ /* allocate caps here, so we can update it by optional elements */
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "width", G_TYPE_INT, 320,
+ "height", G_TYPE_INT, 240,
+ NULL);
/* allocate any data required by the object here */
- priv->src = empathy_gst_make_to_bin (GST_BIN (obj), NULL, "gconfvideosrc");
- if (!priv->src)
+ if (!(element = empathy_gst_make_to_bin (GST_BIN (obj),
+ NULL, "gconfvideosrc")))
g_error ("gst-plugins-good is probably missing. exit");
- scale = empathy_gst_make_to_bin (GST_BIN (obj), priv->src, "videoscale");
- if (!scale)
+ /* we need to save our source to priv->src */
+ priv->src = element;
+
+ /* videomaxrate is curently optional plugin, becouse it depend on
+ * gst-plugins-bad. So we won't fail if it not exist.
+ * todo: in some time videorate will probably replace videomaxrate */
+ /* make a backup of *element before optional GstElement */
+ element_back = element;
+ if (!(element = empathy_gst_make_to_bin (GST_BIN (obj),
+ element, "videomaxrate")))
+ {
+ g_warning ("gst-plugins-bad is probably missing.");
+ element = element_back;
+ }
+ else
+ gst_caps_set_simple (caps,
+ "framerate", GST_TYPE_FRACTION, 15, 1,
+ NULL);
+
+ str = gst_caps_to_string (caps);
+ g_debug ("Current video src caps are : %s", str);
+ g_free (str);
+
+ if (!(element = empathy_gst_make_to_bin (GST_BIN (obj),
+ element, "videoscale")))
g_error ("gst-plugins-base is probably missing. exit");
- colorspace = empathy_gst_make_to_bin (GST_BIN (obj),
- scale, "ffmpegcolorspace");
- if (!colorspace)
+ /* postproc_tmpnois is other optional plugin, it depend on gst-ffmpeg.
+ * may be some day it will go to gst-plugins-base, than we can restrickt it */
+ element_back = element;
+ if (!(element = empathy_gst_make_to_bin (GST_BIN (obj),
+ element, "postproc_tmpnoise")))
+ {
+ g_warning ("gst-ffmpeg is probably missing.");
+ element = element_back;
+ }
+
+ if (!(element = empathy_gst_make_to_bin (GST_BIN (obj),
+ element, "ffmpegcolorspace")))
g_error ("gst-plugins-base is probably missing. exit");
- capsfilter = empathy_gst_make_to_bin (GST_BIN (obj), scale, "capsfilter");
- if (!capsfilter)
+ if (!(element = empathy_gst_make_to_bin (GST_BIN (obj),
+ element, "capsfilter")))
g_error ("core libgstreamer is probably missing. exit");
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "width", G_TYPE_INT, 320,
- "height", G_TYPE_INT, 240,
- NULL);
+ g_object_set (G_OBJECT (element), "caps", caps, NULL);
- g_object_set (G_OBJECT (capsfilter), "caps", caps, NULL);
- src = gst_element_get_static_pad (colorspace, "src");
+ src = gst_element_get_static_pad (element, "src");
if (!src)
g_error ("src pad not found. exit");