Package tvi.webrtc
Class WrappedNativeVideoEncoder
- java.lang.Object
-
- tvi.webrtc.WrappedNativeVideoEncoder
-
- All Implemented Interfaces:
VideoEncoder
- Direct Known Subclasses:
LibvpxVp8Encoder,LibvpxVp9Encoder,VideoEncoderFallback
public abstract class WrappedNativeVideoEncoder extends java.lang.Object implements VideoEncoder
Wraps a native webrtc::VideoEncoder.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface tvi.webrtc.VideoEncoder
VideoEncoder.BitrateAllocation, VideoEncoder.Callback, VideoEncoder.Capabilities, VideoEncoder.CodecSpecificInfo, VideoEncoder.CodecSpecificInfoH264, VideoEncoder.CodecSpecificInfoVP8, VideoEncoder.CodecSpecificInfoVP9, VideoEncoder.EncodeInfo, VideoEncoder.ResolutionBitrateLimits, VideoEncoder.ScalingSettings, VideoEncoder.Settings
-
-
Constructor Summary
Constructors Constructor Description WrappedNativeVideoEncoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract longcreateNativeVideoEncoder()The encoder implementation backing this interface is either 1) a Java encoder (e.g., an Android platform encoder), or alternatively 2) a native encoder (e.g., a software encoder or a C++ encoder adapter).VideoCodecStatusencode(VideoFrame frame, VideoEncoder.EncodeInfo info)Requests the encoder to encode a frame.java.lang.StringgetImplementationName()Should return a descriptive name for the implementation.VideoEncoder.ScalingSettingsgetScalingSettings()Any encoder that wants to use WebRTC provided quality scaler must implement this method.VideoCodecStatusinitEncode(VideoEncoder.Settings settings, VideoEncoder.Callback encodeCallback)Initializes the encoding process.abstract booleanisHardwareEncoder()Returns true if the encoder is backed by hardware.VideoCodecStatusrelease()Releases the encoder.VideoCodecStatussetRateAllocation(VideoEncoder.BitrateAllocation allocation, int framerate)Sets the bitrate allocation and the target framerate for the encoder.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tvi.webrtc.VideoEncoder
getResolutionBitrateLimits
-
-
-
-
Method Detail
-
createNativeVideoEncoder
public abstract long createNativeVideoEncoder()
Description copied from interface:VideoEncoderThe encoder implementation backing this interface is either 1) a Java encoder (e.g., an Android platform encoder), or alternatively 2) a native encoder (e.g., a software encoder or a C++ encoder adapter). For case 1), createNativeVideoEncoder() should return zero. In this case, we expect the native library to call the encoder through JNI using the Java interface declared below. For case 2), createNativeVideoEncoder() should return a non-zero value. In this case, we expect the native library to treat the returned value as a raw pointer of type webrtc::VideoEncoder* (ownership is transferred to the caller). The native library should then directly call the webrtc::VideoEncoder interface without going through JNI. All calls to the Java interface methods declared below should thus throw an UnsupportedOperationException.- Specified by:
createNativeVideoEncoderin interfaceVideoEncoder
-
isHardwareEncoder
public abstract boolean isHardwareEncoder()
Description copied from interface:VideoEncoderReturns true if the encoder is backed by hardware.- Specified by:
isHardwareEncoderin interfaceVideoEncoder
-
initEncode
public final VideoCodecStatus initEncode(VideoEncoder.Settings settings, VideoEncoder.Callback encodeCallback)
Description copied from interface:VideoEncoderInitializes the encoding process. Call before any calls to encode.- Specified by:
initEncodein interfaceVideoEncoder
-
release
public final VideoCodecStatus release()
Description copied from interface:VideoEncoderReleases the encoder. No more calls to encode will be made after this call.- Specified by:
releasein interfaceVideoEncoder
-
encode
public final VideoCodecStatus encode(VideoFrame frame, VideoEncoder.EncodeInfo info)
Description copied from interface:VideoEncoderRequests the encoder to encode a frame.- Specified by:
encodein interfaceVideoEncoder
-
setRateAllocation
public final VideoCodecStatus setRateAllocation(VideoEncoder.BitrateAllocation allocation, int framerate)
Description copied from interface:VideoEncoderSets the bitrate allocation and the target framerate for the encoder.- Specified by:
setRateAllocationin interfaceVideoEncoder
-
getScalingSettings
public final VideoEncoder.ScalingSettings getScalingSettings()
Description copied from interface:VideoEncoderAny encoder that wants to use WebRTC provided quality scaler must implement this method.- Specified by:
getScalingSettingsin interfaceVideoEncoder
-
getImplementationName
public final java.lang.String getImplementationName()
Description copied from interface:VideoEncoderShould return a descriptive name for the implementation. Gets called once and cached. May be called from arbitrary thread.- Specified by:
getImplementationNamein interfaceVideoEncoder
-
-