2 * Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
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_PAYLOAD_H__
21 #define __GST_RTP_BASE_PAYLOAD_H__
27 #define GST_TYPE_RTP_BASE_PAYLOAD \
28 (gst_rtp_base_payload_get_type())
29 #define GST_RTP_BASE_PAYLOAD(obj) \
30 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_BASE_PAYLOAD,GstRTPBasePayload))
31 #define GST_RTP_BASE_PAYLOAD_CLASS(klass) \
32 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_BASE_PAYLOAD,GstRTPBasePayloadClass))
33 #define GST_RTP_BASE_PAYLOAD_GET_CLASS(obj) \
34 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_BASE_PAYLOAD, GstRTPBasePayloadClass))
35 #define GST_IS_RTP_BASE_PAYLOAD(obj) \
36 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_BASE_PAYLOAD))
37 #define GST_IS_RTP_BASE_PAYLOAD_CLASS(klass) \
38 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_BASE_PAYLOAD))
39 #define GST_RTP_BASE_PAYLOAD_CAST(obj) \
40 ((GstRTPBasePayload*)(obj))
42 typedef struct _GstRTPBasePayload GstRTPBasePayload;
43 typedef struct _GstRTPBasePayloadPrivate GstRTPBasePayloadPrivate;
44 typedef struct _GstRTPBasePayloadClass GstRTPBasePayloadClass;
47 * GST_RTP_BASE_PAYLOAD_SINKPAD:
48 * @payload: a #GstRTPBasePayload
50 * Get access to the sinkpad of @payload.
52 #define GST_RTP_BASE_PAYLOAD_SINKPAD(payload) (GST_RTP_BASE_PAYLOAD (payload)->sinkpad)
54 * GST_RTP_BASE_PAYLOAD_SRCPAD:
55 * @payload: a #GstRTPBasePayload
57 * Get access to the srcpad of @payload.
59 #define GST_RTP_BASE_PAYLOAD_SRCPAD(payload) (GST_RTP_BASE_PAYLOAD (payload)->srcpad)
62 * GST_RTP_BASE_PAYLOAD_PT:
63 * @payload: a #GstRTPBasePayload
65 * Get access to the configured payload type of @payload.
67 #define GST_RTP_BASE_PAYLOAD_PT(payload) (GST_RTP_BASE_PAYLOAD (payload)->pt)
69 * GST_RTP_BASE_PAYLOAD_MTU:
70 * @payload: a #GstRTPBasePayload
72 * Get access to the configured MTU of @payload.
74 #define GST_RTP_BASE_PAYLOAD_MTU(payload) (GST_RTP_BASE_PAYLOAD (payload)->mtu)
76 struct _GstRTPBasePayload
105 guint64 ptime; /* in ns */
106 guint64 ptime_multiple; /* in ns */
109 GstRTPBasePayloadPrivate *priv;
111 gpointer _gst_reserved[GST_PADDING];
115 * GstRTPBasePayloadClass:
116 * @parent_class: the parent class
117 * @get_caps: get desired caps
118 * @set_caps: configure the payloader
119 * @handle_buffer: process data
120 * @sink_event: custom event handling on the sinkpad
121 * @src_event: custom event handling on the srcpad
122 * @query: custom query handling
124 * Base class for audio RTP payloader.
126 struct _GstRTPBasePayloadClass
128 GstElementClass parent_class;
130 /* query accepted caps */
131 GstCaps * (*get_caps) (GstRTPBasePayload *payload, GstPad * pad, GstCaps * filter);
132 /* receive caps on the sink pad, configure the payloader. */
133 gboolean (*set_caps) (GstRTPBasePayload *payload, GstCaps *caps);
135 /* handle a buffer, perform 0 or more gst_rtp_base_payload_push() on
136 * the RTP buffers. This function takes ownership of the buffer. */
137 GstFlowReturn (*handle_buffer) (GstRTPBasePayload *payload,
139 /* handle events and queries */
140 gboolean (*sink_event) (GstRTPBasePayload *payload, GstEvent * event);
141 gboolean (*src_event) (GstRTPBasePayload *payload, GstEvent * event);
142 gboolean (*query) (GstRTPBasePayload *payload, GstPad *pad, GstQuery * query);
145 gpointer _gst_reserved[GST_PADDING];
149 GType gst_rtp_base_payload_get_type (void);
152 void gst_rtp_base_payload_set_options (GstRTPBasePayload *payload,
155 const gchar *encoding_name,
159 gboolean gst_rtp_base_payload_set_outcaps (GstRTPBasePayload *payload,
160 const gchar *fieldname, ...);
163 gboolean gst_rtp_base_payload_is_filled (GstRTPBasePayload *payload,
164 guint size, GstClockTime duration);
167 GstFlowReturn gst_rtp_base_payload_push (GstRTPBasePayload *payload,
171 GstFlowReturn gst_rtp_base_payload_push_list (GstRTPBasePayload *payload,
172 GstBufferList *list);
174 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
175 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPBasePayload, gst_object_unref)
180 #endif /* __GST_RTP_BASE_PAYLOAD_H__ */