aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jitsimeet/SSRCInfoPacketExtension.java
blob: 239c708bcd86d2563c0eeffa3423854a77800f4c (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
/*
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.protocol.jabber.extensions.jitsimeet;

import net.java.sip.communicator.impl.protocol.jabber.extensions.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.colibri.*;

import java.lang.*;

/**
 * Packet extension is used to signal owner of media SSRC in jitsi-meet. Owner
 * attribute stores MUC JID of the user to whom it belongs. This extension is
 * inserted as a child of {@link SourcePacketExtension} in 'session-initiate',
 * 'source-add' and 'source-remove' Jingle IQs sent by the focus(Jicofo).
 *
 * @author Pawel Domas
 */
public class SSRCInfoPacketExtension
    extends AbstractPacketExtension
{
    /**
     * XML namespace of this packets extension.
     */
    public static final java.lang.String NAMESPACE = "http://jitsi.org/jitmeet";

    /**
     * XML element name of this packets extension.
     */
    public static final String ELEMENT_NAME = "ssrc-info";

    /**
     * Attribute stores owner JID of parent {@link SourcePacketExtension}.
     */
    public static final String OWNER_ATTR_NAME = "owner";

    /**
     * Attribute stores the type of video SSRC. Can be
     * {@link #CAMERA_VIDEO_TYPE} or {@link #SCREEN_VIDEO_TYPE}.
     */
    public static final String VIDEO_TYPE_ATTR_NAME = "video-type";

    /**
     * Camera video type constant. Inidcates that the user is sending his camera
     * video.
     */
    public static final String CAMERA_VIDEO_TYPE = "camera";

    /**
     * Screen video type constant. Indicates that the user is sharing his
     * screen.
     */
    public static final String SCREEN_VIDEO_TYPE = "screen";

    /**
     * Creates new instance of <tt>SSRCInfoPacketExtension</tt>.
     */
    public SSRCInfoPacketExtension()
    {
        super(NAMESPACE, ELEMENT_NAME);
    }

    /**
     * Returns the value of {@link #OWNER_ATTR_NAME}.
     *
     * @return MUC JID of SSRC owner stored by this instance or <tt>null</tt>
     *         if empty.
     */
    public String getOwner()
    {
        return getAttributeAsString(OWNER_ATTR_NAME);
    }

    /**
     * Sets the value of {@link #OWNER_ATTR_NAME}.
     *
     * @param owner MUC JID of SSRC owner to be stored in this packet extension.
     */
    public void setOwner(String owner)
    {
        setAttribute(OWNER_ATTR_NAME, owner);
    }

    /**
     * Returns the value of {@link #VIDEO_TYPE_ATTR_NAME}.
     * @return {@link #CAMERA_VIDEO_TYPE}, {@link #SCREEN_VIDEO_TYPE} or
     *         <tt>null</tt> if not specified or if media SSRC is not a video.
     */
    public String getVideoType()
    {
        return getAttributeAsString(VIDEO_TYPE_ATTR_NAME);
    }

    /**
     * Sets the type of video SSRC.
     * @param videoType {@link #CAMERA_VIDEO_TYPE}, {@link #SCREEN_VIDEO_TYPE}
     *        or <tt>null</tt> if not specified or if media SSRC is not a video.
     */
    public void setVideoType(String videoType)
    {
        setAttribute(VIDEO_TYPE_ATTR_NAME, videoType);
    }
}