2017-11-10 13:15:04 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package org.webrtc;
|
|
|
|
|
|
2018-12-10 12:30:46 +01:00
|
|
|
import android.support.annotation.Nullable;
|
2018-05-21 13:45:51 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
2018-03-22 13:32:44 +01:00
|
|
|
|
2017-11-10 13:15:04 +01:00
|
|
|
public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
|
2018-07-18 15:11:59 +02:00
|
|
|
@Deprecated
|
|
|
|
|
@Nullable
|
|
|
|
|
@Override
|
|
|
|
|
public VideoDecoder createDecoder(String codecType) {
|
|
|
|
|
return createDecoder(new VideoCodecInfo(codecType, new HashMap<>()));
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-22 13:32:44 +01:00
|
|
|
@Nullable
|
2017-11-10 13:15:04 +01:00
|
|
|
@Override
|
2018-07-13 11:18:03 +02:00
|
|
|
public VideoDecoder createDecoder(VideoCodecInfo codecType) {
|
|
|
|
|
if (codecType.getName().equalsIgnoreCase("VP8")) {
|
2018-11-06 14:10:51 -08:00
|
|
|
return new LibvpxVp8Decoder();
|
2017-11-10 13:15:04 +01:00
|
|
|
}
|
2018-11-06 14:10:51 -08:00
|
|
|
if (codecType.getName().equalsIgnoreCase("VP9") && LibvpxVp9Decoder.nativeIsSupported()) {
|
|
|
|
|
return new LibvpxVp9Decoder();
|
2017-11-10 13:15:04 +01:00
|
|
|
}
|
2021-04-12 15:41:21 +03:00
|
|
|
if (codecType.getName().equalsIgnoreCase("AV1") && LibaomAv1Decoder.nativeIsSupported()) {
|
|
|
|
|
return new LibaomAv1Decoder();
|
|
|
|
|
}
|
2017-11-10 13:15:04 +01:00
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2018-05-21 13:45:51 +02:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public VideoCodecInfo[] getSupportedCodecs() {
|
|
|
|
|
return supportedCodecs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static VideoCodecInfo[] supportedCodecs() {
|
|
|
|
|
List<VideoCodecInfo> codecs = new ArrayList<VideoCodecInfo>();
|
|
|
|
|
|
|
|
|
|
codecs.add(new VideoCodecInfo("VP8", new HashMap<>()));
|
2018-11-06 14:10:51 -08:00
|
|
|
if (LibvpxVp9Decoder.nativeIsSupported()) {
|
2018-05-21 13:45:51 +02:00
|
|
|
codecs.add(new VideoCodecInfo("VP9", new HashMap<>()));
|
|
|
|
|
}
|
2021-04-12 15:41:21 +03:00
|
|
|
if (LibaomAv1Decoder.nativeIsSupported()) {
|
|
|
|
|
codecs.add(new VideoCodecInfo("AV1", new HashMap<>()));
|
|
|
|
|
}
|
2018-05-21 13:45:51 +02:00
|
|
|
|
|
|
|
|
return codecs.toArray(new VideoCodecInfo[codecs.size()]);
|
|
|
|
|
}
|
2017-11-10 13:15:04 +01:00
|
|
|
}
|