|
zacw@1759
|
1 |
/** |
|
zacw@1759
|
2 |
* @file media-gst.h Media API |
|
zacw@1759
|
3 |
* @ingroup core |
|
zacw@1759
|
4 |
*/ |
|
zacw@1759
|
5 |
|
|
zacw@1759
|
6 |
/* purple |
|
zacw@1759
|
7 |
* |
|
zacw@1759
|
8 |
* Purple is the legal property of its developers, whose names are too numerous |
|
zacw@1759
|
9 |
* to list here. Please refer to the COPYRIGHT file distributed with this |
|
zacw@1759
|
10 |
* source distribution. |
|
zacw@1759
|
11 |
* |
|
zacw@1759
|
12 |
* This program is free software; you can redistribute it and/or modify |
|
zacw@1759
|
13 |
* it under the terms of the GNU General Public License as published by |
|
zacw@1759
|
14 |
* the Free Software Foundation; either version 2 of the License, or |
|
zacw@1759
|
15 |
* (at your option) any later version. |
|
zacw@1759
|
16 |
* |
|
zacw@1759
|
17 |
* This program is distributed in the hope that it will be useful, |
|
zacw@1759
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
zacw@1759
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
zacw@1759
|
20 |
* GNU General Public License for more details. |
|
zacw@1759
|
21 |
* |
|
zacw@1759
|
22 |
* You should have received a copy of the GNU General Public License |
|
zacw@1759
|
23 |
* along with this program; if not, write to the Free Software |
|
zacw@1759
|
24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
zacw@1759
|
25 |
*/ |
|
zacw@1759
|
26 |
|
|
zacw@1759
|
27 |
#ifndef _PURPLE_MEDIA_GST_H_ |
|
zacw@1759
|
28 |
#define _PURPLE_MEDIA_GST_H_ |
|
zacw@1759
|
29 |
|
|
zacw@1759
|
30 |
#include "media.h" |
|
zacw@1759
|
31 |
#include "mediamanager.h" |
|
zacw@1759
|
32 |
|
|
zacw@1759
|
33 |
#include <gst/gst.h> |
|
zacw@1759
|
34 |
|
|
zacw@1759
|
35 |
G_BEGIN_DECLS |
|
zacw@1759
|
36 |
|
|
zacw@1759
|
37 |
#define PURPLE_TYPE_MEDIA_ELEMENT_TYPE (purple_media_element_type_get_type()) |
|
zacw@1759
|
38 |
#define PURPLE_TYPE_MEDIA_ELEMENT_INFO (purple_media_element_info_get_type()) |
|
zacw@1759
|
39 |
#define PURPLE_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) |
|
zacw@1759
|
40 |
#define PURPLE_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) |
|
zacw@1759
|
41 |
#define PURPLE_IS_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO)) |
|
zacw@1759
|
42 |
#define PURPLE_IS_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO)) |
|
zacw@1759
|
43 |
#define PURPLE_MEDIA_ELEMENT_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) |
|
zacw@1759
|
44 |
|
|
zacw@1759
|
45 |
/** @copydoc _PurpleMediaElementInfo */ |
|
zacw@1759
|
46 |
typedef struct _PurpleMediaElementInfo PurpleMediaElementInfo; |
|
zacw@1759
|
47 |
typedef struct _PurpleMediaElementInfoClass PurpleMediaElementInfoClass; |
|
zacw@1759
|
48 |
typedef GstElement *(*PurpleMediaElementCreateCallback)(PurpleMedia *media, |
|
zacw@1759
|
49 |
const gchar *session_id, const gchar *participant); |
|
zacw@1759
|
50 |
|
|
zacw@1759
|
51 |
typedef enum { |
|
zacw@1759
|
52 |
PURPLE_MEDIA_ELEMENT_NONE = 0, /** empty element */ |
|
zacw@1759
|
53 |
PURPLE_MEDIA_ELEMENT_AUDIO = 1, /** supports audio */ |
|
zacw@1759
|
54 |
PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1, /** supports video */ |
|
zacw@1759
|
55 |
PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO |
|
zacw@1759
|
56 |
| PURPLE_MEDIA_ELEMENT_VIDEO, /** supports audio and video */ |
|
zacw@1759
|
57 |
|
|
zacw@1759
|
58 |
PURPLE_MEDIA_ELEMENT_NO_SRCS = 0, /** has no src pads */ |
|
zacw@1759
|
59 |
PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2, /** has one src pad */ |
|
zacw@1759
|
60 |
PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, /** has multiple src pads */ |
|
zacw@1759
|
61 |
PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, /** src pads must be requested */ |
|
zacw@1759
|
62 |
|
|
zacw@1759
|
63 |
PURPLE_MEDIA_ELEMENT_NO_SINKS = 0, /** has no sink pads */ |
|
zacw@1759
|
64 |
PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, /** has one sink pad */ |
|
zacw@1759
|
65 |
PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, /** has multiple sink pads */ |
|
zacw@1759
|
66 |
PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, /** sink pads must be requested */ |
|
zacw@1759
|
67 |
|
|
zacw@1759
|
68 |
PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8, /** This element is unique and |
|
zacw@1759
|
69 |
only one instance of it should |
|
zacw@1759
|
70 |
be created at a time */ |
|
zacw@1759
|
71 |
|
|
zacw@1759
|
72 |
PURPLE_MEDIA_ELEMENT_SRC = 1 << 9, /** can be set as an active src */ |
|
zacw@1759
|
73 |
PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /** can be set as an active sink */ |
|
zacw@1759
|
74 |
} PurpleMediaElementType; |
|
zacw@1759
|
75 |
|
|
zacw@1759
|
76 |
#ifdef __cplusplus |
|
zacw@1759
|
77 |
extern "C" { |
|
zacw@1759
|
78 |
#endif |
|
zacw@1759
|
79 |
|
|
zacw@1759
|
80 |
/** |
|
zacw@1759
|
81 |
* Gets the element type's GType. |
|
zacw@1759
|
82 |
* |
|
zacw@1759
|
83 |
* @return The element type's GType. |
|
zacw@1759
|
84 |
* |
|
zacw@1759
|
85 |
* @since 2.6.0 |
|
zacw@1759
|
86 |
*/ |
|
zacw@1759
|
87 |
GType purple_media_element_type_get_type(void); |
|
zacw@1759
|
88 |
|
|
zacw@1759
|
89 |
/** |
|
zacw@1759
|
90 |
* Gets the element info's GType. |
|
zacw@1759
|
91 |
* |
|
zacw@1759
|
92 |
* @return The element info's GType. |
|
zacw@1759
|
93 |
* |
|
zacw@1759
|
94 |
* @since 2.6.0 |
|
zacw@1759
|
95 |
*/ |
|
zacw@1759
|
96 |
GType purple_media_element_info_get_type(void); |
|
zacw@1759
|
97 |
|
|
zacw@1759
|
98 |
/** |
|
zacw@1759
|
99 |
* Gets the source from a session |
|
zacw@1759
|
100 |
* |
|
zacw@1759
|
101 |
* @param media The media object the session is in. |
|
zacw@1759
|
102 |
* @param sess_id The session id of the session to get the source from. |
|
zacw@1759
|
103 |
* |
|
zacw@1759
|
104 |
* @return The source retrieved. |
|
zacw@1759
|
105 |
* |
|
zacw@1759
|
106 |
* @since 2.6.0 |
|
zacw@1759
|
107 |
*/ |
|
zacw@1759
|
108 |
GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id); |
|
zacw@1759
|
109 |
|
|
zacw@1759
|
110 |
/** |
|
zacw@1759
|
111 |
* Gets the tee from a given session/stream. |
|
zacw@1759
|
112 |
* |
|
zacw@1759
|
113 |
* @param media The instance to get the tee from. |
|
zacw@1759
|
114 |
* @param session_id The id of the session to get the tee from. |
|
zacw@1759
|
115 |
* @param participant Optionally, the participant of the stream to get the tee from. |
|
zacw@1759
|
116 |
* |
|
zacw@1759
|
117 |
* @return The GstTee element from the chosen session/stream. |
|
zacw@1759
|
118 |
* |
|
zacw@1759
|
119 |
* @since 2.6.0 |
|
zacw@1759
|
120 |
*/ |
|
zacw@1759
|
121 |
GstElement *purple_media_get_tee(PurpleMedia *media, |
|
zacw@1759
|
122 |
const gchar *session_id, const gchar *participant); |
|
zacw@1759
|
123 |
|
|
zacw@1759
|
124 |
|
|
zacw@1759
|
125 |
/** |
|
zacw@1759
|
126 |
* Gets the pipeline from the media manager. |
|
zacw@1759
|
127 |
* |
|
zacw@1759
|
128 |
* @param manager The media manager to get the pipeline from. |
|
zacw@1759
|
129 |
* |
|
zacw@1759
|
130 |
* @return The pipeline. |
|
zacw@1759
|
131 |
* |
|
zacw@1759
|
132 |
* @since 2.6.0 |
|
zacw@1759
|
133 |
*/ |
|
zacw@1759
|
134 |
GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager); |
|
zacw@1759
|
135 |
|
|
zacw@1759
|
136 |
/** |
|
zacw@1759
|
137 |
* Returns a GStreamer source or sink for audio or video. |
|
zacw@1759
|
138 |
* |
|
zacw@1759
|
139 |
* @param manager The media manager to use to obtain the source/sink. |
|
zacw@1759
|
140 |
* @param type The type of source/sink to get. |
|
zacw@1759
|
141 |
* |
|
zacw@1759
|
142 |
* @since 2.6.0 |
|
zacw@1759
|
143 |
*/ |
|
zacw@1759
|
144 |
GstElement *purple_media_manager_get_element(PurpleMediaManager *manager, |
|
zacw@1759
|
145 |
PurpleMediaSessionType type, PurpleMedia *media, |
|
zacw@1759
|
146 |
const gchar *session_id, const gchar *participant); |
|
zacw@1759
|
147 |
|
|
zacw@1759
|
148 |
PurpleMediaElementInfo *purple_media_manager_get_element_info( |
|
zacw@1759
|
149 |
PurpleMediaManager *manager, const gchar *name); |
|
zacw@1759
|
150 |
gboolean purple_media_manager_register_element(PurpleMediaManager *manager, |
|
zacw@1759
|
151 |
PurpleMediaElementInfo *info); |
|
zacw@1759
|
152 |
gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager, |
|
zacw@1759
|
153 |
const gchar *name); |
|
zacw@1759
|
154 |
gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager, |
|
zacw@1759
|
155 |
PurpleMediaElementInfo *info); |
|
zacw@1759
|
156 |
PurpleMediaElementInfo *purple_media_manager_get_active_element( |
|
zacw@1759
|
157 |
PurpleMediaManager *manager, PurpleMediaElementType type); |
|
zacw@1759
|
158 |
|
|
zacw@1759
|
159 |
gchar *purple_media_element_info_get_id(PurpleMediaElementInfo *info); |
|
zacw@1759
|
160 |
gchar *purple_media_element_info_get_name(PurpleMediaElementInfo *info); |
|
zacw@1759
|
161 |
PurpleMediaElementType purple_media_element_info_get_element_type( |
|
zacw@1759
|
162 |
PurpleMediaElementInfo *info); |
|
zacw@1759
|
163 |
GstElement *purple_media_element_info_call_create( |
|
zacw@1759
|
164 |
PurpleMediaElementInfo *info, PurpleMedia *media, |
|
zacw@1759
|
165 |
const gchar *session_id, const gchar *participant); |
|
zacw@1759
|
166 |
|
|
zacw@1759
|
167 |
#ifdef __cplusplus |
|
zacw@1759
|
168 |
} |
|
zacw@1759
|
169 |
#endif |
|
zacw@1759
|
170 |
|
|
zacw@1759
|
171 |
G_END_DECLS |
|
zacw@1759
|
172 |
|
|
zacw@1759
|
173 |
#endif /* _PURPLE_MEDIA_GST_H_ */ |