Пример #1
0
        public Codec(string name, Media.Codec.MediaType mediaType, Common.Binary.ByteOrder defaultByteOrder, int defaultComponentCount, int defaultBitsPerComponent)
        {
            MediaTypes = mediaType;

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new System.InvalidOperationException("name cannot be null or consist only of whitespace.");
            }

            Name = name;

            try
            {
                Id = ParseGuidAttribute(GetType());
            }
            catch
            {
                Id = Guid.NewGuid();
            }

            DefaultComponentCount = defaultComponentCount;

            DefaultBitsPerComponent = defaultBitsPerComponent;

            Codecs.TryRegisterCodec(this);
        }
Пример #2
0
        /// <summary>
        /// Constructs a new Transformation with the given properties
        /// </summary>
        /// <param name="mediaType">The type of media the tranformation applies to</param>
        /// <param name="quality">The quality of the transformation</param>
        /// <param name="shouldDispose">False if the Transformation should not be allowed to dispose, True by default</param>
        public Transformation(Media.Codec.MediaType mediaType, TransformationQuality quality, bool shouldDispose = true)
            : this(shouldDispose)
        {
            if (mediaType == Media.Codec.MediaType.Unknown)
            {
                throw new System.ArgumentException("mediaType", "Cannot be Codec.MediaType.Unknown");
            }
            MediaType = mediaType;

            if (quality == TransformationQuality.Unspecified)
            {
                throw new System.ArgumentException("quality", "Cannot be Codec.TransformationQuality.Unspecified");
            }
            Quality = quality;
        }