Skip to content

Commit 1dfd634

Browse files
committed
fix on Wpf app camera width and height
1 parent c2ca579 commit 1dfd634

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Examples/AVRecord/MainWindow.xaml.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public partial class MainWindow :System.Windows.Window
2525
private H264Decoder decoder;
2626
private Stream s;
2727
private AviWriter writer;
28-
const int w = 1920;
29-
const int h = 1080;
28+
const int w = 640;
29+
const int h = 480;
3030
object mtex = new object();
3131
int numThreads = 4;
3232
ConverterConfig config = ConverterConfig.Default;
@@ -157,6 +157,11 @@ private void CaptureCam()
157157
capture.FrameWidth = w;
158158
capture.FrameHeight = h;
159159
capture.Fps = 30;
160+
if(capture.FrameWidth!= w || capture.FrameHeight != h)
161+
{
162+
MessageBox.Show($"Unable to set the resolution {w}x{h} for the camera.");
163+
return;
164+
}
160165
Mat frame = new Mat();
161166
Thread t = new Thread(() =>
162167
{

H264SharpBitmapExtentions/H264SharpBitmapExtentions.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,23 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
7+
<Title>H264SharpBitmapExtentions</Title>
8+
<Authors>ReferenceType</Authors>
9+
<Description>Bitmap extentions for H264Sharp</Description>
10+
<PackageProjectUrl>https://github.com/ReferenceType/H264Sharp</PackageProjectUrl>
11+
<RepositoryUrl>https://github.com/ReferenceType/H264Sharp</RepositoryUrl>
12+
<PackageTags>h264</PackageTags>
13+
<PackageLicenseFile>Licence.txt</PackageLicenseFile>
614
</PropertyGroup>
715

16+
<ItemGroup>
17+
<None Include="..\Resources\Licence.txt">
18+
<Pack>True</Pack>
19+
<PackagePath>\</PackagePath>
20+
</None>
21+
</ItemGroup>
22+
823
<ItemGroup>
924
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
1025
</ItemGroup>

0 commit comments

Comments
 (0)