mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
851 B
24 lines
851 B
using Microsoft.Extensions.Logging; |
|
|
|
namespace ErsatzTV.FFmpeg.Format; |
|
|
|
public static class AvailablePixelFormats |
|
{ |
|
public static Option<IPixelFormat> ForPixelFormat(string pixelFormat, ILogger logger) |
|
{ |
|
return pixelFormat switch |
|
{ |
|
PixelFormat.YUV420P => new PixelFormatYuv420P(), |
|
PixelFormat.YUV420P10LE => new PixelFormatYuv420P10Le(), |
|
PixelFormat.YUVJ420P => new PixelFormatYuvJ420P(), |
|
PixelFormat.YUV444P => new PixelFormatYuv444P(), |
|
_ => LogUnknownPixelFormat(pixelFormat, logger) |
|
}; |
|
} |
|
|
|
private static Option<IPixelFormat> LogUnknownPixelFormat(string pixelFormat, ILogger logger) |
|
{ |
|
logger.LogWarning("Unexpected pixel format {PixelFormat} may have playback issues", pixelFormat); |
|
return Option<IPixelFormat>.None; |
|
} |
|
}
|
|
|