Migrate xmpp-caps.xml to XDG cache dir
[pidgin-git.git] / libpurple / media-gst.h
blob57d1ef35109c6c6dede15d0a0887353c7773fa46
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PURPLE_MEDIA_GST_H_
23 #define _PURPLE_MEDIA_GST_H_
24 /**
25 * SECTION:media-gst
26 * @section_id: libpurple-media-gst
27 * @short_description: <filename>media-gst.h</filename>
28 * @title: Media Element API
31 #include "media.h"
32 #include "mediamanager.h"
34 #include <gst/gst.h>
36 #define PURPLE_TYPE_MEDIA_ELEMENT_TYPE (purple_media_element_type_get_type())
37 #define PURPLE_TYPE_MEDIA_ELEMENT_INFO (purple_media_element_info_get_type())
38 #define PURPLE_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
39 #define PURPLE_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
40 #define PURPLE_IS_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO))
41 #define PURPLE_IS_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO))
42 #define PURPLE_MEDIA_ELEMENT_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
44 /**
45 * PurpleMediaElementInfo:
47 * An opaque structure representing an audio/video source/sink.
49 typedef struct _PurpleMediaElementInfo PurpleMediaElementInfo;
50 typedef struct _PurpleMediaElementInfoClass PurpleMediaElementInfoClass;
52 typedef GstElement *(*PurpleMediaElementCreateCallback)(
53 PurpleMediaElementInfo *info, PurpleMedia *media,
54 const gchar *session_id, const gchar *participant);
56 /**
57 * PurpleMediaElementType:
58 * @PURPLE_MEDIA_ELEMENT_NONE: empty element
59 * @PURPLE_MEDIA_ELEMENT_AUDIO: supports audio
60 * @PURPLE_MEDIA_ELEMENT_VIDEO: supports video
61 * @PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO: supports audio and video
62 * @PURPLE_MEDIA_ELEMENT_NO_SRCS: has no src pads
63 * @PURPLE_MEDIA_ELEMENT_ONE_SRC: has one src pad
64 * @PURPLE_MEDIA_ELEMENT_MULTI_SRC: has multiple src pads
65 * @PURPLE_MEDIA_ELEMENT_REQUEST_SRC: src pads must be requested
66 * @PURPLE_MEDIA_ELEMENT_NO_SINKS: has no sink pads
67 * @PURPLE_MEDIA_ELEMENT_ONE_SINK: has one sink pad
68 * @PURPLE_MEDIA_ELEMENT_MULTI_SINK: has multiple sink pads
69 * @PURPLE_MEDIA_ELEMENT_REQUEST_SINK: sink pads must be requested
70 * @PURPLE_MEDIA_ELEMENT_UNIQUE: This element is unique and only one
71 * instance of it should be created at a
72 * time
73 * @PURPLE_MEDIA_ELEMENT_SRC: can be set as an active src
74 * @PURPLE_MEDIA_ELEMENT_SINK: can be set as an active sink
75 * @PURPLE_MEDIA_ELEMENT_APPLICATION: supports application data
77 typedef enum {
78 PURPLE_MEDIA_ELEMENT_NONE = 0,
79 PURPLE_MEDIA_ELEMENT_AUDIO = 1,
80 PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1,
81 PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO
82 | PURPLE_MEDIA_ELEMENT_VIDEO,
83 PURPLE_MEDIA_ELEMENT_NO_SRCS = 0,
84 PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2,
85 PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3,
86 PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4,
87 PURPLE_MEDIA_ELEMENT_NO_SINKS = 0,
88 PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5,
89 PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6,
90 PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7,
91 PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8,
92 PURPLE_MEDIA_ELEMENT_SRC = 1 << 9,
93 PURPLE_MEDIA_ELEMENT_SINK = 1 << 10,
94 PURPLE_MEDIA_ELEMENT_APPLICATION = 1 << 11,
95 } PurpleMediaElementType;
97 G_BEGIN_DECLS
99 /**
100 * purple_media_element_type_get_type:
102 * Gets the element type's GType.
104 * Returns: The element type's GType.
106 GType purple_media_element_type_get_type(void);
109 * purple_media_element_info_get_type:
111 * Gets the element info's GType.
113 * Returns: The element info's GType.
115 GType purple_media_element_info_get_type(void);
118 * purple_media_get_src:
119 * @media: The media object the session is in.
120 * @sess_id: The session id of the session to get the source from.
122 * Gets the source from a session
124 * Returns: The source retrieved.
126 GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id);
129 * purple_media_get_tee:
130 * @media: The instance to get the tee from.
131 * @session_id: The id of the session to get the tee from.
132 * @participant: Optionally, the participant of the stream to get the tee from.
134 * Gets the tee from a given session/stream.
136 * Returns: The GstTee element from the chosen session/stream.
138 GstElement *purple_media_get_tee(PurpleMedia *media,
139 const gchar *session_id, const gchar *participant);
143 * purple_media_manager_get_pipeline:
144 * @manager: The media manager to get the pipeline from.
146 * Gets the pipeline from the media manager.
148 * Returns: The pipeline.
150 GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager);
153 * purple_media_manager_get_element:
154 * @manager: The media manager to use to obtain the source/sink.
155 * @type: The type of source/sink to get.
156 * @media: The media call this element is requested for.
157 * @session_id: The id of the session this element is requested for or NULL.
158 * @participant: The remote user this element is requested for or NULL.
160 * Returns: A GStreamer source or sink for audio or video.
162 GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
163 PurpleMediaSessionType type, PurpleMedia *media,
164 const gchar *session_id, const gchar *participant);
167 * purple_media_manager_enumerate_elements:
168 * @manager: The media manager to use to obtain the element infos.
169 * @type: The type of element infos to get.
171 * Returns: A #GList of registered #PurpleMediaElementInfo instances that match
172 * @type.
174 GList *purple_media_manager_enumerate_elements(PurpleMediaManager *manager,
175 PurpleMediaElementType type);
177 PurpleMediaElementInfo *purple_media_manager_get_element_info(
178 PurpleMediaManager *manager, const gchar *name);
179 gboolean purple_media_manager_register_element(PurpleMediaManager *manager,
180 PurpleMediaElementInfo *info);
181 gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager,
182 const gchar *name);
183 gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager,
184 PurpleMediaElementInfo *info);
185 PurpleMediaElementInfo *purple_media_manager_get_active_element(
186 PurpleMediaManager *manager, PurpleMediaElementType type);
189 * purple_media_manager_set_video_caps:
190 * @manager: The media manager to set the media formats.
191 * @caps: Set of allowed media formats.
193 * Reduces media formats supported by the video source to given set.
195 * Useful to force negotiation of smaller picture resolution more suitable for
196 * use with particular codec and communication protocol without rescaling.
198 void purple_media_manager_set_video_caps(PurpleMediaManager *manager,
199 GstCaps *caps);
202 * purple_media_manager_get_video_caps:
203 * @manager: The media manager to get the media formats from.
205 * Returns current set of media formats limiting the output from video source.
207 * Returns: #GstCaps limiting the video source's formats.
209 GstCaps *purple_media_manager_get_video_caps(PurpleMediaManager *manager);
211 gchar *purple_media_element_info_get_id(PurpleMediaElementInfo *info);
212 gchar *purple_media_element_info_get_name(PurpleMediaElementInfo *info);
213 PurpleMediaElementType purple_media_element_info_get_element_type(
214 PurpleMediaElementInfo *info);
215 GstElement *purple_media_element_info_call_create(
216 PurpleMediaElementInfo *info, PurpleMedia *media,
217 const gchar *session_id, const gchar *participant);
219 G_END_DECLS
221 #endif /* _PURPLE_MEDIA_GST_H_ */