1 /* 2 * Farstream - Farstream RTP Codec Negotiation 3 * 4 * Copyright 2007 Collabora Ltd. 5 * @author: Olivier Crete <olivier.crete@collabora.co.uk> 6 * Copyright 2007 Nokia Corp. 7 * 8 * fs-discover-codecs.h - A Farstream RTP Codec Negotiation 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_CODEC_NEGOTIATION_H__ 26 #define __FS_RTP_CODEC_NEGOTIATION_H__ 27 28 #include "fs-rtp-discover-codecs.h" 29 30 G_BEGIN_DECLS 31 32 /** 33 * CodecAssociation: 34 * @blueprint: Blueprint used to construct this CodecAssociation (or NULL if 35 * this is strictly from profiles) 36 * @codec: The codec this represents.. With the receive-side paremeters 37 * @send_codec: The same codec, but with the send-side parameters 38 * @reserved: Marks a payload-type reserved at the users request 39 * @disable: means that its not a real association, just a spot thats disabled, 40 * its marks the PT of a remote codec that has been refused 41 * @need_config: means that the config has to be retreived from the codec data 42 * @recv_only: means thats its not a real negotiated codec, just a codec that 43 * we have offered from which we have to be ready to receive stuff, just in case 44 * 45 * The codec association structure represents the link between a #FsCodec and 46 * a CodecBlueprint that implements it. 47 * 48 * It should be treated as opaque by any function outside of 49 * fs-rtp-codec-negotiation.c 50 * 51 */ 52 53 typedef struct _CodecAssociation { 54 CodecBlueprint *blueprint; 55 FsCodec *codec; 56 FsCodec *send_codec; 57 58 gchar *send_profile; 59 gchar *recv_profile; 60 61 /*< private >*/ 62 63 gboolean reserved; 64 gboolean disable; 65 gboolean need_config; 66 gboolean recv_only; 67 68 } CodecAssociation; 69 70 typedef struct _CodecPreference { 71 FsCodec *codec; 72 73 GstCaps *input_caps; 74 GstCaps *output_caps; 75 } CodecPreference; 76 77 GList *validate_codecs_configuration ( 78 FsMediaType media_type, 79 GList *blueprints, 80 GList *codecs); 81 82 GList * 83 create_local_codec_associations ( 84 GList *blueprints, 85 GList *codec_prefs, 86 GList *current_codec_associations, 87 GstCaps *input_caps, 88 GstCaps *output_caps); 89 90 GList * 91 negotiate_stream_codecs ( 92 const GList *remote_codecs, 93 GList *current_codec_associations, 94 gboolean multi_stream); 95 96 GList * 97 finish_codec_negotiation ( 98 GList *old_codec_associations, 99 GList *new_codec_associations); 100 101 CodecAssociation * 102 lookup_codec_association_by_pt (GList *codec_associations, gint pt); 103 104 CodecAssociation * 105 lookup_codec_association_by_codec (GList *codec_associations, FsCodec *codec); 106 107 CodecAssociation * 108 lookup_codec_association_by_codec_for_sending (GList *codec_associations, 109 FsCodec *codec); 110 111 gboolean 112 codec_association_is_valid_for_sending (CodecAssociation *ca, 113 gboolean needs_codecbin); 114 115 GList * 116 codec_associations_to_codecs (GList *codec_associations, 117 gboolean include_config); 118 119 GList * 120 codec_associations_to_send_codecs (GList *codec_associations); 121 122 gboolean 123 codec_associations_list_are_equal (GList *list1, GList *list2); 124 125 void 126 codec_association_list_destroy (GList *list); 127 128 typedef gboolean (*CAFindFunc) (CodecAssociation *ca, gpointer user_data); 129 130 CodecAssociation * 131 lookup_codec_association_custom (GList *codec_associations, 132 CAFindFunc func, gpointer user_data); 133 134 GstElement * 135 parse_bin_from_description_all_linked (const gchar *bin_description, 136 FsStreamDirection direction, guint *src_pad_count, guint *sink_pad_count, 137 GError **error); 138 139 140 141 GList * 142 create_local_header_extensions (GList *hdrext_old, GList *hdrext_prefs, 143 guint8 *used_ids); 144 GList * 145 negotiate_stream_header_extensions (GList *hdrext, GList *hdrext_remote, 146 gboolean favor_remote, guint8 *used_ids); 147 GList * 148 finish_header_extensions_nego (GList *hdrexts, guint8 *used_ids); 149 150 void 151 codec_preference_destroy (CodecPreference *cp); 152 153 G_END_DECLS 154 155 #endif /* __FS_RTP_CODEC_NEGOTIATION_H__ */ 156