comparison libpurple/media/codec.h @ 29742:422889fb57e0

propagate from branch 'im.pidgin.pidgin' (head 9028ac0daaa1f7e565726fa39aca22ce7d3ecc49) to branch 'im.pidgin.pidgin.next.minor' (head debffa49382d07f0934a2b22a035940cb8f7892f)
author Paul Aurich <paul@darkrain42.org>
date Thu, 04 Feb 2010 05:30:35 +0000
parents a52831eada67
children d91e3a6c4a91
comparison
equal deleted inserted replaced
29354:86ee7772936f 29742:422889fb57e0
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
35 #include "../util.h"
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
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 */
82 guint purple_media_codec_get_id(PurpleMediaCodec *codec);
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 */
93 gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec);
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 */
104 guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec);
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 */
115 guint purple_media_codec_get_channels(PurpleMediaCodec *codec);
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 *
124 * @return The list of optional parameters.
125 *
126 * @since 2.6.0
127 */
128 GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec);
129
130 /**
131 * Adds an optional parameter to the codec.
132 *
133 * @param codec The codec to add the parameter to.
134 * @param name The name of the parameter to add.
135 * @param value The value of the parameter to add.
136 *
137 * @since 2.6.0
138 */
139 void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec,
140 const gchar *name, const gchar *value);
141
142 /**
143 * Removes an optional parameter from the codec.
144 *
145 * @param codec The codec to remove the parameter from.
146 * @param param A pointer to the parameter to remove.
147 *
148 * @since 2.6.0
149 */
150 void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec,
151 PurpleKeyValuePair *param);
152
153 /**
154 * Gets an optional parameter based on the values given.
155 *
156 * @param codec The codec to find the parameter in.
157 * @param name The name of the parameter to search for.
158 * @param value The value to search for or NULL.
159 *
160 * @return The value found or NULL.
161 *
162 * @since 2.6.0
163 */
164 PurpleKeyValuePair *purple_media_codec_get_optional_parameter(
165 PurpleMediaCodec *codec, const gchar *name,
166 const gchar *value);
167
168 /**
169 * Copies a PurpleMediaCodec object.
170 *
171 * @param codec The codec to copy.
172 *
173 * @return The copy of the codec.
174 *
175 * @since 2.7.0
176 */
177 PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec);
178
179 /**
180 * Copies a GList of PurpleMediaCodec and its contents.
181 *
182 * @param codecs The list of codecs to be copied.
183 *
184 * @return The copy of the GList.
185 *
186 * @since 2.6.0
187 */
188 GList *purple_media_codec_list_copy(GList *codecs);
189
190 /**
191 * Frees a GList of PurpleMediaCodec and its contents.
192 *
193 * @param codecs The list of codecs to be freed.
194 *
195 * @since 2.6.0
196 */
197 void purple_media_codec_list_free(GList *codecs);
198
199 /**
200 * Creates a string representation of the codec.
201 *
202 * @param codec The codec to create the string of.
203 *
204 * @return The new string representation.
205 *
206 * @since 2.6.0
207 */
208 gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec);
209
210 G_END_DECLS
211
212 #endif /* _PURPLE_MEDIA_CODEC_H_ */
213