aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0167_jingle_rtp/stream.vala
blob: 62d85decb5c48f21d711790bc33cdccaa92a0326 (plain) (blame)
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
public abstract class Xmpp.Xep.JingleRtp.Stream : Object {
    public Jingle.Content content { get; protected set; }
    public string name { get {
        return content.content_name;
    }}
    public string? media { get {
        var content_params = content.content_params;
        if (content_params is Parameters) {
            return ((Parameters)content_params).media;
        }
        return null;
    }}
    public JingleRtp.PayloadType? payload_type { get {
        var content_params = content.content_params;
        if (content_params is Parameters) {
            return ((Parameters)content_params).agreed_payload_type;
        }
        return null;
    }}
    public bool sending { get {
        return content.session.senders_include_us(content.senders);
    }}
    public bool receiving { get {
        return content.session.senders_include_counterpart(content.senders);
    }}

    protected Stream(Jingle.Content content) {
        this.content = content;
    }

    public signal void on_send_rtp_data(Bytes bytes);
    public signal void on_send_rtcp_data(Bytes bytes);

    public abstract void on_recv_rtp_data(Bytes bytes);
    public abstract void on_recv_rtcp_data(Bytes bytes);

    public abstract void on_rtp_ready();
    public abstract void on_rtcp_ready();

    public abstract void create();
    public abstract void destroy();

    public string to_string() {
        return @"$name/$media stream in $(content.session.sid)";
    }
}