/// <summary> /// Create from string (length == 4) /// </summary> /// <param name="code"></param> /// <returns></returns> public static FourCC FromString(string code) { if (code == null) { throw new ArgumentNullException(nameof(code)); } if (code.Length == 0) { throw new ArgumentException("code.Length == 0", nameof(code)); } if (code.Length > 4) { throw new ArgumentException("code.Length > 4", nameof(code)); } // padding while (code.Length < 4) { code += " "; } var value = VideoWriter.FourCC(code[0], code[1], code[2], code[3]); return(new FourCC(value)); }
/// <summary> /// Create from string (length == 4) /// </summary> /// <param name="code"></param> /// <returns></returns> public static FourCC FromString(string code) { if (code == null) { throw new ArgumentNullException(nameof(code)); } if (code.Length != 4) { throw new ArgumentException("code.Length != 4", nameof(code)); } var value = VideoWriter.FourCC(code[0], code[1], code[2], code[3]); return(new FourCC(value)); }
/// <summary> /// Create from four characters /// </summary> /// <param name="c1"></param> /// <param name="c2"></param> /// <param name="c3"></param> /// <param name="c4"></param> /// <returns></returns> public static FourCC FromFourChars(char c1, char c2, char c3, char c4) { var value = VideoWriter.FourCC(c1, c2, c3, c4); return(new FourCC(value)); }