mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 13:34:20 +01:00
Rename "codec meta" to "stream meta"
The stream metadata will contain both: - the codec id at the start of the stream - the session metadata (video width and height) at the start of every "session" (typically on rotation)
This commit is contained in:
@@ -409,12 +409,11 @@ with any client which uses the same protocol.
|
|||||||
|
|
||||||
For simplicity, some [server-specific options] have been added to produce raw
|
For simplicity, some [server-specific options] have been added to produce raw
|
||||||
streams easily:
|
streams easily:
|
||||||
- `send_device_meta=false`: disable the device metata (in practice, the device
|
- `send_device_meta=false`: disable device metadata (in practice, the device
|
||||||
name) sent on the _first_ socket
|
name) sent on the _first_ socket
|
||||||
- `send_frame_meta=false`: disable the 12-byte header for each packet
|
- `send_frame_meta=false`: disable the 12-byte header for each packet
|
||||||
- `send_dummy_byte`: disable the dummy byte sent on forward connections
|
- `send_dummy_byte`: disable the dummy byte sent on forward connections
|
||||||
- `send_codec_meta`: disable the codec information (and initial device size for
|
- `send_stream_meta`: disable codec and video size metadata
|
||||||
video)
|
|
||||||
- `raw_stream`: disable all the above
|
- `raw_stream`: disable all the above
|
||||||
|
|
||||||
[server-specific options]: https://github.com/Genymobile/scrcpy/blob/a3cdf1a6b86ea22786e1f7d09b9c202feabc6949/server/src/main/java/com/genymobile/scrcpy/Options.java#L309-L329
|
[server-specific options]: https://github.com/Genymobile/scrcpy/blob/a3cdf1a6b86ea22786e1f7d09b9c202feabc6949/server/src/main/java/com/genymobile/scrcpy/Options.java#L309-L329
|
||||||
|
|||||||
@@ -78,7 +78,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 sendCodecMeta = true; // write the codec metadata before the stream
|
private boolean sendStreamMeta = true; // write the stream metadata (codec and session)
|
||||||
|
|
||||||
public Ln.Level getLogLevel() {
|
public Ln.Level getLogLevel() {
|
||||||
return logLevel;
|
return logLevel;
|
||||||
@@ -284,8 +284,8 @@ public class Options {
|
|||||||
return sendDummyByte;
|
return sendDummyByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSendCodecMeta() {
|
public boolean getSendStreamMeta() {
|
||||||
return sendCodecMeta;
|
return sendStreamMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("MethodLength")
|
@SuppressWarnings("MethodLength")
|
||||||
@@ -500,8 +500,8 @@ public class Options {
|
|||||||
case "send_dummy_byte":
|
case "send_dummy_byte":
|
||||||
options.sendDummyByte = Boolean.parseBoolean(value);
|
options.sendDummyByte = Boolean.parseBoolean(value);
|
||||||
break;
|
break;
|
||||||
case "send_codec_meta":
|
case "send_stream_meta":
|
||||||
options.sendCodecMeta = Boolean.parseBoolean(value);
|
options.sendStreamMeta = Boolean.parseBoolean(value);
|
||||||
break;
|
break;
|
||||||
case "raw_stream":
|
case "raw_stream":
|
||||||
boolean rawStream = Boolean.parseBoolean(value);
|
boolean rawStream = Boolean.parseBoolean(value);
|
||||||
@@ -509,7 +509,7 @@ public class Options {
|
|||||||
options.sendDeviceMeta = false;
|
options.sendDeviceMeta = false;
|
||||||
options.sendFrameMeta = false;
|
options.sendFrameMeta = false;
|
||||||
options.sendDummyByte = false;
|
options.sendDummyByte = false;
|
||||||
options.sendCodecMeta = false;
|
options.sendStreamMeta = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public final class Server {
|
|||||||
audioCapture = new AudioPlaybackCapture(options.getAudioDup());
|
audioCapture = new AudioPlaybackCapture(options.getAudioDup());
|
||||||
}
|
}
|
||||||
|
|
||||||
Streamer audioStreamer = new Streamer(connection.getAudioFd(), audioCodec, options.getSendCodecMeta(), options.getSendFrameMeta());
|
Streamer audioStreamer = new Streamer(connection.getAudioFd(), audioCodec, options.getSendStreamMeta(), options.getSendFrameMeta());
|
||||||
AsyncProcessor audioRecorder;
|
AsyncProcessor audioRecorder;
|
||||||
if (audioCodec == AudioCodec.RAW) {
|
if (audioCodec == AudioCodec.RAW) {
|
||||||
audioRecorder = new AudioRawRecorder(audioCapture, audioStreamer);
|
audioRecorder = new AudioRawRecorder(audioCapture, audioStreamer);
|
||||||
@@ -136,7 +136,7 @@ public final class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (video) {
|
if (video) {
|
||||||
Streamer videoStreamer = new Streamer(connection.getVideoFd(), options.getVideoCodec(), options.getSendCodecMeta(),
|
Streamer videoStreamer = new Streamer(connection.getVideoFd(), options.getVideoCodec(), options.getSendStreamMeta(),
|
||||||
options.getSendFrameMeta());
|
options.getSendFrameMeta());
|
||||||
SurfaceCapture surfaceCapture;
|
SurfaceCapture surfaceCapture;
|
||||||
if (options.getVideoSource() == VideoSource.DISPLAY) {
|
if (options.getVideoSource() == VideoSource.DISPLAY) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public final class Streamer {
|
|||||||
|
|
||||||
private final FileDescriptor fd;
|
private final FileDescriptor fd;
|
||||||
private final Codec codec;
|
private final Codec codec;
|
||||||
private final boolean sendCodecMeta;
|
private final boolean sendStreamMeta;
|
||||||
private final boolean sendFrameMeta;
|
private final boolean sendFrameMeta;
|
||||||
|
|
||||||
private final ByteBuffer headerBuffer = ByteBuffer.allocate(12);
|
private final ByteBuffer headerBuffer = ByteBuffer.allocate(12);
|
||||||
@@ -27,7 +27,7 @@ public final class Streamer {
|
|||||||
public Streamer(FileDescriptor fd, Codec codec, boolean sendCodecMeta, 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.sendCodecMeta = sendCodecMeta;
|
this.sendStreamMeta = sendCodecMeta;
|
||||||
this.sendFrameMeta = sendFrameMeta;
|
this.sendFrameMeta = sendFrameMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ public final class Streamer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeAudioHeader() throws IOException {
|
public void writeAudioHeader() throws IOException {
|
||||||
if (sendCodecMeta) {
|
if (sendStreamMeta) {
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(4);
|
ByteBuffer buffer = ByteBuffer.allocate(4);
|
||||||
buffer.putInt(codec.getId());
|
buffer.putInt(codec.getId());
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
@@ -45,7 +45,7 @@ public final class Streamer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeVideoHeader(Size videoSize) throws IOException {
|
public void writeVideoHeader(Size videoSize) throws IOException {
|
||||||
if (sendCodecMeta) {
|
if (sendStreamMeta) {
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(12);
|
ByteBuffer buffer = ByteBuffer.allocate(12);
|
||||||
buffer.putInt(codec.getId());
|
buffer.putInt(codec.getId());
|
||||||
buffer.putInt(videoSize.getWidth());
|
buffer.putInt(videoSize.getWidth());
|
||||||
|
|||||||
Reference in New Issue
Block a user