Skip to content

Commit

Permalink
Add files
Browse files Browse the repository at this point in the history
  • Loading branch information
LetsPlentendo-CH committed Feb 8, 2021
0 parents commit 8be52c6
Show file tree
Hide file tree
Showing 18 changed files with 871 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# Build results
bin/
obj/

.vs/

*.user
8 changes: 8 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application x:Class="LoadRetimer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LoadRetimer"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
15 changes: 15 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace LoadRetimer {
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
}
}
10 changes: 10 additions & 0 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
32 changes: 32 additions & 0 deletions FinalRetimeWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Window x:Class="LoadRetimer.FinalRetimeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LoadRetimer"
mc:Ignorable="d"
Icon="/Icon.ico"
Title="Final Retime" Height="300" Width="500" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="2*" />
<RowDefinition Height="2*" />
<RowDefinition Height="2*" />
<RowDefinition Height="1*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Content="Final Retime without loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
<Label x:Name="WOLoads" Grid.Row="1" Grid.ColumnSpan="2" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
<Label Grid.Row="2" Content="Retime with loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label Grid.Row="2" Grid.Column="1" Content="Loads:" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label x:Name="WLoads" Grid.Row="3" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label x:Name="Loads" Grid.Row="3" Grid.Column="1" Content="--:--.---" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="15"/>
<Label Grid.Row="4" Grid.ColumnSpan="2" Content="Generated with LoadRetimer v1.0.0" HorizontalAlignment="Center" FontSize="10" />
<Button Grid.Row="5" Grid.ColumnSpan="2" Content="Close" Click="Button_Click" />
</Grid>
</Window>
24 changes: 24 additions & 0 deletions FinalRetimeWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Windows;

namespace LoadRetimer {
/// <summary>
/// Interaction logic for Info.xaml
/// </summary>
public partial class FinalRetimeWindow : Window {
public FinalRetimeWindow() {
InitializeComponent();
}

public FinalRetimeWindow(TimeSpan wloads, TimeSpan loads) {
InitializeComponent();
WLoads.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", wloads);
Loads.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", loads);
WOLoads.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", wloads - loads);
}

private void Button_Click(object sender, RoutedEventArgs e) {
Close();
}
}
}
Binary file added Icon.ico
Binary file not shown.
31 changes: 31 additions & 0 deletions Info.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Window x:Class="LoadRetimer.Info"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LoadRetimer"
mc:Ignorable="d"
Icon="/Icon.ico"
Title="Info" Height="300" Width="500" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*" />
<RowDefinition Height="10*" />
<RowDefinition Height="2*" />
<RowDefinition Height="3*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="Load Retimer v1.0.0" HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" FontSize="25"/>
<TextBlock Grid.Row="1" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Top" Padding="2,0,0,0">
Controls:<LineBreak/>
A/D: go back/forwards 1 frame<LineBreak/>
Q/E: seek 10 seconds backwards/forwards<LineBreak/>
S/F: Set start/end of load<LineBreak/>
Space: Pause/Unpause<LineBreak/>
</TextBlock>
<Label Grid.Row="2" Content="© TheCodingBoy 2021" HorizontalAlignment="Center" />
<Button Grid.Row="3" Content="Close" Click="Button_Click" />
</Grid>
</Window>
16 changes: 16 additions & 0 deletions Info.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Windows;

namespace LoadRetimer {
/// <summary>
/// Interaction logic for Info.xaml
/// </summary>
public partial class Info : Window {
public Info() {
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e) {
Close();
}
}
}
26 changes: 26 additions & 0 deletions LoadInfo.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<UserControl x:Class="LoadRetimer.LoadInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:LoadRetimer"
mc:Ignorable="d" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label x:Name="LoadName" Content="Load" Grid.ColumnSpan="2" FontSize="20" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Separator VerticalAlignment="Top" Margin="0,49,0,0" Grid.ColumnSpan="2"/>
<Label x:Name="LoadFrameDurationF" Grid.Row="1" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold"/>
<Label x:Name="LoadFrameDurationS" Grid.Row="2" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold"/>
<Label x:Name="LoadFrameBeginS" Grid.Row="1" Grid.Column="1" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Label x:Name="LoadFrameEndS" Grid.Row="2" Grid.Column="1" Content="---" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>

</Grid>
</UserControl>
62 changes: 62 additions & 0 deletions LoadInfo.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Windows.Controls;

namespace LoadRetimer {
/// <summary>
/// Interaction logic for LoadInfo.xaml
/// </summary>
public partial class LoadInfo : UserControl {

public long frameStart = -1;
public long frameEnd = -1;

public LoadInfo() {
InitializeComponent();
TryCalculate();
}

public LoadInfo(string name) {
InitializeComponent();
SetName(name);
TryCalculate();
}

public void SetName(string s) {
LoadName.Content = s;
}

public void SetBegin(TimeSpan begin) {
frameStart = (long) Math.Round(begin.TotalSeconds * MainWindow.frameRate);
TryCalculate();
}

public void SetEnd(TimeSpan begin) {
frameEnd = (long)Math.Round(begin.TotalSeconds * MainWindow.frameRate);
TryCalculate();
}

private void TryCalculate() {
LoadFrameDurationF.Content = "---";
LoadFrameDurationS.Content = "---";
if (frameStart > -1) {
LoadFrameBeginS.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", new TimeSpan((long)(frameStart / MainWindow.frameRate * 10_000_000)));
}
if (frameEnd > -1) {
LoadFrameEndS.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", new TimeSpan((long)(frameEnd / MainWindow.frameRate * 10_000_000)));
}
if (frameStart > -1 && frameEnd > -1) {
int frameDuration = FrameDuration();
LoadFrameDurationF.Content = String.Format("{0} frames", frameDuration);
LoadFrameDurationS.Content = String.Format("{0:hh\\:mm\\:ss\\.fff}", new TimeSpan((long)(frameDuration / MainWindow.frameRate * 10_000_000)));
}
}

public int FrameDuration() {
if (frameStart > -1 && frameEnd > -1) {
return (int)(frameEnd - frameStart);
} else {
return 0;
}
}
}
}
36 changes: 36 additions & 0 deletions LoadRetimer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<None Remove="Icon.ico" />
<None Remove="Shader\brightness.ps" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="FFME.Windows" Version="4.3.340" />
</ItemGroup>

<ItemGroup>
<Resource Include="Icon.ico" />
<Resource Include="Shader\brightness.ps" />
</ItemGroup>

<ItemGroup>
<Compile Update="FinalRetimeWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

<ItemGroup>
<Page Update="FinalRetimeWindow.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions LoadRetimer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30711.63
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadRetimer", "LoadRetimer.csproj", "{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02DDEF8A-6CCB-4597-A224-A8D4E9B6891B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7AE40F5E-98E9-4649-9DB4-686C5DF8B16C}
EndGlobalSection
EndGlobal
83 changes: 83 additions & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<Window x:Class="LoadRetimer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LoadRetimer"
xmlns:ffme="clr-namespace:Unosquare.FFME;assembly=ffme.win"
mc:Ignorable="d"
Icon="/Icon.ico"
Title="Load Retimer" Height="450" Width="1000" PreviewKeyDown="Window_KeyDown" MinHeight="300" MinWidth="900" SizeChanged="Window_SizeChanged">
<Grid MouseDown="Video_MouseDown">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="2*" />
<RowDefinition Height="3*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Menu Grid.Row="0" Grid.ColumnSpan="3">
<MenuItem Header="_File">
<MenuItem Header="_Open Video" Click="OpenFile_Click" />
<MenuItem Header="_Open Loads" Click="OpenLoads_Click" />
<MenuItem Header="_Save Loads" Click="SaveLoads_Click" />
<MenuItem Header="_Info" Click="Info_Click" />
</MenuItem>
</Menu>
<Label Content="No video loaded." Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<ffme:MediaElement Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" LoadedBehavior="Pause" x:Name="Video" MediaOpened="Video_MediaOpened"/>
<Rectangle x:Name="Rect" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#20000000" />

<Rectangle Grid.Row="1" Grid.Column="1">
<Rectangle.Fill>
<VisualBrush x:Name="Magnifier" Visual="{Binding ., ElementName=Video}" Stretch="Uniform" Viewbox="0, 0, 533, 352" ViewboxUnits="Absolute" Viewport="0, 0, 1, 1" ViewportUnits="RelativeToBoundingBox" />
</Rectangle.Fill>
<Rectangle.Effect>
<local:BrightnessEffect />
</Rectangle.Effect>
</Rectangle>
<StackPanel Name="VideoInfo" Grid.Row="2" Grid.Column="1">
<Label Content="Video info" FontWeight="Bold" />
<Label x:Name="FPSLabel" Content="FPS:" />
<Label x:Name="DurationLabel" Content="Duration:" />
</StackPanel>

<Grid Grid.Row="1" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<local:LoadInfo Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="TotalRunInfo"/>
<Button Grid.Row="1" Grid.Column="0" Content="Start Run" Click="StartRun_Click" />
<Button Grid.Row="1" Grid.Column="1" Content="End Run" Click="EndRun_Click" />
</Grid>

<ListBox Grid.Row="2" Grid.Column="2" Grid.RowSpan="2" x:Name="LoadBox" HorizontalContentAlignment="Stretch" />
<Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="-1 frame" Click="FrameBack_Click" />
<Button Grid.Column="1" x:Name="PlayPause" Content="Play" Click="ButtonPlayPause_Click" />
<Button Grid.Column="2" Content="+1 frame" Click="FrameForward_Click" />
<Button Grid.Column="3" Content="Begin Load" Click="BeginLoad_Click" />
<Button Grid.Column="4" Content="End Load" Click="EndLoad_Click" />
</Grid>
<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"/>
<Label x:Name="TimePosition" Grid.Row="3" Grid.Column="1" Content="00:00.000" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Courier New" />
<Button Grid.Row="4" Grid.Column="2" Content="Retime!" Click="Retime_Click" />
</Grid>
</Window>
Loading

0 comments on commit 8be52c6

Please sign in to comment.