Allow setting a custom media factory for a server
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-media.h
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 <gst/gst.h>
21 #include <gst/rtsp/gstrtspurl.h>
22
23 #ifndef __GST_RTSP_MEDIA_H__
24 #define __GST_RTSP_MEDIA_H__
25
26 G_BEGIN_DECLS
27
28 #define GST_TYPE_RTSP_MEDIA              (gst_rtsp_media_get_type ())
29 #define GST_IS_RTSP_MEDIA(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA))
30 #define GST_IS_RTSP_MEDIA_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA))
31 #define GST_RTSP_MEDIA_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
32 #define GST_RTSP_MEDIA(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA, GstRTSPMedia))
33 #define GST_RTSP_MEDIA_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA, GstRTSPMediaClass))
34 #define GST_RTSP_MEDIA_CAST(obj)         ((GstRTSPMedia*)(obj))
35 #define GST_RTSP_MEDIA_CLASS_CAST(klass) ((GstRTSPMediaClass*)(klass))
36
37 typedef struct _GstRTSPMedia GstRTSPMedia;
38 typedef struct _GstRTSPMediaStream GstRTSPMediaStream;
39 typedef struct _GstRTSPMediaClass GstRTSPMediaClass;
40
41 /**
42  * GstRTSPMediaStream:
43  *
44  * @idx: the stream index
45  * @element: the toplevel element
46  * @srcpad: the srcpad of the stream
47  * @payloader: the payloader of the formattt
48  * @caps_sig: the signal id for detecting caps
49  * @caps: the caps of the stream
50  *
51  * The definition of a media stream. The streams are identified by @id.
52  */
53 struct _GstRTSPMediaStream {
54   GstRTSPMedia *media;
55
56   guint       idx;
57
58   GstElement *element;
59   GstPad     *srcpad;
60   GstElement *payloader;
61   gulong      caps_sig;
62   GstCaps    *caps;
63 };
64
65 /**
66  * GstRTSPMedia:
67  *
68  * The definition and logic for constructing the pipeline for a media. The media
69  * can contain multiple streams like audio and video.
70  */
71 struct _GstRTSPMedia {
72   GObject       parent;
73
74   gchar        *location;
75   GstRTSPUrl   *url;
76
77   gboolean      prepared;
78   GArray       *streams;
79 };
80
81 struct _GstRTSPMediaClass {
82   GObjectClass  parent_class;
83 };
84
85 GType                gst_rtsp_media_get_type             (void);
86
87 GstRTSPMedia *       gst_rtsp_media_new                  (const gchar *name);
88
89 gboolean             gst_rtsp_media_prepare              (GstRTSPMedia *media, GstBin *bin);
90
91 guint                gst_rtsp_media_n_streams            (GstRTSPMedia *media);
92 GstRTSPMediaStream * gst_rtsp_media_get_stream           (GstRTSPMedia *media, guint idx);
93
94 G_END_DECLS
95
96 #endif /* __GST_RTSP_MEDIA_H__ */