gstreamer_core/libs/gst/net/gstnettimeprovider.c
branchRCL_3
changeset 29 567bb019e3e3
parent 0 0e761a78d257
child 30 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 29:567bb019e3e3
   145   gobject_class->get_property = gst_net_time_provider_get_property;
   145   gobject_class->get_property = gst_net_time_provider_get_property;
   146 
   146 
   147   g_object_class_install_property (gobject_class, PROP_PORT,
   147   g_object_class_install_property (gobject_class, PROP_PORT,
   148       g_param_spec_int ("port", "port",
   148       g_param_spec_int ("port", "port",
   149           "The port to receive the packets from, 0=allocate", 0, G_MAXUINT16,
   149           "The port to receive the packets from, 0=allocate", 0, G_MAXUINT16,
   150           DEFAULT_PORT, G_PARAM_READWRITE));
   150           DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   151   g_object_class_install_property (gobject_class, PROP_ADDRESS,
   151   g_object_class_install_property (gobject_class, PROP_ADDRESS,
   152       g_param_spec_string ("address", "address",
   152       g_param_spec_string ("address", "address",
   153           "The address to bind on, as a dotted quad (x.x.x.x)",
   153           "The address to bind on, as a dotted quad (x.x.x.x)",
   154           DEFAULT_ADDRESS, G_PARAM_READWRITE));
   154           DEFAULT_ADDRESS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   155   g_object_class_install_property (gobject_class, PROP_CLOCK,
   155   g_object_class_install_property (gobject_class, PROP_CLOCK,
   156       g_param_spec_object ("clock", "Clock",
   156       g_param_spec_object ("clock", "Clock",
   157           "The clock to export over the network", GST_TYPE_CLOCK,
   157           "The clock to export over the network", GST_TYPE_CLOCK,
   158           G_PARAM_READWRITE));
   158           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   159   g_object_class_install_property (gobject_class, PROP_ACTIVE,
   159   g_object_class_install_property (gobject_class, PROP_ACTIVE,
   160       g_param_spec_boolean ("active", "Active",
   160       g_param_spec_boolean ("active", "Active",
   161           "TRUE if the clock will respond to queries over the network", TRUE,
   161           "TRUE if the clock will respond to queries over the network", TRUE,
   162           G_PARAM_READWRITE));
   162           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   163 }
   163 }
   164 
   164 
   165 static void
   165 static void
   166 gst_net_time_provider_init (GstNetTimeProvider * self,
   166 gst_net_time_provider_init (GstNetTimeProvider * self,
   167     GstNetTimeProviderClass * g_class)
   167     GstNetTimeProviderClass * g_class)
   312     case PROP_CLOCK:
   312     case PROP_CLOCK:
   313       gst_object_replace ((GstObject **) clock_p,
   313       gst_object_replace ((GstObject **) clock_p,
   314           (GstObject *) g_value_get_object (value));
   314           (GstObject *) g_value_get_object (value));
   315       break;
   315       break;
   316     case PROP_ACTIVE:
   316     case PROP_ACTIVE:
   317       gst_atomic_int_set (&self->active.active, g_value_get_boolean (value));
   317       g_atomic_int_set (&self->active.active, g_value_get_boolean (value));
   318       break;
   318       break;
   319     default:
   319     default:
   320       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   320       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   321       break;
   321       break;
   322   }
   322   }
   382       sizeof (my_addr));
   382       sizeof (my_addr));
   383   if (ret < 0)
   383   if (ret < 0)
   384     goto bind_error;
   384     goto bind_error;
   385 
   385 
   386   len = sizeof (my_addr);
   386   len = sizeof (my_addr);
       
   387 #ifdef G_OS_WIN32
       
   388   ret =
       
   389       getsockname (self->priv->sock.fd, (struct sockaddr *) &my_addr,
       
   390       (gint *) & len);
       
   391 #else
   387   ret = getsockname (self->priv->sock.fd, (struct sockaddr *) &my_addr, &len);
   392   ret = getsockname (self->priv->sock.fd, (struct sockaddr *) &my_addr, &len);
       
   393 #endif
   388   if (ret < 0)
   394   if (ret < 0)
   389     goto getsockname_error;
   395     goto getsockname_error;
   390 
   396 
   391   port = ntohs (my_addr.sin_port);
   397   port = ntohs (my_addr.sin_port);
   392   GST_DEBUG_OBJECT (self, "bound, on port %d", port);
   398   GST_DEBUG_OBJECT (self, "bound, on port %d", port);