summaryrefslogtreecommitdiff
path: root/farstream/fs-conference.h
blob: e13c46e6d05b31565be5376d9763abeedca3f81e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
 * Farstream - FsConference Class
 *
 * Copyright 2007 Collabora Ltd.
 *  @author: Philippe Kalaf <philippe.kalaf@collabora.co.uk>
 * Copyright 2007 Nokia Corp.
 *
 * fs-conference.h - Header file for farstream Conference base class
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 */

#ifndef __FS_CONFERENCE_H__
#define __FS_CONFERENCE_H__

#include <gst/gst.h>

#include <farstream/fs-session.h>
#include <farstream/fs-codec.h>
#include <farstream/fs-enumtypes.h>

G_BEGIN_DECLS


#define FS_TYPE_CONFERENCE \
  (fs_conference_get_type ())
#define FS_CONFERENCE(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj),FS_TYPE_CONFERENCE,FsConference))
#define FS_CONFERENCE_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass),FS_TYPE_CONFERENCE,FsConferenceClass))
#define FS_CONFERENCE_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS((obj),FS_TYPE_CONFERENCE,FsConferenceClass))
#define FS_IS_CONFERENCE(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),FS_TYPE_CONFERENCE))
#define FS_IS_CONFERENCE_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass),FS_TYPE_CONFERENCE))
#define FS_CONFERENCE_CAST(obj) \
  ((FsConference *)(obj))

/**
 * FsConference:
 *
 * Opaque #FsConference data structure.
 */
typedef struct _FsConference FsConference;
typedef struct _FsConferenceClass FsConferenceClass;

/**
 * FsConference
 *
 * The #FsConference structure, all the members are private
 */

struct _FsConference
{
  GstBin parent;

  /*< private >*/

  gpointer _padding[8];
};


/**
 * FsConferenceClass:
 * @parent: parent GstBin class
 * @new_session: virtual method to create a new conference session
 * @new_participant: virtual method to create a new participant
 *
 * #FsConferenceClass class structure.
 */
struct _FsConferenceClass {
  GstBinClass parent;

  /* virtual functions */
  FsSession *(* new_session) (FsConference *conference, FsMediaType media_type,
                              GError **error);

  FsParticipant *(* new_participant) (FsConference *conference,
      GError **error);

  /*< private > */
  gpointer _gst_reserved[GST_PADDING];
};

GType fs_conference_get_type (void);



/**
 * FsError:
 * @FS_ERROR_CONSTRUCTION: Error constructing some of the sub-elements, this
 * probably denotes an error in the installation of the gstreamer elements.
 * It is a fatal error.
 * @FS_ERROR_INVALID_ARGUMENTS: Invalid arguments to the function, this
 * is a programming error and should not be reported to the user
 * @FS_ERROR_INTERNAL: An internal error happened in Farstream, it may be in
 * an inconsistent state. The object from which this error comes should be
 * discarded.
 * @FS_ERROR_NETWORK: A network related error, this should probably be
 *  reported to the user.
 * @FS_ERROR_NOT_IMPLEMENTED: The optional functionality is not implemented by
 * this plugin.
 * @FS_ERROR_NEGOTIATION_FAILED: The codec negotiation has failed, this means
 * that there are no common codecs between the local and remote codecs.
 * @FS_ERROR_UNKNOWN_CODEC: Data is received on an unknown codec, this most
 * likely denotes an error on the remote side, the buffers will be ignored.
 * It can safely be ignored in most cases (but may result in a call with no
 * media received).
 * @FS_ERROR_NO_CODECS: There are no codecs detected for that media type.
 * @FS_ERROR_NO_CODECS_LEFT: All of the codecs have been disabled by the
 * codec preferences, one should try less strict codec preferences.
 * @FS_ERROR_CONNECTION_FAILED: Could not connect to the to remote party.
 * @FS_ERROR_DISPOSED: The object has been disposed.
 * @FS_ERROR_ALREADY_EXISTS: The object already exists
 *
 * This is the enum of error numbers that will come either on the "error"
 * signal, from the Gst Bus or for error in the FS_ERROR domain in GErrors
 */

typedef enum _FsError
{
  FS_ERROR_CONSTRUCTION = 1,
  FS_ERROR_INTERNAL,
  FS_ERROR_INVALID_ARGUMENTS = 100,
  FS_ERROR_NETWORK,
  FS_ERROR_NOT_IMPLEMENTED,
  FS_ERROR_NEGOTIATION_FAILED,
  FS_ERROR_UNKNOWN_CODEC,
  FS_ERROR_NO_CODECS,
  FS_ERROR_NO_CODECS_LEFT,
  FS_ERROR_CONNECTION_FAILED,
  FS_ERROR_DISPOSED,
  FS_ERROR_ALREADY_EXISTS
} FsError;

/**
 * FS_ERROR:
 *
 * This quark is used to denote errors coming from Farstream objects
 */

#define FS_ERROR (fs_error_quark ())

/**
 * FS_ERROR_IS_FATAL:
 * @error: a #FsError
 *
 * Tells the programmer if an error if fatal or not, if it returns %TRUE,
 * the error is fatal, and the object that created it should
 * be discarded. It returns %FALSE otherwise.
 */

#define FS_ERROR_IS_FATAL(error) \
  (error < 100)

GQuark fs_error_quark (void);

/* virtual class function wrappers */
FsSession *fs_conference_new_session (FsConference *conference,
                                      FsMediaType media_type,
                                      GError **error);

FsParticipant *fs_conference_new_participant (FsConference *conference,
    GError **error);

gboolean fs_parse_error (GObject *object,
    GstMessage *message,
    FsError *error,
    const gchar **error_msg);



G_END_DECLS

#endif /* __FS_CONFERENCE_H__ */