Skip to content

Commit

Permalink
Merge pull request #66 from MarcAnt01/2.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
MarcAnt01 authored Aug 31, 2021
2 parents 161bdc4 + 5aa2cf5 commit 1f765fa
Show file tree
Hide file tree
Showing 33 changed files with 4,033 additions and 181 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
/x64/
/x86/
bld/
[Bb]in/
[Oo]bj/
Expand Down Expand Up @@ -258,4 +258,4 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc
12 changes: 9 additions & 3 deletions CaptureEncoder/CaptureEncoder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AssemblyName>CaptureEncoder</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -128,12 +128,18 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.10</Version>
<Version>6.2.11</Version>
</PackageReference>
<PackageReference Include="SharpDX.Direct3D11">
<Version>4.2.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="ScreenSenderComponent">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\libs\ScreenSenderComponent\$(Platform)\ScreenSenderComponent.winmd</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand All @@ -145,4 +151,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
11 changes: 8 additions & 3 deletions CaptureEncoder/CaptureFrameWait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Windows.Graphics.Capture;
using Windows.Graphics.DirectX;
using Windows.Graphics.DirectX.Direct3D11;
using ScreenSenderComponent;

namespace CaptureEncoder
{
Expand Down Expand Up @@ -41,7 +42,8 @@ public sealed class CaptureFrameWait : IDisposable
public CaptureFrameWait(
IDirect3DDevice device,
GraphicsCaptureItem item,
SizeInt32 size)
SizeInt32 size,
LoopbackAudioCapture loopbackAudioCapture)
{
_device = device;
_d3dDevice = Direct3D11Helpers.CreateSharpDXDevice(device);
Expand All @@ -53,10 +55,10 @@ public CaptureFrameWait(
_events = new[] { _closedEvent, _frameEvent };

InitializeBlankTexture(size);
InitializeCapture(size);
InitializeCapture(size, loopbackAudioCapture);
}

private void InitializeCapture(SizeInt32 size)
private async void InitializeCapture(SizeInt32 size, LoopbackAudioCapture loopbackAudioCapture)
{
_item.Closed += OnClosed;
_framePool = Direct3D11CaptureFramePool.CreateFreeThreaded(
Expand All @@ -66,6 +68,9 @@ private void InitializeCapture(SizeInt32 size)
size);
_framePool.FrameArrived += OnFrameArrived;
_session = _framePool.CreateCaptureSession(_item);

if (loopbackAudioCapture != null) await loopbackAudioCapture.Start();

_session.StartCapture();
}

Expand Down
10 changes: 6 additions & 4 deletions CaptureEncoder/Encoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Windows.Media.MediaProperties;
using Windows.Media.Transcoding;
using Windows.Storage.Streams;
using ScreenSenderComponent;

namespace CaptureEncoder
{
Expand All @@ -22,12 +23,12 @@ public Encoder(IDirect3DDevice device, GraphicsCaptureItem item)
CreateMediaObjects();
}

public IAsyncOperation<bool> EncodeAsync(IRandomAccessStream stream, uint width, uint height, uint bitrateInBps, uint frameRate)
public IAsyncOperation<bool> EncodeAsync(IRandomAccessStream stream, uint width, uint height, uint bitrateInBps, uint frameRate, LoopbackAudioCapture loopbackAudioCapture)
{
return EncodeInternalAsync(stream, width, height, bitrateInBps, frameRate).AsAsyncOperation();
return EncodeInternalAsync(stream, width, height, bitrateInBps, frameRate, loopbackAudioCapture).AsAsyncOperation();
}

private async Task<bool> EncodeInternalAsync(IRandomAccessStream stream, uint width, uint height, uint bitrateInBps, uint frameRate)
private async Task<bool> EncodeInternalAsync(IRandomAccessStream stream, uint width, uint height, uint bitrateInBps, uint frameRate, LoopbackAudioCapture loopbackAudioCapture)
{
if (!_isRecording)
{
Expand All @@ -36,7 +37,8 @@ private async Task<bool> EncodeInternalAsync(IRandomAccessStream stream, uint wi
_frameGenerator = new CaptureFrameWait(
_device,
_captureItem,
_captureItem.Size);
_captureItem.Size,
loopbackAudioCapture);

using (_frameGenerator)
{
Expand Down
1 change: 1 addition & 0 deletions FluentScreenRecorder/AppCenterSecret.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
Binary file added FluentScreenRecorder/Assets/Silence.ogg
Binary file not shown.
41 changes: 41 additions & 0 deletions FluentScreenRecorder/CustomMediaTransportControls.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace FluentScreenRecorder
{
public sealed class CustomMediaTransportControls : MediaTransportControls
{
public CustomMediaTransportControls()
{
this.DefaultStyleKey = typeof(CustomMediaTransportControls);
}

public event EventHandler Deleted;
public event EventHandler InfoTap;

protected override void OnApplyTemplate()
{
// This is where you would get your custom button and create an event handler for its click method.
Button DeleteButton = GetTemplateChild("DeleteButton") as Button;
DeleteButton.Click += DeleteButton_Click;
Button InfoButton = GetTemplateChild("InfoButton") as Button;
InfoButton.Click += InfoButton_Click;

base.OnApplyTemplate();
}

private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
// Raise an event on the custom control when 'like' is clicked
Deleted?.Invoke(this, EventArgs.Empty);
}

private void InfoButton_Click(object sender, RoutedEventArgs e)
{
InfoTap?.Invoke(this, EventArgs.Empty);
}


}
}
16 changes: 9 additions & 7 deletions FluentScreenRecorder/Dialogs/AboutDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
xmlns:local="using:FluentScreenRecorder.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:strings="using:FluentScreenRecorder.Strings"
mc:Ignorable="d"
PrimaryButtonText="Report a bug"
SecondaryButtonText="Close"
PrimaryButtonText="{x:Bind strings:Resources.BugReport}"
SecondaryButtonText="{x:Bind strings:Resources.Ok}"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}">
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}"
SecondaryButtonStyle="{ThemeResource ButtonRevealStyle}">

<StackPanel>
<HyperlinkButton Content="View GitHub Repository" NavigateUri="https://github.com/MarcAnt01/Fluent-Screen-Recorder"/>
<HyperlinkButton Content="Join our Discord server" NavigateUri="https://discord.gg/v4EXAwXPHw"/>
<HyperlinkButton Content="Privacy policy" NavigateUri="https://github.com/MarcAnt01/Fluent-Screen-Recorder/blob/master/PRIVACY.md"/>
<HyperlinkButton Content="Copyright" NavigateUri="https://github.com/MarcAnt01/Fluent-Screen-Recorder/blob/master/LICENSE"/>
<HyperlinkButton Content="{x:Bind strings:Resources.GitHub}" NavigateUri="https://github.com/MarcAnt01/Fluent-Screen-Recorder"/>
<HyperlinkButton Content="{x:Bind strings:Resources.Discord}" NavigateUri="https://discord.gg/v4EXAwXPHw"/>
<HyperlinkButton Content="{x:Bind strings:Resources.Privacy}" NavigateUri="https://github.com/MarcAnt01/Fluent-Screen-Recorder/blob/master/PRIVACY.md"/>
<HyperlinkButton Content="{x:Bind strings:Resources.Copyright}" NavigateUri="https://github.com/MarcAnt01/Fluent-Screen-Recorder/blob/master/LICENSE"/>
<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
<TextBlock Text="Version"/>
<TextBlock x:Name="VersionNumberTextBlock" FontWeight="Bold"/>
Expand Down
16 changes: 10 additions & 6 deletions FluentScreenRecorder/Dialogs/ChangelogDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
xmlns:local="using:FluentScreenRecorder"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:strings="using:FluentScreenRecorder.Strings"
mc:Ignorable="d"
Title="{x:Bind displayedVersion}"
CloseButtonText="Ok">
CloseButtonText="{x:Bind strings:Resources.Ok}"
CloseButtonStyle="{ThemeResource ButtonRevealStyle}">

<ScrollViewer>
<StackPanel>
<TextBlock Text="What's new?" FontWeight="Bold" Margin="0,0,0,5"/>
<TextBlock Text="{x:Bind strings:Resources.Whatsnew}" FontWeight="Bold" Margin="0,0,0,5"/>
<RichTextBlock>
<Paragraph>- Now you can see a preview of the recorded video (can be disabled)</Paragraph>
<Paragraph>- Share the recorded video to other UWP apps in one click</Paragraph>
<Paragraph>- More bug fixes and improvements</Paragraph>
<Paragraph>- Now you can record the internal audio and the one coming from the microphone</Paragraph>
<Paragraph>- Bult-in gallery and videoplayer to see your saved recordings</Paragraph>
<Paragraph>- Overlay mode to see a small windows of the app on top of others (can be used as default mode)</Paragraph>
<Paragraph>- New updated icons for Windows 10 and Windows 11</Paragraph>
<Paragraph>- New ui with Windows 11 style</Paragraph>
<Paragraph>- We now have a Discord server if you want to join us :)</Paragraph>
</RichTextBlock>
<HyperlinkButton Content="Join Discord server" NavigateUri="https://discord.com/invite/v4EXAwXPHw"/>
<HyperlinkButton Content="{x:Bind strings:Resources.Discord}" NavigateUri="https://discord.com/invite/v4EXAwXPHw"/>
</StackPanel>
</ScrollViewer>
</ContentDialog>
18 changes: 10 additions & 8 deletions FluentScreenRecorder/Dialogs/SaveDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
xmlns:local="using:FluentScreenRecorder.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Do you want to save your file?"
PrimaryButtonText="Save"
SecondaryButtonText="Save as"
CloseButtonText="Delete"
xmlns:strings="using:FluentScreenRecorder.Strings"
mc:Ignorable="d"
PrimaryButtonClick="Save_Click"
SecondaryButtonClick="SaveAs_Click"
CloseButtonClick="Cancel_Click"
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}">
CloseButtonClick="Cancel_Click"
PrimaryButtonText="{x:Bind strings:Resources.Save}"
SecondaryButtonText="{x:Bind strings:Resources.SaveAs}"
CloseButtonText="{x:Bind strings:Resources.Delete}"
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}"
SecondaryButtonStyle="{ThemeResource ButtonRevealStyle}"
CloseButtonStyle="{ThemeResource ButtonRevealStyle}">

<Grid>
<TextBlock Text="You can choose among the following options"/>
<TextBlock Text="{x:Bind strings:Resources.Options}"/>
</Grid>
</ContentDialog>
19 changes: 19 additions & 0 deletions FluentScreenRecorder/Dialogs/VideoInfoDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<ContentDialog
x:Class="FluentScreenRecorder.Dialogs.VideoInfoDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FluentScreenRecorder.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Info"
CloseButtonText="Ok"
CloseButtonStyle="{ThemeResource ButtonRevealStyle}">

<StackPanel>
<TextBlock x:Name="Frameblock"/>
<TextBlock x:Name="Widthblock"/>
<TextBlock x:Name="Heightblock"/>
<TextBlock x:Name="Sizeblock"/>
</StackPanel>
</ContentDialog>
54 changes: 54 additions & 0 deletions FluentScreenRecorder/Dialogs/VideoInfoDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace FluentScreenRecorder.Dialogs
{
public sealed partial class VideoInfoDialog : ContentDialog
{
public VideoInfoDialog()
{

}

public VideoInfoDialog(IDictionary<string, object> frameRate, IDictionary<string, object> width, IDictionary <string, object> height)
{
this.InitializeComponent();

if (frameRate.TryGetValue("System.Video.FrameRate", out object frameRateValue) && frameRateValue is UInt32 framerate)
{
Frameblock.Text = $"Framerate {framerate / 1000d}";
}

if (width.TryGetValue("System.Video.FrameWidth", out object frameWidthValue) && frameWidthValue is UInt32 widthvalue)
{
Widthblock.Text = $"Width {widthvalue}";
}

if (height.TryGetValue("System.Video.FrameHeight", out object frameHeightValue) && frameHeightValue is UInt32 heightvalue)
{
Heightblock.Text = $"Height {heightvalue}";
}




}



}
}
Loading

0 comments on commit 1f765fa

Please sign in to comment.