mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-09 09:26:07 +00:00
Add support for i.MX6 VPU
This commit is contained in:
@@ -4,7 +4,7 @@ import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.limelight.binding.audio.AlsaAudioRenderer;
|
||||
import com.limelight.binding.video.OmxDecoderRenderer;
|
||||
import com.limelight.binding.video.ImxDecoderRenderer;
|
||||
import com.limelight.binding.crypto.PcCryptoProvider;
|
||||
import com.limelight.nvstream.av.audio.AudioRenderer;
|
||||
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
||||
@@ -21,7 +21,7 @@ public class PlatformBinding {
|
||||
* @return a video decoder and renderer
|
||||
*/
|
||||
public static VideoDecoderRenderer getVideoDecoderRenderer() {
|
||||
return new OmxDecoderRenderer();
|
||||
return new ImxDecoderRenderer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
17
src/com/limelight/binding/video/ImxDecoder.java
Normal file
17
src/com/limelight/binding/video/ImxDecoder.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.limelight.binding.video;
|
||||
|
||||
/**
|
||||
* JNI Decoder bindings
|
||||
* @author Iwan Timmer
|
||||
*/
|
||||
public class ImxDecoder {
|
||||
static {
|
||||
System.loadLibrary("nv_imx_dec");
|
||||
}
|
||||
|
||||
public static native int init();
|
||||
|
||||
public static native void destroy();
|
||||
|
||||
public static native int decode(byte[] indata, int inoff, int inlen, boolean last);
|
||||
}
|
||||
35
src/com/limelight/binding/video/ImxDecoderRenderer.java
Normal file
35
src/com/limelight/binding/video/ImxDecoderRenderer.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.limelight.binding.video;
|
||||
|
||||
import com.limelight.nvstream.av.ByteBufferDescriptor;
|
||||
import com.limelight.nvstream.av.DecodeUnit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Implementation of a video decoder and renderer.
|
||||
* @author Iwan Timmer
|
||||
*/
|
||||
public class ImxDecoderRenderer extends AbstractVideoRenderer {
|
||||
|
||||
@Override
|
||||
public boolean setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
|
||||
return ImxDecoder.init() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
ImxDecoder.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeUnit(DecodeUnit decodeUnit) {
|
||||
List<ByteBufferDescriptor> units = decodeUnit.getBufferList();
|
||||
|
||||
boolean ok = true;
|
||||
for (int i=0;i<units.size();i++) {
|
||||
ByteBufferDescriptor bbd = units.get(i);
|
||||
if (ok)
|
||||
ok = (ImxDecoder.decode(bbd.data, bbd.offset, bbd.length, i == (units.size()-1)) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user