Skip to content

Commit

Permalink
Merge pull request #82 from hudl/AddLastArgsToProcessor
Browse files Browse the repository at this point in the history
ICommandProcessor changes, and new filters and defaults
  • Loading branch information
Casey-Bateman authored Jan 18, 2017
2 parents 5b57d97 + 926bdd1 commit 7f913d2
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 11 deletions.
7 changes: 6 additions & 1 deletion Hudl.FFmpeg.Core/Command/BaseTypes/ICommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ public interface ICommandProcessor
/// contains the stdout message from the last command.
/// </summary>
string StdOut { get; }


/// <summary>
/// contains the last ran Arguments through the processor
/// </summary>
string Command { get; }

/// <summary>
/// opens a command builder session, should get the processor started and ready to recieve commands
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions Hudl.FFmpeg.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyInformationalVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.0")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("5.0.0")]
[assembly: AssemblyFileVersion("5.0.0")]
[assembly: AssemblyVersion("5.0.0.0")]
3 changes: 3 additions & 0 deletions Hudl.FFmpeg/Command/FFmpegCommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public FFmpegCommandProcessor()
public Exception Error { get; protected set; }

public string StdOut { get; protected set; }
public string Command { get; protected set; }

public CommandProcessorStatus Status { get; protected set; }

Expand Down Expand Up @@ -94,6 +95,8 @@ public bool Send(string command, int? timeoutMilliseconds)
throw new ArgumentException("Processing command cannot be null or empty.", "command");
}

Command = command;

var retryCount = 0;
var isSuccessful = false;
do
Expand Down
3 changes: 2 additions & 1 deletion Hudl.FFmpeg/Filters/Overlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public Overlay()
{
Format = OverlayVideoFormatType.Yuv420;
Eval = OverlayVideoEvalType.Frame;
RepeatLast = true;
}
public Overlay(int x, int y)
: this()
Expand All @@ -42,7 +43,7 @@ public Overlay(int x, int y)
[FilterParameter(Name = "shortest", Default = false, Formatter = typeof(BoolToInt32Formatter))]
public bool Shortest { get; set; }

[FilterParameter(Name = "repeatlast", Default = false, Formatter = typeof(BoolToInt32Formatter))]
[FilterParameter(Name = "repeatlast", Default = true, Formatter = typeof(BoolToInt32Formatter))]
public bool RepeatLast { get; set; }

[FilterParameter(Name ="eval", Default = OverlayVideoEvalType.Frame, Formatter = typeof(EnumParameterFormatter))]
Expand Down
3 changes: 3 additions & 0 deletions Hudl.FFmpeg/Hudl.Ffmpeg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<Compile Include="Settings\ChannelInput.cs" />
<Compile Include="Settings\DurationOutput.cs" />
<Compile Include="Settings\FrameDropThreshold.cs" />
<Compile Include="Settings\MapChapters.cs" />
<Compile Include="Settings\MapMetadata.cs" />
<Compile Include="Settings\LogLevel.cs" />
<Compile Include="Settings\LoopInput.cs" />
<Compile Include="Settings\CopyTimestamps.cs" />
<Compile Include="Settings\QualityScaleAudio.cs" />
Expand Down
6 changes: 3 additions & 3 deletions Hudl.FFmpeg/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyInformationalVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.0")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("5.0.0")]
[assembly: AssemblyFileVersion("5.0.0")]
[assembly: AssemblyVersion("5.0.0.0")]
24 changes: 24 additions & 0 deletions Hudl.FFmpeg/Settings/LogLevel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Hudl.FFmpeg.Attributes;
using Hudl.FFmpeg.Resources.BaseTypes;
using Hudl.FFmpeg.Settings.Attributes;
using Hudl.FFmpeg.Settings.Interfaces;

namespace Hudl.FFmpeg.Settings
{
/// <summary>
/// set the logging level used by the target library.
/// </summary>
[ForStream(Type = typeof(AudioStream))]
[ForStream(Type = typeof(VideoStream))]
[Setting(Name = "loglevel")]
public class LogLevel : ISetting
{
public LogLevel(string level)
{
Level = level;
}

[SettingParameter]
public string Level { get; set; }
}
}
24 changes: 24 additions & 0 deletions Hudl.FFmpeg/Settings/MapChapters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Hudl.FFmpeg.Attributes;
using Hudl.FFmpeg.Resources.BaseTypes;
using Hudl.FFmpeg.Settings.Attributes;
using Hudl.FFmpeg.Settings.Interfaces;

namespace Hudl.FFmpeg.Settings
{
/// <summary>
/// copy chapters from input file with index input_file_index to the next output file..
/// </summary>
[ForStream(Type = typeof(AudioStream))]
[ForStream(Type = typeof(VideoStream))]
[Setting(Name = "map_chapters")]
public class MapChapters : ISetting
{
public MapChapters(string mapping)
{
Mapping = mapping;
}

[SettingParameter]
public string Mapping { get; set; }
}
}
24 changes: 24 additions & 0 deletions Hudl.FFmpeg/Settings/MapMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Hudl.FFmpeg.Attributes;
using Hudl.FFmpeg.Resources.BaseTypes;
using Hudl.FFmpeg.Settings.Attributes;
using Hudl.FFmpeg.Settings.Interfaces;

namespace Hudl.FFmpeg.Settings
{
/// <summary>
/// set metadata information of the next output file from infile.
/// </summary>
[ForStream(Type = typeof(AudioStream))]
[ForStream(Type = typeof(VideoStream))]
[Setting(Name = "map_metadata")]
public class MapMetadata : ISetting
{
public MapMetadata(string mapping)
{
Mapping = mapping;
}

[SettingParameter]
public string Mapping { get; set; }
}
}
3 changes: 3 additions & 0 deletions Hudl.FFprobe/Command/FFprobeCommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public FFprobeCommandProcessor()
public Exception Error { get; protected set; }

public string StdOut { get; protected set; }
public string Command { get; protected set; }

public CommandProcessorStatus Status { get; protected set; }

Expand Down Expand Up @@ -91,6 +92,8 @@ public bool Send(string command, int? timeoutMilliseconds)
throw new ArgumentException("Processing command cannot be null or empty.", "command");
}

Command = command;

try
{
Status = CommandProcessorStatus.Processing;
Expand Down
6 changes: 3 additions & 3 deletions Hudl.FFprobe/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyInformationalVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.0")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("5.0.0")]
[assembly: AssemblyFileVersion("5.0.0")]
[assembly: AssemblyVersion("5.0.0.0")]
3 changes: 3 additions & 0 deletions Hudl.Ffmpeg.Tests/Command/TestCommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class TestCommandProcessor : ICommandProcessor

public string StdOut { get; protected set; }

public string Command { get; protected set; }

public Exception Error { get; protected set; }

public bool Open()
Expand All @@ -35,6 +37,7 @@ public bool Send(string command)

public bool Send(string command, int? timeout)
{
Command = command;
SendFired = true;
return true;
}
Expand Down

0 comments on commit 7f913d2

Please sign in to comment.