mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-13 15:12:58 +00:00
MediaMapping -> MountPoints
Describes better what the object manages.
This commit is contained in:
parent
d6ac48fcfd
commit
1d53c46d23
28 changed files with 444 additions and 450 deletions
22
docs/README
22
docs/README
|
@ -94,7 +94,7 @@ can build simple server applications with it.
|
|||
}
|
||||
|
||||
The server manages two other objects: GstRTSPSessionPool and
|
||||
GstRTSPMediaMapping.
|
||||
GstRTSPMountPoints.
|
||||
|
||||
The GstRTSPSessionPool is an object that keeps track of all the active sessions
|
||||
in the server. A session will usually be kept for each client that performed a
|
||||
|
@ -104,13 +104,13 @@ can build simple server applications with it.
|
|||
The default implementation of the session pool is usually sufficient but
|
||||
alternative implementation can be used by the server.
|
||||
|
||||
The GstRTSPMediaMapping object is more interesting and needs more configuration
|
||||
The GstRTSPMountPoints object is more interesting and needs more configuration
|
||||
before the server object is useful. This object manages the mapping from a
|
||||
request URL to a specific stream and its configuration. We explain in the next
|
||||
topic how to configure this object.
|
||||
|
||||
|
||||
* Making url mappings
|
||||
* Making url mount points
|
||||
|
||||
Next we need to define what media is attached to a particular URL. What we want
|
||||
to achieve is that when the user asks our server for a specific URL, say /test,
|
||||
|
@ -141,19 +141,19 @@ can build simple server applications with it.
|
|||
"( videotestsrc ! x264enc ! rtph264pay pt=96 name=pay0 )");
|
||||
|
||||
Now that we have the media factory, we can attach it to a specific url. To do
|
||||
this we get the default GstRTSPMediaMapping from our server and add the url to
|
||||
factory mapping to it like this:
|
||||
this we get the default GstRTSPMountPoints from our server and add the url to
|
||||
factory mount points to it like this:
|
||||
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
|
||||
...create server..create factory..
|
||||
|
||||
/* get the default mapping from the server */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
/* get the default mount points from the server */
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* attach the video test signal to the "/test" URL */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
g_object_unref (mapping);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
g_object_unref (mounts);
|
||||
|
||||
When starting the server now and directing an RTP client to the URL (like with
|
||||
vlc, mplayer or gstreamer):
|
||||
|
@ -387,7 +387,7 @@ GstRTSPAuth
|
|||
basic authentication.
|
||||
|
||||
|
||||
GstRTSPMediaMapping
|
||||
GstRTSPMountPoints
|
||||
- Maps a url to a GstRTSPMediaFactory implementation. The default
|
||||
implementation uses a simple hashtable to map a url to a factory.
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<xi:include href="xml/rtsp-client.xml"/>
|
||||
<xi:include href="xml/rtsp-media-factory.xml"/>
|
||||
<xi:include href="xml/rtsp-media-factory-uri.xml"/>
|
||||
<xi:include href="xml/rtsp-media-mapping.xml"/>
|
||||
<xi:include href="xml/rtsp-mount-points.xml"/>
|
||||
<xi:include href="xml/rtsp-media.xml"/>
|
||||
<xi:include href="xml/rtsp-auth.xml"/>
|
||||
<xi:include href="xml/rtsp-params.xml"/>
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<SECTION>
|
||||
<FILE>rtsp-media-mapping</FILE>
|
||||
<TITLE>GstRTSPMediaMapping</TITLE>
|
||||
GstRTSPMediaMapping
|
||||
GstRTSPMediaMappingClass
|
||||
gst_rtsp_media_mapping_new
|
||||
gst_rtsp_media_mapping_find_factory
|
||||
gst_rtsp_media_mapping_add_factory
|
||||
gst_rtsp_media_mapping_remove_factory
|
||||
<FILE>rtsp-mount-points</FILE>
|
||||
<TITLE>GstRTSPMountPoints</TITLE>
|
||||
GstRTSPMountPoints
|
||||
GstRTSPMountPointsClass
|
||||
gst_rtsp_mount_points_new
|
||||
gst_rtsp_mount_points_find_factory
|
||||
gst_rtsp_mount_points_add_factory
|
||||
gst_rtsp_mount_points_remove_factory
|
||||
<SUBSECTION Standard>
|
||||
GST_RTSP_MEDIA_MAPPING_CLASS
|
||||
GST_RTSP_MEDIA_MAPPING_CAST
|
||||
GST_RTSP_MEDIA_MAPPING_CLASS_CAST
|
||||
GST_RTSP_MEDIA_MAPPING
|
||||
GST_IS_RTSP_MEDIA_MAPPING
|
||||
GST_TYPE_RTSP_MEDIA_MAPPING
|
||||
gst_rtsp_media_mapping_get_type
|
||||
GST_IS_RTSP_MEDIA_MAPPING_CLASS
|
||||
GST_RTSP_MEDIA_MAPPING_GET_CLASS
|
||||
GST_RTSP_MOUNT_POINTS_CLASS
|
||||
GST_RTSP_MOUNT_POINTS_CAST
|
||||
GST_RTSP_MOUNT_POINTS_CLASS_CAST
|
||||
GST_RTSP_MOUNT_POINTS
|
||||
GST_IS_RTSP_MOUNT_POINTS
|
||||
GST_TYPE_RTSP_MOUNT_POINTS
|
||||
gst_rtsp_mount_points_get_type
|
||||
GST_IS_RTSP_MOUNT_POINTS_CLASS
|
||||
GST_RTSP_MOUNT_POINTS_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -135,8 +135,8 @@ gst_rtsp_server_set_backlog
|
|||
gst_rtsp_server_get_backlog
|
||||
gst_rtsp_server_set_session_pool
|
||||
gst_rtsp_server_get_session_pool
|
||||
gst_rtsp_server_set_media_mapping
|
||||
gst_rtsp_server_get_media_mapping
|
||||
gst_rtsp_server_set_mount_points
|
||||
gst_rtsp_server_get_mount_points
|
||||
gst_rtsp_server_get_auth
|
||||
gst_rtsp_server_set_auth
|
||||
gst_rtsp_server_transfer_connection
|
||||
|
@ -272,8 +272,8 @@ gst_rtsp_client_set_server
|
|||
gst_rtsp_client_get_server
|
||||
gst_rtsp_client_set_session_pool
|
||||
gst_rtsp_client_get_session_pool
|
||||
gst_rtsp_client_set_media_mapping
|
||||
gst_rtsp_client_get_media_mapping
|
||||
gst_rtsp_client_set_mount_points
|
||||
gst_rtsp_client_get_mount_points
|
||||
gst_rtsp_client_set_use_client_settings
|
||||
gst_rtsp_client_get_use_client_settings
|
||||
gst_rtsp_client_set_auth
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <gst/rtsp-server/rtsp-auth.h>
|
||||
gst_rtsp_auth_get_type
|
||||
|
||||
#include <gst/rtsp-server/rtsp-media-mapping.h>
|
||||
gst_rtsp_media_mapping_get_type
|
||||
#include <gst/rtsp-server/rtsp-mount-points.h>
|
||||
gst_rtsp_mount_points_get_type
|
||||
|
||||
#include <gst/rtsp-server/rtsp-media-factory.h>
|
||||
gst_rtsp_media_factory_get_type
|
||||
|
|
|
@ -59,7 +59,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
GstRTSPAuth *auth;
|
||||
gchar *basic;
|
||||
|
@ -71,9 +71,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mounts for this server, every server has a default mapper object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
|
||||
/* make a media factory for a test stream. The default media factory can use
|
||||
|
@ -95,7 +95,7 @@ main (int argc, char *argv[])
|
|||
gst_rtsp_media_factory_set_auth (factory, auth);
|
||||
g_object_unref (auth);
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* make another factory */
|
||||
factory = gst_rtsp_media_factory_new ();
|
||||
|
@ -110,10 +110,10 @@ main (int argc, char *argv[])
|
|||
gst_rtsp_media_factory_set_auth (factory, auth);
|
||||
g_object_unref (auth);
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test2", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test2", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
if (gst_rtsp_server_attach (server, NULL) == 0)
|
||||
|
|
|
@ -26,7 +26,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -43,9 +43,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* make a media factory for a test stream. The default media factory can use
|
||||
* gst-launch syntax to create pipelines.
|
||||
|
@ -55,10 +55,10 @@ main (int argc, char *argv[])
|
|||
gst_rtsp_media_factory_set_launch (factory, argv[1]);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
gst_rtsp_server_attach (server, NULL);
|
||||
|
|
|
@ -26,7 +26,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
gchar *str;
|
||||
|
||||
|
@ -42,9 +42,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
str = g_strdup_printf ("( "
|
||||
"filesrc location=%s ! qtdemux name=d "
|
||||
|
@ -60,10 +60,10 @@ main (int argc, char *argv[])
|
|||
g_free (str);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
gst_rtsp_server_attach (server, NULL);
|
||||
|
|
|
@ -39,7 +39,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
GstRTSPAddressPool *pool;
|
||||
|
||||
|
@ -50,9 +50,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* make a media factory for a test stream. The default media factory can use
|
||||
* gst-launch syntax to create pipelines.
|
||||
|
@ -75,10 +75,10 @@ main (int argc, char *argv[])
|
|||
g_object_unref (pool);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
if (gst_rtsp_server_attach (server, NULL) == 0)
|
||||
|
|
|
@ -68,7 +68,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -78,9 +78,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* make a media factory for a test stream. The default media factory can use
|
||||
* gst-launch syntax to create pipelines.
|
||||
|
@ -99,10 +99,10 @@ main (int argc, char *argv[])
|
|||
media_constructed, NULL);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
if (gst_rtsp_server_attach (server, NULL) == 0)
|
||||
|
|
|
@ -26,7 +26,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
gchar *str;
|
||||
|
||||
|
@ -42,9 +42,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
str = g_strdup_printf ("( "
|
||||
"filesrc location=%s ! oggdemux name=d "
|
||||
|
@ -60,10 +60,10 @@ main (int argc, char *argv[])
|
|||
g_free (str);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
gst_rtsp_server_attach (server, NULL);
|
||||
|
|
|
@ -26,7 +26,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -36,9 +36,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* make a media factory for a test stream. The default media factory can use
|
||||
* gst-launch syntax to create pipelines.
|
||||
|
@ -51,10 +51,10 @@ main (int argc, char *argv[])
|
|||
gst_rtsp_media_factory_set_shared (factory, TRUE);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
gst_rtsp_server_attach (server, NULL);
|
||||
|
|
|
@ -39,7 +39,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
gchar *str;
|
||||
|
||||
|
@ -55,9 +55,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* make a media factory for a test stream. The default media factory can use
|
||||
* gst-launch syntax to create pipelines.
|
||||
|
@ -73,10 +73,10 @@ main (int argc, char *argv[])
|
|||
g_free (str);
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
gst_rtsp_server_attach (server, NULL);
|
||||
|
|
|
@ -37,12 +37,12 @@ timeout (GstRTSPServer * server)
|
|||
static gboolean
|
||||
remove_map (GstRTSPServer * server)
|
||||
{
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
|
||||
g_print ("removing /test mapping\n");
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
gst_rtsp_media_mapping_remove_factory (mapping, "/test");
|
||||
g_object_unref (mapping);
|
||||
g_print ("removing /test mount point\n");
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
gst_rtsp_mount_points_remove_factory (mounts, "/test");
|
||||
g_object_unref (mounts);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactoryURI *factory;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -67,9 +67,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
/* make a URI media factory for a test stream. */
|
||||
factory = gst_rtsp_media_factory_uri_new ();
|
||||
|
@ -82,11 +82,11 @@ main (int argc, char *argv[])
|
|||
/* gst_rtsp_media_factory_set_shared ( GST_RTSP_MEDIA_FACTORY (factory), TRUE); */
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test",
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test",
|
||||
GST_RTSP_MEDIA_FACTORY (factory));
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
if (gst_rtsp_server_attach (server, NULL) == 0)
|
||||
|
@ -94,7 +94,7 @@ main (int argc, char *argv[])
|
|||
|
||||
/* do session cleanup every 2 seconds */
|
||||
g_timeout_add_seconds (2, (GSourceFunc) timeout, server);
|
||||
/* remove the mapping after 10 seconds, new clients won't be able to use the
|
||||
/* remove the mount point after 10 seconds, new clients won't be able to use the
|
||||
* /test url anymore */
|
||||
g_timeout_add_seconds (10, (GSourceFunc) remove_map, server);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
GMainLoop *loop;
|
||||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
GstRTSPMediaFactory *factory;
|
||||
#ifdef WITH_AUTH
|
||||
GstRTSPAuth *auth;
|
||||
|
@ -59,9 +59,9 @@ main (int argc, char *argv[])
|
|||
/* create a server instance */
|
||||
server = gst_rtsp_server_new ();
|
||||
|
||||
/* get the mapping for this server, every server has a default mapper object
|
||||
/* get the mount points for this server, every server has a default object
|
||||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
#ifdef WITH_AUTH
|
||||
/* make a new authentication manager. it can be added to control access to all
|
||||
|
@ -86,10 +86,10 @@ main (int argc, char *argv[])
|
|||
"alawenc ! rtppcmapay name=pay1 pt=97 " ")");
|
||||
|
||||
/* attach the test factory to the /test url */
|
||||
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
|
||||
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
|
||||
|
||||
/* don't need the ref to the mapper anymore */
|
||||
g_object_unref (mapping);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* attach the server to the default maincontext */
|
||||
if (gst_rtsp_server_attach (server, NULL) == 0)
|
||||
|
|
|
@ -6,7 +6,7 @@ public_headers = \
|
|||
rtsp-media.h \
|
||||
rtsp-media-factory.h \
|
||||
rtsp-media-factory-uri.h \
|
||||
rtsp-media-mapping.h \
|
||||
rtsp-mount-points.h \
|
||||
rtsp-stream.h \
|
||||
rtsp-stream-transport.h \
|
||||
rtsp-session.h \
|
||||
|
@ -23,7 +23,7 @@ c_sources = \
|
|||
rtsp-media.c \
|
||||
rtsp-media-factory.c \
|
||||
rtsp-media-factory-uri.c \
|
||||
rtsp-media-mapping.c \
|
||||
rtsp-mount-points.c \
|
||||
rtsp-stream.c \
|
||||
rtsp-stream-transport.c \
|
||||
rtsp-session.c \
|
||||
|
|
|
@ -26,8 +26,6 @@ typedef struct _GstRTSPAuth GstRTSPAuth;
|
|||
typedef struct _GstRTSPAuthClass GstRTSPAuthClass;
|
||||
|
||||
#include "rtsp-client.h"
|
||||
#include "rtsp-media-mapping.h"
|
||||
#include "rtsp-session-pool.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ static GMutex tunnels_lock;
|
|||
static GHashTable *tunnels;
|
||||
|
||||
#define DEFAULT_SESSION_POOL NULL
|
||||
#define DEFAULT_MEDIA_MAPPING NULL
|
||||
#define DEFAULT_MOUNT_POINTS NULL
|
||||
#define DEFAULT_USE_CLIENT_SETTINGS FALSE
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_SESSION_POOL,
|
||||
PROP_MEDIA_MAPPING,
|
||||
PROP_MOUNT_POINTS,
|
||||
PROP_USE_CLIENT_SETTINGS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
@ -93,10 +93,10 @@ gst_rtsp_client_class_init (GstRTSPClientClass * klass)
|
|||
GST_TYPE_RTSP_SESSION_POOL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_MEDIA_MAPPING,
|
||||
g_param_spec_object ("media-mapping", "Media Mapping",
|
||||
"The media mapping to use for client session",
|
||||
GST_TYPE_RTSP_MEDIA_MAPPING,
|
||||
g_object_class_install_property (gobject_class, PROP_MOUNT_POINTS,
|
||||
g_param_spec_object ("mount-points", "Mount Points",
|
||||
"The mount points to use for client session",
|
||||
GST_TYPE_RTSP_MOUNT_POINTS,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_USE_CLIENT_SETTINGS,
|
||||
|
@ -223,8 +223,8 @@ gst_rtsp_client_finalize (GObject * obj)
|
|||
gst_rtsp_connection_free (client->connection);
|
||||
if (client->session_pool)
|
||||
g_object_unref (client->session_pool);
|
||||
if (client->media_mapping)
|
||||
g_object_unref (client->media_mapping);
|
||||
if (client->mount_points)
|
||||
g_object_unref (client->mount_points);
|
||||
if (client->auth)
|
||||
g_object_unref (client->auth);
|
||||
|
||||
|
@ -250,8 +250,8 @@ gst_rtsp_client_get_property (GObject * object, guint propid,
|
|||
case PROP_SESSION_POOL:
|
||||
g_value_take_object (value, gst_rtsp_client_get_session_pool (client));
|
||||
break;
|
||||
case PROP_MEDIA_MAPPING:
|
||||
g_value_take_object (value, gst_rtsp_client_get_media_mapping (client));
|
||||
case PROP_MOUNT_POINTS:
|
||||
g_value_take_object (value, gst_rtsp_client_get_mount_points (client));
|
||||
break;
|
||||
case PROP_USE_CLIENT_SETTINGS:
|
||||
g_value_set_boolean (value,
|
||||
|
@ -272,8 +272,8 @@ gst_rtsp_client_set_property (GObject * object, guint propid,
|
|||
case PROP_SESSION_POOL:
|
||||
gst_rtsp_client_set_session_pool (client, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_MEDIA_MAPPING:
|
||||
gst_rtsp_client_set_media_mapping (client, g_value_get_object (value));
|
||||
case PROP_MOUNT_POINTS:
|
||||
gst_rtsp_client_set_mount_points (client, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_USE_CLIENT_SETTINGS:
|
||||
gst_rtsp_client_set_use_client_settings (client,
|
||||
|
@ -385,12 +385,12 @@ find_media (GstRTSPClient * client, GstRTSPClientState * state)
|
|||
}
|
||||
client->media = NULL;
|
||||
|
||||
if (!client->media_mapping)
|
||||
goto no_mapping;
|
||||
if (!client->mount_points)
|
||||
goto no_mount_points;
|
||||
|
||||
/* find the factory for the uri first */
|
||||
if (!(factory =
|
||||
gst_rtsp_media_mapping_find_factory (client->media_mapping,
|
||||
gst_rtsp_mount_points_find_factory (client->mount_points,
|
||||
state->uri)))
|
||||
goto no_factory;
|
||||
|
||||
|
@ -436,7 +436,7 @@ find_media (GstRTSPClient * client, GstRTSPClientState * state)
|
|||
return media;
|
||||
|
||||
/* ERRORS */
|
||||
no_mapping:
|
||||
no_mount_points:
|
||||
{
|
||||
send_generic_response (client, GST_RTSP_STS_NOT_FOUND, state);
|
||||
return NULL;
|
||||
|
@ -1752,45 +1752,45 @@ gst_rtsp_client_get_server (GstRTSPClient * client)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_client_set_media_mapping:
|
||||
* gst_rtsp_client_set_mount_points:
|
||||
* @client: a #GstRTSPClient
|
||||
* @mapping: a #GstRTSPMediaMapping
|
||||
* @mounts: a #GstRTSPMountPoints
|
||||
*
|
||||
* Set @mapping as the media mapping for @client which it will use to map urls
|
||||
* to media streams. These mapping is usually inherited from the server that
|
||||
* Set @mounts as the mount points for @client which it will use to map urls
|
||||
* to media streams. These mount points are usually inherited from the server that
|
||||
* created the client but can be overriden later.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_client_set_media_mapping (GstRTSPClient * client,
|
||||
GstRTSPMediaMapping * mapping)
|
||||
gst_rtsp_client_set_mount_points (GstRTSPClient * client,
|
||||
GstRTSPMountPoints * mounts)
|
||||
{
|
||||
GstRTSPMediaMapping *old;
|
||||
GstRTSPMountPoints *old;
|
||||
|
||||
old = client->media_mapping;
|
||||
old = client->mount_points;
|
||||
|
||||
if (old != mapping) {
|
||||
if (mapping)
|
||||
g_object_ref (mapping);
|
||||
client->media_mapping = mapping;
|
||||
if (old != mounts) {
|
||||
if (mounts)
|
||||
g_object_ref (mounts);
|
||||
client->mount_points = mounts;
|
||||
if (old)
|
||||
g_object_unref (old);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_client_get_media_mapping:
|
||||
* gst_rtsp_client_get_mount_points:
|
||||
* @client: a #GstRTSPClient
|
||||
*
|
||||
* Get the #GstRTSPMediaMapping object that @client uses to manage its sessions.
|
||||
* Get the #GstRTSPMountPoints object that @client uses to manage its sessions.
|
||||
*
|
||||
* Returns: (transfer full): a #GstRTSPMediaMapping, unref after usage.
|
||||
* Returns: (transfer full): a #GstRTSPMountPoints, unref after usage.
|
||||
*/
|
||||
GstRTSPMediaMapping *
|
||||
gst_rtsp_client_get_media_mapping (GstRTSPClient * client)
|
||||
GstRTSPMountPoints *
|
||||
gst_rtsp_client_get_mount_points (GstRTSPClient * client)
|
||||
{
|
||||
GstRTSPMediaMapping *result;
|
||||
GstRTSPMountPoints *result;
|
||||
|
||||
if ((result = client->media_mapping))
|
||||
if ((result = client->mount_points))
|
||||
g_object_ref (result);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef struct _GstRTSPClientState GstRTSPClientState;
|
|||
|
||||
#include "rtsp-server.h"
|
||||
#include "rtsp-media.h"
|
||||
#include "rtsp-media-mapping.h"
|
||||
#include "rtsp-mount-points.h"
|
||||
#include "rtsp-session-pool.h"
|
||||
#include "rtsp-session-media.h"
|
||||
#include "rtsp-auth.h"
|
||||
|
@ -80,7 +80,7 @@ struct _GstRTSPClientState {
|
|||
* @ip: ip address used by the client to connect to us
|
||||
* @use_client_settings: whether to allow client transport settings for multicast
|
||||
* @session_pool: handle to the session pool used by the client.
|
||||
* @media_mapping: handle to the media mapping used by the client.
|
||||
* @mount_points: handle to the mount points used by the client.
|
||||
* @uri: cached uri
|
||||
* @media: cached media
|
||||
* @transports: a list of #GstRTSPStreamTransport using @connection.
|
||||
|
@ -99,7 +99,7 @@ struct _GstRTSPClient {
|
|||
|
||||
GstRTSPServer *server;
|
||||
GstRTSPSessionPool *session_pool;
|
||||
GstRTSPMediaMapping *media_mapping;
|
||||
GstRTSPMountPoints *mount_points;
|
||||
GstRTSPAuth *auth;
|
||||
|
||||
GstRTSPUrl *uri;
|
||||
|
@ -140,9 +140,9 @@ void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
|
|||
GstRTSPSessionPool *pool);
|
||||
GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
|
||||
|
||||
void gst_rtsp_client_set_media_mapping (GstRTSPClient *client,
|
||||
GstRTSPMediaMapping *mapping);
|
||||
GstRTSPMediaMapping * gst_rtsp_client_get_media_mapping (GstRTSPClient *client);
|
||||
void gst_rtsp_client_set_mount_points (GstRTSPClient *client,
|
||||
GstRTSPMountPoints *mounts);
|
||||
GstRTSPMountPoints * gst_rtsp_client_get_mount_points (GstRTSPClient *client);
|
||||
|
||||
void gst_rtsp_client_set_use_client_settings (GstRTSPClient * client,
|
||||
gboolean use_client_settings);
|
||||
|
|
|
@ -1,176 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "rtsp-media-mapping.h"
|
||||
|
||||
G_DEFINE_TYPE (GstRTSPMediaMapping, gst_rtsp_media_mapping, G_TYPE_OBJECT);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (rtsp_media_debug);
|
||||
#define GST_CAT_DEFAULT rtsp_media_debug
|
||||
|
||||
static void gst_rtsp_media_mapping_finalize (GObject * obj);
|
||||
|
||||
static GstRTSPMediaFactory *find_factory (GstRTSPMediaMapping * mapping,
|
||||
const GstRTSPUrl * url);
|
||||
|
||||
static void
|
||||
gst_rtsp_media_mapping_class_init (GstRTSPMediaMappingClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gst_rtsp_media_mapping_finalize;
|
||||
|
||||
klass->find_factory = find_factory;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (rtsp_media_debug, "rtspmediamapping", 0,
|
||||
"GstRTSPMediaMapping");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtsp_media_mapping_init (GstRTSPMediaMapping * mapping)
|
||||
{
|
||||
GST_DEBUG_OBJECT (mapping, "created");
|
||||
|
||||
g_mutex_init (&mapping->lock);
|
||||
mapping->mappings = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtsp_media_mapping_finalize (GObject * obj)
|
||||
{
|
||||
GstRTSPMediaMapping *mapping = GST_RTSP_MEDIA_MAPPING (obj);
|
||||
|
||||
GST_DEBUG_OBJECT (mapping, "finalized");
|
||||
|
||||
g_hash_table_unref (mapping->mappings);
|
||||
g_mutex_clear (&mapping->lock);
|
||||
|
||||
G_OBJECT_CLASS (gst_rtsp_media_mapping_parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_media_mapping_new:
|
||||
*
|
||||
* Make a new media mapping object.
|
||||
*
|
||||
* Returns: a new #GstRTSPMediaMapping
|
||||
*/
|
||||
GstRTSPMediaMapping *
|
||||
gst_rtsp_media_mapping_new (void)
|
||||
{
|
||||
GstRTSPMediaMapping *result;
|
||||
|
||||
result = g_object_new (GST_TYPE_RTSP_MEDIA_MAPPING, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GstRTSPMediaFactory *
|
||||
find_factory (GstRTSPMediaMapping * mapping, const GstRTSPUrl * url)
|
||||
{
|
||||
GstRTSPMediaFactory *result;
|
||||
|
||||
g_mutex_lock (&mapping->lock);
|
||||
/* find the location of the media in the hashtable we only use the absolute
|
||||
* path of the uri to find a mapping. If the mapping depends on other
|
||||
* properties found in the url, this method should be overridden. */
|
||||
result = g_hash_table_lookup (mapping->mappings, url->abspath);
|
||||
if (result)
|
||||
g_object_ref (result);
|
||||
g_mutex_unlock (&mapping->lock);
|
||||
|
||||
GST_INFO ("found media %p for url abspath %s", result, url->abspath);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_media_mapping_find_factory:
|
||||
* @mapping: a #GstRTSPMediaMapping
|
||||
* @url: a url
|
||||
*
|
||||
* Find the #GstRTSPMediaFactory for @url. The default implementation of this object
|
||||
* will use the mappings added with gst_rtsp_media_mapping_add_factory ().
|
||||
*
|
||||
* Returns: (transfer full): the #GstRTSPMediaFactory for @url. g_object_unref() after usage.
|
||||
*/
|
||||
GstRTSPMediaFactory *
|
||||
gst_rtsp_media_mapping_find_factory (GstRTSPMediaMapping * mapping,
|
||||
const GstRTSPUrl * url)
|
||||
{
|
||||
GstRTSPMediaFactory *result;
|
||||
GstRTSPMediaMappingClass *klass;
|
||||
|
||||
klass = GST_RTSP_MEDIA_MAPPING_GET_CLASS (mapping);
|
||||
|
||||
if (klass->find_factory)
|
||||
result = klass->find_factory (mapping, url);
|
||||
else
|
||||
result = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_media_mapping_add_factory:
|
||||
* @mapping: a #GstRTSPMediaMapping
|
||||
* @path: a mount point
|
||||
* @factory: (transfer full): a #GstRTSPMediaFactory
|
||||
*
|
||||
* Attach @factory to the mount point @path in @mapping.
|
||||
*
|
||||
* @path is of the form (/node)+. Any previous mapping will be freed.
|
||||
*
|
||||
* Ownership is taken of the reference on @factory so that @factory should not be
|
||||
* used after calling this function.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_media_mapping_add_factory (GstRTSPMediaMapping * mapping,
|
||||
const gchar * path, GstRTSPMediaFactory * factory)
|
||||
{
|
||||
g_return_if_fail (GST_IS_RTSP_MEDIA_MAPPING (mapping));
|
||||
g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
g_mutex_lock (&mapping->lock);
|
||||
g_hash_table_insert (mapping->mappings, g_strdup (path), factory);
|
||||
g_mutex_unlock (&mapping->lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_media_mapping_remove_factory:
|
||||
* @mapping: a #GstRTSPMediaMapping
|
||||
* @path: a mount point
|
||||
*
|
||||
* Remove the #GstRTSPMediaFactory associated with @path in @mapping.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_media_mapping_remove_factory (GstRTSPMediaMapping * mapping,
|
||||
const gchar * path)
|
||||
{
|
||||
g_return_if_fail (GST_IS_RTSP_MEDIA_MAPPING (mapping));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
g_mutex_lock (&mapping->lock);
|
||||
g_hash_table_remove (mapping->mappings, path);
|
||||
g_mutex_unlock (&mapping->lock);
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <gst/rtsp/gstrtspurl.h>
|
||||
|
||||
#include "rtsp-media-factory.h"
|
||||
|
||||
#ifndef __GST_RTSP_MEDIA_MAPPING_H__
|
||||
#define __GST_RTSP_MEDIA_MAPPING_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_RTSP_MEDIA_MAPPING (gst_rtsp_media_mapping_get_type ())
|
||||
#define GST_IS_RTSP_MEDIA_MAPPING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA_MAPPING))
|
||||
#define GST_IS_RTSP_MEDIA_MAPPING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA_MAPPING))
|
||||
#define GST_RTSP_MEDIA_MAPPING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA_MAPPING, GstRTSPMediaMappingClass))
|
||||
#define GST_RTSP_MEDIA_MAPPING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA_MAPPING, GstRTSPMediaMapping))
|
||||
#define GST_RTSP_MEDIA_MAPPING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA_MAPPING, GstRTSPMediaMappingClass))
|
||||
#define GST_RTSP_MEDIA_MAPPING_CAST(obj) ((GstRTSPMediaMapping*)(obj))
|
||||
#define GST_RTSP_MEDIA_MAPPING_CLASS_CAST(klass) ((GstRTSPMediaMappingClass*)(klass))
|
||||
|
||||
typedef struct _GstRTSPMediaMapping GstRTSPMediaMapping;
|
||||
typedef struct _GstRTSPMediaMappingClass GstRTSPMediaMappingClass;
|
||||
|
||||
/**
|
||||
* GstRTSPMediaMapping:
|
||||
* @parent: parent GObject
|
||||
* @mappings: the mountpoint to media mappings
|
||||
*
|
||||
* Creates a #GstRTSPMediaFactory object for a given url.
|
||||
*/
|
||||
struct _GstRTSPMediaMapping {
|
||||
GObject parent;
|
||||
|
||||
GMutex lock;
|
||||
GHashTable *mappings;
|
||||
};
|
||||
|
||||
/**
|
||||
* GstRTSPMediaMappingClass:
|
||||
* @parent_class: parent GObject class
|
||||
* @find_factory: Create or return a previously cached #GstRTSPMediaFactory object
|
||||
* for the given url. the default implementation will use the mappings
|
||||
* added with gst_rtsp_media_mapping_add_factory().
|
||||
*
|
||||
* The class for the media mapping object.
|
||||
*/
|
||||
struct _GstRTSPMediaMappingClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
GstRTSPMediaFactory * (*find_factory) (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url);
|
||||
};
|
||||
|
||||
GType gst_rtsp_media_mapping_get_type (void);
|
||||
|
||||
/* creating a mapping */
|
||||
GstRTSPMediaMapping * gst_rtsp_media_mapping_new (void);
|
||||
|
||||
/* finding a media factory */
|
||||
GstRTSPMediaFactory * gst_rtsp_media_mapping_find_factory (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url);
|
||||
|
||||
/* managing media to a path */
|
||||
void gst_rtsp_media_mapping_add_factory (GstRTSPMediaMapping *mapping, const gchar *path,
|
||||
GstRTSPMediaFactory *factory);
|
||||
void gst_rtsp_media_mapping_remove_factory (GstRTSPMediaMapping *mapping, const gchar *path);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RTSP_MEDIA_MAPPING_H__ */
|
176
gst/rtsp-server/rtsp-mount-points.c
Normal file
176
gst/rtsp-server/rtsp-mount-points.c
Normal file
|
@ -0,0 +1,176 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "rtsp-mount-points.h"
|
||||
|
||||
G_DEFINE_TYPE (GstRTSPMountPoints, gst_rtsp_mount_points, G_TYPE_OBJECT);
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (rtsp_media_debug);
|
||||
#define GST_CAT_DEFAULT rtsp_media_debug
|
||||
|
||||
static void gst_rtsp_mount_points_finalize (GObject * obj);
|
||||
|
||||
static GstRTSPMediaFactory *find_factory (GstRTSPMountPoints * mounts,
|
||||
const GstRTSPUrl * url);
|
||||
|
||||
static void
|
||||
gst_rtsp_mount_points_class_init (GstRTSPMountPointsClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gst_rtsp_mount_points_finalize;
|
||||
|
||||
klass->find_factory = find_factory;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (rtsp_media_debug, "rtspmountpoints", 0,
|
||||
"GstRTSPMountPoints");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtsp_mount_points_init (GstRTSPMountPoints * mounts)
|
||||
{
|
||||
GST_DEBUG_OBJECT (mounts, "created");
|
||||
|
||||
g_mutex_init (&mounts->lock);
|
||||
mounts->mounts = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtsp_mount_points_finalize (GObject * obj)
|
||||
{
|
||||
GstRTSPMountPoints *mounts = GST_RTSP_MOUNT_POINTS (obj);
|
||||
|
||||
GST_DEBUG_OBJECT (mounts, "finalized");
|
||||
|
||||
g_hash_table_unref (mounts->mounts);
|
||||
g_mutex_clear (&mounts->lock);
|
||||
|
||||
G_OBJECT_CLASS (gst_rtsp_mount_points_parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_mount_points_new:
|
||||
*
|
||||
* Make a new mount points object.
|
||||
*
|
||||
* Returns: a new #GstRTSPMountPoints
|
||||
*/
|
||||
GstRTSPMountPoints *
|
||||
gst_rtsp_mount_points_new (void)
|
||||
{
|
||||
GstRTSPMountPoints *result;
|
||||
|
||||
result = g_object_new (GST_TYPE_RTSP_MOUNT_POINTS, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static GstRTSPMediaFactory *
|
||||
find_factory (GstRTSPMountPoints * mounts, const GstRTSPUrl * url)
|
||||
{
|
||||
GstRTSPMediaFactory *result;
|
||||
|
||||
g_mutex_lock (&mounts->lock);
|
||||
/* find the location of the media in the hashtable we only use the absolute
|
||||
* path of the uri to find a media factory. If the factory depends on other
|
||||
* properties found in the url, this method should be overridden. */
|
||||
result = g_hash_table_lookup (mounts->mounts, url->abspath);
|
||||
if (result)
|
||||
g_object_ref (result);
|
||||
g_mutex_unlock (&mounts->lock);
|
||||
|
||||
GST_INFO ("found media factory %p for url abspath %s", result, url->abspath);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_mount_points_find_factory:
|
||||
* @mounts: a #GstRTSPMountPoints
|
||||
* @url: a url
|
||||
*
|
||||
* Find the #GstRTSPMediaFactory for @url. The default implementation of this object
|
||||
* will use the media factory added with gst_rtsp_mount_points_add_factory ().
|
||||
*
|
||||
* Returns: (transfer full): the #GstRTSPMediaFactory for @url. g_object_unref() after usage.
|
||||
*/
|
||||
GstRTSPMediaFactory *
|
||||
gst_rtsp_mount_points_find_factory (GstRTSPMountPoints * mounts,
|
||||
const GstRTSPUrl * url)
|
||||
{
|
||||
GstRTSPMediaFactory *result;
|
||||
GstRTSPMountPointsClass *klass;
|
||||
|
||||
klass = GST_RTSP_MOUNT_POINTS_GET_CLASS (mounts);
|
||||
|
||||
if (klass->find_factory)
|
||||
result = klass->find_factory (mounts, url);
|
||||
else
|
||||
result = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_mount_points_add_factory:
|
||||
* @mounts: a #GstRTSPMountPoints
|
||||
* @path: a mount point
|
||||
* @factory: (transfer full): a #GstRTSPMediaFactory
|
||||
*
|
||||
* Attach @factory to the mount point @path in @mounts.
|
||||
*
|
||||
* @path is of the form (/node)+. Any previous mount point will be freed.
|
||||
*
|
||||
* Ownership is taken of the reference on @factory so that @factory should not be
|
||||
* used after calling this function.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_mount_points_add_factory (GstRTSPMountPoints * mounts,
|
||||
const gchar * path, GstRTSPMediaFactory * factory)
|
||||
{
|
||||
g_return_if_fail (GST_IS_RTSP_MOUNT_POINTS (mounts));
|
||||
g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
g_mutex_lock (&mounts->lock);
|
||||
g_hash_table_insert (mounts->mounts, g_strdup (path), factory);
|
||||
g_mutex_unlock (&mounts->lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_mount_points_remove_factory:
|
||||
* @mounts: a #GstRTSPMountPoints
|
||||
* @path: a mount point
|
||||
*
|
||||
* Remove the #GstRTSPMediaFactory associated with @path in @mounts.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_mount_points_remove_factory (GstRTSPMountPoints * mounts,
|
||||
const gchar * path)
|
||||
{
|
||||
g_return_if_fail (GST_IS_RTSP_MOUNT_POINTS (mounts));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
g_mutex_lock (&mounts->lock);
|
||||
g_hash_table_remove (mounts->mounts, path);
|
||||
g_mutex_unlock (&mounts->lock);
|
||||
}
|
87
gst/rtsp-server/rtsp-mount-points.h
Normal file
87
gst/rtsp-server/rtsp-mount-points.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <gst/rtsp/gstrtspurl.h>
|
||||
|
||||
#include "rtsp-media-factory.h"
|
||||
|
||||
#ifndef __GST_RTSP_MOUNT_POINTS_H__
|
||||
#define __GST_RTSP_MOUNT_POINTS_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_RTSP_MOUNT_POINTS (gst_rtsp_mount_points_get_type ())
|
||||
#define GST_IS_RTSP_MOUNT_POINTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MOUNT_POINTS))
|
||||
#define GST_IS_RTSP_MOUNT_POINTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MOUNT_POINTS))
|
||||
#define GST_RTSP_MOUNT_POINTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MOUNT_POINTS, GstRTSPMountPointsClass))
|
||||
#define GST_RTSP_MOUNT_POINTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MOUNT_POINTS, GstRTSPMountPoints))
|
||||
#define GST_RTSP_MOUNT_POINTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MOUNT_POINTS, GstRTSPMountPointsClass))
|
||||
#define GST_RTSP_MOUNT_POINTS_CAST(obj) ((GstRTSPMountPoints*)(obj))
|
||||
#define GST_RTSP_MOUNT_POINTS_CLASS_CAST(klass) ((GstRTSPMountPointsClass*)(klass))
|
||||
|
||||
typedef struct _GstRTSPMountPoints GstRTSPMountPoints;
|
||||
typedef struct _GstRTSPMountPointsClass GstRTSPMountPointsClass;
|
||||
|
||||
/**
|
||||
* GstRTSPMountPoints:
|
||||
* @parent: parent GObject
|
||||
* @mounts: the mountpoints to mediafactory mapping
|
||||
*
|
||||
* Creates a #GstRTSPMediaFactory object for a given url.
|
||||
*/
|
||||
struct _GstRTSPMountPoints {
|
||||
GObject parent;
|
||||
|
||||
GMutex lock;
|
||||
GHashTable *mounts;
|
||||
};
|
||||
|
||||
/**
|
||||
* GstRTSPMountPointsClass:
|
||||
* @parent_class: parent GObject class
|
||||
* @find_factory: Create or return a previously cached #GstRTSPMediaFactory object
|
||||
* for the given url. the default implementation will use the factory
|
||||
* added with gst_rtsp_mount_points_add_factory().
|
||||
*
|
||||
* The class for the media mounts object.
|
||||
*/
|
||||
struct _GstRTSPMountPointsClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
GstRTSPMediaFactory * (*find_factory) (GstRTSPMountPoints *mounts, const GstRTSPUrl *url);
|
||||
};
|
||||
|
||||
GType gst_rtsp_mount_points_get_type (void);
|
||||
|
||||
/* creating a mount points */
|
||||
GstRTSPMountPoints * gst_rtsp_mount_points_new (void);
|
||||
|
||||
/* finding a media factory */
|
||||
GstRTSPMediaFactory * gst_rtsp_mount_points_find_factory (GstRTSPMountPoints *mounts, const GstRTSPUrl *url);
|
||||
|
||||
/* managing media to a mount point */
|
||||
void gst_rtsp_mount_points_add_factory (GstRTSPMountPoints *mounts, const gchar *path,
|
||||
GstRTSPMediaFactory *factory);
|
||||
void gst_rtsp_mount_points_remove_factory (GstRTSPMountPoints *mounts, const gchar *path);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RTSP_MOUNT_POINTS_H__ */
|
|
@ -44,7 +44,7 @@ enum
|
|||
PROP_BACKLOG,
|
||||
|
||||
PROP_SESSION_POOL,
|
||||
PROP_MEDIA_MAPPING,
|
||||
PROP_MOUNT_POINTS,
|
||||
PROP_MAX_THREADS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
@ -145,15 +145,15 @@ gst_rtsp_server_class_init (GstRTSPServerClass * klass)
|
|||
GST_TYPE_RTSP_SESSION_POOL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GstRTSPServer::media-mapping:
|
||||
* GstRTSPServer::mount-points:
|
||||
*
|
||||
* The media mapping to use for this server. By default the server has no
|
||||
* media mapping and thus cannot map urls to media streams.
|
||||
* The mount points to use for this server. By default the server has no
|
||||
* mount points and thus cannot map urls to media streams.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_MEDIA_MAPPING,
|
||||
g_param_spec_object ("media-mapping", "Media Mapping",
|
||||
"The media mapping to use for client session",
|
||||
GST_TYPE_RTSP_MEDIA_MAPPING,
|
||||
g_object_class_install_property (gobject_class, PROP_MOUNT_POINTS,
|
||||
g_param_spec_object ("mount-points", "Mount Points",
|
||||
"The mount points to use for client session",
|
||||
GST_TYPE_RTSP_MOUNT_POINTS,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GstRTSPServer::max-threads:
|
||||
|
@ -191,7 +191,7 @@ gst_rtsp_server_init (GstRTSPServer * server)
|
|||
server->socket = NULL;
|
||||
server->backlog = DEFAULT_BACKLOG;
|
||||
server->session_pool = gst_rtsp_session_pool_new ();
|
||||
server->media_mapping = gst_rtsp_media_mapping_new ();
|
||||
server->mount_points = gst_rtsp_mount_points_new ();
|
||||
server->max_threads = DEFAULT_MAX_THREADS;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ gst_rtsp_server_finalize (GObject * object)
|
|||
g_object_unref (server->socket);
|
||||
|
||||
g_object_unref (server->session_pool);
|
||||
g_object_unref (server->media_mapping);
|
||||
g_object_unref (server->mount_points);
|
||||
|
||||
if (server->auth)
|
||||
g_object_unref (server->auth);
|
||||
|
@ -445,26 +445,26 @@ gst_rtsp_server_get_session_pool (GstRTSPServer * server)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_server_set_media_mapping:
|
||||
* gst_rtsp_server_set_mount_points:
|
||||
* @server: a #GstRTSPServer
|
||||
* @mapping: a #GstRTSPMediaMapping
|
||||
* @mounts: a #GstRTSPMountPoints
|
||||
*
|
||||
* configure @mapping to be used as the media mapping of @server.
|
||||
* configure @mounts to be used as the mount points of @server.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_server_set_media_mapping (GstRTSPServer * server,
|
||||
GstRTSPMediaMapping * mapping)
|
||||
gst_rtsp_server_set_mount_points (GstRTSPServer * server,
|
||||
GstRTSPMountPoints * mounts)
|
||||
{
|
||||
GstRTSPMediaMapping *old;
|
||||
GstRTSPMountPoints *old;
|
||||
|
||||
g_return_if_fail (GST_IS_RTSP_SERVER (server));
|
||||
|
||||
if (mapping)
|
||||
g_object_ref (mapping);
|
||||
if (mounts)
|
||||
g_object_ref (mounts);
|
||||
|
||||
GST_RTSP_SERVER_LOCK (server);
|
||||
old = server->media_mapping;
|
||||
server->media_mapping = mapping;
|
||||
old = server->mount_points;
|
||||
server->mount_points = mounts;
|
||||
GST_RTSP_SERVER_UNLOCK (server);
|
||||
|
||||
if (old)
|
||||
|
@ -473,23 +473,23 @@ gst_rtsp_server_set_media_mapping (GstRTSPServer * server,
|
|||
|
||||
|
||||
/**
|
||||
* gst_rtsp_server_get_media_mapping:
|
||||
* gst_rtsp_server_get_mount_points:
|
||||
* @server: a #GstRTSPServer
|
||||
*
|
||||
* Get the #GstRTSPMediaMapping used as the media mapping of @server.
|
||||
* Get the #GstRTSPMountPoints used as the mount points of @server.
|
||||
*
|
||||
* Returns: (transfer full): the #GstRTSPMediaMapping of @server. g_object_unref() after
|
||||
* Returns: (transfer full): the #GstRTSPMountPoints of @server. g_object_unref() after
|
||||
* usage.
|
||||
*/
|
||||
GstRTSPMediaMapping *
|
||||
gst_rtsp_server_get_media_mapping (GstRTSPServer * server)
|
||||
GstRTSPMountPoints *
|
||||
gst_rtsp_server_get_mount_points (GstRTSPServer * server)
|
||||
{
|
||||
GstRTSPMediaMapping *result;
|
||||
GstRTSPMountPoints *result;
|
||||
|
||||
g_return_val_if_fail (GST_IS_RTSP_SERVER (server), NULL);
|
||||
|
||||
GST_RTSP_SERVER_LOCK (server);
|
||||
if ((result = server->media_mapping))
|
||||
if ((result = server->mount_points))
|
||||
g_object_ref (result);
|
||||
GST_RTSP_SERVER_UNLOCK (server);
|
||||
|
||||
|
@ -612,8 +612,8 @@ gst_rtsp_server_get_property (GObject * object, guint propid,
|
|||
case PROP_SESSION_POOL:
|
||||
g_value_take_object (value, gst_rtsp_server_get_session_pool (server));
|
||||
break;
|
||||
case PROP_MEDIA_MAPPING:
|
||||
g_value_take_object (value, gst_rtsp_server_get_media_mapping (server));
|
||||
case PROP_MOUNT_POINTS:
|
||||
g_value_take_object (value, gst_rtsp_server_get_mount_points (server));
|
||||
break;
|
||||
case PROP_MAX_THREADS:
|
||||
g_value_set_int (value, gst_rtsp_server_get_max_threads (server));
|
||||
|
@ -642,8 +642,8 @@ gst_rtsp_server_set_property (GObject * object, guint propid,
|
|||
case PROP_SESSION_POOL:
|
||||
gst_rtsp_server_set_session_pool (server, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_MEDIA_MAPPING:
|
||||
gst_rtsp_server_set_media_mapping (server, g_value_get_object (value));
|
||||
case PROP_MOUNT_POINTS:
|
||||
gst_rtsp_server_set_mount_points (server, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_MAX_THREADS:
|
||||
gst_rtsp_server_set_max_threads (server, g_value_get_int (value));
|
||||
|
@ -922,8 +922,8 @@ default_create_client (GstRTSPServer * server)
|
|||
/* set the session pool that this client should use */
|
||||
GST_RTSP_SERVER_LOCK (server);
|
||||
gst_rtsp_client_set_session_pool (client, server->session_pool);
|
||||
/* set the media mapping that this client should use */
|
||||
gst_rtsp_client_set_media_mapping (client, server->media_mapping);
|
||||
/* set the mount points that this client should use */
|
||||
gst_rtsp_client_set_mount_points (client, server->mount_points);
|
||||
/* set authentication manager */
|
||||
gst_rtsp_client_set_auth (client, server->auth);
|
||||
GST_RTSP_SERVER_UNLOCK (server);
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef struct _GstRTSPServer GstRTSPServer;
|
|||
typedef struct _GstRTSPServerClass GstRTSPServerClass;
|
||||
|
||||
#include "rtsp-session-pool.h"
|
||||
#include "rtsp-media-mapping.h"
|
||||
#include "rtsp-mount-points.h"
|
||||
#include "rtsp-media-factory-uri.h"
|
||||
#include "rtsp-client.h"
|
||||
#include "rtsp-auth.h"
|
||||
|
@ -68,8 +68,8 @@ struct _GstRTSPServer {
|
|||
/* sessions on this server */
|
||||
GstRTSPSessionPool *session_pool;
|
||||
|
||||
/* media mapper for this server */
|
||||
GstRTSPMediaMapping *media_mapping;
|
||||
/* mount points for this server */
|
||||
GstRTSPMountPoints *mount_points;
|
||||
|
||||
/* authentication manager */
|
||||
GstRTSPAuth *auth;
|
||||
|
@ -117,8 +117,8 @@ gint gst_rtsp_server_get_backlog (GstRTSPServer *serve
|
|||
void gst_rtsp_server_set_session_pool (GstRTSPServer *server, GstRTSPSessionPool *pool);
|
||||
GstRTSPSessionPool * gst_rtsp_server_get_session_pool (GstRTSPServer *server);
|
||||
|
||||
void gst_rtsp_server_set_media_mapping (GstRTSPServer *server, GstRTSPMediaMapping *mapping);
|
||||
GstRTSPMediaMapping * gst_rtsp_server_get_media_mapping (GstRTSPServer *server);
|
||||
void gst_rtsp_server_set_mount_points (GstRTSPServer *server, GstRTSPMountPoints *mounts);
|
||||
GstRTSPMountPoints * gst_rtsp_server_get_mount_points (GstRTSPServer *server);
|
||||
|
||||
void gst_rtsp_server_set_auth (GstRTSPServer *server, GstRTSPAuth *auth);
|
||||
GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *server);
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
|
||||
#include "rtsp-session.h"
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#define DEFAULT_TIMEOUT 60
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#include "rtsp-session-pool.h"
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#define DEFAULT_MAX_SESSIONS 0
|
||||
|
||||
enum
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef enum
|
|||
*
|
||||
* Returns: a #GstRTSPFilterResult.
|
||||
*/
|
||||
typedef GstRTSPFilterResult (*GstRTSPSessionFilterFunc) (GstRTSPSessionPool *pool,
|
||||
typedef GstRTSPFilterResult (*GstRTSPSessionFilterFunc) (GstRTSPSessionPool *pool,
|
||||
GstRTSPSession *session,
|
||||
gpointer user_data);
|
||||
|
||||
|
|
|
@ -136,19 +136,19 @@ get_client_ports (GstRTSPRange * range)
|
|||
static void
|
||||
start_server ()
|
||||
{
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMountPoints *mounts;
|
||||
gchar *service;
|
||||
GstRTSPMediaFactory *factory;
|
||||
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
mounts = gst_rtsp_server_get_mount_points (server);
|
||||
|
||||
factory = gst_rtsp_media_factory_new ();
|
||||
|
||||
gst_rtsp_media_factory_set_launch (factory,
|
||||
"( " VIDEO_PIPELINE " " AUDIO_PIPELINE " )");
|
||||
|
||||
gst_rtsp_media_mapping_add_factory (mapping, TEST_MOUNT_POINT, factory);
|
||||
g_object_unref (mapping);
|
||||
gst_rtsp_mount_points_add_factory (mounts, TEST_MOUNT_POINT, factory);
|
||||
g_object_unref (mounts);
|
||||
|
||||
/* set port */
|
||||
test_port = get_unused_port (SOCK_STREAM);
|
||||
|
@ -700,7 +700,9 @@ GST_START_TEST (test_bind_already_in_use)
|
|||
service = g_socket_service_new ();
|
||||
|
||||
/* bind service to port */
|
||||
port = g_socket_listener_add_any_inet_port (G_SOCKET_LISTENER (service), NULL, &error);
|
||||
port =
|
||||
g_socket_listener_add_any_inet_port (G_SOCKET_LISTENER (service), NULL,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
port_str = g_strdup_printf ("%d\n", port);
|
||||
|
|
Loading…
Reference in a new issue