Skip to content

Commit 1d9dba3

Browse files
committed
feat: Add conferences to native java bindings.
1 parent aa235fa commit 1d9dba3

File tree

188 files changed

+7683
-1641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+7683
-1641
lines changed

.restyled.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ exclude:
33
- "gradlew"
44
- "**/*.cpp"
55
- "**/*.h"
6+
- "**/*Jni.java"

BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ kt_jvm_library(
8686
kt_jvm_test(
8787
name = "ToxCoreTest",
8888
size = "small",
89-
srcs = ["lib/src/jvmTest/java/im/tox/tox4j/core/ToxCoreTest.kt"],
89+
srcs = glob(["lib/src/jvmTest/**/*.kt"]),
9090
jvm_flags = ["-Djava.library.path=jvm-toxcore-c"],
9191
test_class = "im.tox.tox4j.core.ToxCoreTest",
9292
deps = [

lib/src/commonMain/kotlin/im/tox/tox4j/av/ToxAv.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ interface ToxAv : AutoCloseable {
6262
/**
6363
* Call a friend. This will start ringing the friend.
6464
*
65-
* It is the client's responsibility to stop ringing after a certain timeout, if such behaviour is
66-
* desired. If the client does not stop ringing, the library will not stop until the friend is
67-
* disconnected.
65+
* It is the client's responsibility to stop ringing after a certain timeout, if such behaviour
66+
* is desired. If the client does not stop ringing, the library will not stop until the friend
67+
* is disconnected.
6868
*
6969
* @param friendNumber The friend number of the friend that should be called.
7070
* @param audioBitRate Audio bit rate in Kb/sec. Set this to 0 to disable audio sending.
@@ -80,8 +80,8 @@ interface ToxAv : AutoCloseable {
8080
/**
8181
* Accept an incoming call.
8282
*
83-
* If answering fails for any reason, the call will still be pending and it is possible to try and
84-
* answer it later.
83+
* If answering fails for any reason, the call will still be pending and it is possible to try
84+
* and answer it later.
8585
*
8686
* @param friendNumber The friend number of the friend that is calling.
8787
* @param audioBitRate Audio bit rate in Kb/sec. Set this to 0 to disable audio sending.
@@ -135,10 +135,10 @@ interface ToxAv : AutoCloseable {
135135
/**
136136
* Send an audio frame to a friend.
137137
*
138-
* The expected format of the PCM data is: [s1c1][s1c2][...][s2c1][s2c2][...]... Meaning: sample 1
139-
* for channel 1, sample 1 for channel 2, ... For mono audio, this has no meaning, every sample is
140-
* subsequent. For stereo, this means the expected format is LRLRLR... with samples for left and
141-
* right alternating.
138+
* The expected format of the PCM data is: [s1c1][s1c2][...][s2c1][s2c2][...]... Meaning: sample
139+
* 1 for channel 1, sample 1 for channel 2, ... For mono audio, this has no meaning, every
140+
* sample is subsequent. For stereo, this means the expected format is LRLRLR... with samples
141+
* for left and right alternating.
142142
*
143143
* @param friendNumber The friend number of the friend to which to send an audio frame.
144144
* @param pcm An array of audio samples. The size of this array must be sample_count * channels.
@@ -161,8 +161,8 @@ interface ToxAv : AutoCloseable {
161161
/**
162162
* Send a video frame to a friend.
163163
*
164-
* Y - plane should be of size: height * width U - plane should be of size: (height/2) * (width/2)
165-
* V - plane should be of size: (height/2) * (width/2)
164+
* Y - plane should be of size: height * width U - plane should be of size: (height/2) *
165+
* (width/2) V - plane should be of size: (height/2) * (width/2)
166166
*
167167
* @param friendNumber The friend number of the friend to which to send a video frame.
168168
* @param width Width of the frame in pixels.

lib/src/commonMain/kotlin/im/tox/tox4j/av/callbacks/CallStateCallback.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import im.tox.tox4j.core.data.ToxFriendNumber
77
interface CallStateCallback<ToxCoreState> {
88
/**
99
* @param friendNumber The friend number this call state change is for.
10-
* @param callState A set of ToxCallState values comprising the new call state. Although this is a
11-
* Collection (therefore might actually be a List), this is effectively a Set. Any
10+
* @param callState A set of ToxCallState values comprising the new call state. Although this is
11+
* a Collection (therefore might actually be a List), this is effectively a Set. Any
1212
* [[ToxavFriendCallState]] value is contained exactly 0 or 1 times.
1313
*/
1414
fun callState(

lib/src/commonMain/kotlin/im/tox/tox4j/av/callbacks/VideoReceiveFrameCallback.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ interface VideoReceiveFrameCallback<ToxCoreState> {
1212
* @param height Height of the frame in pixels.
1313
* @param y Y-plane.
1414
* @param u U-plane.
15-
* @param v V-plane. The size of plane data is derived from width and height where Y = max(width,
16-
* abs(yStride)) * height U = max(width/2, abs(uStride)) * (height/2) V = max(width/2,
17-
* abs(vStride)) * (height/2).
15+
* @param v V-plane. The size of plane data is derived from width and height where Y =
16+
* max(width, abs(yStride)) * height U = max(width/2, abs(uStride)) * (height/2) V =
17+
* max(width/2, abs(vStride)) * (height/2).
1818
* @param yStride Stride length for Y-plane.
1919
* @param uStride Stride length for U-plane.
20-
* @param vStride Stride length for V-plane. Strides represent padding for each plane that may or
21-
* may not be present. You must handle strides in your image processing code. Strides are
22-
* negative if the image is bottom-up hence why you must abs() it when calculating plane buffer
23-
* size.
20+
* @param vStride Stride length for V-plane. Strides represent padding for each plane that may
21+
* or may not be present. You must handle strides in your image processing code. Strides are
22+
* negative if the image is bottom-up hence why you must abs() it when calculating plane
23+
* buffer size.
2424
*/
2525
fun videoReceiveFrame(
2626
friendNumber: ToxFriendNumber,
@@ -36,9 +36,9 @@ interface VideoReceiveFrameCallback<ToxCoreState> {
3636
): ToxCoreState = state
3737

3838
/**
39-
* An implementation may choose to keep the arrays to copy the data to around as an optimisation.
40-
* If this method does not return [[null]], the arrays in the return value are passed to
41-
* [[videoReceiveFrame]] as y, u, and v.
39+
* An implementation may choose to keep the arrays to copy the data to around as an
40+
* optimisation. If this method does not return [[null]], the arrays in the return value are
41+
* passed to [[videoReceiveFrame]] as y, u, and v.
4242
*/
4343
fun videoFrameCachedYUV(
4444
height: Height,
Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,36 @@
11
package im.tox.tox4j.av.enums
22

3-
/**
4-
* Call control.
5-
*/
3+
/** Call control. */
64
enum class ToxavCallControl {
75
/**
8-
* Resume a previously paused call. Only valid if the pause was caused by this
9-
* client, if not, this control is ignored. Not valid before the call is
10-
* accepted.
6+
* Resume a previously paused call. Only valid if the pause was caused by this client, if not,
7+
* this control is ignored. Not valid before the call is accepted.
118
*/
129
RESUME,
1310

14-
/**
15-
* Put a call on hold. Not valid before the call is accepted.
16-
*/
11+
/** Put a call on hold. Not valid before the call is accepted. */
1712
PAUSE,
1813

19-
/**
20-
* Reject a call if it was not answered, yet. Cancel a call after it was
21-
* answered.
22-
*/
14+
/** Reject a call if it was not answered, yet. Cancel a call after it was answered. */
2315
CANCEL,
2416

2517
/**
26-
* Request that the friend stops sending audio. Regardless of the friend's
27-
* compliance, this will cause the {@link
28-
* im.tox.tox4j.av.callbacks.AudioReceiveFrameCallback} event to stop being
18+
* Request that the friend stops sending audio. Regardless of the friend's compliance, this will
19+
* cause the {@link im.tox.tox4j.av.callbacks.AudioReceiveFrameCallback} event to stop being
2920
* triggered on receiving an audio frame from the friend.
3021
*/
3122
MUTE_AUDIO,
3223

33-
/**
34-
* Calling this control will notify client to start sending audio again.
35-
*/
24+
/** Calling this control will notify client to start sending audio again. */
3625
UNMUTE_AUDIO,
3726

3827
/**
39-
* Request that the friend stops sending video. Regardless of the friend's
40-
* compliance, this will cause the {@link
41-
* im.tox.tox4j.av.callbacks.VideoReceiveFrameCallback} event to stop being
28+
* Request that the friend stops sending video. Regardless of the friend's compliance, this will
29+
* cause the {@link im.tox.tox4j.av.callbacks.VideoReceiveFrameCallback} event to stop being
4230
* triggered on receiving an video frame from the friend.
4331
*/
4432
HIDE_VIDEO,
4533

46-
/**
47-
* Calling this control will notify client to start sending video again.
48-
*/
34+
/** Calling this control will notify client to start sending video again. */
4935
SHOW_VIDEO,
5036
}
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,30 @@
11
package im.tox.tox4j.av.enums
22

3-
/**
4-
* Call state graph.
5-
*/
3+
/** Call state graph. */
64
enum class ToxavFriendCallState {
75
/**
8-
* Set by the AV core if an error occurred on the remote end or if friend
9-
* timed out. This is the final state after which no more state
10-
* transitions can occur for the call. This call state will never be triggered
11-
* in combination with other call states.
6+
* Set by the AV core if an error occurred on the remote end or if friend timed out. This is the
7+
* final state after which no more state transitions can occur for the call. This call state
8+
* will never be triggered in combination with other call states.
129
*/
1310
ERROR,
1411

1512
/**
16-
* The call has finished. This is the final state after which no more state
17-
* transitions can occur for the call. This call state will never be
18-
* triggered in combination with other call states.
13+
* The call has finished. This is the final state after which no more state transitions can
14+
* occur for the call. This call state will never be triggered in combination with other call
15+
* states.
1916
*/
2017
FINISHED,
2118

22-
/**
23-
* The flag that marks that friend is sending audio.
24-
*/
19+
/** The flag that marks that friend is sending audio. */
2520
SENDING_A,
2621

27-
/**
28-
* The flag that marks that friend is sending video.
29-
*/
22+
/** The flag that marks that friend is sending video. */
3023
SENDING_V,
3124

32-
/**
33-
* The flag that marks that friend is receiving audio.
34-
*/
25+
/** The flag that marks that friend is receiving audio. */
3526
ACCEPTING_A,
3627

37-
/**
38-
* The flag that marks that friend is receiving video.
39-
*/
28+
/** The flag that marks that friend is receiving video. */
4029
ACCEPTING_V,
4130
}

lib/src/commonMain/kotlin/im/tox/tox4j/av/exceptions/ToxavAnswerException.kt

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,26 @@ import im.tox.tox4j.exceptions.ToxException
44

55
class ToxavAnswerException : ToxException {
66
enum class Code {
7-
/**
8-
* Failed to initialise codecs for call session.
9-
*/
7+
/** Failed to initialise codecs for call session. */
108
CODEC_INITIALIZATION,
119

1210
/**
13-
* The friend was valid, but they are not currently trying to initiate a call.
14-
* This is also returned if this client is already in a call with the friend.
11+
* The friend was valid, but they are not currently trying to initiate a call. This is also
12+
* returned if this client is already in a call with the friend.
1513
*/
1614
FRIEND_NOT_CALLING,
1715

18-
/**
19-
* The friend number did not designate a valid friend.
20-
*/
16+
/** The friend number did not designate a valid friend. */
2117
FRIEND_NOT_FOUND,
2218

23-
/**
24-
* Audio or video bit rate is invalid.
25-
*/
19+
/** Audio or video bit rate is invalid. */
2620
INVALID_BIT_RATE,
2721

28-
/**
29-
* Synchronization error occurred.
30-
*/
22+
/** Synchronization error occurred. */
3123
SYNC,
3224
}
3325

3426
constructor(code: Code) : this(code, "")
27+
3528
constructor(code: Code, message: String) : super(code, message)
3629
}

lib/src/commonMain/kotlin/im/tox/tox4j/av/exceptions/ToxavBitRateSetException.kt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,20 @@ import im.tox.tox4j.exceptions.ToxException
44

55
class ToxavBitRateSetException : ToxException {
66
enum class Code {
7-
/**
8-
* The friend_number passed did not designate a valid friend.
9-
*/
7+
/** The friend_number passed did not designate a valid friend. */
108
FRIEND_NOT_FOUND,
119

12-
/**
13-
* This client is currently not in a call with the friend.
14-
*/
10+
/** This client is currently not in a call with the friend. */
1511
FRIEND_NOT_IN_CALL,
1612

17-
/**
18-
* The bit rate passed was not one of the supported values.
19-
*/
13+
/** The bit rate passed was not one of the supported values. */
2014
INVALID_BIT_RATE,
2115

22-
/**
23-
* Synchronization error occurred.
24-
*/
16+
/** Synchronization error occurred. */
2517
SYNC,
2618
}
2719

2820
constructor(code: Code) : this(code, "")
21+
2922
constructor(code: Code, message: String) : super(code, message)
3023
}

lib/src/commonMain/kotlin/im/tox/tox4j/av/exceptions/ToxavCallControlException.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,26 @@ import im.tox.tox4j.exceptions.ToxException
44

55
class ToxavCallControlException : ToxException {
66
enum class Code {
7-
/**
8-
* The friend number did not designate a valid friend.
9-
*/
7+
/** The friend number did not designate a valid friend. */
108
FRIEND_NOT_FOUND,
119

1210
/**
13-
* This client is currently not in a call with the friend. Before the call is
14-
* answered, only CANCEL is a valid control
11+
* This client is currently not in a call with the friend. Before the call is answered, only
12+
* CANCEL is a valid control
1513
*/
1614
FRIEND_NOT_IN_CALL,
1715

1816
/**
19-
* Happens if user tried to pause an already paused call or if trying to
20-
* resume a call that is not paused.
17+
* Happens if user tried to pause an already paused call or if trying to resume a call that
18+
* is not paused.
2119
*/
2220
INVALID_TRANSITION,
2321

24-
/**
25-
* Synchronization error occurred.
26-
*/
22+
/** Synchronization error occurred. */
2723
SYNC,
2824
}
2925

3026
constructor(code: Code) : this(code, "")
27+
3128
constructor(code: Code, message: String) : super(code, message)
3229
}

0 commit comments

Comments
 (0)