Beispiel #1
0
        /// <summary>
        /// Gets the video quality limits for the given video codec.
        /// </summary>
        /// <param name="encoder">The video encoder to check.</param>
        /// <returns>Limits on the video quality for the encoder.</returns>
        public static VideoQualityLimits GetVideoQualityLimits(HBVideoEncoder encoder)
        {
            float low = 0;
            float high = 0;
            float granularity = 0;
            int direction = 0;

            HBFunctions.hb_video_quality_get_limits((uint)encoder.Id, ref low, ref high, ref granularity, ref direction);

            return new VideoQualityLimits
                {
                    Low = low,
                    High = high,
                    Granularity = granularity,
                    Ascending = direction == 0
                };
        }
Beispiel #2
0
        /// <summary>
        /// Converts a native HB encoder structure to an Encoder model.
        /// </summary>
        /// <param name="encoder">The structure to convert.</param>
        /// <returns>The converted model.</returns>
        public static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)
        {
            var result = new HBVideoEncoder
            {
                Id = encoder.encoder,
                ShortName = encoder.short_name,
                DisplayName = encoder.human_readable_name,
                CompatibleContainers = Container.None
            };

            if ((encoder.muxers & NativeConstants.HB_MUX_MKV) > 0)
            {
                result.CompatibleContainers = result.CompatibleContainers | Container.Mkv;
            }

            if ((encoder.muxers & NativeConstants.HB_MUX_MP4) > 0)
            {
                result.CompatibleContainers = result.CompatibleContainers | Container.Mp4;
            }

            return result;
        }