1 /* GStreamer 2 * Copyright (C) <2006> Philippe Khalaf <philippe.kalaf@collabora.co.uk> 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 #ifndef __GST_RTP_BASE_AUDIO_PAYLOAD_H__ 21 #define __GST_RTP_BASE_AUDIO_PAYLOAD_H__ 22 23 #include <gst/gst.h> 24 #include <gst/rtp/gstrtpbasepayload.h> 25 #include <gst/base/gstadapter.h> 26 27 G_BEGIN_DECLS 28 29 typedef struct _GstRTPBaseAudioPayload GstRTPBaseAudioPayload; 30 typedef struct _GstRTPBaseAudioPayloadClass GstRTPBaseAudioPayloadClass; 31 32 typedef struct _GstRTPBaseAudioPayloadPrivate GstRTPBaseAudioPayloadPrivate; 33 34 #define GST_TYPE_RTP_BASE_AUDIO_PAYLOAD \ 35 (gst_rtp_base_audio_payload_get_type()) 36 #define GST_RTP_BASE_AUDIO_PAYLOAD(obj) \ 37 (G_TYPE_CHECK_INSTANCE_CAST((obj), \ 38 GST_TYPE_RTP_BASE_AUDIO_PAYLOAD,GstRTPBaseAudioPayload)) 39 #define GST_RTP_BASE_AUDIO_PAYLOAD_CLASS(klass) \ 40 (G_TYPE_CHECK_CLASS_CAST((klass), \ 41 GST_TYPE_RTP_BASE_AUDIO_PAYLOAD,GstRTPBaseAudioPayloadClass)) 42 #define GST_IS_RTP_BASE_AUDIO_PAYLOAD(obj) \ 43 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_BASE_AUDIO_PAYLOAD)) 44 #define GST_IS_RTP_BASE_AUDIO_PAYLOAD_CLASS(klass) \ 45 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_BASE_AUDIO_PAYLOAD)) 46 #define GST_RTP_BASE_AUDIO_PAYLOAD_CAST(obj) \ 47 ((GstRTPBaseAudioPayload *) (obj)) 48 49 struct _GstRTPBaseAudioPayload 50 { 51 GstRTPBasePayload payload; 52 53 GstRTPBaseAudioPayloadPrivate *priv; 54 55 GstClockTime base_ts; 56 gint frame_size; 57 gint frame_duration; 58 59 gint sample_size; 60 61 /*< private >*/ 62 gpointer _gst_reserved[GST_PADDING]; 63 }; 64 65 /** 66 * GstRTPBaseAudioPayloadClass: 67 * @parent_class: the parent class 68 * 69 * Base class for audio RTP payloader. 70 */ 71 struct _GstRTPBaseAudioPayloadClass 72 { 73 GstRTPBasePayloadClass parent_class; 74 75 /*< private >*/ 76 gpointer _gst_reserved[GST_PADDING]; 77 }; 78 79 GST_RTP_API 80 GType gst_rtp_base_audio_payload_get_type (void); 81 82 /* configure frame based */ 83 84 GST_RTP_API 85 void gst_rtp_base_audio_payload_set_frame_based (GstRTPBaseAudioPayload *rtpbaseaudiopayload); 86 87 GST_RTP_API 88 void gst_rtp_base_audio_payload_set_frame_options (GstRTPBaseAudioPayload *rtpbaseaudiopayload, 89 gint frame_duration, gint frame_size); 90 91 /* configure sample based */ 92 93 GST_RTP_API 94 void gst_rtp_base_audio_payload_set_sample_based (GstRTPBaseAudioPayload *rtpbaseaudiopayload); 95 96 GST_RTP_API 97 void gst_rtp_base_audio_payload_set_sample_options (GstRTPBaseAudioPayload *rtpbaseaudiopayload, 98 gint sample_size); 99 100 GST_RTP_API 101 void gst_rtp_base_audio_payload_set_samplebits_options (GstRTPBaseAudioPayload *rtpbaseaudiopayload, 102 gint sample_size); 103 104 /* get the internal adapter */ 105 106 GST_RTP_API 107 GstAdapter* gst_rtp_base_audio_payload_get_adapter (GstRTPBaseAudioPayload *rtpbaseaudiopayload); 108 109 /* push and flushing data */ 110 111 GST_RTP_API 112 GstFlowReturn gst_rtp_base_audio_payload_push (GstRTPBaseAudioPayload * baseaudiopayload, 113 const guint8 * data, guint payload_len, 114 GstClockTime timestamp); 115 116 GST_RTP_API 117 GstFlowReturn gst_rtp_base_audio_payload_flush (GstRTPBaseAudioPayload * baseaudiopayload, 118 guint payload_len, GstClockTime timestamp); 119 120 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTPBaseAudioPayload, gst_object_unref) 121 122 G_END_DECLS 123 124 #endif /* __GST_RTP_BASE_AUDIO_PAYLOAD_H__ */ 125