mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Use switch expression
This commit is contained in:
parent
0e2c788796
commit
6561d0bec1
1 changed files with 15 additions and 15 deletions
|
@ -7,26 +7,26 @@ public static class FileExtension
|
|||
{
|
||||
public static string ForType(VideoType type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case VideoType.Mp4: return Mp4;
|
||||
case VideoType.Ogv: return Ogv;
|
||||
case VideoType.Ts: return Ts;
|
||||
case VideoType.WebM: return WebM;
|
||||
default: throw new Exception("The extension for this video type is not defined.");
|
||||
}
|
||||
VideoType.Mp4 => Mp4,
|
||||
VideoType.Ogv => Ogv,
|
||||
VideoType.Ts => Ts,
|
||||
VideoType.WebM => WebM,
|
||||
_ => throw new Exception("The extension for this video type is not defined.")
|
||||
};
|
||||
}
|
||||
public static string ForCodec(VideoCodec type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case VideoCodec.LibX264: return Mp4;
|
||||
case VideoCodec.LibVpx: return WebM;
|
||||
case VideoCodec.LibTheora: return Ogv;
|
||||
case VideoCodec.MpegTs: return Ts;
|
||||
case VideoCodec.Png: return Png;
|
||||
default: throw new Exception("The extension for this video type is not defined.");
|
||||
}
|
||||
VideoCodec.LibX264 => Mp4,
|
||||
VideoCodec.LibVpx => WebM,
|
||||
VideoCodec.LibTheora => Ogv,
|
||||
VideoCodec.MpegTs => Ts,
|
||||
VideoCodec.Png => Png,
|
||||
_ => throw new Exception("The extension for this video type is not defined.")
|
||||
};
|
||||
}
|
||||
public static readonly string Mp4 = ".mp4";
|
||||
public static readonly string Mp3 = ".mp3";
|
||||
|
|
Loading…
Reference in a new issue