196 lines
5.3 KiB
Java
196 lines
5.3 KiB
Java
package org.webrtc;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import c.d.b.a.a;
|
|
import org.webrtc.EncodedImage;
|
|
public interface VideoEncoder {
|
|
|
|
public static class BitrateAllocation {
|
|
public final int[][] bitratesBbs;
|
|
|
|
@CalledByNative("BitrateAllocation")
|
|
public BitrateAllocation(int[][] iArr) {
|
|
this.bitratesBbs = iArr;
|
|
}
|
|
|
|
public int getSum() {
|
|
int[][] iArr = this.bitratesBbs;
|
|
int i = 0;
|
|
for (int[] iArr2 : iArr) {
|
|
for (int i2 : iArr2) {
|
|
i += i2;
|
|
}
|
|
}
|
|
return i;
|
|
}
|
|
}
|
|
|
|
public interface Callback {
|
|
void onEncodedFrame(EncodedImage encodedImage, CodecSpecificInfo codecSpecificInfo);
|
|
}
|
|
|
|
public static class Capabilities {
|
|
public final boolean lossNotification;
|
|
|
|
@CalledByNative("Capabilities")
|
|
public Capabilities(boolean z2) {
|
|
this.lossNotification = z2;
|
|
}
|
|
}
|
|
|
|
public static class CodecSpecificInfo {
|
|
}
|
|
|
|
public static class CodecSpecificInfoH264 extends CodecSpecificInfo {
|
|
}
|
|
|
|
public static class CodecSpecificInfoVP8 extends CodecSpecificInfo {
|
|
}
|
|
|
|
public static class CodecSpecificInfoVP9 extends CodecSpecificInfo {
|
|
}
|
|
|
|
public static class EncodeInfo {
|
|
public final EncodedImage.FrameType[] frameTypes;
|
|
|
|
@CalledByNative("EncodeInfo")
|
|
public EncodeInfo(EncodedImage.FrameType[] frameTypeArr) {
|
|
this.frameTypes = frameTypeArr;
|
|
}
|
|
}
|
|
|
|
public static class ResolutionBitrateLimits {
|
|
public final int frameSizePixels;
|
|
public final int maxBitrateBps;
|
|
public final int minBitrateBps;
|
|
public final int minStartBitrateBps;
|
|
|
|
public ResolutionBitrateLimits(int i, int i2, int i3, int i4) {
|
|
this.frameSizePixels = i;
|
|
this.minStartBitrateBps = i2;
|
|
this.minBitrateBps = i3;
|
|
this.maxBitrateBps = i4;
|
|
}
|
|
|
|
@CalledByNative("ResolutionBitrateLimits")
|
|
public int getFrameSizePixels() {
|
|
return this.frameSizePixels;
|
|
}
|
|
|
|
@CalledByNative("ResolutionBitrateLimits")
|
|
public int getMaxBitrateBps() {
|
|
return this.maxBitrateBps;
|
|
}
|
|
|
|
@CalledByNative("ResolutionBitrateLimits")
|
|
public int getMinBitrateBps() {
|
|
return this.minBitrateBps;
|
|
}
|
|
|
|
@CalledByNative("ResolutionBitrateLimits")
|
|
public int getMinStartBitrateBps() {
|
|
return this.minStartBitrateBps;
|
|
}
|
|
}
|
|
|
|
public static class ScalingSettings {
|
|
public static final ScalingSettings OFF = new ScalingSettings();
|
|
@Nullable
|
|
public final Integer high;
|
|
@Nullable
|
|
public final Integer low;
|
|
public final boolean on;
|
|
|
|
private ScalingSettings() {
|
|
this.on = false;
|
|
this.low = null;
|
|
this.high = null;
|
|
}
|
|
|
|
public ScalingSettings(int i, int i2) {
|
|
this.on = true;
|
|
this.low = Integer.valueOf(i);
|
|
this.high = Integer.valueOf(i2);
|
|
}
|
|
|
|
@Deprecated
|
|
public ScalingSettings(boolean z2) {
|
|
this.on = z2;
|
|
this.low = null;
|
|
this.high = null;
|
|
}
|
|
|
|
@Deprecated
|
|
public ScalingSettings(boolean z2, int i, int i2) {
|
|
this.on = z2;
|
|
this.low = Integer.valueOf(i);
|
|
this.high = Integer.valueOf(i2);
|
|
}
|
|
|
|
public String toString() {
|
|
if (!this.on) {
|
|
return "OFF";
|
|
}
|
|
StringBuilder K = a.K("[ ");
|
|
K.append(this.low);
|
|
K.append(", ");
|
|
return a.z(K, this.high, " ]");
|
|
}
|
|
}
|
|
|
|
public static class Settings {
|
|
public final boolean automaticResizeOn;
|
|
public final Capabilities capabilities;
|
|
public final int height;
|
|
public final int maxFramerate;
|
|
public final int numberOfCores;
|
|
public final int numberOfSimulcastStreams;
|
|
public final int startBitrate;
|
|
public final int width;
|
|
|
|
@Deprecated
|
|
public Settings(int i, int i2, int i3, int i4, int i5, int i6, boolean z2) {
|
|
this(i, i2, i3, i4, i5, i6, z2, new Capabilities(false));
|
|
}
|
|
|
|
@CalledByNative("Settings")
|
|
public Settings(int i, int i2, int i3, int i4, int i5, int i6, boolean z2, Capabilities capabilities) {
|
|
this.numberOfCores = i;
|
|
this.width = i2;
|
|
this.height = i3;
|
|
this.startBitrate = i4;
|
|
this.maxFramerate = i5;
|
|
this.numberOfSimulcastStreams = i6;
|
|
this.automaticResizeOn = z2;
|
|
this.capabilities = capabilities;
|
|
}
|
|
}
|
|
|
|
@CalledByNative
|
|
long createNativeVideoEncoder();
|
|
|
|
@CalledByNative
|
|
VideoCodecStatus encode(VideoFrame videoFrame, EncodeInfo encodeInfo);
|
|
|
|
@CalledByNative
|
|
String getImplementationName();
|
|
|
|
@CalledByNative
|
|
ResolutionBitrateLimits[] getResolutionBitrateLimits();
|
|
|
|
@CalledByNative
|
|
ScalingSettings getScalingSettings();
|
|
|
|
@CalledByNative
|
|
VideoCodecStatus initEncode(Settings settings, Callback callback);
|
|
|
|
@CalledByNative
|
|
boolean isHardwareEncoder();
|
|
|
|
@CalledByNative
|
|
VideoCodecStatus release();
|
|
|
|
@CalledByNative
|
|
VideoCodecStatus setRateAllocation(BitrateAllocation bitrateAllocation, int i);
|
|
}
|