1 /* 2 * Farstream - Farstream RTP Stream 3 * 4 * Copyright 2007 Collabora Ltd. 5 * @author: Olivier Crete <olivier.crete@collabora.co.uk> 6 * Copyright 2007 Nokia Corp. 7 * 8 * fs-rtp-stream.h - A Farstream RTP Stream 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 #ifndef __FS_RTP_STREAM_H__ 26 #define __FS_RTP_STREAM_H__ 27 28 #include <farstream/fs-stream.h> 29 #include <farstream/fs-stream-transmitter.h> 30 31 #include "fs-rtp-participant.h" 32 #include "fs-rtp-session.h" 33 #include "fs-rtp-substream.h" 34 35 G_BEGIN_DECLS 36 37 /* TYPE MACROS */ 38 #define FS_TYPE_RTP_STREAM \ 39 (fs_rtp_stream_get_type ()) 40 #define FS_RTP_STREAM(obj) \ 41 (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_RTP_STREAM, FsRtpStream)) 42 #define FS_RTP_STREAM_CLASS(klass) \ 43 (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_RTP_STREAM, FsRtpStreamClass)) 44 #define FS_IS_RTP_STREAM(obj) \ 45 (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_RTP_STREAM)) 46 #define FS_IS_RTP_STREAM_CLASS(klass) \ 47 (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_RTP_STREAM)) 48 #define FS_RTP_STREAM_GET_CLASS(obj) \ 49 (G_TYPE_INSTANCE_GET_CLASS ((obj), FS_TYPE_RTP_STREAM, FsRtpStreamClass)) 50 #define FS_RTP_STREAM_CAST(obj) ((FsRtpStream*) (obj)) 51 52 typedef struct _FsRtpStream FsRtpStream; 53 typedef struct _FsRtpStreamClass FsRtpStreamClass; 54 typedef struct _FsRtpStreamPrivate FsRtpStreamPrivate; 55 56 struct _FsRtpStreamClass 57 { 58 FsStreamClass parent_class; 59 60 }; 61 62 /** 63 * FsRtpStream: 64 * 65 */ 66 struct _FsRtpStream 67 { 68 FsStream parent; 69 70 /*< private >*/ 71 72 /* Can only be accessed while holding the FsRtpSession lock */ 73 /* Dont modify, call set_remote_codecs() */ 74 GList *remote_codecs; 75 GList *negotiated_codecs; 76 77 /* Same as codecs, hold FsRtpSession lock and modify by 78 * setting the property 79 */ 80 GList *hdrext; 81 82 /* Dont modify, call add_substream() */ 83 GList *substreams; 84 85 FsRtpParticipant *participant; 86 87 FsRtpStreamPrivate *priv; 88 }; 89 90 GType fs_rtp_stream_get_type (void); 91 92 typedef gboolean (*stream_new_remote_codecs_cb) (FsRtpStream *stream, 93 GList *codecs, GError **error, gpointer user_data); 94 typedef void (*stream_known_source_packet_receive_cb) (FsRtpStream *stream, 95 guint component, GstBuffer *buffer, gpointer user_data); 96 typedef void (*stream_sending_changed_locked_cb) (FsRtpStream *stream, 97 gboolean sending, gpointer user_data); 98 typedef void (*stream_ssrc_added_cb) (FsRtpStream *stream, guint32 ssrc, 99 gpointer user_data); 100 typedef FsStreamTransmitter* (*stream_get_new_stream_transmitter_cb) ( 101 FsRtpStream *stream, FsParticipant *participant, 102 const gchar *transmitter_name, GParameter *parameters, guint n_parameters, 103 GError **error, gpointer user_data); 104 typedef gboolean (*stream_decrypt_clear_locked_cb) (FsRtpStream *stream, 105 gpointer user_data); 106 107 FsRtpStream *fs_rtp_stream_new (FsRtpSession *session, 108 FsRtpParticipant *participant, 109 FsStreamDirection direction, 110 stream_new_remote_codecs_cb new_remote_codecs_cb, 111 stream_known_source_packet_receive_cb known_source_packet_received_cb, 112 stream_sending_changed_locked_cb sending_changed_locked_cb, 113 stream_ssrc_added_cb ssrc_added_cb, 114 stream_get_new_stream_transmitter_cb get_new_stream_transmitter_cb, 115 stream_decrypt_clear_locked_cb decrypt_clear_locked_cb, 116 gpointer user_data_for_cb); 117 118 gboolean fs_rtp_stream_add_substream_unlock (FsRtpStream *stream, 119 FsRtpSubStream *substream, 120 FsRtpSession *session, 121 GError **error); 122 123 void 124 fs_rtp_stream_set_negotiated_codecs_unlock (FsRtpStream *stream, 125 GList *codecs); 126 127 gboolean 128 validate_srtp_parameters (GstStructure *parameters, 129 gint *srtp_cipher, gint *srtcp_cipher, gint *srtp_auth, gint *srtcp_auth, 130 GstBuffer **key, guint *replay_window, GError **error); 131 132 GstCaps * 133 fs_rtp_stream_get_srtp_caps_locked (FsRtpStream *self); 134 135 gboolean 136 fs_rtp_stream_requires_crypto_locked (FsRtpStream *self); 137 138 G_END_DECLS 139 140 #endif /* __FS_RTP_STREAM_H__ */ 141