mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* try one thread for everything * add (unused) framerate filter * disable framerate normalization by default * update dependenciespull/640/head
15 changed files with 7860 additions and 15 deletions
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
namespace ErsatzTV.FFmpeg.Filter; |
||||
|
||||
public class FrameRateFilter : BaseFilter |
||||
{ |
||||
private readonly FrameState _currentState; |
||||
private readonly int _frameRate; |
||||
|
||||
public FrameRateFilter(FrameState currentState, int frameRate) |
||||
{ |
||||
_currentState = currentState; |
||||
_frameRate = frameRate; |
||||
} |
||||
|
||||
public override string Filter |
||||
{ |
||||
get |
||||
{ |
||||
string frameRate = $"framerate=fps={_frameRate}:flags=-scd"; |
||||
string pixelFormat = _currentState.PixelFormat.Match(pf => pf.FFmpegName, () => string.Empty); |
||||
|
||||
if (_currentState.FrameDataLocation == FrameDataLocation.Hardware) |
||||
{ |
||||
if (!string.IsNullOrWhiteSpace(pixelFormat)) |
||||
{ |
||||
return $"hwdownload,format={pixelFormat},{frameRate}"; |
||||
} |
||||
|
||||
return $"hwdownload,{frameRate}"; |
||||
} |
||||
|
||||
return frameRate; |
||||
} |
||||
} |
||||
|
||||
public override FrameState NextState(FrameState currentState) => currentState with { FrameRate = _frameRate }; |
||||
} |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
namespace ErsatzTV.FFmpeg.Option; |
||||
|
||||
public class ThreadCountOption : GlobalOption |
||||
{ |
||||
private readonly int _threadCount; |
||||
|
||||
public ThreadCountOption(int threadCount) |
||||
{ |
||||
_threadCount = threadCount; |
||||
} |
||||
|
||||
public override IList<string> GlobalOptions => new List<string> { "-threads", _threadCount.ToString() }; |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations |
||||
{ |
||||
public partial class Disable_FrameRateNormalization_ByDefault : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "NormalizeFramerate", |
||||
table: "FFmpegProfile", |
||||
type: "INTEGER", |
||||
nullable: false, |
||||
defaultValue: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "INTEGER"); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AlterColumn<bool>( |
||||
name: "NormalizeFramerate", |
||||
table: "FFmpegProfile", |
||||
type: "INTEGER", |
||||
nullable: false, |
||||
oldClrType: typeof(bool), |
||||
oldType: "INTEGER", |
||||
oldDefaultValue: false); |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations |
||||
{ |
||||
public partial class TurnOff_FrameRateNormalization : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.Sql("UPDATE FFmpegProfile SET NormalizeFramerate = 0"); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue