-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMediaCodecInfoWrapper.java
More file actions
69 lines (55 loc) · 1.7 KB
/
Copy pathMediaCodecInfoWrapper.java
File metadata and controls
69 lines (55 loc) · 1.7 KB
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
package com.programminghoch10.CodecMod;
import android.media.MediaCodecInfo;
import android.os.Build;
import androidx.annotation.RequiresApi;
/**
* drop in replacement for MediaCodecInfo
* with compatibility checks for older SDKs
*
* @see MediaCodecInfo
*/
public class MediaCodecInfoWrapper {
private final MediaCodecInfo mediaCodecInfo;
MediaCodecInfoWrapper(MediaCodecInfo mediaCodecInfo) {
this.mediaCodecInfo = mediaCodecInfo;
}
public MediaCodecInfo getOriginalMediaCodecInfo() {
return mediaCodecInfo;
}
public String getCanonicalName() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return mediaCodecInfo.getCanonicalName();
}
return mediaCodecInfo.getName();
}
public boolean isAlias() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return mediaCodecInfo.isAlias();
}
return false;
}
public String getName() {
return mediaCodecInfo.getName();
}
@RequiresApi(api = Build.VERSION_CODES.Q)
public boolean isHardwareAccelerated() {
return mediaCodecInfo.isHardwareAccelerated();
}
@RequiresApi(api = Build.VERSION_CODES.Q)
public boolean isSoftwareOnly() {
return mediaCodecInfo.isSoftwareOnly();
}
@RequiresApi(api = Build.VERSION_CODES.Q)
public boolean isVendor() {
return mediaCodecInfo.isVendor();
}
public boolean isEncoder() {
return mediaCodecInfo.isEncoder();
}
public boolean isDecoder() {
return !isEncoder();
}
public String[] getSupportedTypes() {
return mediaCodecInfo.getSupportedTypes();
}
}