MediaCodec: add VP8 and VP9 codecs

This commit is contained in:
Julian Winkler
2025-06-02 20:20:59 +02:00
parent 5383360c38
commit 542e6222b7
3 changed files with 20 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ public class MediaCodec {
if ("aac".equals(codecName) || "mp3".equals(codecName) || "opus".equals(codecName)) {
native_configure_audio(native_codec, format.getByteBuffer("csd-0"), format.getInteger("sample-rate"), format.getInteger("channel-count"));
} else if ("h264".equals(codecName)) {
} else if ("h264".equals(codecName) || "vp8".equals(codecName) || "vp9".equals(codecName)) {
native_configure_video(native_codec, format.getByteBuffer("csd-0"), format.getByteBuffer("csd-1"), surface);
} else {
System.out.println("configure: format " + format + " not implemented");

View File

@@ -3,7 +3,7 @@ package android.media;
public class MediaCodecList {
public static int getCodecCount() {
return 4;
return 6;
}
public static MediaCodecInfo getCodecInfoAt(int index) {
@@ -16,6 +16,10 @@ public class MediaCodecList {
return new MediaCodecInfo("mp3", "audio/mpeg");
case 3:
return new MediaCodecInfo("opus", "audio/opus");
case 4:
return new MediaCodecInfo("vp8", "video/x-vnd.on2.vp8");
case 5:
return new MediaCodecInfo("vp9", "video/x-vnd.on2.vp9");
default:
return null;
}