提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* 语音编码类型 |
|
5 |
* |
|
6 |
* @author 47040 |
|
7 |
* @since Created at 2021/5/26 10:25 |
|
8 |
*/ |
|
9 |
public enum TALK_CODING_TYPE { |
|
10 |
|
|
11 |
NET_TALK_DEFAULT(0, "无头PCM"), |
|
12 |
NET_TALK_PCM(1, "带头PCM"), |
|
13 |
NET_TALK_G711a(2, "G711a"), |
|
14 |
NET_TALK_AMR(3, "AMR"), |
|
15 |
NET_TALK_G711u(4, "G711u"), |
|
16 |
NET_TALK_G726(5, "G726"), |
|
17 |
NET_TALK_G723_53(6, "G723_53"), |
|
18 |
NET_TALK_G723_63(7, "G723_63"), |
|
19 |
NET_TALK_AAC(8, "AAC"), |
|
20 |
NET_TALK_OGG(9, "OGG"), |
|
21 |
NET_TALK_G729(10, "G729"), |
|
22 |
NET_TALK_MPEG2(11, "MPEG2"), |
|
23 |
NET_TALK_MPEG2_Layer2(12, "MPEG2-Layer2"), |
|
24 |
NET_TALK_G722_1(13, "G.722.1"), |
|
25 |
NET_TALK_ADPCM(21, "ADPCM"), |
|
26 |
NET_TALK_MP3(22, "MP3"); |
|
27 |
|
|
28 |
private final int value; |
|
29 |
private final String note; |
|
30 |
|
|
31 |
TALK_CODING_TYPE(int givenValue, String note) { |
|
32 |
this.value = givenValue; |
|
33 |
this.note = note; |
|
34 |
} |
|
35 |
|
|
36 |
public String getNote() { |
|
37 |
return note; |
|
38 |
} |
|
39 |
|
|
40 |
public int getValue() { |
|
41 |
return value; |
|
42 |
} |
|
43 |
|
|
44 |
public static String getNoteByValue(int givenValue) { |
|
45 |
for (TALK_CODING_TYPE enumType : TALK_CODING_TYPE.values()) { |
|
46 |
if (givenValue == enumType.getValue()) { |
|
47 |
return enumType.getNote(); |
|
48 |
} |
|
49 |
} |
|
50 |
return null; |
|
51 |
} |
|
52 |
|
|
53 |
public static int getValueByNote(String givenNote) { |
|
54 |
for (TALK_CODING_TYPE enumType : TALK_CODING_TYPE.values()) { |
|
55 |
if (givenNote.equals(enumType.getNote())) { |
|
56 |
return enumType.getValue(); |
|
57 |
} |
|
58 |
} |
|
59 |
return -1; |
|
60 |
} |
|
61 |
|
|
62 |
public static TALK_CODING_TYPE getEnum(int value) { |
|
63 |
for (TALK_CODING_TYPE e : TALK_CODING_TYPE.values()) { |
|
64 |
if (e.getValue() == value) |
|
65 |
return e; |
|
66 |
} |
|
67 |
return TALK_CODING_TYPE.NET_TALK_DEFAULT; |
|
68 |
} |
|
69 |
} |