| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | package org.webrtc; |
| 12 |
| 13 | // Explicit imports necessary for JNI generation. |
| 14 | import androidx.annotation.Nullable; |
| 15 | import org.webrtc.VideoEncoder; |
| 16 |
| 17 | /** |
| 18 | * This class contains the Java glue code for JNI generation of VideoEncoder. |
| 19 | */ |
| 20 | class VideoEncoderWrapper { |
| 21 | @CalledByNative |
| 22 | static boolean getScalingSettingsOn(VideoEncoder.ScalingSettings scalingSettings) { |
| 23 | return scalingSettings.on; |
| 24 | } |
| 25 |
| 26 | @Nullable |
| 27 | @CalledByNative |
| 28 | static Integer getScalingSettingsLow(VideoEncoder.ScalingSettings scalingSettings) { |
| 29 | return scalingSettings.low; |
| 30 | } |
| 31 |
| 32 | @Nullable |
| 33 | @CalledByNative |
| 34 | static Integer getScalingSettingsHigh(VideoEncoder.ScalingSettings scalingSettings) { |
| 35 | return scalingSettings.high; |
| 36 | } |
| 37 |
| 38 | @CalledByNative |
| 39 | static VideoEncoder.Callback createEncoderCallback(final long nativeEncoder) { |
| 40 | return (EncodedImage frame, |
| 41 | VideoEncoder.CodecSpecificInfo info) -> nativeOnEncodedFrame(nativeEncoder, frame); |
| 42 | } |
| 43 |
| 44 | private static native void nativeOnEncodedFrame( |
| 45 | long nativeVideoEncoderWrapper, EncodedImage frame); |
| 46 | } |
| 47 |