1 /* 2 * Farstream - Farstream RTP Packet modder 3 * 4 * Copyright 2010 Collabora Ltd. 5 * @author: Olivier Crete <olivier.crete@collabora.co.uk> 6 * Copyright 2010 Nokia Corp. 7 * 8 * fs-rtp-packet-modder.h - Filter to modify RTP packets 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 26 #ifndef __FS_RTP_PACKET_MODDER_H__ 27 #define __FS_RTP_PACKET_MODDER_H__ 28 29 #include <gst/gst.h> 30 31 G_BEGIN_DECLS 32 33 #define FS_TYPE_RTP_PACKET_MODDER \ 34 (fs_rtp_packet_modder_get_type ()) 35 #define FS_RTP_PACKET_MODDER(obj) \ 36 (G_TYPE_CHECK_INSTANCE_CAST((obj),FS_TYPE_RTP_PACKET_MODDER, \ 37 FsRtpPacketModder)) 38 #define FS_RTP_PACKET_MODDER_CLASS(klass) \ 39 (G_TYPE_CHECK_CLASS_CAST((klass),FS_TYPE_RTP_PACKET_MODDER, \ 40 FsRtpPacketModderClass)) 41 #define FS_IS_RTP_PACKET_MODDER(obj) \ 42 (G_TYPE_CHECK_INSTANCE_TYPE((obj),FS_TYPE_RTP_PACKET_MODDER)) 43 #define FS_IS_RTP_PACKET_MODDER_CLASS(klass) \ 44 (G_TYPE_CHECK_CLASS_TYPE((klass),FS_TYPE_RTP_PACKET_MODDER)) 45 46 typedef struct _FsRtpPacketModder FsRtpPacketModder; 47 typedef struct _FsRtpPacketModderClass FsRtpPacketModderClass; 48 49 50 typedef GstBuffer *(*FsRtpPacketModderFunc) (FsRtpPacketModder *modder, 51 GstBuffer *buffer, GstClockTime sync_time, gpointer user_data); 52 53 typedef GstClockTime (*FsRtpPacketModderSyncTimeFunc) ( 54 FsRtpPacketModder *modder, GstBuffer *buffer, gpointer user_data); 55 56 /** 57 * FsRtpPacketModder: 58 * 59 * Opaque #FsRtpPacketModder data structure. 60 */ 61 struct _FsRtpPacketModder { 62 GstElement element; 63 64 GstPad *srcpad; 65 GstPad *sinkpad; 66 67 FsRtpPacketModderFunc modder_func; 68 FsRtpPacketModderSyncTimeFunc sync_func; 69 gpointer user_data; 70 71 /* for sync */ 72 GstSegment segment; 73 GstClockID clock_id; 74 gboolean unscheduled; 75 /* the latency of the upstream peer, we have to take this into account when 76 * synchronizing the buffers. */ 77 GstClockTime peer_latency; 78 }; 79 80 struct _FsRtpPacketModderClass { 81 GstElementClass parent_class; 82 }; 83 84 GType fs_rtp_packet_modder_get_type (void); 85 86 FsRtpPacketModder *fs_rtp_packet_modder_new ( 87 FsRtpPacketModderFunc modder_func, 88 FsRtpPacketModderSyncTimeFunc sync_func, 89 gpointer user_data); 90 91 92 G_END_DECLS 93 94 #endif /* __FS_RTP_PACKET_MODDER_H__ */ 95