mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 02:20:42 +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 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.GamepadMapping;
|
||||
import com.limelight.nvstream.NvConnection;
|
||||
@@ -95,6 +97,17 @@ public class Limelight implements NvConnectionListener {
|
||||
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
|
||||
*/
|
||||
@@ -150,6 +163,7 @@ public class Limelight implements NvConnectionListener {
|
||||
int resolution = 720;
|
||||
int refresh = 60;
|
||||
boolean parse = true;
|
||||
boolean fake = false;
|
||||
String mapping = null;
|
||||
String audio = "hw:0,0";
|
||||
|
||||
@@ -188,6 +202,8 @@ public class Limelight implements NvConnectionListener {
|
||||
refresh = 30;
|
||||
} else if (args[i].equals("-60fps")) {
|
||||
refresh = 60;
|
||||
} else if (args[i].equals("-fake")) {
|
||||
fake = true;
|
||||
} else {
|
||||
System.out.println("Syntax Error: Unrecognized argument: " + args[i]);
|
||||
parse = false;
|
||||
@@ -215,7 +231,10 @@ public class Limelight implements NvConnectionListener {
|
||||
|
||||
Limelight limelight = new Limelight(host);
|
||||
if (!pair)
|
||||
limelight.startUp(streamConfig, inputs, mapping, audio);
|
||||
if (fake)
|
||||
limelight.startUpFake(streamConfig);
|
||||
else
|
||||
limelight.startUp(streamConfig, inputs, mapping, audio);
|
||||
else
|
||||
limelight.pair();
|
||||
}
|
||||
|
||||
23
src/com/limelight/binding/audio/FakeAudioRenderer.java
Normal file
23
src/com/limelight/binding/audio/FakeAudioRenderer.java
Normal file
@@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
33
src/com/limelight/binding/video/FakeVideoRenderer.java
Normal file
33
src/com/limelight/binding/video/FakeVideoRenderer.java
Normal file
@@ -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