mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-06-17 14:22:00 +00:00
Add hidden debug mode with fake audio and video output
This commit is contained in:
@@ -3,6 +3,8 @@ package com.limelight;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.limelight.binding.PlatformBinding;
|
import com.limelight.binding.PlatformBinding;
|
||||||
|
import com.limelight.binding.audio.FakeAudioRenderer;
|
||||||
|
import com.limelight.binding.video.FakeVideoRenderer;
|
||||||
import com.limelight.input.EvdevHandler;
|
import com.limelight.input.EvdevHandler;
|
||||||
import com.limelight.input.GamepadMapping;
|
import com.limelight.input.GamepadMapping;
|
||||||
import com.limelight.nvstream.NvConnection;
|
import com.limelight.nvstream.NvConnection;
|
||||||
@@ -95,6 +97,17 @@ public class Limelight implements NvConnectionListener {
|
|||||||
PlatformBinding.getVideoDecoderRenderer());
|
PlatformBinding.getVideoDecoderRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a connection to the host and starts up the stream.
|
||||||
|
*/
|
||||||
|
private void startUpFake(StreamConfiguration streamConfig) {
|
||||||
|
conn = new NvConnection(host, this, streamConfig);
|
||||||
|
conn.start(PlatformBinding.getDeviceName(), null,
|
||||||
|
VideoDecoderRenderer.FLAG_PREFER_QUALITY,
|
||||||
|
new FakeAudioRenderer(),
|
||||||
|
new FakeVideoRenderer());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pair the device with the host
|
* Pair the device with the host
|
||||||
*/
|
*/
|
||||||
@@ -150,6 +163,7 @@ public class Limelight implements NvConnectionListener {
|
|||||||
int resolution = 720;
|
int resolution = 720;
|
||||||
int refresh = 60;
|
int refresh = 60;
|
||||||
boolean parse = true;
|
boolean parse = true;
|
||||||
|
boolean fake = false;
|
||||||
String mapping = null;
|
String mapping = null;
|
||||||
String audio = "hw:0,0";
|
String audio = "hw:0,0";
|
||||||
|
|
||||||
@@ -188,6 +202,8 @@ public class Limelight implements NvConnectionListener {
|
|||||||
refresh = 30;
|
refresh = 30;
|
||||||
} else if (args[i].equals("-60fps")) {
|
} else if (args[i].equals("-60fps")) {
|
||||||
refresh = 60;
|
refresh = 60;
|
||||||
|
} else if (args[i].equals("-fake")) {
|
||||||
|
fake = true;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Syntax Error: Unrecognized argument: " + args[i]);
|
System.out.println("Syntax Error: Unrecognized argument: " + args[i]);
|
||||||
parse = false;
|
parse = false;
|
||||||
@@ -215,6 +231,9 @@ public class Limelight implements NvConnectionListener {
|
|||||||
|
|
||||||
Limelight limelight = new Limelight(host);
|
Limelight limelight = new Limelight(host);
|
||||||
if (!pair)
|
if (!pair)
|
||||||
|
if (fake)
|
||||||
|
limelight.startUpFake(streamConfig);
|
||||||
|
else
|
||||||
limelight.startUp(streamConfig, inputs, mapping, audio);
|
limelight.startUp(streamConfig, inputs, mapping, audio);
|
||||||
else
|
else
|
||||||
limelight.pair();
|
limelight.pair();
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.limelight.binding.audio;
|
||||||
|
|
||||||
|
import com.limelight.nvstream.av.audio.AudioRenderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fake implementation for audio renderer.
|
||||||
|
* @author Iwan Timmer
|
||||||
|
*/
|
||||||
|
public class FakeAudioRenderer implements AudioRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void streamInitialized(int channelCount, int sampleRate) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playDecodedAudio(byte[] audioData, int offset, int length) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void streamClosing() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.limelight.binding.video;
|
||||||
|
|
||||||
|
import com.limelight.nvstream.av.DecodeUnit;
|
||||||
|
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of a video decoder and renderer.
|
||||||
|
* @author Iwan Timmer
|
||||||
|
*/
|
||||||
|
public class FakeVideoRenderer implements VideoDecoderRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(int width, int height, int redrawRate, Object renderTarget, int drFlags) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void release() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean submitDecodeUnit(DecodeUnit decodeUnit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user