Skip to content

Commit

Permalink
[CastIt] Added initial logic to change the style of the subtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Sep 17, 2020
1 parent a30dc90 commit 6f1d0db
Show file tree
Hide file tree
Showing 18 changed files with 775 additions and 59 deletions.
7 changes: 7 additions & 0 deletions CastIt/Common/Enums/SubtitleBgColorType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace CastIt.Common.Enums
{
public enum SubtitleBgColorType
{
Transparent
}
}
8 changes: 8 additions & 0 deletions CastIt/Common/Enums/SubtitleFgColorType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace CastIt.Common.Enums
{
public enum SubtitleFgColorType
{
White,
Yellow
}
}
14 changes: 14 additions & 0 deletions CastIt/Common/Enums/SubtitleFontScaleType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace CastIt.Common.Enums
{
public enum SubtitleFontScaleType
{
Fifty = 50,
SeventyFive = 75,
Ninety = 95,
Hundred = 100,
HundredAndTwentyFive = 125,
HundredAndFifty = 150,
HundedAndSeventyFive = 175,
TwoHundred = 200
}
}
2 changes: 1 addition & 1 deletion CastIt/Common/Extensions/ColorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static System.Windows.Media.Color ToMediaColor(this string hex)
}

public static string ToHexString(this Color c)
=> string.Format("#{0:X6}", c.ToArgb() & 0x00FFFFFF);
=> $"#{c.ToArgb() & 0x00FFFFFF:X6}";

public static Color ToDrawingColor(this System.Windows.Media.Color mediaColor)
{
Expand Down
9 changes: 9 additions & 0 deletions CastIt/Interfaces/IAppSettingsService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CastIt.Common.Enums;
using CastIt.GoogleCast.Enums;

namespace CastIt.Interfaces
{
Expand All @@ -21,6 +22,14 @@ public interface IAppSettingsService
bool MinimizeToTray { get; set; }
bool ShowPlayListTotalDuration { get; set; }

SubtitleFgColorType CurrentSubtitleFgColor { get; set; }
SubtitleBgColorType CurrentSubtitleBgColor { get; set; }
SubtitleFontScaleType CurrentSubtitleFontScale { get; set; }
TextTrackFontStyleType CurrentSubtitleFontStyle { get; set; }
TextTrackFontGenericFamilyType CurrentSubtitleFontFamily { get; set; }
double SubtitleDelayInSeconds { get; set; }
bool LoadFirstSubtitleFoundAutomatically { get; set; }

void SaveSettings();
}
}
8 changes: 8 additions & 0 deletions CastIt/Models/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CastIt.Common.Enums;
using CastIt.GoogleCast.Enums;

namespace CastIt.Models
{
Expand All @@ -20,5 +21,12 @@ public class AppSettings
public bool EnableHardwareAcceleration { get; set; }
public bool MinimizeToTray { get; set; }
public bool ShowPlayListTotalDuration { get; set; }
public SubtitleFgColorType CurrentSubtitleFgColor { get; set; }
public SubtitleBgColorType CurrentSubtitleBgColor { get; set; }
public SubtitleFontScaleType CurrentSubtitleFontScale { get; set; }
public TextTrackFontStyleType CurrentSubtitleFontStyle { get; set; }
public TextTrackFontGenericFamilyType CurrentSubtitleFontFamily { get; set; }
public double SubtitleDelayInSeconds { get; set; }
public bool LoadFirstSubtitleFoundAutomatically { get; set; }
}
}
6 changes: 6 additions & 0 deletions CastIt/Models/FFMpeg/Args/FFmpegOutputArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,11 @@ public FFmpegOutputArgs SetPixelFormat(HwAccelDeviceType type)

public FFmpegOutputArgs SetPlayList(int index)
=> AddArg("map", $"p:{index}");

public FFmpegOutputArgs SetDelayInSeconds(double seconds)
=> AddArg("muxdelay", seconds);

public FFmpegOutputArgs SetDelayInMicroSeconds(int ms)
=> AddArg("maxdelay", ms);
}
}
153 changes: 153 additions & 0 deletions CastIt/Resources/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions CastIt/Resources/Resource.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,55 @@
<data name="Total" xml:space="preserve">
<value>Total</value>
</data>
<data name="Transparent" xml:space="preserve">
<value>Transparente</value>
</data>
<data name="White" xml:space="preserve">
<value>Blanco</value>
</data>
<data name="Yellow" xml:space="preserve">
<value>Amarillo</value>
</data>
<data name="Normal" xml:space="preserve">
<value>Normal</value>
</data>
<data name="Bold" xml:space="preserve">
<value>Negrita</value>
</data>
<data name="Italic" xml:space="preserve">
<value>Itálica</value>
</data>
<data name="General" xml:space="preserve">
<value>General</value>
</data>
<data name="FontColor" xml:space="preserve">
<value>Color de la fuente</value>
</data>
<data name="BackgroundColor" xml:space="preserve">
<value>Color de fondo</value>
</data>
<data name="FontStyle" xml:space="preserve">
<value>Estilo de fuente</value>
</data>
<data name="FontFamily" xml:space="preserve">
<value>Familia de la fuente</value>
</data>
<data name="FontScale" xml:space="preserve">
<value>Escala de la fuente</value>
</data>
<data name="SubtitleDelay" xml:space="preserve">
<value>Retraso de los subtítulos</value>
</data>
<data name="ShowPlayListTotalDuration" xml:space="preserve">
<value>Mostrar la duración total de una lista de reproducción</value>
</data>
<data name="FontBackgroundColor" xml:space="preserve">
<value>Color de fondo de la fuente</value>
</data>
<data name="LoadFirstSubtitleFoundAutomatically" xml:space="preserve">
<value>Cargar los primeros subtítulos encontrados automáticamente</value>
</data>
<data name="XSeconds" xml:space="preserve">
<value>{0} segundos</value>
</data>
</root>
Loading

0 comments on commit 6f1d0db

Please sign in to comment.