namespace FileFlows.VideoNodes;
///
/// Metadata about a video file
///
public class VideoInfo
{
///
/// Gets or sets the full filename of the file
///
public string FileName { get; set; }
///
/// Gets or sets the bitrate in bytes per second
///
public float Bitrate { get; set; }
///
/// Gets or sets if this file is already processed
///
public bool AlreadyProcessed { get; set; }
///
/// Gets or sets the video streams contained in the file
///
public List VideoStreams { get; set; } = new List();
///
/// Gets or sets the audio streams contained in the file
///
public List AudioStreams { get; set; } = new List();
///
/// Gets or sets the subtitle streams contained in the file
///
public List SubtitleStreams { get; set; } = new List();
///
/// Gets or sets the chapters in the file
///
public List Chapters { get; set; } = new List();
///
/// Gets or sets the attachments in the file
///
public List Attachments { get; set; } = new();
}
///
/// Metadata about a stream in a video file
///
public class VideoFileStream
{
///
/// The original index of the stream in the overall video
///
public int Index { get; set; }
///
/// The index of the specific type
///
public int TypeIndex { get; set; }
///
/// The stream title (name)
///
public string Title { get; set; } = "";
///
/// The bitrate(BPS) of the video stream in bytes per second
///
public float Bitrate { get; set; }
///
/// The codec of the stream
///
public string Codec { get; set; } = "";
///
/// The codec tag of the stream
///
public string CodecTag { get; set; } = "";
///
/// If this stream is an image
///
public bool IsImage { get; set; }
///
/// Gets or sets the index string of this track
///
public string IndexString { get; set; }
///
/// Gets or sets the input file index
///
public int InputFileIndex { get; set; } = 0;
///
/// Gets or sets the pixel format that should be used to decode this stream
///
public string PixelFormat { get; set; }
}
///
/// Metadata about a video stream
///
public class VideoStream : VideoFileStream
{
///
/// Gets or sets if the stream is HDR
///
public bool HDR { get; set; }
///
/// Gets or sets the bits
/// 0 if unknown
///
public int Bits { get; set; }
///
/// Gets or sets if this stream is 10 bit
///
public bool Is10Bit => Bits == 10;
///
/// Gets or sets if this stream is 12 bit
///
public bool Is12Bit => Bits == 12;
///
/// Gets or sets if this is dolby vision
///
public bool DolbyVision { get; set; }
///
/// The width of the video stream
///
public int Width { get; set; }
///
/// The height of the video stream
///
public int Height { get; set; }
///
/// The number of frames per second
///
public float FramesPerSecond { get; set; }
///
/// The duration of the stream
///
public TimeSpan Duration { get; set; }
///
/// Converts the steam to a string
///
///
public override string ToString()
=> string.Join(" / ", new string[]
{
Index.ToString(),
Codec,
Title
}.Where(x => string.IsNullOrWhiteSpace(x) == false));
}
///
/// Metadata about an audio stream in a video file
///
public class AudioStream : VideoFileStream
{
///
/// The language of the stream
///
public string Language { get; set; }
///
/// The channels of the stream
///
public float Channels { get; set; }
///
/// The duration of the stream
///
public TimeSpan Duration { get; set; }
///
/// The sample rate of the audio stream
///
public int SampleRate { get; set; }
///
/// If this is a the default audio track
///
public bool Default { get; set; }
///
/// Converts the steam to a string
///
///
public override string ToString()
=> string.Join(" / ", new string[]
{
Index.ToString(),
Language,
Codec,
Title,
Channels > 0 ? Channels.ToString("0.0") : null,
Default ? "Default" : null
}.Where(x => string.IsNullOrWhiteSpace(x) == false));
}
///
/// Metadata about a subtitle stream in a video file
///
public class SubtitleStream : VideoFileStream
{
///
/// The language of the stream
///
public string Language { get; set; }
///
/// If this is a forced subtitle
///
public bool Forced { get; set; }
///
/// If this is a the default subtitle track
///
public bool Default { get; set; }
///
/// Converts the steam to a string
///
///
public override string ToString()
=> string.Join(" / ", new string[]
{
Index.ToString(),
Language,
Codec,
Title,
Default ? "Default" : null
}.Where(x => string.IsNullOrWhiteSpace(x) == false));
}
///
/// A chapter in a video file
///
public class Chapter
{
///
/// Gets or sets the title of the stream
///
public string Title { get; set; }
///
/// Gets or sets the start of the chapter
///
public TimeSpan Start { get; set; }
///
/// Gets or sets the end of the chapter
///
public TimeSpan End { get; set; }
}
///
/// Attachment stream
///
public class AttachmentStream: VideoFileStream
{
///
/// Gets or sets the filename of the attachment
///
public string FileName { get; set; }
///
/// Gets or sets the mime type of the attachment
///
public string MimeType { get; set; }
}