Oops, I forgot this. This is done internally in libgadu, and not doing it
[pidgin-git.git] / libpurple / media-gst.h
blobd729e32aa5282cf88fff5fcb36c2efc8fb15c5d4
1 /**
2 * @file media-gst.h Media API
3 * @ingroup core
4 */
6 /* purple
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_GST_H_
28 #define _PURPLE_MEDIA_GST_H_
30 #include "media.h"
31 #include "mediamanager.h"
33 #include <gst/gst.h>
35 G_BEGIN_DECLS
37 #define PURPLE_TYPE_MEDIA_ELEMENT_TYPE (purple_media_element_type_get_type())
38 #define PURPLE_TYPE_MEDIA_ELEMENT_INFO (purple_media_element_info_get_type())
39 #define PURPLE_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
40 #define PURPLE_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
41 #define PURPLE_IS_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO))
42 #define PURPLE_IS_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO))
43 #define PURPLE_MEDIA_ELEMENT_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
45 /** An opaque structure representing an audio/video source/sink. */
46 typedef struct _PurpleMediaElementInfo PurpleMediaElementInfo;
47 typedef struct _PurpleMediaElementInfoClass PurpleMediaElementInfoClass;
48 typedef GstElement *(*PurpleMediaElementCreateCallback)(PurpleMedia *media,
49 const gchar *session_id, const gchar *participant);
51 typedef enum {
52 PURPLE_MEDIA_ELEMENT_NONE = 0, /** empty element */
53 PURPLE_MEDIA_ELEMENT_AUDIO = 1, /** supports audio */
54 PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1, /** supports video */
55 PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO
56 | PURPLE_MEDIA_ELEMENT_VIDEO, /** supports audio and video */
58 PURPLE_MEDIA_ELEMENT_NO_SRCS = 0, /** has no src pads */
59 PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2, /** has one src pad */
60 PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, /** has multiple src pads */
61 PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, /** src pads must be requested */
63 PURPLE_MEDIA_ELEMENT_NO_SINKS = 0, /** has no sink pads */
64 PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, /** has one sink pad */
65 PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, /** has multiple sink pads */
66 PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, /** sink pads must be requested */
68 PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8, /** This element is unique and
69 only one instance of it should
70 be created at a time */
72 PURPLE_MEDIA_ELEMENT_SRC = 1 << 9, /** can be set as an active src */
73 PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /** can be set as an active sink */
74 } PurpleMediaElementType;
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
80 /**
81 * Gets the element type's GType.
83 * @return The element type's GType.
85 * @since 2.6.0
87 GType purple_media_element_type_get_type(void);
89 /**
90 * Gets the element info's GType.
92 * @return The element info's GType.
94 * @since 2.6.0
96 GType purple_media_element_info_get_type(void);
98 /**
99 * Gets the source from a session
101 * @param media The media object the session is in.
102 * @param sess_id The session id of the session to get the source from.
104 * @return The source retrieved.
106 * @since 2.6.0
108 GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id);
111 * Gets the tee from a given session/stream.
113 * @param media The instance to get the tee from.
114 * @param session_id The id of the session to get the tee from.
115 * @param participant Optionally, the participant of the stream to get the tee from.
117 * @return The GstTee element from the chosen session/stream.
119 * @since 2.6.0
121 GstElement *purple_media_get_tee(PurpleMedia *media,
122 const gchar *session_id, const gchar *participant);
126 * Gets the pipeline from the media manager.
128 * @param manager The media manager to get the pipeline from.
130 * @return The pipeline.
132 * @since 2.6.0
134 GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager);
137 * Returns a GStreamer source or sink for audio or video.
139 * @param manager The media manager to use to obtain the source/sink.
140 * @param type The type of source/sink to get.
141 * @param media The media call this element is requested for.
142 * @param session_id The id of the session this element is requested for or NULL.
143 * @param participant The remote user this element is requested for or NULL.
145 * @since 2.6.0
147 GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
148 PurpleMediaSessionType type, PurpleMedia *media,
149 const gchar *session_id, const gchar *participant);
151 PurpleMediaElementInfo *purple_media_manager_get_element_info(
152 PurpleMediaManager *manager, const gchar *name);
153 gboolean purple_media_manager_register_element(PurpleMediaManager *manager,
154 PurpleMediaElementInfo *info);
155 gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager,
156 const gchar *name);
157 gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager,
158 PurpleMediaElementInfo *info);
159 PurpleMediaElementInfo *purple_media_manager_get_active_element(
160 PurpleMediaManager *manager, PurpleMediaElementType type);
162 gchar *purple_media_element_info_get_id(PurpleMediaElementInfo *info);
163 gchar *purple_media_element_info_get_name(PurpleMediaElementInfo *info);
164 PurpleMediaElementType purple_media_element_info_get_element_type(
165 PurpleMediaElementInfo *info);
166 GstElement *purple_media_element_info_call_create(
167 PurpleMediaElementInfo *info, PurpleMedia *media,
168 const gchar *session_id, const gchar *participant);
170 #ifdef __cplusplus
172 #endif
174 G_END_DECLS
176 #endif /* _PURPLE_MEDIA_GST_H_ */