Skip to content

Commit 8be52c6

Browse files
author
LetsPlentendo-CH
committed
Add files
0 parents  commit 8be52c6

18 files changed

+871
-0
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
##
4+
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5+
6+
# Build results
7+
bin/
8+
obj/
9+
10+
.vs/
11+
12+
*.user

App.xaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application x:Class="LoadRetimer.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:LoadRetimer"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
</Application.Resources>
8+
</Application>

App.xaml.cs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace LoadRetimer {
10+
/// <summary>
11+
/// Interaction logic for App.xaml
12+
/// </summary>
13+
public partial class App : Application {
14+
}
15+
}

AssemblyInfo.cs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

FinalRetimeWindow.xaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Window x:Class="LoadRetimer.FinalRetimeWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:LoadRetimer"
7+
mc:Ignorable="d"
8+
Icon="/Icon.ico"
9+
Title="Final Retime" Height="300" Width="500" ResizeMode="NoResize">
10+
<Grid>
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="2*" />
13+
<RowDefinition Height="2*" />
14+
<RowDefinition Height="2*" />
15+
<RowDefinition Height="2*" />
16+
<RowDefinition Height="1*" />
17+
<RowDefinition Height="2*" />
18+
</Grid.RowDefinitions>
19+
<Grid.ColumnDefinitions>
20+
<ColumnDefinition Width="1*" />
21+
<ColumnDefinition Width="1*" />
22+
</Grid.ColumnDefinitions>
23+
<Label Grid.Row="0" Grid.ColumnSpan="2" Content="Final Retime without loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
24+
<Label x:Name="WOLoads" Grid.Row="1" Grid.ColumnSpan="2" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
25+
<Label Grid.Row="2" Content="Retime with loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
26+
<Label Grid.Row="2" Grid.Column="1" Content="Loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
27+
<Label x:Name="WLoads" Grid.Row="3" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
28+
<Label x:Name="Loads" Grid.Row="3" Grid.Column="1" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
29+
<Label Grid.Row="4" Grid.ColumnSpan="2" Content="Generated with LoadRetimer v1.0.0" HorizontalAlignment="Center" FontSize="10" />
30+
<Button Grid.Row="5" Grid.ColumnSpan="2" Content="Close" Click="Button_Click" />
31+
</Grid>
32+
</Window>

FinalRetimeWindow.xaml.cs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Windows;
3+
4+
namespace LoadRetimer {
5+
/// <summary>
6+
/// Interaction logic for Info.xaml
7+
/// </summary>
8+
public partial class FinalRetimeWindow : Window {
9+
public FinalRetimeWindow() {
10+
InitializeComponent();
11+
}
12+
13+
public FinalRetimeWindow(TimeSpan wloads, TimeSpan loads) {
14+
InitializeComponent();
15+
WLoads.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", wloads);
16+
Loads.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", loads);
17+
WOLoads.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", wloads - loads);
18+
}
19+
20+
private void Button_Click(object sender, RoutedEventArgs e) {
21+
Close();
22+
}
23+
}
24+
}

Icon.ico

99.7 KB
Binary file not shown.

Info.xaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Window x:Class="LoadRetimer.Info"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:LoadRetimer"
7+
mc:Ignorable="d"
8+
Icon="/Icon.ico"
9+
Title="Info" Height="300" Width="500" ResizeMode="NoResize">
10+
<Grid>
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="5*" />
13+
<RowDefinition Height="10*" />
14+
<RowDefinition Height="2*" />
15+
<RowDefinition Height="3*" />
16+
</Grid.RowDefinitions>
17+
<Grid.ColumnDefinitions>
18+
<ColumnDefinition Width="1*" />
19+
</Grid.ColumnDefinitions>
20+
<Label Content="Load Retimer v1.0.0" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
21+
<TextBlock Grid.Row="1" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Top" Padding="2,0,0,0">
22+
Controls:<LineBreak/>
23+
A/D: go back/forwards 1 frame<LineBreak/>
24+
Q/E: seek 10 seconds backwards/forwards<LineBreak/>
25+
S/F: Set start/end of load<LineBreak/>
26+
Space: Pause/Unpause<LineBreak/>
27+
</TextBlock>
28+
<Label Grid.Row="2" Content="© TheCodingBoy 2021" HorizontalAlignment="Center" />
29+
<Button Grid.Row="3" Content="Close" Click="Button_Click" />
30+
</Grid>
31+
</Window>

Info.xaml.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Windows;
2+
3+
namespace LoadRetimer {
4+
/// <summary>
5+
/// Interaction logic for Info.xaml
6+
/// </summary>
7+
public partial class Info : Window {
8+
public Info() {
9+
InitializeComponent();
10+
}
11+
12+
private void Button_Click(object sender, RoutedEventArgs e) {
13+
Close();
14+
}
15+
}
16+
}

LoadInfo.xaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<UserControl x:Class="LoadRetimer.LoadInfo"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:LoadRetimer"
7+
mc:Ignorable="d" >
8+
<Grid>
9+
<Grid.RowDefinitions>
10+
<RowDefinition Height="Auto" />
11+
<RowDefinition Height="1*" />
12+
<RowDefinition Height="1*" />
13+
</Grid.RowDefinitions>
14+
<Grid.ColumnDefinitions>
15+
<ColumnDefinition Width="1*" />
16+
<ColumnDefinition Width="1*" />
17+
</Grid.ColumnDefinitions>
18+
<Label x:Name="LoadName" Content="Load" Grid.ColumnSpan="2" FontSize="20" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
19+
<Separator VerticalAlignment="Top" Margin="0,49,0,0" Grid.ColumnSpan="2"/>
20+
<Label x:Name="LoadFrameDurationF" Grid.Row="1" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold"/>
21+
<Label x:Name="LoadFrameDurationS" Grid.Row="2" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold"/>
22+
<Label x:Name="LoadFrameBeginS" Grid.Row="1" Grid.Column="1" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
23+
<Label x:Name="LoadFrameEndS" Grid.Row="2" Grid.Column="1" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
24+
25+
</Grid>
26+
</UserControl>

LoadInfo.xaml.cs

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using System.Windows.Controls;
3+
4+
namespace LoadRetimer {
5+
/// <summary>
6+
/// Interaction logic for LoadInfo.xaml
7+
/// </summary>
8+
public partial class LoadInfo : UserControl {
9+
10+
public long frameStart = -1;
11+
public long frameEnd = -1;
12+
13+
public LoadInfo() {
14+
InitializeComponent();
15+
TryCalculate();
16+
}
17+
18+
public LoadInfo(string name) {
19+
InitializeComponent();
20+
SetName(name);
21+
TryCalculate();
22+
}
23+
24+
public void SetName(string s) {
25+
LoadName.Content = s;
26+
}
27+
28+
public void SetBegin(TimeSpan begin) {
29+
frameStart = (long) Math.Round(begin.TotalSeconds * MainWindow.frameRate);
30+
TryCalculate();
31+
}
32+
33+
public void SetEnd(TimeSpan begin) {
34+
frameEnd = (long)Math.Round(begin.TotalSeconds * MainWindow.frameRate);
35+
TryCalculate();
36+
}
37+
38+
private void TryCalculate() {
39+
LoadFrameDurationF.Content = "---";
40+
LoadFrameDurationS.Content = "---";
41+
if (frameStart > -1) {
42+
LoadFrameBeginS.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", new TimeSpan((long)(frameStart / MainWindow.frameRate * 10_000_000)));
43+
}
44+
if (frameEnd > -1) {
45+
LoadFrameEndS.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", new TimeSpan((long)(frameEnd / MainWindow.frameRate * 10_000_000)));
46+
}
47+
if (frameStart > -1 && frameEnd > -1) {
48+
int frameDuration = FrameDuration();
49+
LoadFrameDurationF.Content = String.Format("{0} frames", frameDuration);
50+
LoadFrameDurationS.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", new TimeSpan((long)(frameDuration / MainWindow.frameRate * 10_000_000)));
51+
}
52+
}
53+
54+
public int FrameDuration() {
55+
if (frameStart > -1 && frameEnd > -1) {
56+
return (int)(frameEnd - frameStart);
57+
} else {
58+
return 0;
59+
}
60+
}
61+
}
62+
}

LoadRetimer.csproj

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net5.0-windows</TargetFramework>
6+
<UseWPF>true</UseWPF>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<None Remove="Icon.ico" />
11+
<None Remove="Shader\brightness.ps" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="FFME.Windows" Version="4.3.340" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<Resource Include="Icon.ico" />
20+
<Resource Include="Shader\brightness.ps" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<Compile Update="FinalRetimeWindow.xaml.cs">
25+
<SubType>Code</SubType>
26+
</Compile>
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<Page Update="FinalRetimeWindow.xaml">
31+
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
32+
<SubType>Designer</SubType>
33+
</Page>
34+
</ItemGroup>
35+
36+
</Project>

LoadRetimer.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30711.63
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadRetimer", "LoadRetimer.csproj", "{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {7AE40F5E-98E9-4649-9DB4-686C5DF8B16C}
24+
EndGlobalSection
25+
EndGlobal

MainWindow.xaml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<Window x:Class="LoadRetimer.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:LoadRetimer"
7+
xmlns:ffme="clr-namespace:Unosquare.FFME;assembly=ffme.win"
8+
mc:Ignorable="d"
9+
Icon="/Icon.ico"
10+
Title="Load Retimer" Height="450" Width="1000" PreviewKeyDown="Window_KeyDown" MinHeight="300" MinWidth="900" SizeChanged="Window_SizeChanged">
11+
<Grid MouseDown="Video_MouseDown">
12+
<Grid.RowDefinitions>
13+
<RowDefinition Height="Auto" />
14+
<RowDefinition Height="2*" />
15+
<RowDefinition Height="3*" />
16+
<RowDefinition Height="Auto" />
17+
<RowDefinition Height="40" />
18+
</Grid.RowDefinitions>
19+
<Grid.ColumnDefinitions>
20+
<ColumnDefinition Width="8*" />
21+
<ColumnDefinition Width="2*" />
22+
<ColumnDefinition Width="3*" />
23+
</Grid.ColumnDefinitions>
24+
<Menu Grid.Row="0" Grid.ColumnSpan="3">
25+
<MenuItem Header="_File">
26+
<MenuItem Header="_Open Video" Click="OpenFile_Click" />
27+
<MenuItem Header="_Open Loads" Click="OpenLoads_Click" />
28+
<MenuItem Header="_Save Loads" Click="SaveLoads_Click" />
29+
<MenuItem Header="_Info" Click="Info_Click" />
30+
</MenuItem>
31+
</Menu>
32+
<Label Content="No video loaded." Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
33+
<ffme:MediaElement Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" LoadedBehavior="Pause" x:Name="Video" MediaOpened="Video_MediaOpened"/>
34+
<Rectangle x:Name="Rect" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#20000000" />
35+
36+
<Rectangle Grid.Row="1" Grid.Column="1">
37+
<Rectangle.Fill>
38+
<VisualBrush x:Name="Magnifier" Visual="{Binding ., ElementName=Video}" Stretch="Uniform" Viewbox="0, 0, 533, 352" ViewboxUnits="Absolute" Viewport="0, 0, 1, 1" ViewportUnits="RelativeToBoundingBox" />
39+
</Rectangle.Fill>
40+
<Rectangle.Effect>
41+
<local:BrightnessEffect />
42+
</Rectangle.Effect>
43+
</Rectangle>
44+
<StackPanel Name="VideoInfo" Grid.Row="2" Grid.Column="1">
45+
<Label Content="Video info" FontWeight="Bold" />
46+
<Label x:Name="FPSLabel" Content="FPS:" />
47+
<Label x:Name="DurationLabel" Content="Duration:" />
48+
</StackPanel>
49+
50+
<Grid Grid.Row="1" Grid.Column="2">
51+
<Grid.RowDefinitions>
52+
<RowDefinition Height="1*" />
53+
<RowDefinition Height="Auto" />
54+
</Grid.RowDefinitions>
55+
<Grid.ColumnDefinitions>
56+
<ColumnDefinition Width="1*" />
57+
<ColumnDefinition Width="1*" />
58+
</Grid.ColumnDefinitions>
59+
<local:LoadInfo Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="TotalRunInfo"/>
60+
<Button Grid.Row="1" Grid.Column="0" Content="Start Run" Click="StartRun_Click" />
61+
<Button Grid.Row="1" Grid.Column="1" Content="End Run" Click="EndRun_Click" />
62+
</Grid>
63+
64+
<ListBox Grid.Row="2" Grid.Column="2" Grid.RowSpan="2" x:Name="LoadBox" HorizontalContentAlignment="Stretch" />
65+
<Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2">
66+
<Grid.ColumnDefinitions>
67+
<ColumnDefinition Width="1*" />
68+
<ColumnDefinition Width="1*" />
69+
<ColumnDefinition Width="1*" />
70+
<ColumnDefinition Width="2*" />
71+
<ColumnDefinition Width="2*" />
72+
</Grid.ColumnDefinitions>
73+
<Button Grid.Column="0" Content="-1 frame" Click="FrameBack_Click" />
74+
<Button Grid.Column="1" x:Name="PlayPause" Content="Play" Click="ButtonPlayPause_Click" />
75+
<Button Grid.Column="2" Content="+1 frame" Click="FrameForward_Click" />
76+
<Button Grid.Column="3" Content="Begin Load" Click="BeginLoad_Click" />
77+
<Button Grid.Column="4" Content="End Load" Click="EndLoad_Click" />
78+
</Grid>
79+
<Slider Grid.Row="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" x:Name="Slider" Thumb.DragStarted="Slider_DragStarted" Thumb.DragCompleted="Slider_DragCompleted" ValueChanged="Slider_ValueChanged" Maximum="1000" LargeChange="0" SmallChange="0"/>
80+
<Label x:Name="TimePosition" Grid.Row="3" Grid.Column="1" Content="00:00.000" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Courier New" />
81+
<Button Grid.Row="4" Grid.Column="2" Content="Retime!" Click="Retime_Click" />
82+
</Grid>
83+
</Window>

0 commit comments

Comments
 (0)