Android: Generate JNI code for VideoDecoder

Bug: webrtc:8278
Change-Id: I985fa63b0c5a9cdd0fb1817730646bcd4b30288a
Reviewed-on: https://webrtc-review.googlesource.com/24221
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20803}
This commit is contained in:
Magnus Jedvert
2017-11-20 22:33:40 +01:00
committed by Commit Bot
parent 4171afb186
commit 4eb0188cb6
16 changed files with 229 additions and 219 deletions

View File

@ -12,6 +12,8 @@ package org.webrtc;
import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit;
// TODO(bugs.webrtc.org/8556): Remove unnecessary import.
import org.webrtc.EncodedImage;
/**
* An encoded frame from a video stream. Used as an input for decoders and as an output for
@ -33,6 +35,17 @@ public class EncodedImage {
public int getNative() {
return nativeIndex;
}
// TODO(bugs.webrtc.org/8556): Remove unnecessary 'EncodedImage.'.
@CalledByNative("FrameType")
static EncodedImage.FrameType fromNativeIndex(int nativeIndex) {
for (FrameType type : FrameType.values()) {
if (type.getNative() == nativeIndex) {
return type;
}
}
throw new IllegalArgumentException("Unknown native frame type: " + nativeIndex);
}
}
public final ByteBuffer buffer;
@ -125,4 +138,13 @@ public class EncodedImage {
rotation, completeFrame, qp);
}
}
// TODO(bugs.webrtc.org/8551) Remove.
@CalledByNative
static EncodedImage create(ByteBuffer buffer, int encodedWidth, int encodedHeight,
long captureTimeNs, EncodedImage.FrameType frameType, int rotation, boolean completeFrame,
Integer qp) {
return new EncodedImage(
buffer, encodedWidth, encodedHeight, captureTimeNs, frameType, rotation, completeFrame, qp);
}
}

View File

@ -54,23 +54,23 @@ public interface VideoDecoder {
* Initializes the decoding process with specified settings. Will be called on the decoding thread
* before any decode calls.
*/
VideoCodecStatus initDecode(Settings settings, Callback decodeCallback);
@CalledByNative VideoCodecStatus initDecode(Settings settings, Callback decodeCallback);
/**
* Called when the decoder is no longer needed. Any more calls to decode will not be made.
*/
VideoCodecStatus release();
@CalledByNative VideoCodecStatus release();
/**
* Request the decoder to decode a frame.
*/
VideoCodecStatus decode(EncodedImage frame, DecodeInfo info);
@CalledByNative VideoCodecStatus decode(EncodedImage frame, DecodeInfo info);
/**
* The decoder should return true if it prefers late decoding. That is, it can not decode
* infinite number of frames before the decoded frame is consumed.
*/
boolean getPrefersLateDecoding();
@CalledByNative boolean getPrefersLateDecoding();
/**
* Should return a descriptive name for the implementation. Gets called once and cached. May be
* called from arbitrary thread.
*/
String getImplementationName();
@CalledByNative String getImplementationName();
}