2023-09-21 22:49:36 +02:00
|
|
|
package android.media;
|
|
|
|
|
|
|
|
|
|
public class MediaCodecList {
|
|
|
|
|
|
2025-10-18 21:18:19 +02:00
|
|
|
public MediaCodecList(int kind) {}
|
|
|
|
|
|
2023-09-21 22:49:36 +02:00
|
|
|
public static int getCodecCount() {
|
2025-06-02 20:20:59 +02:00
|
|
|
return 6;
|
2023-10-08 16:09:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static MediaCodecInfo getCodecInfoAt(int index) {
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
return new MediaCodecInfo("aac", "audio/mp4a-latm");
|
|
|
|
|
case 1:
|
|
|
|
|
return new MediaCodecInfo("h264", "video/avc");
|
2025-01-26 22:27:19 +01:00
|
|
|
case 2:
|
|
|
|
|
return new MediaCodecInfo("mp3", "audio/mpeg");
|
|
|
|
|
case 3:
|
|
|
|
|
return new MediaCodecInfo("opus", "audio/opus");
|
2025-06-02 20:20:59 +02:00
|
|
|
case 4:
|
|
|
|
|
return new MediaCodecInfo("vp8", "video/x-vnd.on2.vp8");
|
|
|
|
|
case 5:
|
|
|
|
|
return new MediaCodecInfo("vp9", "video/x-vnd.on2.vp9");
|
2023-10-08 16:09:27 +02:00
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2023-09-21 22:49:36 +02:00
|
|
|
}
|
|
|
|
|
|
2025-10-18 21:18:19 +02:00
|
|
|
public MediaCodecInfo[] getCodecInfos() {
|
|
|
|
|
MediaCodecInfo[] infos = new MediaCodecInfo[getCodecCount()];
|
|
|
|
|
for (int i=0; i<infos.length; i++)
|
|
|
|
|
infos[i] = getCodecInfoAt(i);
|
|
|
|
|
return infos;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-21 22:49:36 +02:00
|
|
|
}
|