Skip to content

Commit 8243784

Browse files
author
RandomEngy
committed
Adding missing files for logging/x264 options.
1 parent b2a1431 commit 8243784

4 files changed

Lines changed: 321 additions & 0 deletions

File tree

VidCoder/View/LogWindow.xaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Window x:Class="VidCoder.View.LogWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="Log" Height="393" Width="459"
5+
Style="{StaticResource NormalWindow}"
6+
WindowStyle="ToolWindow" ShowInTaskbar="False" Closing="Window_Closing">
7+
<Grid>
8+
<TextBox
9+
Name="logTextBox"
10+
Margin="0,0,0,36"
11+
IsReadOnly="True"
12+
Text="{Binding LogText, Mode=OneWay}"
13+
TextWrapping="WrapWithOverflow" TextChanged="logTextBox_TextChanged"
14+
VerticalScrollBarVisibility="Auto"/>
15+
<Button
16+
Content="Clear"
17+
Command="{Binding ClearLogCommand}"
18+
Height="23" HorizontalAlignment="Right" Margin="0,0,12,7" VerticalAlignment="Bottom" Width="75" />
19+
</Grid>
20+
</Window>

VidCoder/View/LogWindow.xaml.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Windows;
6+
using System.Windows.Controls;
7+
using System.Windows.Data;
8+
using System.Windows.Documents;
9+
using System.Windows.Input;
10+
using System.Windows.Media;
11+
using System.Windows.Media.Imaging;
12+
using System.Windows.Shapes;
13+
using VidCoder.Properties;
14+
15+
namespace VidCoder.View
16+
{
17+
/// <summary>
18+
/// Interaction logic for LogWindow.xaml
19+
/// </summary>
20+
public partial class LogWindow : Window
21+
{
22+
public LogWindow()
23+
{
24+
InitializeComponent();
25+
}
26+
27+
protected override void OnSourceInitialized(EventArgs e)
28+
{
29+
base.OnSourceInitialized(e);
30+
this.SetPlacement(Properties.Settings.Default.LogWindowPlacement);
31+
}
32+
33+
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
34+
{
35+
Settings.Default.LogWindowPlacement = this.GetPlacement();
36+
Settings.Default.Save();
37+
}
38+
39+
private void logTextBox_TextChanged(object sender, TextChangedEventArgs e)
40+
{
41+
this.logTextBox.ScrollToEnd();
42+
}
43+
}
44+
}
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace VidCoder.ViewModel
7+
{
8+
public class AdvancedChoice
9+
{
10+
/// <summary>
11+
/// Gets or sets a value indicating whether the given choice is default.
12+
/// </summary>
13+
public bool IsDefault { get; set; }
14+
15+
/// <summary>
16+
/// Gets or sets the UI label for the choice.
17+
/// </summary>
18+
public string Label { get; set; }
19+
20+
/// <summary>
21+
/// Gets or sets the value on the options string for the choice.
22+
/// </summary>
23+
public string Value { get; set; }
24+
}
25+
26+
public static class AdvancedChoices
27+
{
28+
private static List<AdvancedChoice> referenceFrames;
29+
private static List<AdvancedChoice> bFrames;
30+
private static List<AdvancedChoice> adaptiveBFrames;
31+
private static List<AdvancedChoice> directPrediction;
32+
private static List<AdvancedChoice> motionEstimationMethod;
33+
private static List<AdvancedChoice> subpixelMotionEstimation;
34+
private static List<AdvancedChoice> motionEstimationRange;
35+
private static List<AdvancedChoice> analysis;
36+
private static List<AdvancedChoice> trellis;
37+
private static List<AdvancedChoice> deblockingStrength;
38+
private static List<AdvancedChoice> deblockingThreshold;
39+
40+
static AdvancedChoices()
41+
{
42+
referenceFrames = CreateNumberList(0, 16, defaultNumber: 3);
43+
bFrames = CreateNumberList(0, 16, defaultNumber: 3);
44+
45+
adaptiveBFrames = new List<AdvancedChoice>
46+
{
47+
new AdvancedChoice { Label = "Off", Value = "0" },
48+
new AdvancedChoice { Label = "Fast (Default)", Value = "1", IsDefault = true },
49+
new AdvancedChoice { Label = "Optimal", Value = "2" }
50+
};
51+
52+
directPrediction = new List<AdvancedChoice>
53+
{
54+
new AdvancedChoice { Label = "None", Value = "none" },
55+
new AdvancedChoice { Label = "Spatial (Default)", Value = "spatial", IsDefault = true },
56+
new AdvancedChoice { Label = "Temporal", Value = "temporal" },
57+
new AdvancedChoice { Label = "Automatic", Value = "auto" }
58+
};
59+
60+
motionEstimationMethod = new List<AdvancedChoice>
61+
{
62+
new AdvancedChoice { Label = "Diamond", Value = "dia" },
63+
new AdvancedChoice { Label = "Hexagon (Default)", Value = "hex", IsDefault = true },
64+
new AdvancedChoice { Label = "Uneven Multi-Hexagon", Value = "umh" },
65+
new AdvancedChoice { Label = "Exhaustive", Value = "esa" },
66+
new AdvancedChoice { Label = "Transformed Exhaustive", Value = "tesa" },
67+
};
68+
69+
subpixelMotionEstimation = CreateNumberList(0, 9, defaultNumber: 7);
70+
motionEstimationRange = CreateNumberList(4, 64, defaultNumber: 16);
71+
72+
analysis = new List<AdvancedChoice>
73+
{
74+
new AdvancedChoice { Label = "None", Value = "none" },
75+
new AdvancedChoice { Label = "Some (Default)", IsDefault = true },
76+
new AdvancedChoice { Label = "All", Value = "all" }
77+
};
78+
79+
trellis = CreateNumberList(0, 2, defaultNumber: 1);
80+
deblockingStrength = CreateNumberList(-6, 6, defaultNumber: 0);
81+
deblockingThreshold = CreateNumberList(-6, 6, defaultNumber: 0);
82+
}
83+
84+
#region Properties
85+
public static List<AdvancedChoice> ReferenceFrames
86+
{
87+
get
88+
{
89+
return referenceFrames;
90+
}
91+
}
92+
93+
public static List<AdvancedChoice> BFrames
94+
{
95+
get
96+
{
97+
return bFrames;
98+
}
99+
}
100+
101+
public static List<AdvancedChoice> AdaptiveBFrames
102+
{
103+
get
104+
{
105+
return adaptiveBFrames;
106+
}
107+
}
108+
109+
public static List<AdvancedChoice> DirectPrediction
110+
{
111+
get
112+
{
113+
return directPrediction;
114+
}
115+
}
116+
117+
public static List<AdvancedChoice> MotionEstimationMethod
118+
{
119+
get
120+
{
121+
return motionEstimationMethod;
122+
}
123+
}
124+
125+
public static List<AdvancedChoice> SubpixelMotionEstimation
126+
{
127+
get
128+
{
129+
return subpixelMotionEstimation;
130+
}
131+
}
132+
133+
public static List<AdvancedChoice> MotionEstimationRange
134+
{
135+
get
136+
{
137+
return motionEstimationRange;
138+
}
139+
}
140+
141+
public static List<AdvancedChoice> Analysis
142+
{
143+
get
144+
{
145+
return analysis;
146+
}
147+
}
148+
149+
public static List<AdvancedChoice> Trellis
150+
{
151+
get
152+
{
153+
return trellis;
154+
}
155+
}
156+
157+
public static List<AdvancedChoice> DeblockingStrength
158+
{
159+
get
160+
{
161+
return deblockingStrength;
162+
}
163+
}
164+
165+
public static List<AdvancedChoice> DeblockingThreshold
166+
{
167+
get
168+
{
169+
return deblockingThreshold;
170+
}
171+
}
172+
#endregion
173+
174+
private static List<AdvancedChoice> CreateNumberList(int lower, int upper, int defaultNumber)
175+
{
176+
var list = new List<AdvancedChoice>();
177+
AddRange(list, lower, upper, defaultNumber);
178+
179+
return list;
180+
}
181+
182+
private static void AddRange(List<AdvancedChoice> list, int lower, int upper, int defaultNumber)
183+
{
184+
for (int i = lower; i <= upper; i++)
185+
{
186+
if (i == defaultNumber)
187+
{
188+
list.Add(new AdvancedChoice
189+
{
190+
IsDefault = true,
191+
Label = i.ToString() + " (Default)",
192+
Value = i.ToString()
193+
});
194+
}
195+
else
196+
{
197+
list.Add(new AdvancedChoice
198+
{
199+
Label = i.ToString(),
200+
Value = i.ToString()
201+
});
202+
}
203+
}
204+
}
205+
}
206+
}

VidCoder/ViewModel/LogViewModel.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using VidCoder.Model;
6+
using System.Windows.Input;
7+
8+
namespace VidCoder.ViewModel
9+
{
10+
public class LogViewModel : OkCancelDialogViewModel
11+
{
12+
private Logger logger;
13+
14+
private ICommand clearLogCommand;
15+
16+
public LogViewModel(Logger logger)
17+
{
18+
this.logger = logger;
19+
}
20+
21+
public string LogText
22+
{
23+
get
24+
{
25+
return logger.LogText;
26+
}
27+
}
28+
29+
public ICommand ClearLogCommand
30+
{
31+
get
32+
{
33+
if (this.clearLogCommand == null)
34+
{
35+
this.clearLogCommand = new RelayCommand(param =>
36+
{
37+
this.logger.ClearLog();
38+
this.NotifyPropertyChanged("LogText");
39+
});
40+
}
41+
42+
return this.clearLogCommand;
43+
}
44+
}
45+
46+
public void RefreshLogs()
47+
{
48+
this.NotifyPropertyChanged("LogText");
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)