CanHaveAlpha property for VideoStream to check if pixfmt supports alpha channel

This commit is contained in:
n00mkrad
2025-11-09 16:50:39 +01:00
parent 0b93537ffb
commit 95295c3b0f

View File

@@ -1,9 +1,12 @@
using System.Drawing; using System.Collections.Generic;
using System.Drawing;
namespace Flowframes.Data.Streams namespace Flowframes.Data.Streams
{ {
public class VideoStream : Stream public class VideoStream : Stream
{ {
public static readonly List<string> AlphaPixFmts = new List<string> { "argb", "rgba", "abgr", "bgra", "yuva420p", "yuva422p", "yuva444p", "yuva420p9be", "yuva420p9le", "yuva422p9be", "yuva422p9le", "yuva444p9be", "yuva444p9le", "yuva420p10be", "yuva420p10le", "yuva422p10be", "yuva422p10le", "yuva444p10be", "yuva444p10le", "yuva420p16be", "yuva420p16le", "yuva422p16be", "yuva422p16le", "yuva444p16be", "yuva444p16le", "rgba64be", "rgba64le", "bgra64be", "bgra64le", "gbrap", "gbrap16be", "gbrap16le", "vuya", "rgbaf16be", "rgbaf16le", "gbrap12be", "gbrap12le", "gbrap10be", "gbrap10le", "gbrapf32be", "gbrapf32le", "yuva422p12be", "yuva422p12le", "yuva444p12be", "yuva444p12le", "ayuv64le", "ayuv64be", "gbrap14be", "gbrap14le", "ayuv", "uyva", "rgba128be", "rgba128le", "gbrap32be", "gbrap32le", "rgbaf32be", "rgbaf32le" };
public int FrameCount { get; } = 0; public int FrameCount { get; } = 0;
public string PixelFormat { get; } public string PixelFormat { get; }
public int Kbits { get; } public int Kbits { get; }
@@ -11,7 +14,9 @@ namespace Flowframes.Data.Streams
public Size Sar { get; } public Size Sar { get; }
public Size Dar { get; } public Size Dar { get; }
public FpsInfo FpsInfo { get; } public FpsInfo FpsInfo { get; }
public Fraction Rate { get => FpsInfo.Fps; }
public Fraction Rate => FpsInfo.Fps;
public bool CanHaveAlpha => AlphaPixFmts.Contains(PixelFormat.Lower());
public VideoStream(string language, string title, string codec, string codecLong, string pixFmt, int kbits, Size resolution, Size sar, Size dar, FpsInfo fpsInf, int frameCount) public VideoStream(string language, string title, string codec, string codecLong, string pixFmt, int kbits, Size resolution, Size sar, Size dar, FpsInfo fpsInf, int frameCount)
{ {