2 * @file codec.h Codec for Media API
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.
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.
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.
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
27 #ifndef _PURPLE_MEDIA_CODEC_H_
28 #define _PURPLE_MEDIA_CODEC_H_
30 #include "enum-types.h"
32 /** An opaque structure representing an audio or video codec. */
33 typedef struct _PurpleMediaCodec PurpleMediaCodec
;
37 #include <glib-object.h>
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))
50 * Gets the type of the media codec structure.
52 * @return The media codec's GType
56 GType
purple_media_codec_get_type(void);
59 * Creates a new PurpleMediaCodec instance.
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.
66 * @return The newly created PurpleMediaCodec.
70 PurpleMediaCodec
*purple_media_codec_new(int id
, const char *encoding_name
,
71 PurpleMediaSessionType media_type
, guint clock_rate
);
76 * @param The codec to get the id from.
78 * @return The codec id.
82 guint
purple_media_codec_get_id(PurpleMediaCodec
*codec
);
85 * Gets the encoding name.
87 * @param The codec to get the encoding name from.
89 * @return The encoding name.
93 gchar
*purple_media_codec_get_encoding_name(PurpleMediaCodec
*codec
);
96 * Gets the clock rate.
98 * @param The codec to get the clock rate from.
100 * @return The clock rate.
104 guint
purple_media_codec_get_clock_rate(PurpleMediaCodec
*codec
);
107 * Gets the number of channels.
109 * @param The codec to get the number of channels from.
111 * @return The number of channels.
115 guint
purple_media_codec_get_channels(PurpleMediaCodec
*codec
);
118 * Gets a list of the optional parameters.
120 * The list consists of PurpleKeyValuePair's.
122 * @param The codec to get the optional parameters from.
124 * @return The list of optional parameters. The list is owned by the codec and
125 * should not be freed.
129 GList
*purple_media_codec_get_optional_parameters(PurpleMediaCodec
*codec
);
132 * Adds an optional parameter to the codec.
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.
140 void purple_media_codec_add_optional_parameter(PurpleMediaCodec
*codec
,
141 const gchar
*name
, const gchar
*value
);
144 * Removes an optional parameter from the codec.
146 * @param codec The codec to remove the parameter from.
147 * @param param A pointer to the parameter to remove.
151 void purple_media_codec_remove_optional_parameter(PurpleMediaCodec
*codec
,
152 PurpleKeyValuePair
*param
);
155 * Gets an optional parameter based on the values given.
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.
161 * @return The value found or NULL.
165 PurpleKeyValuePair
*purple_media_codec_get_optional_parameter(
166 PurpleMediaCodec
*codec
, const gchar
*name
,
170 * Copies a PurpleMediaCodec object.
172 * @param codec The codec to copy.
174 * @return The copy of the codec.
178 PurpleMediaCodec
*purple_media_codec_copy(PurpleMediaCodec
*codec
);
181 * Copies a GList of PurpleMediaCodec and its contents.
183 * @param codecs The list of codecs to be copied.
185 * @return The copy of the GList.
189 GList
*purple_media_codec_list_copy(GList
*codecs
);
192 * Frees a GList of PurpleMediaCodec and its contents.
194 * @param codecs The list of codecs to be freed.
198 void purple_media_codec_list_free(GList
*codecs
);
201 * Creates a string representation of the codec.
203 * @param codec The codec to create the string of.
205 * @return The new string representation.
209 gchar
*purple_media_codec_to_string(const PurpleMediaCodec
*codec
);
213 #endif /* _PURPLE_MEDIA_CODEC_H_ */