OdessaGUIProject.Workers.SaveWorker.IsValidVideo C# (CSharp) Method

IsValidVideo() private method

private IsValidVideo ( FileInfo fileInfo ) : bool
fileInfo System.IO.FileInfo
return bool
        private bool IsValidVideo(FileInfo fileInfo)
        {
            if (fileInfo == null)
                return false;

            if (OutputFormat == OutputFormats.ProRes)
            {
                return fileInfo.Length > 1024 * 1024; // 1mb in size
            }
            else
            {

                Thread.Sleep(1000); // let things settle. sometimes we can't read the video dimensions and hopefully this will help that.

                var inputFileObject = new InputFileObject(fileInfo);
                using (var scanWorker = new ScanWorker(inputFileObject))
                {
                    scanWorker.SetVideoDimensions();
                }

                Debug.Assert(inputFileObject.VideoWidth > 0 && inputFileObject.VideoHeight > 0, "Cannot determine dimensions of " + inputFileObject.SourceFileInfo.FullName);

                return (inputFileObject.VideoWidth > 0 && inputFileObject.VideoHeight > 0);
            }
        }