Commit 0499a1ec authored by Wim Taymans's avatar Wim Taymans

media: make it possible to set permissions

Make it possible to set permissions on media and media factory objects
parent 8f008807
......@@ -29,6 +29,7 @@
struct _GstRTSPMediaFactoryPrivate
{
GMutex lock; /* protects everything but medias */
GstRTSPPermissions *permissions;
gchar *launch;
gboolean shared;
gboolean eos_shutdown;
......@@ -274,6 +275,57 @@ gst_rtsp_media_factory_new (void)
return result;
}
/**
* gst_rtsp_media_factory_set_permissions:
* @factory: a #GstRTSPMediaFactory
* @permissions: a #GstRTSPPermissions
*
* Set @permissions on @factory.
*/
void
gst_rtsp_media_factory_set_permissions (GstRTSPMediaFactory * factory,
GstRTSPPermissions * permissions)
{
GstRTSPMediaFactoryPrivate *priv;
g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory));
priv = factory->priv;
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
if (priv->permissions)
gst_rtsp_permissions_unref (priv->permissions);
if ((priv->permissions = permissions))
gst_rtsp_permissions_ref (permissions);
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
}
/**
* gst_rtsp_media_factory_get_permissions:
* @factory: a #GstRTSPMediaFactory
*
* Get the permissions object from @factory.
*
* Returns: (transfer full): a #GstRTSPPermissions object, unref after usage.
*/
GstRTSPPermissions *
gst_rtsp_media_factory_get_permissions (GstRTSPMediaFactory * factory)
{
GstRTSPMediaFactoryPrivate *priv;
GstRTSPPermissions *result;
g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), NULL);
priv = factory->priv;
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
if ((result = priv->permissions))
gst_rtsp_permissions_ref (result);
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
return result;
}
/**
* gst_rtsp_media_factory_set_launch:
* @factory: a #GstRTSPMediaFactory
......
......@@ -21,7 +21,7 @@
#include <gst/rtsp/gstrtspurl.h>
#include "rtsp-media.h"
#include "rtsp-auth.h"
#include "rtsp-permissions.h"
#include "rtsp-address-pool.h"
#ifndef __GST_RTSP_MEDIA_FACTORY_H__
......@@ -99,34 +99,40 @@ GType gst_rtsp_media_factory_get_type (void);
GstRTSPMediaFactory * gst_rtsp_media_factory_new (void);
/* configuring the factory */
void gst_rtsp_media_factory_set_launch (GstRTSPMediaFactory *factory,
const gchar *launch);
gchar * gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_permissions (GstRTSPMediaFactory *factory,
GstRTSPPermissions *permissions);
GstRTSPPermissions * gst_rtsp_media_factory_get_permissions (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_shared (GstRTSPMediaFactory *factory,
gboolean shared);
gboolean gst_rtsp_media_factory_is_shared (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_launch (GstRTSPMediaFactory *factory,
const gchar *launch);
gchar * gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFactory *factory,
gboolean eos_shutdown);
gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_shared (GstRTSPMediaFactory *factory,
gboolean shared);
gboolean gst_rtsp_media_factory_is_shared (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory, GstRTSPLowerTrans protocols);
GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFactory *factory,
gboolean eos_shutdown);
gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_address_pool (GstRTSPMediaFactory * factory,
GstRTSPAddressPool * pool);
GstRTSPAddressPool * gst_rtsp_media_factory_get_address_pool (GstRTSPMediaFactory * factory);
void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory,
GstRTSPLowerTrans protocols);
GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_buffer_size (GstRTSPMediaFactory * factory, guint size);
guint gst_rtsp_media_factory_get_buffer_size (GstRTSPMediaFactory * factory);
void gst_rtsp_media_factory_set_address_pool (GstRTSPMediaFactory * factory,
GstRTSPAddressPool * pool);
GstRTSPAddressPool * gst_rtsp_media_factory_get_address_pool (GstRTSPMediaFactory * factory);
void gst_rtsp_media_factory_set_buffer_size (GstRTSPMediaFactory * factory,
guint size);
guint gst_rtsp_media_factory_get_buffer_size (GstRTSPMediaFactory * factory);
/* creating the media from the factory and a url */
GstRTSPMedia * gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory,
const GstRTSPUrl *url);
GstRTSPMedia * gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory,
const GstRTSPUrl *url);
GstElement * gst_rtsp_media_factory_create_element (GstRTSPMediaFactory *factory,
const GstRTSPUrl *url);
GstElement * gst_rtsp_media_factory_create_element (GstRTSPMediaFactory *factory,
const GstRTSPUrl *url);
G_END_DECLS
......
......@@ -34,6 +34,7 @@ struct _GstRTSPMediaPrivate
GCond cond;
/* protected by lock */
GstRTSPPermissions *permissions;
gboolean shared;
gboolean reusable;
GstRTSPLowerTrans protocols;
......@@ -496,6 +497,57 @@ gst_rtsp_media_take_pipeline (GstRTSPMedia * media, GstPipeline * pipeline)
gst_bin_add (GST_BIN_CAST (pipeline), priv->element);
}
/**
* gst_rtsp_media_set_permissions:
* @media: a #GstRTSPMedia
* @permissions: a #GstRTSPPermissions
*
* Set @permissions on @media.
*/
void
gst_rtsp_media_set_permissions (GstRTSPMedia * media,
GstRTSPPermissions * permissions)
{
GstRTSPMediaPrivate *priv;
g_return_if_fail (GST_IS_RTSP_MEDIA (media));
priv = media->priv;
g_mutex_lock (&priv->lock);
if (priv->permissions)
gst_rtsp_permissions_unref (priv->permissions);
if ((priv->permissions = permissions))
gst_rtsp_permissions_ref (permissions);
g_mutex_unlock (&priv->lock);
}
/**
* gst_rtsp_media_get_permissions:
* @media: a #GstRTSPMedia
*
* Get the permissions object from @media.
*
* Returns: (transfer full): a #GstRTSPPermissions object, unref after usage.
*/
GstRTSPPermissions *
gst_rtsp_media_get_permissions (GstRTSPMedia * media)
{
GstRTSPMediaPrivate *priv;
GstRTSPPermissions *result;
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), NULL);
priv = media->priv;
g_mutex_lock (&priv->lock);
if ((result = priv->permissions))
gst_rtsp_permissions_ref (result);
g_mutex_unlock (&priv->lock);
return result;
}
/**
* gst_rtsp_media_set_shared:
* @media: a #GstRTSPMedia
......
......@@ -42,7 +42,7 @@ typedef struct _GstRTSPMediaClass GstRTSPMediaClass;
typedef struct _GstRTSPMediaPrivate GstRTSPMediaPrivate;
#include "rtsp-stream.h"
#include "rtsp-auth.h"
#include "rtsp-permissions.h"
#include "rtsp-address-pool.h"
/**
......@@ -125,6 +125,10 @@ void gst_rtsp_media_take_pipeline (GstRTSPMedia *media, GstP
GstRTSPMediaStatus gst_rtsp_media_get_status (GstRTSPMedia *media);
void gst_rtsp_media_set_permissions (GstRTSPMedia *media,
GstRTSPPermissions *permissions);
GstRTSPPermissions * gst_rtsp_media_get_permissions (GstRTSPMedia *media);
void gst_rtsp_media_set_shared (GstRTSPMedia *media, gboolean shared);
gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment