FourCC() public static method

Concatenates 4 chars to a fourcc code. This static method constructs the fourcc code of the codec to be used in the constructor VideoWriter::VideoWriter or VideoWriter::open.
public static FourCC ( char c1, char c2, char c3, char c4 ) : int
c1 char
c2 char
c3 char
c4 char
return int
示例#1
0
        /// <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));
        }
示例#2
0
        /// <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));
        }
示例#3
0
        /// <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));
        }