/soc/2015/mmcc/main: 03f15d1b9207: remove preproc conditions for...
Michael McConville
mmcconville at mykolab.com
Tue Jun 23 16:02:33 EDT 2015
Changeset: 03f15d1b9207e20a03d8d9854a9871a9d1428a75
Author: Michael McConville <mmcconville at mykolab.com>
Date: 2015-06-18 15:17 -0400
Branch: default
URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/03f15d1b9207
Description:
remove preproc conditions for GStreamer <1.0
diffstat:
finch/gntsound.c | 8 --
libpurple/media/backend-fs2.c | 63 +------------------
libpurple/mediamanager.c | 40 ------------
pidgin/gtkprefs.c | 134 +-----------------------------------------
pidgin/gtksound.c | 4 -
5 files changed, 7 insertions(+), 242 deletions(-)
diffs (truncated from 592 to 300 lines):
diff --git a/finch/gntsound.c b/finch/gntsound.c
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -365,11 +365,7 @@ finch_sound_init(void)
#ifdef USE_GSTREAMER
purple_debug_info("sound", "Initializing sound output drivers.\n");
-#if (GST_VERSION_MAJOR > 0 || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 10))
gst_registry_fork_set_enabled(FALSE);
-#endif
if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
purple_notify_error(NULL, _("GStreamer Failure"),
_("GStreamer failed to initialize."),
@@ -543,11 +539,7 @@ finch_sound_play_file(const char *filena
return;
}
-#if GST_CHECK_VERSION(1,0,0)
play = gst_element_factory_make("playbin", "play");
-#else
- play = gst_element_factory_make("playbin2", "play");
-#endif
if (play == NULL) {
return;
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -81,7 +81,6 @@ static GList *purple_media_backend_fs2_g
static GList *purple_media_backend_fs2_get_local_candidates(
PurpleMediaBackend *self,
const gchar *sess_id, const gchar *participant);
-#if GST_CHECK_VERSION(1,0,0)
static gboolean purple_media_backend_fs2_set_encryption_parameters (
PurpleMediaBackend *self, const gchar *sess_id, const gchar *cipher,
const gchar *auth, const gchar *key, gsize key_len);
@@ -89,7 +88,6 @@ static gboolean purple_media_backend_fs2
PurpleMediaBackend *self, const gchar *sess_id,
const gchar *participant, const gchar *cipher,
const gchar *auth, const gchar *key, gsize key_len);
-#endif
static gboolean purple_media_backend_fs2_set_remote_codecs(
PurpleMediaBackend *self,
const gchar *sess_id, const gchar *participant,
@@ -239,14 +237,12 @@ purple_media_network_protocol_to_fs(Purp
switch (protocol) {
case PURPLE_MEDIA_NETWORK_PROTOCOL_UDP:
return FS_NETWORK_PROTOCOL_UDP;
-#if GST_CHECK_VERSION(1,0,0)
case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE:
return FS_NETWORK_PROTOCOL_TCP_PASSIVE;
case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE:
return FS_NETWORK_PROTOCOL_TCP_ACTIVE;
case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO:
return FS_NETWORK_PROTOCOL_TCP_SO;
-#endif
default:
g_return_val_if_reached(FS_NETWORK_PROTOCOL_TCP);
}
@@ -258,30 +254,21 @@ purple_media_network_protocol_from_fs(Fs
switch (protocol) {
case FS_NETWORK_PROTOCOL_UDP:
return PURPLE_MEDIA_NETWORK_PROTOCOL_UDP;
-#if GST_CHECK_VERSION(1,0,0)
case FS_NETWORK_PROTOCOL_TCP_PASSIVE:
return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE;
case FS_NETWORK_PROTOCOL_TCP_ACTIVE:
return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE;
case FS_NETWORK_PROTOCOL_TCP_SO:
return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO;
-#endif
default:
g_return_val_if_reached(PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE);
}
}
-#if GST_CHECK_VERSION(1,0,0)
static GstPadProbeReturn
event_probe_cb(GstPad *srcpad, GstPadProbeInfo *info, gpointer unused)
-#else
-static gboolean
-event_probe_cb(GstPad *srcpad, GstEvent *event, gboolean release_pad)
-#endif
{
-#if GST_CHECK_VERSION(1,0,0)
GstEvent *event = GST_PAD_PROBE_INFO_EVENT(info);
-#endif
if (GST_EVENT_TYPE(event) == GST_EVENT_CUSTOM_DOWNSTREAM
&& gst_event_has_name(event, "purple-unlink-tee")) {
@@ -289,40 +276,23 @@ event_probe_cb(GstPad *srcpad, GstEvent
gst_pad_unlink(srcpad, gst_pad_get_peer(srcpad));
-#if GST_CHECK_VERSION(1,0,0)
gst_pad_remove_probe(srcpad,
g_value_get_ulong(gst_structure_get_value(s, "handler-id")));
-#else
- gst_pad_remove_event_probe(srcpad,
- g_value_get_uint(gst_structure_get_value(s, "handler-id")));
-#endif
if (g_value_get_boolean(gst_structure_get_value(s, "release-pad")))
gst_element_release_request_pad(GST_ELEMENT_PARENT(srcpad), srcpad);
-#if GST_CHECK_VERSION(1,0,0)
return GST_PAD_PROBE_DROP;
-#else
- return FALSE;
-#endif
}
-#if GST_CHECK_VERSION(1,0,0)
return GST_PAD_PROBE_OK;
-#else
- return TRUE;
-#endif
}
static void
unlink_teepad_dynamic(GstPad *srcpad, gboolean release_pad)
{
-#if GST_CHECK_VERSION(1,0,0)
gulong id = gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
event_probe_cb, NULL, NULL);
-#else
- guint id = gst_pad_add_event_probe(srcpad, G_CALLBACK(event_probe_cb), NULL);
-#endif
if (GST_IS_GHOST_PAD(srcpad))
srcpad = gst_ghost_pad_get_target(GST_GHOST_PAD(srcpad));
@@ -331,11 +301,7 @@ unlink_teepad_dynamic(GstPad *srcpad, gb
gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM,
gst_structure_new("purple-unlink-tee",
"release-pad", G_TYPE_BOOLEAN, release_pad,
-#if GST_CHECK_VERSION(1,0,0)
"handler-id", G_TYPE_ULONG, id,
-#else
- "handler-id", G_TYPE_UINT, id,
-#endif
NULL)));
}
@@ -348,6 +314,9 @@ purple_media_backend_fs2_dispose(GObject
purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n");
+/* XXX: This condition should probably go.
+ * If we're compiling V/V, we should have Farstream.
+ */
#ifndef HAVE_FARSIGHT
if (priv->notifier) {
g_object_unref(priv->notifier);
@@ -559,12 +528,10 @@ purple_media_backend_iface_init(PurpleMe
purple_media_backend_fs2_get_local_candidates;
iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs;
iface->set_send_codec = purple_media_backend_fs2_set_send_codec;
-#if GST_CHECK_VERSION(1,0,0)
iface->set_encryption_parameters =
purple_media_backend_fs2_set_encryption_parameters;
iface->set_decryption_parameters =
purple_media_backend_fs2_set_decryption_parameters;
-#endif
iface->set_params = purple_media_backend_fs2_set_params;
iface->get_available_params = purple_media_backend_fs2_get_available_params;
iface->send_dtmf = purple_media_backend_fs2_send_dtmf;
@@ -945,13 +912,11 @@ gst_msg_db_to_percent(GstMessage *msg, g
gdouble percent;
list = gst_structure_get_value(gst_message_get_structure(msg), value_name);
-#if GST_CHECK_VERSION(1,0,0)
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
value = g_value_array_get_nth(g_value_get_boxed(list), 0);
G_GNUC_END_IGNORE_DEPRECATIONS
-#else
- value = gst_value_list_get_value(list, 0);
-#endif
+
value_db = g_value_get_double(value);
percent = pow(10, value_db / 20);
return (percent > 1.0) ? 1.0 : percent;
@@ -1768,11 +1733,7 @@ create_src(PurpleMediaBackendFs2 *self,
srcpad = gst_element_get_static_pad(session->srcvalve, "src");
g_object_set(volume, "volume", input_volume, NULL);
} else {
-#if GST_CHECK_VERSION(1,0,0)
srcpad = gst_element_get_request_pad(session->tee, "src_%u");
-#else
- srcpad = gst_element_get_request_pad(session->tee, "src%d");
-#endif
}
purple_debug_info("backend-fs2", "connecting pad: %s\n",
@@ -2030,11 +1991,7 @@ src_pad_added_cb(FsStream *fsstream, Gst
gst_element_link(stream->queue, stream->volume);
sink = stream->queue;
} else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
-#if GST_CHECK_VERSION(1,0,0)
stream->src = gst_element_factory_make("funnel", NULL);
-#else
- stream->src = gst_element_factory_make("fsfunnel", NULL);
-#endif
sink = gst_element_factory_make("fakesink", NULL);
g_object_set(G_OBJECT(sink), "async", FALSE, NULL);
gst_bin_add(GST_BIN(priv->confbin), sink);
@@ -2042,11 +1999,7 @@ src_pad_added_cb(FsStream *fsstream, Gst
stream->fakesink = sink;
#ifdef HAVE_MEDIA_APPLICATION
} else if (codec->media_type == FS_MEDIA_TYPE_APPLICATION) {
-#if GST_CHECK_VERSION(1,0,0)
stream->src = gst_element_factory_make("funnel", NULL);
-#else
- stream->src = gst_element_factory_make("fsfunnel", NULL);
-#endif
sink = purple_media_manager_get_element(
purple_media_get_manager(priv->media),
PURPLE_MEDIA_RECV_APPLICATION, priv->media,
@@ -2064,11 +2017,7 @@ src_pad_added_cb(FsStream *fsstream, Gst
gst_element_link_many(stream->src, stream->tee, sink, NULL);
}
-#if GST_CHECK_VERSION(1,0,0)
sinkpad = gst_element_get_request_pad(stream->src, "sink_%u");
-#else
- sinkpad = gst_element_get_request_pad(stream->src, "sink%d");
-#endif
gst_pad_link(srcpad, sinkpad);
gst_object_unref(sinkpad);
@@ -2548,7 +2497,6 @@ purple_media_backend_fs2_set_remote_code
return TRUE;
}
-#if GST_CHECK_VERSION(1,0,0)
static GstStructure *
create_fs2_srtp_structure(const gchar *cipher, const gchar *auth,
const gchar *key, gsize key_len)
@@ -2637,7 +2585,6 @@ purple_media_backend_fs2_set_decryption_
gst_structure_free(srtp);
return result;
}
-#endif /* GST 1.0+ */
static gboolean
purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -39,11 +39,7 @@
#else
#include <farstream/fs-element-added-notifier.h>
#endif
-#if GST_CHECK_VERSION(1,0,0)
#include <gst/video/videooverlay.h>
-#else
-#include <gst/interfaces/xoverlay.h>
-#endif
#ifdef HAVE_MEDIA_APPLICATION
#include <gst/app/app.h>
#endif
@@ -313,11 +309,7 @@ purple_media_manager_get_pipeline(Purple
gst_bus_add_signal_watch(GST_BUS(bus));
g_signal_connect(G_OBJECT(bus), "message",
G_CALLBACK(pipeline_bus_call), manager);
-#if GST_CHECK_VERSION(1,0,0)
gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL, NULL);
-#else
- gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, NULL);
-#endif
gst_object_unref(bus);
filename = g_build_filename(purple_user_dir(),
@@ -622,9 +614,7 @@ request_pad_unlinked_cb(GstPad *pad, Gst
{
GstElement *parent = GST_ELEMENT_PARENT(pad);
GstIterator *iter;
-#if GST_CHECK_VERSION(1,0,0)
GValue tmp = G_VALUE_INIT;
-#endif
GstPad *remaining_pad;
GstIteratorResult result;
@@ -632,21 +622,15 @@ request_pad_unlinked_cb(GstPad *pad, Gst
iter = gst_element_iterate_src_pads(parent);
-#if GST_CHECK_VERSION(1,0,0)
result = gst_iterator_next(iter, &tmp);
-#else
- result = gst_iterator_next(iter, (gpointer)&remaining_pad);
-#endif
if (result == GST_ITERATOR_DONE) {
gst_element_set_locked_state(parent, TRUE);
gst_element_set_state(parent, GST_STATE_NULL);
gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent);
} else if (result == GST_ITERATOR_OK) {
More information about the Commits
mailing list