Skip to content

Commit

Permalink
Update to scrcpy 1.23 + small WPF UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Fusion86 committed Apr 22, 2022
1 parent 73c66a8 commit 6e25eef
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deps/shared/README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Based on scrcpy, which can be found here -> https://github.com/Genymobile/scrcpy

Binaries downloaded from https://github.com/Genymobile/scrcpy/releases/tag/v1.21
Binaries downloaded from https://github.com/Genymobile/scrcpy/releases/tag/v1.23
Binary file modified deps/shared/scrcpy-server.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions src/ScrcpyNet.Sample.ViewModels/ScrcpyViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
using SharpAdbClient;
using System;
using System.Reactive;
using System.Threading.Tasks;

namespace ScrcpyNet.Sample.ViewModels
{
public class ScrcpyViewModel : ViewModelBase
{
[Reactive] public double Bitrate { get; set; } = 8000000;
[Reactive] public double BitrateKb { get; set; } = 8_000;

[Reactive] public bool IsConnected { get; private set; }
[Reactive] public string DeviceName { get; private set; } = "";
Expand All @@ -35,7 +34,7 @@ private void Connect(DeviceData device)
if (Scrcpy != null) throw new Exception("Already connected.");

Scrcpy = new Scrcpy(device);
Scrcpy.Bitrate = (long)Bitrate;
Scrcpy.Bitrate = (long)(BitrateKb * 1000);
Scrcpy.Start();
DeviceName = Scrcpy.DeviceName;
IsConnected = true;
Expand Down
7 changes: 4 additions & 3 deletions src/ScrcpyNet.Sample.Wpf/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@
</ComboBox>
</DockPanel>

<TextBox Text="{Binding Scrcpy.Bitrate, Converter={StaticResource IntegerValueConverter}, UpdateSourceTrigger=PropertyChanged}"
Margin="0,2,0,0"
<TextBlock Text="Bitrate (kbit/s)" Margin="0,4,0,2"/>

<TextBox Text="{Binding Scrcpy.BitrateKb, Converter={StaticResource IntegerValueConverter}, UpdateSourceTrigger=PropertyChanged}"
PreviewTextInput="TextBox_PreviewTextInput"/>

<Button Content="Connect"
Margin="0,2,0,0"
Margin="0,4,0,0"
Command="{Binding Scrcpy.ConnectCommand}"
CommandParameter="{Binding SelectedDevice}"/>
</StackPanel>
Expand Down
2 changes: 1 addition & 1 deletion src/ScrcpyNet.Wpf/ScrcpyNet.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseWPF>true</UseWPF>
</PropertyGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/ScrcpyNet/Scrcpy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace ScrcpyNet
public class Scrcpy
{
public string DeviceName { get; private set; } = "";
public int Width { get; set; }
public int Height { get; set; }
public int Width { get; internal set; }
public int Height { get; internal set; }
public long Bitrate { get; set; } = 8000000;
public string ScrcpyServerFile { get; set; } = "ScrcpyNet/scrcpy-server.jar";

Expand Down Expand Up @@ -272,7 +272,7 @@ private void MobileServerStart()
var cts = new CancellationTokenSource();
var receiver = new SerilogOutputReceiver();

string version = "1.21";
string version = "1.23";
int maxFramerate = 0;
ScrcpyLockVideoOrientation orientation = ScrcpyLockVideoOrientation.Unlocked; // -1 means allow rotate
bool control = true;
Expand Down Expand Up @@ -307,6 +307,9 @@ private void MobileServerStart()
cmds.Add("display_id=0");
cmds.Add($"show_touches={showTouches}");
cmds.Add($"stay_awake={stayAwake}");
cmds.Add("power_off_on_close=false");
cmds.Add("downsize_on_error=true");
cmds.Add("cleanup=true");

string command = string.Join(" ", cmds);

Expand Down
2 changes: 1 addition & 1 deletion src/ScrcpyNet/ScrcpyNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<PackageId>ScrcpyNet</PackageId>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<TargetFramework>netstandard2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9.0</LangVersion>
Expand Down

0 comments on commit 6e25eef

Please sign in to comment.