Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
android finished
  • Loading branch information
LichKing-2234 committed Sep 27, 2020
commit d69a73db44ba1a400a89adb3641cd272f830fec1
84 changes: 48 additions & 36 deletions Annotations.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package io.agora.rtc.base;

import androidx.annotation.IntDef;
import androidx.annotation.StringDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import io.agora.rtc.Constants;
import io.agora.rtc.IMetadataObserver;
import io.agora.rtc.RtcEngineConfig;
import io.agora.rtc.video.BeautyOptions;
import io.agora.rtc.video.VideoCanvas;

@SuppressWarnings("deprecation")
public class Annotations {

@IntDef({
AgoraRtcAppType.NATIVE,
AgoraRtcAppType.COCOS,
Expand Down Expand Up @@ -131,15 +130,6 @@ public class Annotations {
public @interface AgoraAudioProfile {
}

@IntDef({
Constants.RAW_AUDIO_FRAME_OP_MODE_READ_ONLY,
Constants.RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY,
Constants.RAW_AUDIO_FRAME_OP_MODE_READ_WRITE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraAudioRawFrameOperationMode {
}

@IntDef({
Constants.AUDIO_RECORDING_QUALITY_LOW,
Constants.AUDIO_RECORDING_QUALITY_MEDIUM,
Expand Down Expand Up @@ -386,16 +376,20 @@ public class Annotations {
int MAINTAIN_BALANCED = 2;
}

@StringDef({
@IntDef({
AgoraEncryptionMode.NONE,
AgoraEncryptionMode.AES128XTS,
AgoraEncryptionMode.AES256XTS,
AgoraEncryptionMode.AES128ECB,
AgoraEncryptionMode.AES256XTS,
AgoraEncryptionMode.SM4128ECB,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraEncryptionMode {
String AES128XTS = "aes-128-xts";
String AES256XTS = "aes-256-xts";
String AES128ECB = "aes-128-ecb";
int NONE = 0;
int AES128XTS = 1;
int AES128ECB = 2;
int AES256XTS = 3;
int SM4128ECB = 4;
}

@IntDef({
Expand All @@ -419,6 +413,7 @@ public class Annotations {
Constants.ERR_ALREADY_IN_USE,
Constants.ERR_INVALID_APP_ID,
Constants.ERR_INVALID_CHANNEL_NAME,
Constants.ERR_NO_SERVER_RESOURCES,
Constants.ERR_TOKEN_EXPIRED,
Constants.ERR_INVALID_TOKEN,
Constants.ERR_CONNECTION_INTERRUPTED,
Expand Down Expand Up @@ -543,24 +538,6 @@ public class Annotations {
public @interface AgoraLogFilter {
}

@IntDef({
Constants.MEDIA_TYPE_NONE,
Constants.MEDIA_TYPE_AUDIO_ONLY,
Constants.MEDIA_TYPE_VIDEO_ONLY,
Constants.MEDIA_TYPE_AUDIO_AND_VIDEO,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraMediaType {
}

@IntDef({
IMetadataObserver.UNKNOWN_METADATA,
IMetadataObserver.VIDEO_METADATA,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraMetadataType {
}

@IntDef({
Constants.QUALITY_UNKNOWN,
Constants.QUALITY_EXCELLENT,
Expand Down Expand Up @@ -766,15 +743,50 @@ public class Annotations {
Constants.WARN_ADM_RUNTIME_PLAYOUT_WARNING,
Constants.WARN_ADM_RUNTIME_RECORDING_WARNING,
Constants.WARN_ADM_RECORD_AUDIO_SILENCE,
Constants.WARN_ADM_PLAYOUT_ABNORMAL_FREQUENCY,
Constants.WARN_ADM_RECORD_ABNORMAL_FREQUENCY,
Constants.WARN_ADM_CALL_INTERRUPTION,
Constants.WARN_ADM_RECORD_AUDIO_LOWLEVEL,
Constants.WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL,
Constants.WARN_ADM_RECORD_IS_OCCUPIED,
Constants.WARN_APM_HOWLING,
Constants.WARN_ADM_GLITCH_STATE,
Constants.WARN_ADM_IMPROPER_SETTINGS,
Constants.WARN_APM_RESIDUAL_ECHO,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraWarningCode {
}

@IntDef({
RtcEngineConfig.AreaCode.AREA_CODE_CN,
RtcEngineConfig.AreaCode.AREA_CODE_NA,
RtcEngineConfig.AreaCode.AREA_CODE_EU,
RtcEngineConfig.AreaCode.AREA_CODE_AS,
RtcEngineConfig.AreaCode.AREA_CODE_JP,
RtcEngineConfig.AreaCode.AREA_CODE_IN,
RtcEngineConfig.AreaCode.AREA_CODE_GLOB,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraAreaCode {
}

@IntDef({
Constants.SUB_STATE_IDLE,
Constants.SUB_STATE_NO_SUBSCRIBED,
Constants.SUB_STATE_SUBSCRIBING,
Constants.SUB_STATE_SUBSCRIBED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraStreamSubscribeState {
}

@IntDef({
Constants.PUB_STATE_IDLE,
Constants.PUB_STATE_NO_PUBLISHED,
Constants.PUB_STATE_PUBLISHING,
Constants.PUB_STATE_PUBLISHED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraStreamPublishState {
}
}
8 changes: 8 additions & 0 deletions BeanCovertor.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.agora.rtc.base

import android.graphics.Color
import io.agora.rtc.internal.EncryptionConfig
import io.agora.rtc.internal.LastmileProbeConfig
import io.agora.rtc.live.LiveInjectStreamConfig
import io.agora.rtc.live.LiveTranscoding
Expand Down Expand Up @@ -169,3 +170,10 @@ fun mapToChannelMediaOptions(map: Map<*, *>): ChannelMediaOptions {
(map["autoSubscribeVideo"] as? Boolean)?.let { autoSubscribeVideo = it }
}
}

fun mapToEncryptionConfig(map: Map<*, *>): EncryptionConfig {
return EncryptionConfig().apply {
(map["encryptionMode"] as? Number)?.let { encryptionMode = intToEncryptionMode(it.toInt()) }
(map["encryptionKey"] as? String)?.let { encryptionKey = it }
}
}
10 changes: 10 additions & 0 deletions EnumCovertor.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.agora.rtc.base

import io.agora.rtc.internal.EncryptionConfig
import io.agora.rtc.live.LiveInjectStreamConfig
import io.agora.rtc.live.LiveTranscoding
import io.agora.rtc.video.CameraCapturerConfiguration
Expand Down Expand Up @@ -85,3 +86,12 @@ fun intToCameraDirection(@Annotations.AgoraCameraDirection intValue: Int): Camer
}
throw RuntimeException("CameraCapturerConfiguration.CAMERA_DIRECTION not contains $intValue")
}

fun intToEncryptionMode(@Annotations.AgoraEncryptionMode intValue: Int): EncryptionConfig.EncryptionMode {
for (value in EncryptionConfig.EncryptionMode.values()) {
if (value.value == intValue) {
return value
}
}
throw RuntimeException("EncryptionConfig.EncryptionMode not contains $intValue")
}
Loading