webrtc_m130/sdk/android/api/org/webrtc/SoftwareVideoEncoderFactory.java
philipel 09d488b352 Rename corresponding libaom_av1_encoder_if_supported java buildtargets.
This is in preparation to introduce new java buildtargets that will use the `libaom_av1_encoder` buildtarget instead.

bug: webrtc:13573
Change-Id: I23e80653943ede576657acc17bcc5602cb0a4d5d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/254540
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36171}
2022-03-10 13:18:34 +00:00

58 lines
1.8 KiB
Java

/*
* 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;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
@Nullable
@Override
public VideoEncoder createEncoder(VideoCodecInfo codecInfo) {
String codecName = codecInfo.getName();
if (codecName.equalsIgnoreCase(VideoCodecMimeType.VP8.name())) {
return new LibvpxVp8Encoder();
}
if (codecName.equalsIgnoreCase(VideoCodecMimeType.VP9.name())
&& LibvpxVp9Encoder.nativeIsSupported()) {
return new LibvpxVp9Encoder();
}
if (codecName.equalsIgnoreCase(VideoCodecMimeType.AV1.name())
&& LibaomAv1EncoderIfSupported.nativeIsSupported()) {
return new LibaomAv1EncoderIfSupported();
}
return null;
}
@Override
public VideoCodecInfo[] getSupportedCodecs() {
return supportedCodecs();
}
static VideoCodecInfo[] supportedCodecs() {
List<VideoCodecInfo> codecs = new ArrayList<VideoCodecInfo>();
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP8.name(), new HashMap<>()));
if (LibvpxVp9Encoder.nativeIsSupported()) {
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP9.name(), new HashMap<>()));
}
if (LibaomAv1EncoderIfSupported.nativeIsSupported()) {
codecs.add(new VideoCodecInfo(VideoCodecMimeType.AV1.name(), new HashMap<>()));
}
return codecs.toArray(new VideoCodecInfo[codecs.size()]);
}
}