comparison libpurple/media/codec.h @ 29538:e18c1d347e37

Break PurpleMediaCodec out into its own file.
author maiku@pidgin.im
date Thu, 22 Oct 2009 00:22:59 +0000
parents
children 9549d3f8f7c2
comparison
equal deleted inserted replaced
29537:b8235e92ede7 29538:e18c1d347e37
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 guint purple_media_codec_get_id(PurpleMediaCodec *codec);
74 gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec);
75 guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec);
76 guint purple_media_codec_get_channels(PurpleMediaCodec *codec);
77 GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec);
78
79 /**
80 * Adds an optional parameter to the codec.
81 *
82 * @param codec The codec to add the parameter to.
83 * @param name The name of the parameter to add.
84 * @param value The value of the parameter to add.
85 *
86 * @since 2.6.0
87 */
88 void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec,
89 const gchar *name, const gchar *value);
90
91 /**
92 * Removes an optional parameter from the codec.
93 *
94 * @param codec The codec to remove the parameter from.
95 * @param param A pointer to the parameter to remove.
96 *
97 * @since 2.6.0
98 */
99 void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec,
100 PurpleKeyValuePair *param);
101
102 /**
103 * Gets an optional parameter based on the values given.
104 *
105 * @param codec The codec to find the parameter in.
106 * @param name The name of the parameter to search for.
107 * @param value The value to search for or NULL.
108 *
109 * @return The value found or NULL.
110 *
111 * @since 2.6.0
112 */
113 PurpleKeyValuePair *purple_media_codec_get_optional_parameter(
114 PurpleMediaCodec *codec, const gchar *name,
115 const gchar *value);
116
117 /**
118 * Copies a PurpleMediaCodec object.
119 *
120 * @param codec The codec to copy.
121 *
122 * @return The copy of the codec.
123 *
124 * @since 2.7.0
125 */
126 PurpleMediaCodec *purple_media_codec_copy(PurpleMediaCodec *codec);
127
128 /**
129 * Copies a GList of PurpleMediaCodec and its contents.
130 *
131 * @param codecs The list of codecs to be copied.
132 *
133 * @return The copy of the GList.
134 *
135 * @since 2.6.0
136 */
137 GList *purple_media_codec_list_copy(GList *codecs);
138
139 /**
140 * Frees a GList of PurpleMediaCodec and its contents.
141 *
142 * @param codecs The list of codecs to be freed.
143 *
144 * @since 2.6.0
145 */
146 void purple_media_codec_list_free(GList *codecs);
147
148 /**
149 * Creates a string representation of the codec.
150 *
151 * @param codec The codec to create the string of.
152 *
153 * @return The new string representation.
154 *
155 * @since 2.6.0
156 */
157 gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec);
158
159 G_END_DECLS
160
161 #endif /* _PURPLE_MEDIA_CODEC_H_ */
162