aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0167_jingle_rtp/stream.vala
blob: adae11f5df0fdc125363faeba1633ca0cbd1eda6 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 JingleRtp.Crypto? local_crypto { get {
        var content_params = content.content_params;
        if (content_params is Parameters) {
            return ((Parameters)content_params).local_crypto;
        }
        return null;
    }}
    public JingleRtp.Crypto? remote_crypto { get {
        var content_params = content.content_params;
        if (content_params is Parameters) {
            return ((Parameters)content_params).remote_crypto;
        }
        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);
    }}
    public bool rtcp_mux { get {
        var content_params = content.content_params;
        if (content_params is Parameters) {
            return ((Parameters)content_params).rtcp_mux;
        }
        return false;
    }}

    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)";
    }
}