summaryrefslogtreecommitdiff
path: root/telepathy-farstream/stream.h
blob: 9cf639cafffc3343435716d6b2cf7f67c53e5c23 (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
#ifndef __TF_STREAM_H__
#define __TF_STREAM_H__

#include <glib-object.h>
#include <telepathy-glib/telepathy-glib.h>

#include <farstream/fs-conference.h>

G_BEGIN_DECLS

#define TF_TYPE_STREAM tf_stream_get_type()

#define TF_STREAM(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
  TF_TYPE_STREAM, TfStream))

#define TF_STREAM_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST ((klass), \
  TF_TYPE_STREAM, TfStreamClass))

#define TF_IS_STREAM(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
  TF_TYPE_STREAM))

#define TF_IS_STREAM_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
  TF_TYPE_STREAM))

#define TF_STREAM_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
  TF_TYPE_STREAM, TfStreamClass))

/**
 * TfStream:
 *
 * All members are privated
 */

typedef struct _TfStream TfStream;

/**
 * TfStreamClass:
 *
 * This class is not subclassable
 */

typedef struct _TfStreamClass TfStreamClass;

GType tf_stream_get_type (void);

guint tf_stream_get_id (TfStream *stream);

void tf_stream_error (TfStream *self,
  TpMediaStreamError error,
  const gchar *message);


typedef struct _TfStreamPrivate TfStreamPrivate;

/*
 * TfStream:
 * @parent: the parent #GObject
 * @stream_id: the ID of the stream (READ-ONLY)
 *
 * All other members are privated
 */

struct _TfStream {
  GObject parent;

  /* Read-only */
  guint stream_id;

  /*< private >*/

  TfStreamPrivate *priv;
};

/*
 * TfStreamClass:
 * @parent_class: the parent #GObjecClass
 *
 * There are no overridable functions
 */

struct _TfStreamClass {
  GObjectClass parent_class;

  /*< private >*/

  gpointer unused[4];
};


typedef struct {
  gchar *nat_traversal;
  gchar *stun_server;
  guint16 stun_port;
  gchar *relay_token;
} TfNatProperties;

typedef void (NewStreamCreatedCb) (TfStream *stream, gpointer channel);

TfStream *
_tf_stream_new (gpointer channel,
    FsConference *conference,
    FsParticipant *participant,
    TpMediaStreamHandler *proxy,
    guint stream_id,
    TpMediaStreamType media_type,
    TpMediaStreamDirection direction,
    TfNatProperties *nat_props,
    GList *local_codecs_config,
    NewStreamCreatedCb new_stream_created_cb);

gboolean _tf_stream_bus_message (TfStream *stream,
    GstMessage *message);

void _tf_stream_try_sending_codecs (TfStream *stream);

TpMediaStreamError fserror_to_tperror (GError *error);



G_END_DECLS

#endif /* __TF_STREAM_H__ */