2 * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
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.
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.
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.
20 #ifndef __GST_RTP_BASE_DEPAYLOAD_H__
21 #define __GST_RTP_BASE_DEPAYLOAD_H__
24 #include <gst/rtp/gstrtpbuffer.h>
28 #define GST_TYPE_RTP_BASE_DEPAYLOAD (gst_rtp_base_depayload_get_type())
29 #define GST_RTP_BASE_DEPAYLOAD(obj) \
30 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_BASE_DEPAYLOAD,GstRTPBaseDepayload))
31 #define GST_RTP_BASE_DEPAYLOAD_CLASS(klass) \
32 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_BASE_DEPAYLOAD,GstRTPBaseDepayloadClass))
33 #define GST_RTP_BASE_DEPAYLOAD_GET_CLASS(obj) \
34 (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_RTP_BASE_DEPAYLOAD,GstRTPBaseDepayloadClass))
35 #define GST_IS_RTP_BASE_DEPAYLOAD(obj) \
36 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_BASE_DEPAYLOAD))
37 #define GST_IS_RTP_BASE_DEPAYLOAD_CLASS(klass) \
38 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_BASE_DEPAYLOAD))
39 #define GST_RTP_BASE_DEPAYLOAD_CAST(obj) ((GstRTPBaseDepayload *)(obj))
41 #define GST_RTP_BASE_DEPAYLOAD_SINKPAD(depayload) (GST_RTP_BASE_DEPAYLOAD_CAST (depayload)->sinkpad)
42 #define GST_RTP_BASE_DEPAYLOAD_SRCPAD(depayload) (GST_RTP_BASE_DEPAYLOAD_CAST (depayload)->srcpad)
44 typedef struct _GstRTPBaseDepayload GstRTPBaseDepayload;
45 typedef struct _GstRTPBaseDepayloadClass GstRTPBaseDepayloadClass;
46 typedef struct _GstRTPBaseDepayloadPrivate GstRTPBaseDepayloadPrivate;
48 struct _GstRTPBaseDepayload
52 GstPad *sinkpad, *srcpad;
54 /* this attribute must be set by the child */
58 gboolean need_newsegment;
61 GstRTPBaseDepayloadPrivate *priv;
63 gpointer _gst_reserved[GST_PADDING];
67 * GstRTPBaseDepayloadClass:
68 * @parent_class: the parent class
69 * @set_caps: configure the depayloader
70 * @process: process incoming rtp packets
71 * @packet_lost: signal the depayloader about packet loss
72 * @handle_event: custom event handling
74 * Base class for RTP depayloaders.
76 struct _GstRTPBaseDepayloadClass
78 GstElementClass parent_class;
80 /* virtuals, inform the subclass of the caps. */
81 gboolean (*set_caps) (GstRTPBaseDepayload *filter, GstCaps *caps);
83 /* pure virtual function, child must implement either this method
84 * or the process_rtp_packet virtual method to process incoming
85 * rtp packets. If the child returns a buffer without a valid timestamp,
86 * the timestamp of @in will be applied to the result buffer and the
87 * buffer will be pushed. If this function returns %NULL, nothing is
89 GstBuffer * (*process) (GstRTPBaseDepayload *base, GstBuffer *in);
91 /* non-pure function used to to signal the depayloader about packet loss. the
92 * timestamp and duration are the estimated values of the lost packet.
93 * The default implementation of this message pushes a segment update. */
94 gboolean (*packet_lost) (GstRTPBaseDepayload *filter, GstEvent *event);
96 /* the default implementation does the default actions for events but
97 * implementation can override. */
98 gboolean (*handle_event) (GstRTPBaseDepayload * filter, GstEvent * event);
100 /* Optional. Same as the process virtual function, but slightly more
101 * efficient, since it is passed the rtp buffer structure that has already
102 * been mapped (with GST_MAP_READ) by the base class and thus does not have
103 * to be mapped again by the subclass. Can be used by the subclass to process
104 * incoming rtp packets. If the subclass returns a buffer without a valid
105 * timestamp, the timestamp of the input buffer will be applied to the result
106 * buffer and the output buffer will be pushed out. If this function returns
107 * %NULL, nothing is pushed out.
111 GstBuffer * (*process_rtp_packet) (GstRTPBaseDepayload *base, GstRTPBuffer * rtp_buffer);
114 gpointer _gst_reserved[GST_PADDING - 1];
118 GType gst_rtp_base_depayload_get_type (void);
121 GstFlowReturn gst_rtp_base_depayload_push (GstRTPBaseDepayload *filter, GstBuffer *out_buf);
124 GstFlowReturn gst_rtp_base_depayload_push_list (GstRTPBaseDepayload *filter, GstBufferList *out_list);
127 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
128 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPBaseDepayload, gst_object_unref)
133 #endif /* __GST_RTP_BASE_DEPAYLOAD_H__ */