f9c0a6a0c63a296424b89cabaa1df5ea0c7c3f5e
[platform/upstream/gstreamer.git] / webrtc / android / app / src / main / java / org / freedesktop / gstreamer / WebRTC.java
1 /* GStreamer
2  *
3  * Copyright (C) 2014-2015 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 package org.freedesktop.gstreamer;
22
23 import java.io.Closeable;
24 import android.view.Surface;
25 import android.content.Context;
26 import org.freedesktop.gstreamer.GStreamer;
27
28 public class WebRTC implements Closeable {
29     private static native void nativeClassInit();
30     public static void init(Context context) throws Exception {
31         System.loadLibrary("gstreamer_android");
32         GStreamer.init(context);
33
34         System.loadLibrary("gstwebrtc");
35         nativeClassInit();
36     }
37
38     private long native_webrtc;
39     private native void nativeNew();
40     public WebRTC() {
41         nativeNew();
42     }
43
44     private native void nativeFree();
45     @Override
46     public void close() {
47         nativeFree();
48     }
49
50     private Surface surface;
51     private native void nativeSetSurface(Surface surface);
52     public void setSurface(Surface surface) {
53         this.surface = surface;
54         nativeSetSurface(surface);
55     }
56
57     public Surface getSurface() {
58         return surface;
59     }
60
61     private String signallingServer;
62     private native void nativeSetSignallingServer(String server);
63     public void setSignallingServer(String server) {
64         this.signallingServer = server;
65         nativeSetSignallingServer(server);
66     }
67
68     public String getSignallingServer() {
69         return this.signallingServer;
70     }
71
72     private String callID;
73     private native void nativeSetCallID(String ID);
74     public void setCallID(String ID) {
75         this.callID = ID;
76         nativeSetCallID(ID);
77     }
78
79     public String getCallID() {
80         return this.callID;
81     }
82
83     private native void nativeCallOtherParty();
84     public void callOtherParty() {
85         nativeCallOtherParty();
86     }
87
88     private native void nativeEndCall();
89     public void endCall() {
90         nativeEndCall();
91     }
92 }