Rename sendCodecId to sendCodecMeta
This will allow the codec header to contain more than the codec id.
This commit is contained in:
parent
be985b8242
commit
aa1efbc35c
3 changed files with 15 additions and 15 deletions
|
@ -40,7 +40,7 @@ public class Options {
|
||||||
private boolean sendDeviceMeta = true; // send device name and size
|
private boolean sendDeviceMeta = true; // send device name and size
|
||||||
private boolean sendFrameMeta = true; // send PTS so that the client may record properly
|
private boolean sendFrameMeta = true; // send PTS so that the client may record properly
|
||||||
private boolean sendDummyByte = true; // write a byte on start to detect connection issues
|
private boolean sendDummyByte = true; // write a byte on start to detect connection issues
|
||||||
private boolean sendCodecId = true; // write the codec ID (4 bytes) before the stream
|
private boolean sendCodecMeta = true; // write the codec metadata before the stream
|
||||||
|
|
||||||
public Ln.Level getLogLevel() {
|
public Ln.Level getLogLevel() {
|
||||||
return logLevel;
|
return logLevel;
|
||||||
|
@ -282,11 +282,11 @@ public class Options {
|
||||||
this.sendDummyByte = sendDummyByte;
|
this.sendDummyByte = sendDummyByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSendCodecId() {
|
public boolean getSendCodecMeta() {
|
||||||
return sendCodecId;
|
return sendCodecMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSendCodecId(boolean sendCodecId) {
|
public void setSendCodecMeta(boolean sendCodecMeta) {
|
||||||
this.sendCodecId = sendCodecId;
|
this.sendCodecMeta = sendCodecMeta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public final class Server {
|
||||||
|
|
||||||
if (audio) {
|
if (audio) {
|
||||||
AudioCodec audioCodec = options.getAudioCodec();
|
AudioCodec audioCodec = options.getAudioCodec();
|
||||||
Streamer audioStreamer = new Streamer(connection.getAudioFd(), audioCodec, options.getSendCodecId(),
|
Streamer audioStreamer = new Streamer(connection.getAudioFd(), audioCodec, options.getSendCodecMeta(),
|
||||||
options.getSendFrameMeta());
|
options.getSendFrameMeta());
|
||||||
AsyncProcessor audioRecorder;
|
AsyncProcessor audioRecorder;
|
||||||
if (audioCodec == AudioCodec.RAW) {
|
if (audioCodec == AudioCodec.RAW) {
|
||||||
|
@ -120,7 +120,7 @@ public final class Server {
|
||||||
asyncProcessors.add(audioRecorder);
|
asyncProcessors.add(audioRecorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
Streamer videoStreamer = new Streamer(connection.getVideoFd(), options.getVideoCodec(), options.getSendCodecId(),
|
Streamer videoStreamer = new Streamer(connection.getVideoFd(), options.getVideoCodec(), options.getSendCodecMeta(),
|
||||||
options.getSendFrameMeta());
|
options.getSendFrameMeta());
|
||||||
ScreenEncoder screenEncoder = new ScreenEncoder(device, videoStreamer, options.getVideoBitRate(), options.getMaxFps(),
|
ScreenEncoder screenEncoder = new ScreenEncoder(device, videoStreamer, options.getVideoBitRate(), options.getMaxFps(),
|
||||||
options.getVideoCodecOptions(), options.getVideoEncoder(), options.getDownsizeOnError());
|
options.getVideoCodecOptions(), options.getVideoEncoder(), options.getDownsizeOnError());
|
||||||
|
@ -315,9 +315,9 @@ public final class Server {
|
||||||
boolean sendDummyByte = Boolean.parseBoolean(value);
|
boolean sendDummyByte = Boolean.parseBoolean(value);
|
||||||
options.setSendDummyByte(sendDummyByte);
|
options.setSendDummyByte(sendDummyByte);
|
||||||
break;
|
break;
|
||||||
case "send_codec_id":
|
case "send_codec_meta":
|
||||||
boolean sendCodecId = Boolean.parseBoolean(value);
|
boolean sendCodecMeta = Boolean.parseBoolean(value);
|
||||||
options.setSendCodecId(sendCodecId);
|
options.setSendCodecMeta(sendCodecMeta);
|
||||||
break;
|
break;
|
||||||
case "raw_video_stream":
|
case "raw_video_stream":
|
||||||
boolean rawVideoStream = Boolean.parseBoolean(value);
|
boolean rawVideoStream = Boolean.parseBoolean(value);
|
||||||
|
@ -325,7 +325,7 @@ public final class Server {
|
||||||
options.setSendDeviceMeta(false);
|
options.setSendDeviceMeta(false);
|
||||||
options.setSendFrameMeta(false);
|
options.setSendFrameMeta(false);
|
||||||
options.setSendDummyByte(false);
|
options.setSendDummyByte(false);
|
||||||
options.setSendCodecId(false);
|
options.setSendCodecMeta(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -15,15 +15,15 @@ public final class Streamer {
|
||||||
|
|
||||||
private final FileDescriptor fd;
|
private final FileDescriptor fd;
|
||||||
private final Codec codec;
|
private final Codec codec;
|
||||||
private final boolean sendCodecId;
|
private final boolean sendCodecMeta;
|
||||||
private final boolean sendFrameMeta;
|
private final boolean sendFrameMeta;
|
||||||
|
|
||||||
private final ByteBuffer headerBuffer = ByteBuffer.allocate(12);
|
private final ByteBuffer headerBuffer = ByteBuffer.allocate(12);
|
||||||
|
|
||||||
public Streamer(FileDescriptor fd, Codec codec, boolean sendCodecId, boolean sendFrameMeta) {
|
public Streamer(FileDescriptor fd, Codec codec, boolean sendCodecMeta, boolean sendFrameMeta) {
|
||||||
this.fd = fd;
|
this.fd = fd;
|
||||||
this.codec = codec;
|
this.codec = codec;
|
||||||
this.sendCodecId = sendCodecId;
|
this.sendCodecMeta = sendCodecMeta;
|
||||||
this.sendFrameMeta = sendFrameMeta;
|
this.sendFrameMeta = sendFrameMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public final class Streamer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeHeader() throws IOException {
|
public void writeHeader() throws IOException {
|
||||||
if (sendCodecId) {
|
if (sendCodecMeta) {
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(4);
|
ByteBuffer buffer = ByteBuffer.allocate(4);
|
||||||
buffer.putInt(codec.getId());
|
buffer.putInt(codec.getId());
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
|
|
Loading…
Reference in a new issue