40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
package org.webrtc;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
|
|
public static VideoCodecInfo[] supportedCodecs() {
|
|
ArrayList arrayList = new ArrayList();
|
|
arrayList.add(new VideoCodecInfo("VP8", new HashMap()));
|
|
if (LibvpxVp9Decoder.nativeIsSupported()) {
|
|
arrayList.add(new VideoCodecInfo("VP9", new HashMap()));
|
|
}
|
|
return (VideoCodecInfo[]) arrayList.toArray(new VideoCodecInfo[arrayList.size()]);
|
|
}
|
|
|
|
@Override // org.webrtc.VideoDecoderFactory
|
|
@Nullable
|
|
@Deprecated
|
|
public VideoDecoder createDecoder(String str) {
|
|
return createDecoder(new VideoCodecInfo(str, new HashMap()));
|
|
}
|
|
|
|
@Override // org.webrtc.VideoDecoderFactory
|
|
@Nullable
|
|
public VideoDecoder createDecoder(VideoCodecInfo videoCodecInfo) {
|
|
if (videoCodecInfo.getName().equalsIgnoreCase("VP8")) {
|
|
return new LibvpxVp8Decoder();
|
|
}
|
|
if (!videoCodecInfo.getName().equalsIgnoreCase("VP9") || !LibvpxVp9Decoder.nativeIsSupported()) {
|
|
return null;
|
|
}
|
|
return new LibvpxVp9Decoder();
|
|
}
|
|
|
|
@Override // org.webrtc.VideoDecoderFactory
|
|
public VideoCodecInfo[] getSupportedCodecs() {
|
|
return supportedCodecs();
|
|
}
|
|
}
|