comparison libpurple/media-gst.h @ 26431:1ae3af12095a

Move GStreamer related media functions into its own header.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Mon, 23 Mar 2009 02:59:18 +0000
parents
children 064657db29c4
comparison
equal deleted inserted replaced
26430:d7393eebf1f4 26431:1ae3af12095a
1 /**
2 * @file media-gst.h 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27 #ifndef __MEDIA_GST_H_
28 #define __MEDIA_GST_H_
29
30 #ifdef USE_VV
31
32 #include "media.h"
33 #include "mediamanager.h"
34
35 #include <gst/gst.h>
36
37 G_BEGIN_DECLS
38
39 /** @copydoc _PurpleMediaElementInfo */
40 typedef struct _PurpleMediaElementInfo PurpleMediaElementInfo;
41
42 typedef enum {
43 PURPLE_MEDIA_ELEMENT_AUDIO = 1, /** supports audio */
44 PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1, /** supports video */
45 PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO
46 | PURPLE_MEDIA_ELEMENT_VIDEO, /** supports audio and video */
47
48 PURPLE_MEDIA_ELEMENT_NO_SRCS = 0, /** has no src pads */
49 PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2, /** has one src pad */
50 PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, /** has multiple src pads */
51 PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, /** src pads must be requested */
52
53 PURPLE_MEDIA_ELEMENT_NO_SINKS = 0, /** has no sink pads */
54 PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, /** has one sink pad */
55 PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, /** has multiple sink pads */
56 PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, /** sink pads must be requested */
57
58 PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8, /** This element is unique and
59 only one instance of it should
60 be created at a time */
61
62 PURPLE_MEDIA_ELEMENT_SRC = 1 << 9, /** can be set as an active src */
63 PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /** can be set as an active sink */
64 } PurpleMediaElementType;
65
66 struct _PurpleMediaElementInfo
67 {
68 const gchar *id;
69 PurpleMediaElementType type;
70 GstElement *(*create)(void);
71 };
72
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76
77 /**
78 * Gets the source from a session
79 *
80 * @param media The media object the session is in.
81 * @param sess_id The session id of the session to get the source from.
82 *
83 * @return The source retrieved.
84 */
85 GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id);
86
87 /**
88 * Gets the pipeline from the media session.
89 *
90 * @param media The media session to retrieve the pipeline from.
91 *
92 * @return The pipeline retrieved.
93 */
94 GstElement *purple_media_get_pipeline(PurpleMedia *media);
95
96 /**
97 * Gets the tee from a given session/stream.
98 *
99 * @param media The instance to get the tee from.
100 * @param session_id The id of the session to get the tee from.
101 * @param participant Optionally, the participant of the stream to get the tee from.
102 *
103 * @return The GstTee element from the chosen session/stream.
104 */
105 GstElement *purple_media_get_tee(PurpleMedia *media,
106 const gchar *session_id, const gchar *participant);
107
108
109 /**
110 * Gets the pipeline from the media manager.
111 *
112 * @param manager The media manager to get the pipeline from.
113 *
114 * @return The pipeline.
115 */
116 GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager);
117
118 /**
119 * Returns a GStreamer source or sink for audio or video.
120 *
121 * @param manager The media manager to use to obtain the source/sink.
122 * @param type The type of source/sink to get.
123 */
124 GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
125 PurpleMediaSessionType type);
126
127 PurpleMediaElementInfo *purple_media_manager_get_element_info(
128 PurpleMediaManager *manager, const gchar *name);
129 gboolean purple_media_manager_register_element(PurpleMediaManager *manager,
130 PurpleMediaElementInfo *info);
131 gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager,
132 const gchar *name);
133 gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager,
134 PurpleMediaElementInfo *info);
135 PurpleMediaElementInfo *purple_media_manager_get_active_element(
136 PurpleMediaManager *manager, PurpleMediaElementType type);
137
138 #ifdef __cplusplus
139 }
140 #endif
141
142 G_END_DECLS
143
144 #endif /* USE_VV */
145
146 #endif /* __MEDIA_GST_H_ */