Allow setting a custom media factory for a server
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-media-factory.c
1 /* GStreamer
2  * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "rtsp-media-factory.h"
21
22 G_DEFINE_TYPE (GstRTSPMediaFactory, gst_rtsp_media_factory, G_TYPE_OBJECT);
23
24 static void gst_rtsp_media_factory_finalize (GObject * obj);
25
26 static GstRTSPMedia * create_media (GstRTSPMediaFactory *factory, const gchar *url);
27
28 static void
29 gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
30 {
31   GObjectClass *gobject_class;
32
33   gobject_class = G_OBJECT_CLASS (klass);
34
35   gobject_class->finalize = gst_rtsp_media_factory_finalize;
36
37   klass->create_media = create_media;
38 }
39
40 static void
41 gst_rtsp_media_factory_init (GstRTSPMediaFactory * factory)
42 {
43 }
44
45 static void
46 gst_rtsp_media_factory_finalize (GObject * obj)
47 {
48   G_OBJECT_CLASS (gst_rtsp_media_factory_parent_class)->finalize (obj);
49 }
50
51 GstRTSPMediaFactory *
52 gst_rtsp_media_factory_new (void)
53 {
54   GstRTSPMediaFactory *result;
55
56   result = g_object_new (GST_TYPE_RTSP_MEDIA_FACTORY, NULL);
57
58   return result;
59 }
60
61 static GstRTSPMedia *
62 create_media (GstRTSPMediaFactory *factory, const gchar *url)
63 {
64   GstRTSPMedia *result;
65
66   result = gst_rtsp_media_new (url);
67
68   return result;
69 }
70
71 GstRTSPMedia *
72 gst_rtsp_media_factory_create (GstRTSPMediaFactory *factory, const gchar *url)
73 {
74   GstRTSPMedia *result = NULL;
75   GstRTSPMediaFactoryClass *klass;
76
77   klass = GST_RTSP_MEDIA_FACTORY_GET_CLASS (factory);
78
79   if (klass->create_media)
80     result = klass->create_media (factory, url);
81
82   return result;
83 }
84
85 void
86 gst_rtsp_media_factory_add (GstRTSPMediaFactory *factory, const gchar *path,
87     GType type)
88 {
89   g_warning ("gst_rtsp_media_factory_add: not implemented");
90 }
91 void
92 gst_rtsp_media_factory_remove (GstRTSPMediaFactory *factory, const gchar *path,
93     GType type)
94 {
95   g_warning ("gst_rtsp_media_factory_remove: not implemented");
96 }
97