@ -9,13 +9,15 @@ namespace ErsatzTV.Core.Tests.FFmpeg;
@@ -9,13 +9,15 @@ namespace ErsatzTV.Core.Tests.FFmpeg;
[TestFixture]
public class FFmpegPlaybackSettingsCalculatorTests
{
private static readonly MediaVersion TestVersion = new ( ) { SampleAspectRatio = "1:1" , Width = 1 9 2 0 , Height = 1 0 8 0 } ;
[TestFixture]
public class CalculateSettings
{
private readonly FFmpegPlaybackSettingsCalculator _ calculator ;
public CalculateSettings ( ) = > _ calculator = new FFmpegPlaybackSettingsCalculator ( ) ;
[Test]
public void Should_Not_GenPts_ForHlsSegmenter ( )
{
@ -24,7 +26,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -24,7 +26,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . HttpLiveStreamingSegmenter ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -47,7 +49,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -47,7 +49,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -68,7 +70,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -68,7 +70,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . HttpLiveStreamingSegmenter ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -89,7 +91,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -89,7 +91,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -112,7 +114,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -112,7 +114,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . HttpLiveStreamingDirect ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -135,7 +137,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -135,7 +137,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -156,7 +158,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -156,7 +158,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . HttpLiveStreamingDirect ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
@ -179,7 +181,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -179,7 +181,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
now ,
@ -203,7 +205,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -203,7 +205,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . HttpLiveStreamingDirect ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
now ,
@ -217,33 +219,11 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -217,33 +219,11 @@ public class FFmpegPlaybackSettingsCalculatorTests
actual . StreamSeek . IfNone ( TimeSpan . Zero ) . Should ( ) . Be ( TimeSpan . FromMinutes ( 5 ) ) ;
}
[Test]
public void ShouldNot_SetScaledSize_When_NotNormalizingVideo_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with { NormalizeVideo = false } ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
new MediaVersion ( ) ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
DateTimeOffset . Now ,
TimeSpan . Zero ,
TimeSpan . Zero ,
false ,
None ) ;
actual . ScaledSize . IsNone . Should ( ) . BeTrue ( ) ;
}
[Test]
public void ShouldNot_SetScaledSize_When_ContentIsCorrectSize_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 }
} ;
@ -271,7 +251,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -271,7 +251,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 }
} ;
@ -299,7 +278,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -299,7 +278,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 }
} ;
@ -328,8 +306,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -328,8 +306,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 }
} ;
@ -358,8 +334,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -358,8 +334,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 2 8 0 , Height = 7 2 0 }
} ;
@ -389,8 +363,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -389,8 +363,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 }
} ;
@ -414,43 +386,12 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -414,43 +386,12 @@ public class FFmpegPlaybackSettingsCalculatorTests
actual . PadToDesiredResolution . Should ( ) . BeFalse ( ) ;
}
[Test]
public void Should_NotPadToDesiredResolution_When_NotNormalizingVideo ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeVideo = false ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 }
} ;
// not anamorphic
var version = new MediaVersion { Width = 1 9 1 8 , Height = 1 0 8 0 , SampleAspectRatio = "1:1" } ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
version ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
DateTimeOffset . Now ,
TimeSpan . Zero ,
TimeSpan . Zero ,
false ,
None ) ;
actual . ScaledSize . IsNone . Should ( ) . BeTrue ( ) ;
actual . PadToDesiredResolution . Should ( ) . BeFalse ( ) ;
}
[Test]
public void Should_SetDesiredVideoFormat_When_ContentIsPadded_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoFormat = FFmpegProfileVideoFormat . H264
} ;
@ -478,12 +419,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -478,12 +419,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
[Test]
public void
Should_SetDesiredVideoFormat_When_ContentIsCorrectSize_And_NormalizingVideo_ ForTransportStream ( )
Should_SetDesiredVideoFormat_When_ContentIsCorrectSize_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoFormat = FFmpegProfileVideoFormat . H264
} ;
@ -511,13 +450,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -511,13 +450,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void
Should_SetCopyVideoFormat_When_ContentIsCorrectSize_And_NormalizingVideo_ForHttpLiveStreaming ( )
public void Should_SetCopyVideoFormat_When_ContentIsCorrectSize_ForHttpLiveStreamingDirect ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoFormat = FFmpegProfileVideoFormat . H264
} ;
@ -549,8 +485,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -549,8 +485,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoFormat = FFmpegProfileVideoFormat . H264
} ;
@ -577,85 +511,11 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -577,85 +511,11 @@ public class FFmpegPlaybackSettingsCalculatorTests
actual . VideoFormat . Should ( ) . Be ( FFmpegProfileVideoFormat . H264 ) ;
}
[Test]
public void
Should_SetCopyVideoFormat_When_ContentIsCorrectSize_And_NotNormalizingVideo_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = false ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoFormat = FFmpegProfileVideoFormat . H264
} ;
// not anamorphic
var version = new MediaVersion
{ Width = 1 9 2 0 , Height = 1 0 8 0 , SampleAspectRatio = "1:1" } ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
version ,
new MediaStream { Codec = "mpeg2video" } ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
DateTimeOffset . Now ,
TimeSpan . Zero ,
TimeSpan . Zero ,
false ,
None ) ;
actual . ScaledSize . IsNone . Should ( ) . BeTrue ( ) ;
actual . PadToDesiredResolution . Should ( ) . BeFalse ( ) ;
actual . VideoFormat . Should ( ) . Be ( FFmpegProfileVideoFormat . Copy ) ;
}
[Test]
public void
Should_SetCopyVideoFormat_AndCopyAudioFormat_When_NotTranscoding_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = false ,
NormalizeVideo = true ,
NormalizeAudio = true ,
NormalizeLoudness = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoFormat = FFmpegProfileVideoFormat . H264
} ;
// not anamorphic
var version = new MediaVersion
{ Width = 1 9 2 0 , Height = 1 0 8 0 , SampleAspectRatio = "1:1" } ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
version ,
new MediaStream { Codec = "mpeg2video" } ,
new MediaStream ( ) ,
DateTimeOffset . Now ,
DateTimeOffset . Now ,
TimeSpan . Zero ,
TimeSpan . Zero ,
false ,
None ) ;
actual . ScaledSize . IsNone . Should ( ) . BeTrue ( ) ;
actual . PadToDesiredResolution . Should ( ) . BeFalse ( ) ;
actual . VideoFormat . Should ( ) . Be ( FFmpegProfileVideoFormat . Copy ) ;
actual . NormalizeLoudness . Should ( ) . BeFalse ( ) ;
actual . AudioFormat . Should ( ) . Be ( FFmpegProfileAudioFormat . Copy ) ;
}
[Test]
public void Should_SetVideoBitrate_When_ContentIsPadded_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoBitrate = 2 5 2 5
} ;
@ -682,12 +542,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -682,12 +542,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetVideoBitrate_When_ContentIsCorrectSize_And_NormalizingVideo_ ForTransportStream ( )
public void Should_SetVideoBitrate_When_ContentIsCorrectSize_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoBitrate = 2 5 2 5
} ;
@ -719,8 +577,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -719,8 +577,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoBufferSize = 2 5 2 5
} ;
@ -747,13 +603,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -747,13 +603,10 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void
Should_SetVideoBufferSize_When_ContentIsCorrectSize_And_NormalizingVideo_ForTransportStream ( )
public void Should_SetVideoBufferSize_When_ContentIsCorrectSize_ForTransportStream ( )
{
var ffmpegProfile = new FFmpegProfile
{
Transcode = true ,
NormalizeVideo = true ,
Resolution = new Resolution { Width = 1 9 2 0 , Height = 1 0 8 0 } ,
VideoBufferSize = 2 5 2 5
} ;
@ -781,21 +634,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -781,21 +634,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetDesiredAudioFormat_When_NormalizingAudio_W ith_CorrectFormat_ForTransportStream ( )
public void Should_SetDesiredAudioFormat_With_CorrectFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioFormat = FFmpegProfileAudioFormat . Aac
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "aac" } ,
DateTimeOffset . Now ,
@ -809,48 +658,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -809,48 +658,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetCopyAudioFormat_When_NotNormalizingAudio_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
NormalizeAudio = false ,
AudioFormat = FFmpegProfileAudioFormat . Aac
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
version ,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
DateTimeOffset . Now ,
TimeSpan . Zero ,
TimeSpan . Zero ,
false ,
None ) ;
actual . AudioFormat . Should ( ) . Be ( FFmpegProfileAudioFormat . Copy ) ;
}
[Test]
public void Should_SetDesiredAudioFormat_When_NormalizingAudio_ForTransportStream ( )
public void Should_SetDesiredAudioFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioFormat = FFmpegProfileAudioFormat . Aac
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestVersion ,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -864,21 +682,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -864,21 +682,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetCopyAudioFormat_When_NormalizingAudio_ ForHttpLiveStreaming ( )
public void Should_SetCopyAudioFormat_ForHttpLiveStreamingDirect ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioFormat = FFmpegProfileAudioFormat . Aac
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . HttpLiveStreamingDirect ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -892,22 +706,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -892,22 +706,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioBitrate_When_NormalizingAudio_W ith_CorrectFormat_ForTransportStream ( )
public void Should_SetAudioBitrate_With_CorrectFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioBitrate = 2 4 2 4 ,
AudioFormat = FFmpegProfileAudioFormat . Ac3
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -921,22 +731,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -921,22 +731,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioBufferSize_When_NormalizingAudio_W ith_CorrectFormat_ForTransportStream ( )
public void Should_SetAudioBufferSize_With_CorrectFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioBufferSize = 2 4 2 4 ,
AudioFormat = FFmpegProfileAudioFormat . Ac3
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -950,22 +756,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -950,22 +756,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioChannels_When_NormalizingAudio_W ith_CorrectFormat_ForTransportStream ( )
public void Should_SetAudioChannels_With_CorrectFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioFormat = FFmpegProfileAudioFormat . Ac3 ,
AudioChannels = 6
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -979,22 +781,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -979,22 +781,18 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioSampleRate_When_NormalizingAudio_W ith_CorrectFormat_ForTransportStream ( )
public void Should_SetAudioSampleRate_With_CorrectFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioFormat = FFmpegProfileAudioFormat . Ac3 ,
AudioSampleRate = 4 8
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -1008,21 +806,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -1008,21 +806,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioChannels_When_NormalizingAudio_ ForTransportStream ( )
public void Should_SetAudioChannels_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioChannels = 6
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -1036,21 +830,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -1036,21 +830,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioSampleRate_When_NormalizingAudio_ ForTransportStream ( )
public void Should_SetAudioSampleRate_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioSampleRate = 4 8
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -1064,17 +854,15 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -1064,17 +854,15 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetAudioDuration_When_NormalizingAudio_W ith_CorrectFormat_ForTransportStream ( )
public void Should_SetAudioDuration_With_CorrectFormat_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
AudioSampleRate = 4 8 ,
AudioFormat = FFmpegProfileAudioFormat . Ac3
} ;
var version = new MediaVersion { Duration = TimeSpan . FromMinutes ( 5 ) } ; // not pulled from here
var version = new MediaVersion { SampleAspectRatio = "1:1" , Width = 1 9 2 0 , Height = 1 0 8 0 , Duration = TimeSpan . FromMinutes ( 5 ) } ; // not pulled from here
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
@ -1093,21 +881,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -1093,21 +881,17 @@ public class FFmpegPlaybackSettingsCalculatorTests
}
[Test]
public void Should_SetNormalizeLoudness_When_NormalizingAudio_ ForTransportStream ( )
public void Should_SetNormalizeLoudness_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = true ,
NormalizeLoudness = true
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
v ersion,
TestV ersion,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
@ -1119,34 +903,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -1119,34 +903,6 @@ public class FFmpegPlaybackSettingsCalculatorTests
actual . NormalizeLoudness . Should ( ) . BeTrue ( ) ;
}
[Test]
public void Should_NotSetNormalizeLoudness_When_NotNormalizingAudio_ForTransportStream ( )
{
FFmpegProfile ffmpegProfile = TestProfile ( ) with
{
Transcode = true ,
NormalizeAudio = false ,
NormalizeLoudness = true
} ;
var version = new MediaVersion ( ) ;
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
version ,
new MediaStream ( ) ,
new MediaStream { Codec = "ac3" } ,
DateTimeOffset . Now ,
DateTimeOffset . Now ,
TimeSpan . Zero ,
TimeSpan . Zero ,
false ,
None ) ;
actual . NormalizeLoudness . Should ( ) . BeFalse ( ) ;
}
}
[TestFixture]
@ -1165,7 +921,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
@@ -1165,7 +921,7 @@ public class FFmpegPlaybackSettingsCalculatorTests
FFmpegPlaybackSettings actual = _ calculator . CalculateSettings (
StreamingMode . TransportStream ,
ffmpegProfile ,
new MediaVersion ( ) ,
TestVersion ,
new MediaStream ( ) ,
new MediaStream ( ) ,
DateTimeOffset . Now ,