Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / rtp / gstbasertpdepayload.h
1 /* GStreamer
2  * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org> 
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_DEPAYLOAD_H__
21 #define __GST_BASE_RTP_DEPAYLOAD_H__
22
23 #include <gst/gst.h>
24 #include <gst/rtp/gstrtpbuffer.h>
25
26 G_BEGIN_DECLS
27
28 #define GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type())
29 #define GST_BASE_RTP_DEPAYLOAD(obj) \
30   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload))
31 #define GST_BASE_RTP_DEPAYLOAD_CLASS(klass) \
32   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
33 #define GST_BASE_RTP_DEPAYLOAD_GET_CLASS(obj) \
34         (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
35 #define GST_IS_BASE_RTP_DEPAYLOAD(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD))
37 #define GST_IS_BASE_RTP_DEPAYLOAD_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD))
39
40 #define GST_BASE_RTP_DEPAYLOAD_SINKPAD(depayload) (GST_BASE_RTP_DEPAYLOAD (depayload)->sinkpad)
41 #define GST_BASE_RTP_DEPAYLOAD_SRCPAD(depayload)  (GST_BASE_RTP_DEPAYLOAD (depayload)->srcpad)
42
43 #ifndef GST_DISABLE_DEPRECATED
44 /* this was presumably never meant to be public API, or should at least
45  * have been prefixed if it was. Don't use. (FIXME: remove in 0.11) */
46 #define QUEUE_LOCK_INIT(base)   (g_static_rec_mutex_init(&base->queuelock))
47 #define QUEUE_LOCK_FREE(base)   (g_static_rec_mutex_free(&base->queuelock))
48 #define QUEUE_LOCK(base)        (g_static_rec_mutex_lock(&base->queuelock))
49 #define QUEUE_UNLOCK(base)      (g_static_rec_mutex_unlock(&base->queuelock))
50 #endif
51
52 typedef struct _GstBaseRTPDepayload      GstBaseRTPDepayload;
53 typedef struct _GstBaseRTPDepayloadClass GstBaseRTPDepayloadClass;
54 typedef struct _GstBaseRTPDepayloadPrivate GstBaseRTPDepayloadPrivate;
55
56 struct _GstBaseRTPDepayload
57 {
58   GstElement parent;
59
60   GstPad *sinkpad, *srcpad;
61
62 #ifndef GST_REMOVE_DEPRECATED
63   /* lock to protect the queue, deprecated */
64   GStaticRecMutex queuelock;
65
66   /* deprecated */
67   gboolean thread_running;
68   /* the releaser thread, deprecated */
69   GThread *thread;
70 #endif
71
72   /* this attribute must be set by the child */
73   guint clock_rate;
74
75 #ifndef GST_REMOVE_DEPRECATED
76   /* this value can be modified by the child if needed, deprecated */
77   guint queue_delay;
78 #endif
79
80   /* we will queue up to RTP_QUEUEDELAY ms of packets,
81    * reordering them if necessary
82    * dropping any packets that are more than
83    * RTP_QUEUEDELAY ms late, deprecated */
84   GQueue *queue;
85
86   GstSegment segment;
87   gboolean need_newsegment;
88
89   /*< private >*/
90   GstBaseRTPDepayloadPrivate *priv;
91
92   gpointer _gst_reserved[GST_PADDING-1];
93 };
94
95 struct _GstBaseRTPDepayloadClass
96 {
97   GstElementClass parent_class;
98
99   /* virtuals, inform the subclass of the caps. */
100   gboolean (*set_caps) (GstBaseRTPDepayload *filter, GstCaps *caps);
101
102   /* non-pure function, default implementation in base class
103    * this does buffering, reordering and dropping, deprecated */
104   GstFlowReturn (*add_to_queue) (GstBaseRTPDepayload *filter, GstBuffer *in);
105
106   /* pure virtual function, child must use this to process incoming
107    * rtp packets. If the child returns a buffer without a valid timestamp,
108    * the timestamp of @in will be applied to the result buffer and the
109    * buffer will be pushed. If this function returns %NULL, nothing is
110    * pushed.  */
111   GstBuffer * (*process) (GstBaseRTPDepayload *base, GstBuffer *in);
112
113   /* non-pure function used to convert from RTP timestamp to GST timestamp
114    * this function is used by the child class before gst_pad_pushing */
115   void (*set_gst_timestamp) (GstBaseRTPDepayload *filter, guint32 timestamp, GstBuffer *buf);
116
117   /* non-pure function used to to signal the depayloader about packet loss. the
118    * timestamp and duration are the estimated values of the lost packet.
119    * The default implementation of this message pushes a segment update. */
120   gboolean (*packet_lost) (GstBaseRTPDepayload *filter, GstEvent *event);
121
122   /* the default implementation does the default actions for events but
123    * implementation can override.
124    * Since: 0.10.32   */
125   gboolean (*handle_event) (GstBaseRTPDepayload * filter, GstEvent * event);
126
127   /*< private >*/
128   gpointer _gst_reserved[GST_PADDING-2];
129 };
130
131 GType gst_base_rtp_depayload_get_type (void);
132
133 GstFlowReturn   gst_base_rtp_depayload_push              (GstBaseRTPDepayload *filter, GstBuffer *out_buf);
134 GstFlowReturn   gst_base_rtp_depayload_push_ts           (GstBaseRTPDepayload *filter,
135                                                           guint32 timestamp, GstBuffer *out_buf);
136 GstFlowReturn   gst_base_rtp_depayload_push_list         (GstBaseRTPDepayload *filter, GstBufferList *out_list);
137
138
139 G_END_DECLS
140
141 #endif /* __GST_BASE_RTP_DEPAYLOAD_H__ */