aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-video-src.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@luon.net>2012-08-27 01:23:06 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-03 16:15:13 +0800
commitd641d0d903b9847864acae4a47aa948131aa50b0 (patch)
treee089e935a5e5ad3efd1d175420fda9aa314706ba /src/empathy-video-src.c
parent0af7f92b16f1d1b3527463906936fa0ea602ad57 (diff)
downloadgsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.tar
gsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.tar.gz
gsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.tar.bz2
gsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.tar.lz
gsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.tar.xz
gsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.tar.zst
gsoc2013-empathy-d641d0d903b9847864acae4a47aa948131aa50b0.zip
Port to gstreamer 1.0
Diffstat (limited to 'src/empathy-video-src.c')
-rw-r--r--src/empathy-video-src.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/empathy-video-src.c b/src/empathy-video-src.c
index 8c9c75015..2fc483567 100644
--- a/src/empathy-video-src.c
+++ b/src/empathy-video-src.c
@@ -23,7 +23,11 @@
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_GST1
+#include <gst/video/colorbalance.h>
+#else
#include <gst/interfaces/colorbalance.h>
+#endif
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
#include <libempathy/empathy-debug.h>
@@ -112,11 +116,24 @@ error:
return NULL;
}
+#ifdef HAVE_GST1
+static GstPadProbeReturn
+empathy_video_src_drop_eos (GstPad *pad,
+ GstPadProbeInfo *info,
+ gpointer user_data)
+{
+ if (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_EVENT (info)) == GST_EVENT_EOS)
+ return GST_PAD_PROBE_DROP;
+
+ return GST_PAD_PROBE_OK;
+}
+#else
static gboolean
empathy_video_src_drop_eos (GstPad *pad, GstEvent *event, gpointer user_data)
{
return GST_EVENT_TYPE (event) != GST_EVENT_EOS;
}
+#endif
static void
empathy_video_src_init (EmpathyGstVideoSrc *obj)
@@ -128,7 +145,11 @@ empathy_video_src_init (EmpathyGstVideoSrc *obj)
gchar *str;
/* allocate caps here, so we can update it by optional elements */
+#ifdef HAVE_GST1
+ caps = gst_caps_new_simple ("video/x-raw",
+#else
caps = gst_caps_new_simple ("video/x-raw-yuv",
+#endif
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240,
NULL);
@@ -144,7 +165,14 @@ empathy_video_src_init (EmpathyGstVideoSrc *obj)
/* Drop EOS events, so that our sinks don't get confused when we restart the
* source (triggering an EOS) */
src = gst_element_get_static_pad (element, "src");
+
+#ifdef HAVE_GST1
+ gst_pad_add_probe (src, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
+ empathy_video_src_drop_eos, NULL, NULL);
+#else
gst_pad_add_event_probe (src, G_CALLBACK (empathy_video_src_drop_eos), NULL);
+#endif
+
gst_object_unref (src);
/* videorate with the required properties optional as it needs a currently
@@ -178,9 +206,15 @@ empathy_video_src_init (EmpathyGstVideoSrc *obj)
DEBUG ("Current video src caps are : %s", str);
g_free (str);
+#ifdef HAVE_GST1
+ if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
+ element, "videoconvert")) == NULL)
+ g_error ("Failed to add \"videoconvert\" (gst-plugins-base missing?)");
+#else
if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
element, "ffmpegcolorspace")) == NULL)
g_error ("Failed to add \"ffmpegcolorspace\" (gst-plugins-base missing?)");
+#endif
if ((element = empathy_gst_add_to_bin (GST_BIN (obj),
element, "videoscale")) == NULL)