address-pool: add clear method

This commit is contained in:
Wim Taymans 2012-11-14 16:17:33 +01:00
parent 6085b1fcc1
commit d0ffc8e679
2 changed files with 24 additions and 0 deletions

View file

@ -120,6 +120,29 @@ gst_rtsp_address_pool_new (void)
return pool;
}
/**
* gst_rtsp_address_pool_clear:
* @pool: a #GstRTSPAddressPool
*
* Clear all addresses in @pool. There should be no outstanding
* allocations.
*/
void
gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool)
{
GstRTSPAddressPoolPrivate *priv;
g_return_if_fail (GST_IS_RTSP_ADDRESS_POOL (pool));
g_return_if_fail (pool->priv->allocated == NULL);
priv = pool->priv;
g_mutex_lock (&priv->lock);
g_list_free_full (priv->addresses, (GDestroyNotify) free_range);
priv->addresses = NULL;
g_mutex_unlock (&priv->lock);
}
static gboolean
fill_address (const gchar * address, guint16 port, Addr * addr)
{

View file

@ -64,6 +64,7 @@ GType gst_rtsp_address_pool_get_type (void);
/* create a new address pool */
GstRTSPAddressPool * gst_rtsp_address_pool_new (void);
void gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool);
void gst_rtsp_address_pool_dump (GstRTSPAddressPool * pool);
gboolean gst_rtsp_address_pool_add_range (GstRTSPAddressPool * pool,