Compare commits
5 Commits
de4d535edc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ab9f487c6 | |||
| 40a9b653b2 | |||
| 31477b99a0 | |||
| c731b34b36 | |||
| eb0d30384d |
@@ -445,7 +445,7 @@ namespace robospot_camera_finder
|
||||
{
|
||||
toolStripStatusLabel.Text = "Loading camera...";
|
||||
Camera camera = all_cameras.FirstOrDefault<Camera>(cam => cam.camera_ip.ToString() == lbMain.SelectedValue.ToString());
|
||||
Form viewer = new StreamViewer(lbMain.GetItemText(lbMain.SelectedItem), lbMain.SelectedValue.ToString(), camera, this);
|
||||
Form viewer = new StreamViewer(camera, this);
|
||||
viewer.Show();
|
||||
toolStripStatusLabel.Text = "";
|
||||
}
|
||||
|
||||
16
Properties/PublishProfiles/Windows x64.pubxml
Normal file
16
Properties/PublishProfiles/Windows x64.pubxml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>bin\Release\net9.0-windows\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net9.0-windows</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
4
StreamViewer.Designer.cs
generated
4
StreamViewer.Designer.cs
generated
@@ -1,6 +1,4 @@
|
||||
using LibVLCSharp.Forms.Shared;
|
||||
|
||||
namespace robospot_camera_finder
|
||||
namespace robospot_camera_finder
|
||||
{
|
||||
partial class StreamViewer
|
||||
{
|
||||
|
||||
@@ -8,29 +8,30 @@ namespace robospot_camera_finder
|
||||
public LibVLC _libVLC;
|
||||
public MediaPlayer _mp;
|
||||
|
||||
string cam_ip = "";
|
||||
MainForm.Camera camera;
|
||||
|
||||
int max_zoom_pulse = 9999;
|
||||
int min_zoom_pulse = 10;
|
||||
const int MAX_ZOOM_PULSE = 9999;
|
||||
const int MIN_ZOOM_PULSE = 10;
|
||||
|
||||
bool zoomTestSeqFlag = false;
|
||||
|
||||
public StreamViewer(string name, string ip, MainForm.Camera camera, MainForm mainForm)
|
||||
public StreamViewer(MainForm.Camera cam, MainForm mainForm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_libVLC = new LibVLC();
|
||||
_mp = new MediaPlayer(_libVLC);
|
||||
|
||||
cam_ip = ip;
|
||||
this.Text = name;
|
||||
camera = cam;
|
||||
|
||||
if (!cam_ip.StartsWith("10."))
|
||||
this.Text = camera.camera_name;
|
||||
|
||||
if (!cam.camera_ip.StartsWith("10."))
|
||||
{
|
||||
MessageBox.Show("Camera is not on the 10.0.0.0/8 network, the RoboSpot might not find it.", "Wrong IP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
string rtsp_link = "rtsp://" + ip + "/profile2/media.smp";
|
||||
string rtsp_link = "rtsp://" + camera.camera_ip + "/profile2/media.smp";
|
||||
|
||||
updateZoomSlider();
|
||||
|
||||
@@ -45,7 +46,7 @@ namespace robospot_camera_finder
|
||||
|
||||
private void updateZoomSlider()
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=query&action=view&Query=Zoom");
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + camera.camera_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=query&action=view&Query=Zoom");
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
string text;
|
||||
@@ -59,16 +60,16 @@ namespace robospot_camera_finder
|
||||
private void sendZoomValue(string zoom_pulse)
|
||||
{
|
||||
// clamp values to allowed range
|
||||
if (int.Parse(zoom_pulse) < min_zoom_pulse)
|
||||
if (int.Parse(zoom_pulse) < MIN_ZOOM_PULSE)
|
||||
{
|
||||
zoom_pulse = min_zoom_pulse.ToString();
|
||||
zoom_pulse = MIN_ZOOM_PULSE.ToString();
|
||||
}
|
||||
if (int.Parse(zoom_pulse) > max_zoom_pulse)
|
||||
if (int.Parse(zoom_pulse) > MAX_ZOOM_PULSE)
|
||||
{
|
||||
zoom_pulse = max_zoom_pulse.ToString();
|
||||
zoom_pulse = MAX_ZOOM_PULSE.ToString();
|
||||
}
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=absolute&action=control&ZoomPulse=" + zoom_pulse);
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + camera.camera_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=absolute&action=control&ZoomPulse=" + zoom_pulse);
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
@@ -76,7 +77,7 @@ namespace robospot_camera_finder
|
||||
|
||||
private void sendZoomValueManual(string zoom_value)
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + cam_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=continuous&NormalizedSpeed=True&action=control&Channel=0&Zoom=" + zoom_value);
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://" + camera.camera_ip + "/stw-cgi/ptzcontrol.cgi?msubmenu=continuous&NormalizedSpeed=True&action=control&Channel=0&Zoom=" + zoom_value);
|
||||
request.Credentials = new NetworkCredential(MainForm.cam_username, MainForm.cam_password);
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
@@ -105,13 +106,13 @@ namespace robospot_camera_finder
|
||||
|
||||
private void btnZoomMax_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbZoom.Value = max_zoom_pulse;
|
||||
tbZoom.Value = MAX_ZOOM_PULSE;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
}
|
||||
|
||||
private void btnZoomMin_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbZoom.Value = min_zoom_pulse;
|
||||
tbZoom.Value = MIN_ZOOM_PULSE;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
}
|
||||
|
||||
@@ -130,12 +131,12 @@ namespace robospot_camera_finder
|
||||
{
|
||||
if (zoomTestSeqFlag)
|
||||
{
|
||||
tbZoom.Value = min_zoom_pulse;
|
||||
tbZoom.Value = MIN_ZOOM_PULSE;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
zoomTestSeqFlag = false;
|
||||
} else
|
||||
{
|
||||
tbZoom.Value = max_zoom_pulse;
|
||||
tbZoom.Value = MAX_ZOOM_PULSE;
|
||||
sendZoomValue(tbZoom.Value.ToString());
|
||||
zoomTestSeqFlag = true;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,20 @@
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="favicon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LibVLCSharp" Version="3.8.2" />
|
||||
<PackageReference Include="LibVLCSharp.Forms" Version="3.8.2" />
|
||||
<PackageReference Include="LibVLCSharp.WinForms" Version="3.8.2" />
|
||||
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.20" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user