Add AL-FEC feature
[platform/upstream/gst-rtsp-server.git] / gst / rtsp-server / rtsp-media-ext.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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #include <gst/gst.h>
21 #include <gst/rtsp/gstrtsprange.h>
22 #include <gst/rtsp/gstrtspurl.h>
23 #include <gst/net/gstnet.h>
24
25 #ifndef __GST_RTSP_MEDIA_EXT_H__
26 #define __GST_RTSP_MEDIA_EXT_H__
27
28 G_BEGIN_DECLS
29
30 /* types for the media */
31 #define GST_TYPE_RTSP_MEDIA_EXT              (gst_rtsp_media_ext_get_type ())
32 #define GST_IS_RTSP_MEDIA_EXT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA_EXT))
33 #define GST_IS_RTSP_MEDIA_EXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA_EXT))
34 #define GST_RTSP_MEDIA_EXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA_EXT, GstRTSPMediaExtClass))
35 #define GST_RTSP_MEDIA_EXT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA_EXT, GstRTSPMediaExt))
36 #define GST_RTSP_MEDIA_EXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA_EXT, GstRTSPMediaExtClass))
37 #define GST_RTSP_MEDIA_EXT_CAST(obj)         ((GstRTSPMediaExt*)(obj))
38 #define GST_RTSP_MEDIA_EXT_CLASS_CAST(klass) ((GstRTSPMediaExtClass*)(klass))
39
40 typedef struct _GstRTSPMediaExt GstRTSPMediaExt;
41 typedef struct _GstRTSPMediaExtClass GstRTSPMediaExtClass;
42 typedef struct _GstRTSPMediaExtPrivate GstRTSPMediaExtPrivate;
43
44 #include "rtsp-stream.h"
45
46 typedef enum {
47   MEDIA_EXT_MODE_NONE = (0 << 0),
48   MEDIA_EXT_MODE_RESEND = (1 << 0),
49   MEDIA_EXT_MODE_FEC    = (1 << 1)
50 } GstRTSPMediaExtMode;
51
52 typedef enum {
53   MEDIA_EXT_LATENCY_NONE,
54   MEDIA_EXT_LATENCY_LOW,
55   MEDIA_EXT_LATENCY_MID,
56   MEDIA_EXT_LATENCY_HIGH
57 } GstRTSPMediaExtLatency;
58
59 /**
60  * GstRTSPMedia:
61  *
62  * A class that contains the GStreamer element along with a list of
63  * #GstRTSPStream objects that can produce data.
64  *
65  * This object is usually created from a #GstRTSPMediaFactory.
66  */
67 struct _GstRTSPMediaExt {
68   GstRTSPMedia            parent;
69
70   /*< private >*/
71   GstRTSPMediaExtPrivate *priv;
72   gpointer _gst_reserved[GST_PADDING];
73 };
74
75 /**
76  * GstRTSPMediaClass:
77  * @handle_message: handle a message
78  * @prepare: the default implementation adds all elements and sets the
79  *           pipeline's state to GST_STATE_PAUSED (or GST_STATE_PLAYING
80  *           in case of NO_PREROLL elements).
81  * @unprepare: the default implementation sets the pipeline's state
82  *             to GST_STATE_NULL and removes all elements.
83  * @suspend: the default implementation sets the pipeline's state to
84  *           GST_STATE_NULL GST_STATE_PAUSED depending on the selected
85  *           suspend mode.
86  * @unsuspend: the default implementation reverts the suspend operation.
87  *             The pipeline will be prerolled again if it's state was
88  *             set to GST_STATE_NULL in suspend.
89  * @convert_range: convert a range to the given unit
90  * @query_position: query the current position in the pipeline
91  * @query_stop: query when playback will stop
92  *
93  * The RTSP media class
94  */
95 struct _GstRTSPMediaExtClass {
96   GstRTSPMediaClass  parent_class;
97
98   /*< private >*/
99   gpointer         _gst_reserved[GST_PADDING_LARGE];
100 };
101
102 GType                 gst_rtsp_media_ext_get_type         (void);
103
104 /* creating the media */
105 GstRTSPMediaExt *  gst_rtsp_media_ext_new                (GstElement *element);
106 guint              gst_rtsp_media_ext_get_resent_packets (GstRTSPMediaExt *media);
107 void               gst_rtsp_media_ext_set_extended_mode  (GstRTSPMediaExt *media, GstRTSPMediaExtMode mode);
108 void               gst_rtsp_media_ext_set_retrans_port   (GstRTSPMediaExt *media, guint port);
109 void               gst_rtsp_media_ext_set_fec_value      (GstRTSPMediaExt *media, guint max_k, guint max_p);
110 void               gst_rtsp_media_ext_set_latency_mode   (GstRTSPMediaExt *media, GstRTSPMediaExtLatency latency);
111 void               gst_rtsp_media_ext_set_next_param     (GstRTSPMediaExt *media, gint32 next_k, gint32 next_p);
112
113 G_END_DECLS
114
115 #endif /* __GST_RTSP_MEDIA_EXT_H__ */