Example #1
0
        private void DrawWaveform(
            Graphics g,
            VidkaProj proj,
            VidkaFileMapping projMapping,
            VidkaClipVideo vclip,
            int x1, int y1, int clipw, int cliph,
            double secStart, double secEnd)
        {
            // TODO: tmp!!! please use a cache or something u idiot, dont read the f*****g file on every paint
            string waveFile = projMapping.AddGetWaveFilenameJpg(vclip.FileName);

            if (File.Exists(waveFile))
            {
                Bitmap bmpWave = imgCache.getWaveImg(waveFile);                         //Image ot
                var    xSrc1   = (int)(bmpWave.Width * secStart / vclip.FileLengthSec); //TODO: this
                var    xSrc2   = (int)(bmpWave.Width * secEnd / vclip.FileLengthSec);
                srcRect.X       = xSrc1;
                srcRect.Width   = xSrc2 - xSrc1;
                srcRect.Y       = 0;
                srcRect.Height  = bmpWave.Height;                //TODO: use constant from Ops
                destRect.X      = x1;
                destRect.Y      = y1;
                destRect.Width  = clipw;
                destRect.Height = cliph;
                g.DrawImage(bmpWave, destRect: destRect, srcRect: srcRect, srcUnit: GraphicsUnit.Pixel);
            }
        }
Example #2
0
        private void updateAudioInfo(VidkaClipVideoAbstract vclip)
        {
            if (vclip == null)
            {
                lblAudioProperties.Text    = "Audio info: ---";
                waveImageBox.ImageLocation = null;
                return;
            }
            lblAudioProperties.Text = (!vclip.CustomAudioLengthSec.HasValue)
                ? "Audio info: ---"
                : lblAudioProperties.Text = String.Format("Audio info: {0}", TimeSpan.FromSeconds(vclip.CustomAudioLengthSec ?? 0).ToTsString_MinuteOrHour());
            var waveFilename = fileMapping.AddGetWaveFilenameJpg(vclip.CustomAudioFilename);

            waveImageBox.ImageLocation = (vclip.HasCustomAudio && File.Exists(waveFilename))
                ? waveFilename
                : null;
        }