Exemple #1
0
        private void ReloadBitmap()
        {
            FFmpegResult result = CellFFmpegResult;

            if (_bitmap != null)
            {
                _bitmap.Dispose();
            }
            if (result != null)
            {
                _bitmap = ThumbUtil.ResizeBitmap(result.Bitmap, ThumbUtil.ThumbWidth, ThumbUtil.ThumbHeight) ?? ThumbUtil.GetErrorBitmap();
            }
        }
Exemple #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.Clear(Color.White);

            if (_bitmap != null)
            {
                g.DrawImage(_bitmap, 0, 0);
            }
            ThumbUtil.DrawBitmapRect(g, this, _thumbResult);

            base.OnPaint(e);
        }
        private void fullFileScanner_ResultDetected(object sender, FullFileScanner.FileScanResult scanresult)
        {
            IResultNode result = scanresult.Result;

            if (scanresult.Result == null)
            {
                return;
            }

            // First make sure the result is valid.
            List <IResultNode> allKeyframes = ThumbUtil.GetAllKeyFrames(scanresult.Result.Children.ToArray());

            if (allKeyframes.Count > 0)
            {
                ProjectKeyframeOverviewRow row = CreateAndAddKeyframeRow(_projectFiles[_activeScanFileIndex]);
                row.KeyframesSourceFragment = scanresult.SourceFragment;

                if (_fullFileScanner.ScanNumCodecStreams > 0)
                {
                    int codecCountNotScanned = scanresult.AvailableCodecStreams - _fullFileScanner.ScanNumCodecStreams;
                    if (scanresult.AvailableCodecStreams > 1)
                    {
                        // Warn that only 1 codecstream in the container is scanned for this row
                        row.WarnMoreCodecStreams(codecCountNotScanned);
                    }
                }

                List <IResultNode> keyFrames = ThumbUtil.CheckMaxThumbCount(allKeyframes, NumThumbs);
                foreach (IResultNode frame in keyFrames)
                {
                    _ffmpegManager.AddToConvertQueue(frame, row);
                }
            }
            else
            {
                // Invalidate the result, the scanner will scan the next codecstream (when available).
                scanresult.IsValid = false;
            }
        }
        public void DisplayIFramesAsThumbs(IResultNode[] resultNodes)
        {
            _currentThumbSource = resultNodes;
            if (_videoKeyframesWindow == null)
            {
                return;
            }
            _ffmpegManager.NewQueue();

            List <IResultNode> allKeyframes = ThumbUtil.GetAllKeyFrames(resultNodes);
            int allKeyframesCount           = allKeyframes.Count;
            List <IResultNode> keyFrames    = ThumbUtil.CheckMaxThumbCount(allKeyframes, _maxThumbs);

            if (keyFrames.Count > 0)
            {
                _videoKeyframesWindow.NewConvertBatch(keyFrames.Count, allKeyframesCount);

                foreach (IResultNode frame in keyFrames)
                {
                    _ffmpegManager.AddToConvertQueue(frame, this);
                }
            }
        }
Exemple #5
0
        public override void OnPaint(Graphics graphics)
        {
            base.OnPaint(graphics);

            if (_bitmap == null && CellData.Value != null)
            {
                ReloadBitmap();
            }

            int thumbX = Bounds.X + ((Bounds.Width / 2) - (ThumbUtil.ThumbWidth / 2));
            int thumbY = Bounds.Y + ((Bounds.Height / 2) - (ThumbUtil.ThumbHeight / 2));

            if (_bitmap != null)
            {
                graphics.DrawImage(_bitmap, thumbX, thumbY);
            }
            else
            {
                var brsh = new SolidBrush(Color.White);
                graphics.FillRectangle(brsh, new Rectangle(thumbX, thumbY, Width, Height));
                brsh.Dispose();
            }
            ThumbUtil.DrawBitmapRect(graphics, this, CellFFmpegResult, thumbX, thumbY);
        }
Exemple #6
0
 public void UpdateContainerAndResult(IThumbsControlContainer thumbsControlContainer, FFmpegResult thumbResult)
 {
     _thumbsControlContainer = thumbsControlContainer;
     _thumbResult            = thumbResult;
     if (thumbResult != null)
     {
         _bitmap = (thumbResult.Bitmap != null) ? ThumbUtil.ResizeBitmap(thumbResult.Bitmap, Width, Height) : ThumbUtil.GetErrorBitmap();
         Invalidate();
     }
 }