Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / rtp / gstbasertppayload.h
1 /* GStreamer
2  * Copyright (C) <2005> Wim Taymans <wim@fluendo.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 #ifndef __GST_BASE_RTP_PAYLOAD_H__
21 #define __GST_BASE_RTP_PAYLOAD_H__
22
23 #include <gst/gst.h>
24
25 G_BEGIN_DECLS
26
27 #define GST_TYPE_BASE_RTP_PAYLOAD \
28         (gst_basertppayload_get_type())
29 #define GST_BASE_RTP_PAYLOAD(obj) \
30         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_PAYLOAD,GstBaseRTPPayload))
31 #define GST_BASE_RTP_PAYLOAD_CLASS(klass) \
32         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_PAYLOAD,GstBaseRTPPayloadClass))
33 #define GST_BASE_RTP_PAYLOAD_GET_CLASS(obj) \
34         (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_RTP_PAYLOAD, GstBaseRTPPayloadClass))
35 #define GST_IS_BASE_RTP_PAYLOAD(obj) \
36         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_PAYLOAD))
37 #define GST_IS_BASE_RTP_PAYLOAD_CLASS(klass) \
38         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_PAYLOAD))
39 #define GST_BASE_RTP_PAYLOAD_CAST(obj) \
40         ((GstBaseRTPPayload*)(obj))
41
42 typedef struct _GstBaseRTPPayload GstBaseRTPPayload;
43 typedef struct _GstBaseRTPPayloadPrivate GstBaseRTPPayloadPrivate;
44 typedef struct _GstBaseRTPPayloadClass GstBaseRTPPayloadClass;
45
46 /**
47  * GST_BASE_RTP_PAYLOAD_SINKPAD:
48  * @payload: a #GstBaseRTPPayload
49  *
50  * Get access to the sinkpad of @payload.
51  */
52 #define GST_BASE_RTP_PAYLOAD_SINKPAD(payload) (GST_BASE_RTP_PAYLOAD (payload)->sinkpad)
53 /**
54  * GST_BASE_RTP_PAYLOAD_SRCPAD:
55  * @payload: a #GstBaseRTPPayload
56  *
57  * Get access to the srcpad of @payload.
58  */
59 #define GST_BASE_RTP_PAYLOAD_SRCPAD(payload)  (GST_BASE_RTP_PAYLOAD (payload)->srcpad)
60
61 /**
62  * GST_BASE_RTP_PAYLOAD_PT:
63  * @payload: a #GstBaseRTPPayload
64  *
65  * Get access to the configured payload type of @payload.
66  */
67 #define GST_BASE_RTP_PAYLOAD_PT(payload)  (GST_BASE_RTP_PAYLOAD (payload)->pt)
68 /**
69  * GST_BASE_RTP_PAYLOAD_MTU:
70  * @payload: a #GstBaseRTPPayload
71  *
72  * Get access to the configured MTU of @payload.
73  */
74 #define GST_BASE_RTP_PAYLOAD_MTU(payload) (GST_BASE_RTP_PAYLOAD (payload)->mtu)
75
76 struct _GstBaseRTPPayload
77 {
78   GstElement element;
79
80   /*< private >*/
81   GstPad  *sinkpad;
82   GstPad  *srcpad;
83
84   /* FIXME 0.11: none of these GRands are used anymore, remove them */
85   GRand   *seq_rand;
86   GRand   *ssrc_rand;
87   GRand   *ts_rand;
88
89   guint32  ts_base;
90   guint16  seqnum_base;
91
92   gchar   *media;
93   gchar   *encoding_name;
94   gboolean dynamic;
95   guint32  clock_rate;
96
97   gint32   ts_offset;
98   guint32  timestamp;
99   gint16   seqnum_offset;
100   guint16  seqnum;
101   gint64   max_ptime;
102   guint    pt;
103   guint    ssrc;
104   guint    current_ssrc;
105   guint    mtu;
106
107   GstSegment segment;
108
109   guint64  min_ptime;
110
111   /*< private >*/
112   GstBaseRTPPayloadPrivate *priv;
113
114   union  {
115     struct {
116       guint64 ptime; /* in ns */
117       guint64 ptime_multiple; /* in ns */
118     } ABI;
119     gpointer _gst_reserved[GST_PADDING - (sizeof(guint64)/sizeof(gpointer)) - 1];
120   } abidata;
121 };
122
123 struct _GstBaseRTPPayloadClass
124 {
125   GstElementClass parent_class;
126
127   /* receive caps on the sink pad, configure the payloader. */
128   gboolean      (*set_caps)             (GstBaseRTPPayload *payload, GstCaps *caps);
129   /* handle a buffer, perform 0 or more gst_basertppayload_push() on
130    * the RTP buffers. This function takes ownership of the buffer. */
131   GstFlowReturn (*handle_buffer)        (GstBaseRTPPayload *payload,
132                                          GstBuffer *buffer);
133   gboolean      (*handle_event)         (GstPad * pad, GstEvent * event);
134   GstCaps *     (*get_caps)             (GstBaseRTPPayload *payload, GstPad * pad);
135
136   /*< private >*/
137   gpointer _gst_reserved[GST_PADDING-2];
138 };
139
140 GType           gst_basertppayload_get_type             (void);
141
142 void            gst_basertppayload_set_options          (GstBaseRTPPayload *payload,
143                                                          const gchar *media,
144                                                          gboolean dynamic,
145                                                          const gchar *encoding_name,
146                                                          guint32 clock_rate);
147
148 gboolean        gst_basertppayload_set_outcaps          (GstBaseRTPPayload *payload,
149                                                          const gchar *fieldname, ...);
150
151 gboolean        gst_basertppayload_is_filled            (GstBaseRTPPayload *payload,
152                                                          guint size, GstClockTime duration);
153
154 GstFlowReturn   gst_basertppayload_push                 (GstBaseRTPPayload *payload,
155                                                          GstBuffer *buffer);
156
157 GstFlowReturn   gst_basertppayload_push_list            (GstBaseRTPPayload *payload,
158                                                          GstBufferList *list);
159
160 G_END_DECLS
161
162 #endif /* __GST_BASE_RTP_PAYLOAD_H__ */