mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
media: make it possible to set permissions
Make it possible to set permissions on media and media factory objects
This commit is contained in:
parent
8f008807ad
commit
0499a1ec7d
4 changed files with 136 additions and 22 deletions
|
@ -29,6 +29,7 @@
|
||||||
struct _GstRTSPMediaFactoryPrivate
|
struct _GstRTSPMediaFactoryPrivate
|
||||||
{
|
{
|
||||||
GMutex lock; /* protects everything but medias */
|
GMutex lock; /* protects everything but medias */
|
||||||
|
GstRTSPPermissions *permissions;
|
||||||
gchar *launch;
|
gchar *launch;
|
||||||
gboolean shared;
|
gboolean shared;
|
||||||
gboolean eos_shutdown;
|
gboolean eos_shutdown;
|
||||||
|
@ -274,6 +275,57 @@ gst_rtsp_media_factory_new (void)
|
||||||
return result;
|
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:
|
* gst_rtsp_media_factory_set_launch:
|
||||||
* @factory: a #GstRTSPMediaFactory
|
* @factory: a #GstRTSPMediaFactory
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <gst/rtsp/gstrtspurl.h>
|
#include <gst/rtsp/gstrtspurl.h>
|
||||||
|
|
||||||
#include "rtsp-media.h"
|
#include "rtsp-media.h"
|
||||||
#include "rtsp-auth.h"
|
#include "rtsp-permissions.h"
|
||||||
#include "rtsp-address-pool.h"
|
#include "rtsp-address-pool.h"
|
||||||
|
|
||||||
#ifndef __GST_RTSP_MEDIA_FACTORY_H__
|
#ifndef __GST_RTSP_MEDIA_FACTORY_H__
|
||||||
|
@ -99,6 +99,10 @@ GType gst_rtsp_media_factory_get_type (void);
|
||||||
GstRTSPMediaFactory * gst_rtsp_media_factory_new (void);
|
GstRTSPMediaFactory * gst_rtsp_media_factory_new (void);
|
||||||
|
|
||||||
/* configuring the factory */
|
/* configuring the 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_launch (GstRTSPMediaFactory *factory,
|
void gst_rtsp_media_factory_set_launch (GstRTSPMediaFactory *factory,
|
||||||
const gchar *launch);
|
const gchar *launch);
|
||||||
gchar * gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);
|
gchar * gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);
|
||||||
|
@ -111,14 +115,16 @@ void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFac
|
||||||
gboolean eos_shutdown);
|
gboolean eos_shutdown);
|
||||||
gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
|
gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
|
||||||
|
|
||||||
void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory, GstRTSPLowerTrans protocols);
|
void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory,
|
||||||
|
GstRTSPLowerTrans protocols);
|
||||||
GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);
|
GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);
|
||||||
|
|
||||||
void gst_rtsp_media_factory_set_address_pool (GstRTSPMediaFactory * factory,
|
void gst_rtsp_media_factory_set_address_pool (GstRTSPMediaFactory * factory,
|
||||||
GstRTSPAddressPool * pool);
|
GstRTSPAddressPool * pool);
|
||||||
GstRTSPAddressPool * gst_rtsp_media_factory_get_address_pool (GstRTSPMediaFactory * factory);
|
GstRTSPAddressPool * gst_rtsp_media_factory_get_address_pool (GstRTSPMediaFactory * factory);
|
||||||
|
|
||||||
void gst_rtsp_media_factory_set_buffer_size (GstRTSPMediaFactory * factory, guint size);
|
void gst_rtsp_media_factory_set_buffer_size (GstRTSPMediaFactory * factory,
|
||||||
|
guint size);
|
||||||
guint gst_rtsp_media_factory_get_buffer_size (GstRTSPMediaFactory * factory);
|
guint gst_rtsp_media_factory_get_buffer_size (GstRTSPMediaFactory * factory);
|
||||||
|
|
||||||
/* creating the media from the factory and a url */
|
/* creating the media from the factory and a url */
|
||||||
|
|
|
@ -34,6 +34,7 @@ struct _GstRTSPMediaPrivate
|
||||||
GCond cond;
|
GCond cond;
|
||||||
|
|
||||||
/* protected by lock */
|
/* protected by lock */
|
||||||
|
GstRTSPPermissions *permissions;
|
||||||
gboolean shared;
|
gboolean shared;
|
||||||
gboolean reusable;
|
gboolean reusable;
|
||||||
GstRTSPLowerTrans protocols;
|
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_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:
|
* gst_rtsp_media_set_shared:
|
||||||
* @media: a #GstRTSPMedia
|
* @media: a #GstRTSPMedia
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct _GstRTSPMediaClass GstRTSPMediaClass;
|
||||||
typedef struct _GstRTSPMediaPrivate GstRTSPMediaPrivate;
|
typedef struct _GstRTSPMediaPrivate GstRTSPMediaPrivate;
|
||||||
|
|
||||||
#include "rtsp-stream.h"
|
#include "rtsp-stream.h"
|
||||||
#include "rtsp-auth.h"
|
#include "rtsp-permissions.h"
|
||||||
#include "rtsp-address-pool.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);
|
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);
|
void gst_rtsp_media_set_shared (GstRTSPMedia *media, gboolean shared);
|
||||||
gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
|
gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue