Beispiel #1
0
        /// <summary>
        /// Parametrizes the provider and itself according to the required config.
        /// You can consider it as converting required -> actual config.
        /// </summary>
        /// <param name="config">The required configuration from the UI</param>
        private void configPane_SetupComplete(InteractiveDSConfig config)
        {
            // Copy the provider
            provider = config.Provider;

            // Enable stats if necessary
            stats.Enabled = config.Statistics;

            // Prepare the buffer
            BMPbuffer   = null;
            BMPbuffered = config.Buffered;

            videoInfoHeader = provider.StartProvider(config.Preview, this, config.Owner.Handle);

            // Setup image storage
            imageWidth  = videoInfoHeader.BmiHeader.Width;
            imageHeight = videoInfoHeader.BmiHeader.Height;
            imageStride = imageWidth * 3;
            imageOffset = (imageHeight - 1) * imageStride;
            savedArray  = new byte[imageWidth * imageHeight * 4];

            // Adjust the preview
            ResizeVideo(config.Owner.Size);

            // Create the current configuration object
            configuration = new DSConfig(provider, imageWidth, imageHeight, config.Preview, config.Statistics);

            // Indicate that the preparations are complete
            mediaOnline = true;
            if (MediaOnline != null)
            {
                MediaOnline(configuration);
            }
        }