pidgin: d675933e: Add a GstCapsFilter between every video ...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Fri Jan 7 06:45:57 EST 2011
----------------------------------------------------------------------
Revision: d675933edc091cf6c8c5aabe60fba40027c2699e
Parent: b53f7f4eeb80dadaa8c653c5d7d6aec036fdca7c
Author: jakub.adam at ktknet.cz
Date: 01/07/11 06:38:12
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d675933edc091cf6c8c5aabe60fba40027c2699e
Changelog:
Add a GstCapsFilter between every video source and the rest of the pipeline.
This will force the sources to have the same capaibilties as the
"pidgindefaultvideosrc" and should reduce CPU usage as well. Refs #13095.
Changes against parent b53f7f4eeb80dadaa8c653c5d7d6aec036fdca7c
patched libpurple/mediamanager.c
patched pidgin/gtkmedia.c
-------------- next part --------------
============================================================
--- libpurple/mediamanager.c 69f27683e29c9b05775fdd6ee7a06ee3aeba8bb6
+++ libpurple/mediamanager.c e0222ef60f84976df8aeb38f7bcab68c7d89dd58
@@ -81,6 +81,7 @@ struct _PurpleMediaManagerPrivate
GList *output_windows;
gulong next_output_window_id;
GType backend_type;
+ GstCaps *video_caps;
PurpleMediaElementInfo *video_src;
PurpleMediaElementInfo *video_sink;
@@ -191,6 +192,8 @@ purple_media_manager_finalize (GObject *
g_list_delete_link(priv->elements, priv->elements)) {
g_object_unref(priv->elements->data);
}
+ if (priv->video_caps)
+ gst_caps_unref(priv->video_caps);
parent_class->finalize(media);
}
#endif
@@ -414,6 +417,20 @@ request_pad_unlinked_cb(GstPad *pad, Gst
#endif
#ifdef USE_GSTREAMER
+
+static GstCaps *
+purple_media_manager_get_video_caps(PurpleMediaManager *manager)
+{
+#ifdef USE_VV
+ if (manager->priv->video_caps == NULL)
+ manager->priv->video_caps = gst_caps_from_string("video/x-raw-yuv,"
+ "width=[250,352], height=[200,288], framerate=[1/1,20/1]");
+ return manager->priv->video_caps;
+#else
+ return NULL;
+#endif
+}
+
GstElement *
purple_media_manager_get_element(PurpleMediaManager *manager,
PurpleMediaSessionType type, PurpleMedia *media,
@@ -456,8 +473,22 @@ purple_media_manager_get_element(PurpleM
bin = gst_bin_new(id);
tee = gst_element_factory_make("tee", "tee");
gst_bin_add_many(GST_BIN(bin), ret, tee, NULL);
- gst_element_link(ret, tee);
+ if (type & PURPLE_MEDIA_SEND_VIDEO) {
+ GstElement *videoscale;
+ GstElement *capsfilter;
+
+ videoscale = gst_element_factory_make("videoscale", NULL);
+ capsfilter = gst_element_factory_make("capsfilter", "prpl_video_caps");
+
+ g_object_set(G_OBJECT(capsfilter),
+ "caps", purple_media_manager_get_video_caps(manager), NULL);
+
+ gst_bin_add_many(GST_BIN(bin), videoscale, capsfilter, NULL);
+ gst_element_link_many(ret, videoscale, capsfilter, tee, NULL);
+ } else
+ gst_element_link(ret, tee);
+
/*
* This shouldn't be necessary, but it stops it from
* giving a not-linked error upon destruction
============================================================
--- pidgin/gtkmedia.c e742870673c1c68643fc5fe719de7106d2f69588
+++ pidgin/gtkmedia.c 5c7c1695c896d7ae5fb8b7ad7bf9a408d88aaf3c
@@ -932,10 +932,9 @@ create_default_video_src(PurpleMedia *me
create_default_video_src(PurpleMedia *media,
const gchar *session_id, const gchar *participant)
{
- GstElement *sendbin, *src, *videoscale, *capsfilter;
+ GstElement *sendbin, *src;
GstPad *pad;
GstPad *ghost;
- GstCaps *caps;
#ifdef _WIN32
/* autovideosrc doesn't pick ksvideosrc for some reason */
@@ -960,19 +959,10 @@ create_default_video_src(PurpleMedia *me
}
sendbin = gst_bin_new("pidgindefaultvideosrc");
- videoscale = gst_element_factory_make("videoscale", NULL);
- capsfilter = gst_element_factory_make("capsfilter", NULL);
- /* It was recommended to set the size <= 352x288 and framerate <= 20 */
- caps = gst_caps_from_string("video/x-raw-yuv , width=[250,352] , "
- "height=[200,288] , framerate=[1/1,20/1]");
- g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);
+ gst_bin_add(GST_BIN(sendbin), src);
- gst_bin_add_many(GST_BIN(sendbin), src,
- videoscale, capsfilter, NULL);
- gst_element_link_many(src, videoscale, capsfilter, NULL);
-
- pad = gst_element_get_static_pad(capsfilter, "src");
+ pad = gst_element_get_static_pad(src, "src");
ghost = gst_ghost_pad_new("ghostsrc", pad);
gst_object_unref(pad);
gst_element_add_pad(sendbin, ghost);
More information about the Commits
mailing list