Convert all uses of PURPLE_UNSAFE_DEBUG to the new API I added.
[pidgin-git.git] / libpurple / media-gst.h
blob3840792d2b75ccdee08e08af20841d0f3908636f
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 /** @copydoc _PurpleMediaElementInfo */
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.
142 * @since 2.6.0
144 GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
145 PurpleMediaSessionType type, PurpleMedia *media,
146 const gchar *session_id, const gchar *participant);
148 PurpleMediaElementInfo *purple_media_manager_get_element_info(
149 PurpleMediaManager *manager, const gchar *name);
150 gboolean purple_media_manager_register_element(PurpleMediaManager *manager,
151 PurpleMediaElementInfo *info);
152 gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager,
153 const gchar *name);
154 gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager,
155 PurpleMediaElementInfo *info);
156 PurpleMediaElementInfo *purple_media_manager_get_active_element(
157 PurpleMediaManager *manager, PurpleMediaElementType type);
159 gchar *purple_media_element_info_get_id(PurpleMediaElementInfo *info);
160 gchar *purple_media_element_info_get_name(PurpleMediaElementInfo *info);
161 PurpleMediaElementType purple_media_element_info_get_element_type(
162 PurpleMediaElementInfo *info);
163 GstElement *purple_media_element_info_call_create(
164 PurpleMediaElementInfo *info, PurpleMedia *media,
165 const gchar *session_id, const gchar *participant);
167 #ifdef __cplusplus
169 #endif
171 G_END_DECLS
173 #endif /* _PURPLE_MEDIA_GST_H_ */