Mercurial > pidgin
annotate libpurple/media/codec.h @ 30912:63aeff4ebc19
jabber: Avoid a double-free in the google relay code.
Also some whitespace clean-up right next to the double-free. Reported by
"mordy" in #pidgin.
| author | Paul Aurich <paul@darkrain42.org> |
|---|---|
| date | Mon, 08 Nov 2010 17:05:18 +0000 |
| parents | d91e3a6c4a91 |
| children | 44f53d3fc54f |
| rev | line source |
|---|---|
| 29144 | 1 /** |
| 2 * @file codec.h Codec for Media API | |
| 3 * @ingroup core | |
| 4 */ | |
| 5 | |
| 6 /* purple | |
| 7 * | |
| 8 * Purple is the legal property of its developers, whose names are too numerous | |
| 9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 10 * source distribution. | |
| 11 * | |
| 12 * This program is free software; you can redistribute it and/or modify | |
| 13 * it under the terms of the GNU General Public License as published by | |
| 14 * the Free Software Foundation; either version 2 of the License, or | |
| 15 * (at your option) any later version. | |
| 16 * | |
| 17 * This program is distributed in the hope that it will be useful, | |
| 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 * GNU General Public License for more details. | |
| 21 * | |
| 22 * You should have received a copy of the GNU General Public License | |
| 23 * along with this program; if not, write to the Free Software | |
| 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
| 25 */ | |
| 26 | |
| 27 #ifndef _PURPLE_MEDIA_CODEC_H_ | |
| 28 #define _PURPLE_MEDIA_CODEC_H_ | |
| 29 | |
| 30 #include "enum-types.h" | |
| 31 | |
| 32 /** An opaque structure representing an audio or video codec. */ | |
| 33 typedef struct _PurpleMediaCodec PurpleMediaCodec; | |
| 34 | |
|
29341
a52831eada67
Add pidgin-2 and purple-2 .pc variants
Will Thompson <will.thompson@collabora.co.uk>
parents:
29241
diff
changeset
|
35 #include "../util.h" |
| 29144 | 36 |
| 37 #include <glib-object.h> | |
| 38 | |
| 39 G_BEGIN_DECLS | |
| 40 | |
| 41 #define PURPLE_TYPE_MEDIA_CODEC (purple_media_codec_get_type()) | |
| 42 #define PURPLE_IS_MEDIA_CODEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_CODEC)) | |
| 43 #define PURPLE_IS_MEDIA_CODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_CODEC)) | |
| 44 #define PURPLE_MEDIA_CODEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) | |
| 45 #define PURPLE_MEDIA_CODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) | |
| 46 #define PURPLE_MEDIA_CODEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) | |
| 47 | |
| 48 | |
| 49 /** | |
| 50 * Gets the type of the media codec structure. | |
| 51 * | |
| 52 * @return The media codec's GType | |
| 53 * | |
| 54 * @since 2.6.0 | |
| 55 */ | |
| 56 GType purple_media_codec_get_type(void); | |
| 57 | |
| 58 /** | |
| 59 * Creates a new PurpleMediaCodec instance. | |
| 60 * | |
| 61 * @param id Codec identifier. | |
| 62 * @param encoding_name Name of the media type this encodes. | |
| 63 * @param media_type PurpleMediaSessionType of this codec. | |
| 64 * @param clock_rate The clock rate this codec encodes at, if applicable. | |
| 65 * | |
| 66 * @return The newly created PurpleMediaCodec. | |
| 67 * | |
| 68 * @since 2.6.0 | |
| 69 */ | |
| 70 PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, | |
| 71 PurpleMediaSessionType media_type, guint clock_rate); | |
| 72 | |
| 29241 | 73 /** |
| 74 * Gets the codec id. | |
| 75 * | |
| 76 * @param The codec to get the id from. | |
| 77 * | |
| 78 * @return The codec id. | |
| 79 * | |
| 80 * @since 2.6.0 | |
| 81 */ | |
| 29144 | 82 guint purple_media_codec_get_id(PurpleMediaCodec *codec); |
| 29241 | 83 |
| 84 /** | |
| 85 * Gets the encoding name. | |
| 86 * | |
| 87 * @param The codec to get the encoding name from. | |
| 88 * | |
| 89 * @return The encoding name. | |
| 90 * | |
| 91 * @since 2.6.0 | |
| 92 */ | |
| 29144 | 93 gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); |
| 29241 | 94 |
| 95 /** | |
| 96 * Gets the clock rate. | |
| 97 * | |
| 98 * @param The codec to get the clock rate from. | |
| 99 * | |
| 100 * @return The clock rate. | |
| 101 * | |
| 102 * @since 2.6.0 | |
| 103 */ | |
| 29144 | 104 guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); |
| 29241 | 105 |
| 106 /** | |
| 107 * Gets the number of channels. | |
| 108 * | |
| 109 * @param The codec to get the number of channels from. | |
| 110 * | |
| 111 * @return The number of channels. | |
| 112 * | |
| 113 * @since 2.6.0 | |
| 114 */ | |
| 29144 | 115 guint purple_media_codec_get_channels(PurpleMediaCodec *codec); |
| 29241 | 116 |
| 117 /** | |
| 118 * Gets a list of the optional parameters. | |
| 119 * | |
| 120 * The list consists of PurpleKeyValuePair's. | |
| 121 * | |
| 122 * @param The codec to get the optional parameters from. | |
| 123 * | |
|
30438
d91e3a6c4a91
Clarify documentation on a function return value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29341
diff
changeset
|
124 * @return The list of optional parameters. The list is owned by the codec and |
|
d91e3a6c4a91
Clarify documentation on a function return value.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29341
diff
changeset
|
125 * should not be freed. |
| 29241 | 126 * |
| 127 * @since 2.6.0 | |
| 128 */ | |
| 29144 | 129 GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); |
| 130 | |
| 131 /** | |
| 132 * Adds an optional parameter to the codec. | |
| 133 * | |
| 134 * @param codec The codec to add the parameter to. | |
| 135 * @param name The name of the parameter to add. | |
| 136 * @param value The value of the parameter to add. | |
| 137 * | |
| 138 * @since 2.6.0 | |
| 139 */ | |
| 140 void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, | |
| 141 const gchar *name, const gchar *value); | |
| 142 | |
| 143 /** | |
| 144 * Removes an optional parameter from the codec. | |
| 145 * | |
| 146 * @param codec The codec to remove the parameter from. | |
| 147 * @param param A pointer to the parameter to remove. | |
| 148 * | |
| 149 * @since 2.6.0 | |
| 150 */ | |
| 151 void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, | |
| 152 PurpleKeyValuePair *param); | |
| 153 | |
| 154 /** | |
| 155 * Gets an optional parameter based on the values given. | |
| 156 * | |
| 157 * @param codec The codec to find the parameter in. | |
| 158 * @param name The name of the parameter to search for. | |
| 159 * @param value The value to search for or NULL. | |
| 160 * | |
| 161 * @return The value found or NULL. | |
| 162 * | |
| 163 * @since 2.6.0 | |
| 164 */ | |
| 165 PurpleKeyValuePair *purple_media_codec_get_optional_parameter( | |
| 166 PurpleMediaCodec *codec, const gchar *name, | |
| 167 const gchar *value); | |
| 168 | |
| 169 /** | |
| 170 * Copies a PurpleMediaCodec object. | |
| 171 * | |
| 172 * @param codec The codec to copy. | |
| 173 * | |
| 174 * @return The copy of the codec. | |
| 175 * | |
| 176 * @since 2.7.0 | |
| 177 */ | |
| 178 PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec); | |
| 179 | |
| 180 /** | |
| 181 * Copies a GList of PurpleMediaCodec and its contents. | |
| 182 * | |
| 183 * @param codecs The list of codecs to be copied. | |
| 184 * | |
| 185 * @return The copy of the GList. | |
| 186 * | |
| 187 * @since 2.6.0 | |
| 188 */ | |
| 189 GList *purple_media_codec_list_copy(GList *codecs); | |
| 190 | |
| 191 /** | |
| 192 * Frees a GList of PurpleMediaCodec and its contents. | |
| 193 * | |
| 194 * @param codecs The list of codecs to be freed. | |
| 195 * | |
| 196 * @since 2.6.0 | |
| 197 */ | |
| 198 void purple_media_codec_list_free(GList *codecs); | |
| 199 | |
| 200 /** | |
| 201 * Creates a string representation of the codec. | |
| 202 * | |
| 203 * @param codec The codec to create the string of. | |
| 204 * | |
| 205 * @return The new string representation. | |
| 206 * | |
| 207 * @since 2.6.0 | |
| 208 */ | |
| 209 gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec); | |
| 210 | |
| 211 G_END_DECLS | |
| 212 | |
| 213 #endif /* _PURPLE_MEDIA_CODEC_H_ */ | |
| 214 |
