@ -2,6 +2,7 @@
using System.Diagnostics ;
using System.Diagnostics ;
using ErsatzTV.Core.Domain ;
using ErsatzTV.Core.Domain ;
using ErsatzTV.Core.Interfaces.FFmpeg ;
using ErsatzTV.Core.Interfaces.FFmpeg ;
using LanguageExt ;
namespace ErsatzTV.Core.FFmpeg
namespace ErsatzTV.Core.FFmpeg
{
{
@ -83,14 +84,14 @@ namespace ErsatzTV.Core.FFmpeg
. Build ( ) ;
. Build ( ) ;
}
}
public Process ForOfflineImage ( string ffmpegPath , Channel channel )
public Process ForOfflineImage ( string ffmpegPath , Channel channel , Option < TimeSpan > duration )
{
{
FFmpegPlaybackSettings playbackSettings =
FFmpegPlaybackSettings playbackSettings =
_ playbackSettingsCalculator . CalculateErrorSettings ( channel . FFmpegProfile ) ;
_ playbackSettingsCalculator . CalculateErrorSettings ( channel . FFmpegProfile ) ;
IDisplaySize desiredResolution = channel . FFmpegProfile . Resolution ;
IDisplaySize desiredResolution = channel . FFmpegProfile . Resolution ;
return new FFmpegProcessBuilder ( ffmpegPath )
FFmpegProcessBuilder builder = new FFmpegProcessBuilder ( ffmpegPath )
. WithThreads ( 1 )
. WithThreads ( 1 )
. WithQuiet ( )
. WithQuiet ( )
. WithFormatFlags ( playbackSettings . FormatFlags )
. WithFormatFlags ( playbackSettings . FormatFlags )
@ -102,10 +103,11 @@ namespace ErsatzTV.Core.FFmpeg
. WithPixfmt ( "yuv420p" )
. WithPixfmt ( "yuv420p" )
. WithPlaybackArgs ( playbackSettings )
. WithPlaybackArgs ( playbackSettings )
. WithMetadata ( channel )
. WithMetadata ( channel )
. WithFormat ( "mpegts" )
. WithFormat ( "mpegts" ) ;
. WithDuration ( TimeSpan . FromSeconds ( 1 0 ) ) // TODO: figure out when we're back online
. WithPipe ( )
duration . IfSome ( d = > builder = builder . WithDuration ( d ) ) ;
. Build ( ) ;
return builder . WithPipe ( ) . Build ( ) ;
}
}
public Process ConcatChannel ( string ffmpegPath , Channel channel , string scheme , string host )
public Process ConcatChannel ( string ffmpegPath , Channel channel , string scheme , string host )