Rename sendCodecId to sendCodecMeta

This will allow the codec header to contain more than the codec id.
This commit is contained in:
Romain Vimont 2023-03-10 22:47:38 +01:00
parent be985b8242
commit aa1efbc35c
3 changed files with 15 additions and 15 deletions

View file

@ -40,7 +40,7 @@ public class Options {
private boolean sendDeviceMeta = true; // send device name and size
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 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() {
return logLevel;
@ -282,11 +282,11 @@ public class Options {
this.sendDummyByte = sendDummyByte;
}
public boolean getSendCodecId() {
return sendCodecId;
public boolean getSendCodecMeta() {
return sendCodecMeta;
}
public void setSendCodecId(boolean sendCodecId) {
this.sendCodecId = sendCodecId;
public void setSendCodecMeta(boolean sendCodecMeta) {
this.sendCodecMeta = sendCodecMeta;
}
}

View file

@ -108,7 +108,7 @@ public final class Server {
if (audio) {
AudioCodec audioCodec = options.getAudioCodec();
Streamer audioStreamer = new Streamer(connection.getAudioFd(), audioCodec, options.getSendCodecId(),
Streamer audioStreamer = new Streamer(connection.getAudioFd(), audioCodec, options.getSendCodecMeta(),
options.getSendFrameMeta());
AsyncProcessor audioRecorder;
if (audioCodec == AudioCodec.RAW) {
@ -120,7 +120,7 @@ public final class Server {
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());
ScreenEncoder screenEncoder = new ScreenEncoder(device, videoStreamer, options.getVideoBitRate(), options.getMaxFps(),
options.getVideoCodecOptions(), options.getVideoEncoder(), options.getDownsizeOnError());
@ -315,9 +315,9 @@ public final class Server {
boolean sendDummyByte = Boolean.parseBoolean(value);
options.setSendDummyByte(sendDummyByte);
break;
case "send_codec_id":
boolean sendCodecId = Boolean.parseBoolean(value);
options.setSendCodecId(sendCodecId);
case "send_codec_meta":
boolean sendCodecMeta = Boolean.parseBoolean(value);
options.setSendCodecMeta(sendCodecMeta);
break;
case "raw_video_stream":
boolean rawVideoStream = Boolean.parseBoolean(value);
@ -325,7 +325,7 @@ public final class Server {
options.setSendDeviceMeta(false);
options.setSendFrameMeta(false);
options.setSendDummyByte(false);
options.setSendCodecId(false);
options.setSendCodecMeta(false);
}
break;
default:

View file

@ -15,15 +15,15 @@ public final class Streamer {
private final FileDescriptor fd;
private final Codec codec;
private final boolean sendCodecId;
private final boolean sendCodecMeta;
private final boolean sendFrameMeta;
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.codec = codec;
this.sendCodecId = sendCodecId;
this.sendCodecMeta = sendCodecMeta;
this.sendFrameMeta = sendFrameMeta;
}
@ -32,7 +32,7 @@ public final class Streamer {
}
public void writeHeader() throws IOException {
if (sendCodecId) {
if (sendCodecMeta) {
ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.putInt(codec.getId());
buffer.flip();