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)
|
public static string ForType(VideoType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
return type switch
|
||||||
{
|
{
|
||||||
case VideoType.Mp4: return Mp4;
|
VideoType.Mp4 => Mp4,
|
||||||
case VideoType.Ogv: return Ogv;
|
VideoType.Ogv => Ogv,
|
||||||
case VideoType.Ts: return Ts;
|
VideoType.Ts => Ts,
|
||||||
case VideoType.WebM: return WebM;
|
VideoType.WebM => WebM,
|
||||||
default: throw new Exception("The extension for this video type is not defined.");
|
_ => throw new Exception("The extension for this video type is not defined.")
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
public static string ForCodec(VideoCodec type)
|
public static string ForCodec(VideoCodec type)
|
||||||
{
|
{
|
||||||
switch (type)
|
return type switch
|
||||||
{
|
{
|
||||||
case VideoCodec.LibX264: return Mp4;
|
VideoCodec.LibX264 => Mp4,
|
||||||
case VideoCodec.LibVpx: return WebM;
|
VideoCodec.LibVpx => WebM,
|
||||||
case VideoCodec.LibTheora: return Ogv;
|
VideoCodec.LibTheora => Ogv,
|
||||||
case VideoCodec.MpegTs: return Ts;
|
VideoCodec.MpegTs => Ts,
|
||||||
case VideoCodec.Png: return Png;
|
VideoCodec.Png => Png,
|
||||||
default: throw new Exception("The extension for this video type is not defined.");
|
_ => throw new Exception("The extension for this video type is not defined.")
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
public static readonly string Mp4 = ".mp4";
|
public static readonly string Mp4 = ".mp4";
|
||||||
public static readonly string Mp3 = ".mp3";
|
public static readonly string Mp3 = ".mp3";
|
||||||
|
|
Loading…
Reference in a new issue