[farsight2/master] Pass the igd object to each component

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:25:08 PST 2008


---
 transmitters/rawudp/fs-rawudp-component.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/transmitters/rawudp/fs-rawudp-component.c b/transmitters/rawudp/fs-rawudp-component.c
index 7e82993..c4d4878 100644
--- a/transmitters/rawudp/fs-rawudp-component.c
+++ b/transmitters/rawudp/fs-rawudp-component.c
@@ -38,6 +38,10 @@
 
 #include <gst/netbuffer/gstnetbuffer.h>
 
+#ifdef HAVE_GUPNP
+#include <ext/fsupnp/fs-upnp-simple-igd-thread.h>
+#endif
+
 #include <string.h>
 #include <sys/types.h>
 
@@ -88,7 +92,8 @@ enum
   PROP_UPNP_MAPPING,
   PROP_UPNP_DISCOVERY,
   PROP_UPNP_MAPPING_TIMEOUT,
-  PROP_UPNP_DISCOVERY_TIMEOUT
+  PROP_UPNP_DISCOVERY_TIMEOUT,
+  PROP_UPNP_IGD
 #endif
 };
 
@@ -121,6 +126,8 @@ struct _FsRawUdpComponentPrivate
   gboolean upnp_mapping;
   guint upnp_mapping_timeout;
   guint upnp_discovery_timeout;
+
+  FsUpnpSimpleIgdThread *upnp_igd;
 #endif
 
   /* Above this line, its all set at construction time */
@@ -377,6 +384,14 @@ fs_rawudp_component_class_init (FsRawUdpComponentClass *klass)
           " and the local IP is returned",
           0, G_MAXUINT32, DEFAULT_UPNP_DISCOVERY_TIMEOUT,
           G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+      PROP_UPNP_IGD,
+      g_param_spec_object ("upnp-igd",
+          "The FsUpnpSimpleIgd object",
+          "This is the upnp igd abstraction object",
+          FS_TYPE_UPNP_SIMPLE_IGD_THREAD,
+          G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
 #endif
 
    /**
@@ -559,6 +574,12 @@ fs_rawudp_component_dispose (GObject *object)
     fs_rawudp_component_stop (self);
   }
 
+  if (self->priv->upnp_igd)
+  {
+    g_object_unref (self->priv->upnp_igd);
+    self->priv->upnp_igd = NULL;
+  }
+
   /* Make sure dispose does not run twice. */
   self->priv->disposed = TRUE;
 
@@ -770,6 +791,9 @@ fs_rawudp_component_set_property (GObject *object,
     case PROP_UPNP_DISCOVERY_TIMEOUT:
       self->priv->upnp_discovery_timeout = g_value_get_uint (value);
       break;
+    case PROP_UPNP_IGD:
+      self->priv->upnp_igd = g_value_dup_object (value);
+      break;
 #endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-- 
1.5.6.5




More information about the farsight-commits mailing list