private static double CalculateFidelity(IList <byte[]> rawFrames, IList <byte[]> processedFrames) { double sumDifferences = 0.0; int totalPixels = rawFrames.Count * (rawFrames[0].Length / 4); for (int i = 0; i < rawFrames.Count; i++) { var rawFrame = rawFrames[i]; var processedFrame = processedFrames[i]; for (int j = 0; j < rawFrame.Length; j++) { var rawB = rawFrame[j]; var processedB = processedFrame[j++]; var rawG = rawFrame[j]; var processedG = processedFrame[j++]; var rawR = rawFrame[j]; var processedR = processedFrame[j++]; var distance = VideoHelper.GetColorDistance(rawR, rawG, rawB, processedR, processedG, processedB); sumDifferences += distance; // (distance * distance); } } var avg = sumDifferences / totalPixels; return(avg); }
void timerElapsed(object sender, EventArgs e) { if (_frame != null) { analyze(VideoHelper.CreateBitmap(ref _frame)); } }
public void LoadVideoClip() { try { string FileExt = ""; string FileVideoSrc = ""; string FileVideoImage = ""; string Lang = Globals.GetLang(); OtherFunctions obj = new OtherFunctions(); if (_isAgentCat) { _agentCatID = Globals.AgentCatID; } DataSet ds = obj.GetFirstVideo("VideoProduct", _agentCatID, Lang); //DataRow dr = obj.GetRandomVideo("VideoProduct", Globals.AgentCatID, Lang); DataRow dr = ds.Tables[0].Rows[0]; if (dr != null && dr.Table.Rows.Count > 0) { FileExt = Convert.ToString(dr["FileExt"]); FileVideoSrc = Convert.ToString(dr["VideoSrc"]); FileVideoImage = Convert.ToString(dr["VideoImage"]); //if (FileExt.ToLower() == "wmv") //vì wmv dùng control khác nên chỉ ra file video wmv để play //MyVideo.FilePath = Globals.GetUploadsUrl() + FileVideoSrc; } //Response.Write("<div class=\"title_box\">" + _subject + "</div>"); //Response.Write("<div class=\"border_box\">"); if (FileExt == "flv") { Response.Write(VideoHelper.LoadFlvVideo(FileVideoSrc, FileVideoImage, _widthBox, _heightBox)); } //Response.Write("</div>"); } catch { } }
private unsafe void SocketThread() { while (true) { var bytesReceived = _socket.Receive(_receiveBuffer); if (bytesReceived == 0) { Thread.Sleep(1); continue; } var arr = new byte[bytesReceived]; Array.Copy(_receiveBuffer, arr, bytesReceived); fixed(byte *pData = &arr[0]) { _avPacket.data = pData; _avPacket.size = bytesReceived; AVFrame *pFrame; if (_decoder.TryDecode(ref _avPacket, out pFrame)) { byte[] data = _converter.ConvertFrame(pFrame); var bitmap = VideoHelper.CreateBitmap(data, pFrame->width, pFrame->height); UpdateImage(bitmap); } } } }
public void GetVideoEmbedUrl_ProvidedVariousVideoKinds_GetCorrectVideoFormat(VideoKindEnum kind, string embedUrlPrefix) { var model = new VideoModel("foo", "123456", kind); string actualEmbedUrl = VideoHelper.GetVideoEmbedUrl(model); Assert.That(actualEmbedUrl, Does.StartWith(embedUrlPrefix)); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here _helpTexture = TextureLoader.LoadTexture(GraphicsDevice, "Content/HelpTexture.png"); #if TEST_ASS _video = VideoHelper.LoadFromFile(@"D:\Videos\sm32324383.mp4"); var subtitle = new AssSubtitleRenderer(); subtitle.LoadFromFile(@"D:\Videos\sm32324383.ass"); subtitle.Enabled = true; _videoPlayer.SubtitleRenderer = subtitle; #elif TEST_SRT _video = VideoHelper.LoadFromFile(@"D:\TEMP\test_mp4.mp4"); var subtitle = new SrtSubtitleRenderer(GraphicsDevice); subtitle.LoadFromFile(@"D:\TEMP\test_mp4.srt"); subtitle.ApplyFontFile(@"C:\Windows\Fonts\arial.ttf"); subtitle.Enabled = true; _videoPlayer.SubtitleRenderer = subtitle; #else _video = VideoHelper.LoadFromFile("Content/SampleVideo_1280x720_1mb.mp4"); #endif _videoPlayer.IsLooped = true; _videoPlayer.Play(_video); }
/// <summary> /// 勾选框勾选 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _checkBox_Checked(object sender, RoutedEventArgs e) { //勾选 //如果是桌面,则特殊处理 _image = new ImageX(_model, _index, _textBlock.Text, this); _model._imagexList.Add(_index, _image); _model.ImagePanel.Children.Add(_image); if (_index == 0) { List <SimpleModel> deskCapabilityList = CommonHelper.GetDeskCapability(); _image.SetResolution(deskCapabilityList); //开始显示桌面 Rectangle screenArea = Rectangle.Empty; screenArea = Rectangle.Union(screenArea, Screen.PrimaryScreen.Bounds); var streamVideo = new ScreenCaptureStream(screenArea); _image.SetVideoResource(streamVideo); } else { //index-1 是因为要去掉【桌面】这个序号 _image.SetResolution(VideoHelper.GetCameraResolution(_index - 1)); //开始显示摄像头 FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count > 0) { var camera = new VideoCaptureDevice(videoDevices[_index - 1].MonikerString); camera.VideoResolution = camera.VideoCapabilities[_index - 1]; camera.NewFrame += _image.Camera_NewFrame; _image.setFrameRate(camera.VideoCapabilities[_index - 1].AverageFrameRate); _image.SetVideoResource(camera); } } }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException); AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); _cw = new ConsoleWriter(); Console.SetOut(_cw); var settingsFile = "settings.json"; if (args != null && args.Length > 0) { settingsFile = args[0]; } var settings = JsonHelper.DeserializeFile <Settings>(settingsFile); _cw.LogDirectory = settings.LogDirectory; var Camera_Dirs = Directory.GetDirectories(settings.SourceDataDirectory); Console.WriteLine($"Found { Camera_Dirs.Length} Directory in {settings.SourceDataDirectory}"); foreach (var Camera_Dir in Camera_Dirs) { var Day_Dirs = Directory.GetDirectories(Camera_Dir); foreach (var day_dir in Day_Dirs) { try { string dirName = new DirectoryInfo(day_dir).Name; var IsTodayFormatMatch = false; foreach (string DateFormat in settings.DateFormats) { if (dirName.Contains(DateTime.Today.ToString(DateFormat))) { IsTodayFormatMatch = true; break; } } if (IsTodayFormatMatch && settings.ExcludeToday) { Console.WriteLine($"Not Making video file for {dirName} because it contains Today."); continue; } var filename = Path.Combine(settings.DestinationSummaryDirectory, new DirectoryInfo(Camera_Dir).Name + "_" + dirName + ".mp4"); VideoHelper.MakeVideoFromImages(day_dir, filename, settings.TempDirectory, settings.DeleteImages, settings.MinImagesToMakeVideo); } catch (Exception ex) { Console.WriteLine($"Directory was not processes successfully. Exception: {ex.Message}"); } } } FileHelper.DeleteDirIfEmpty(settings.SourceDataDirectory); CloseWait(); }
private void LoadData() { try { string FileExt = ""; string FileVideoSrc = ""; string FileVideoImage = ""; string Lang = Globals.GetLang(); OtherFunctions obj = new OtherFunctions(); if (_isAgentCat) { _agentCatID = Globals.AgentCatID; } DataSet ds = obj.GetFirstVideo("VideoProduct", _agentCatID, Lang); //DataRow dr = obj.GetRandomVideo("VideoProduct", Globals.AgentCatID, Lang); DataRow dr = ds.Tables[0].Rows[0]; if (dr != null && dr.Table.Rows.Count > 0) { FileExt = Convert.ToString(dr["FileExt"]); FileVideoSrc = Convert.ToString(dr["VideoSrc"]); FileVideoImage = Convert.ToString(dr["VideoImage"]); //if (FileExt.ToLower() == "wmv") //vì wmv dùng control khác nên chỉ ra file video wmv để play //MyVideo.FilePath = Globals.GetUploadsUrl() + FileVideoSrc; } if (FileExt == "flv") { divContent.InnerHtml = VideoHelper.LoadFlvVideo(FileVideoSrc, FileVideoImage, _widthBox, _heightBox); } } catch { } }
/// <summary> /// Saves the image from the video decoder /// </summary> public void SaveImage() { if (_frame == null) { return; } if (_frameBitmap == null) { _frameBitmap = VideoHelper.CreateBitmap(ref _frame); } else { VideoHelper.UpdateBitmap(ref _frameBitmap, ref _frame); } if (!Directory.Exists(DataPath)) { System.IO.Directory.CreateDirectory(DataPath); } _frameBitmap.Save(DataPath + _frameTag + _frameNumber.ToString("000000") + ".png"); if (!Directory.Exists(LivePath)) { System.IO.Directory.CreateDirectory(LivePath); } _frameBitmap.Save(LivePath + "live.png"); }
/// <summary> /// 刷新摄像头.重新读取摄像头列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RefreshBtn_Click(object sender, RoutedEventArgs e) { cameraList = VideoHelper.GetAllCameras(); if (cameraList.Count == 0) { XCameraList.ItemsSource = null; XCamRes.ItemsSource = null; XCam.ItemsSource = null; CameraSetting.IsEnabled = false; return; } XCameraList.ItemsSource = cameraList; XCameraList.SelectedIndex = 0; CameraSetting.IsEnabled = true; List <SimpleModel> resolutionList = VideoHelper.GetCameraResolution(0); if (resolutionList == null || resolutionList.Count == 0) { MessageBox.Show("读取摄像头出错,该摄像头没有支持的分辨率!", "系统提示"); return; } XmlHelper.SetValue("Camera", XCameraList.SelectedIndex, XCameraList.Text); XCamRes.ItemsSource = resolutionList; XCamRes.SelectedIndex = 0; XmlHelper.SetValue("CameraResolution", XCamRes.SelectedIndex, XCamRes.Text); SetCamSize(); }
protected override async void OnAppearing() { base.OnAppearing(); videosListLayout.ItemSelected += VideoSelected; var videos = await VideoHelper.GetAllVideosAsync(); //TODO: ORIGINAL //Device.BeginInvokeOnMainThread(() => //{ // if (videos.Count <= 0) // { // Content = noVideoLayout; // } // else // { // videosListLayout.ItemsSource = videos; // Content = videosListLayout; // } //}); //TODO: IDENTIFYING BUG videosListLayout.ItemsSource = videos; Content = videosListLayout; }
public void SetCameraName(string str) { cameraName = VideoHelper.GetCameraName(); if (cameraName == str) { return; } else { if (str != "无") { cameraName = str; XmlHelper.SetValue("Camera", str); XmlHelper.SetValue("CameraResolution", 0, VideoHelper.GetCamereFirstResolution(cameraName)); cameraName = VideoHelper.GetCameraName(); PreviewCamera(); } else { XmlHelper.SetValue("Camera", str); cameraName = VideoHelper.GetCameraName(); PreviewDesktop(); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { cameraName = VideoHelper.GetCameraName(); cameraResolution = VideoHelper.GetCameraResolution(); cameraResolutionIndex = VideoHelper.GetCameraResolutionIndex(); if (cameraName == string.Empty || cameraResolution == string.Empty || cameraName == "无") { //设置默认的摄像头 设置默认的分辨率 修改appconfig.config文件 VideoHelper.SetDefaultCamera(); cameraName = VideoHelper.GetCameraName(); cameraResolution = VideoHelper.GetCameraResolution(); if (cameraName == "无") { //如果没有摄像头 则默认直播方式是直播桌面 liveType = LiveType.Desktop; PreviewDesktop(); } else { liveType = LiveType.Camera; PreviewCamera(); } } else { liveType = LiveType.Camera; PreviewCamera(); } }
public override void Process(HandleCallbackArgs args) { if (args.Notification.IsVideoUpload()) { VideoHelper.SetIngestStatus(args.Notification); } }
// GET: VideoWidget public ActionResult Index() { var properties = GetProperties(); var viewModel = VideoHelper.GetVideoModel(properties.VideoUrl); return(PartialView("~/Views/Shared/Kentico/Widgets/_VideoWidget.cshtml", viewModel)); }
private unsafe void Button_Test_Click(object sender, RoutedEventArgs e) { Bitmap bitmap = CreateTestBitmap(); AVFrame *inFrame = FFmpegInvoke.avcodec_alloc_frame(); if (inFrame == null) { throw new Exception("Could not allocate video frame"); } inFrame->width = bitmap.Width; inFrame->height = bitmap.Height; inFrame->format = (int)AVPixelFormat.AV_PIX_FMT_BGR24; int ret1 = FFmpegInvoke.av_image_alloc(&inFrame->data_0, inFrame->linesize, bitmap.Width, bitmap.Height, AVPixelFormat.AV_PIX_FMT_BGR24, 32); if (ret1 < 0) { throw new Exception("Could not allocate raw picture buffer"); } VideoHelper.UpdateFrame(inFrame, bitmap); VideoConverter converterToYuv = new VideoConverter(AVPixelFormat.AV_PIX_FMT_YUV420P); var data = converterToYuv.ConvertFrame(inFrame); var bitmap2 = VideoHelper.CreateBitmap(data, bitmap.Width, bitmap.Height); SetImageSource(bitmap2); }
public Image[] makeBigBlocks(byte[] mapping, byte[] tiles, byte[] palette, int count, MapViewType curViewType = MapViewType.Tiles) { var result = new Image[count]; ushort[] m = Mapper.loadMapping(mapping); Color[] cpal = getPalette(palette); for (ushort i = 0; i < count; i++) { if (!ConfigScript.isBlockSize4x4()) { var b = getBlock(m, tiles, cpal, i); result[i] = UtilsGDI.ResizeBitmap(b, 32, 32); } else { var b = getBlock4X4(m, tiles, cpal, i); result[i] = UtilsGDI.ResizeBitmap(b, 32, 32); } if (curViewType == MapViewType.ObjNumbers) { result[i] = VideoHelper.addObjNumber(result[i], i); } } return(result); }
/// <summary> /// 摄像头设置Tab /// </summary> private void LoadTab1() { cameraList = VideoHelper.GetAllCameras(); if (cameraList.Count == 0) { return; } XCameraList.ItemsSource = cameraList; XCameraList.SelectedIndex = XmlHelper.GetIndexValue("Camera"); List <SimpleModel> resolutionList = VideoHelper.GetCameraResolution(XCameraList.SelectedIndex); if (resolutionList == null || resolutionList.Count == 0) { MessageBox.Show("该摄像头没有支持的分辨率!", "系统提示"); return; } XCamRes.ItemsSource = resolutionList; XCamRes.SelectedIndex = XmlHelper.GetIndexValue("CameraResolution"); XCam.ItemsSource = VideoHelper.GetCameraSize(XCamRes.Text); XCam.SelectedIndex = XmlHelper.GetIndexValue("CameraSize"); XCameraPosition.SelectedIndex = XmlHelper.GetIndexValue("CameraPosition"); CameraSetting.IsEnabled = true; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var file = (StorageFile)e.Parameter; var parent = await file.GetParentAsync(); var list = await parent.GetFilesAsync(); var videolist = VideoHelper.getVideosFromFolder(list, false); foreach (var item in videolist) { FolderVideoModel model = new FolderVideoModel() { title = item.DisplayName, duration = await VideoHelper.GetVideoDuration(item), imageSource = await ThumbnailHelper.getThumbnailForVideo(item), subtitle = null, videoPath = item.Path, mediaPlaybackItem = new MediaPlaybackItem(MediaSource.CreateFromStorageFile(item)) }; videoFiles.Add(model); playbackList.Items.Add(model.mediaPlaybackItem); } }
/// <summary> /// Creates AviSynth script used to determine black borders for cropping /// </summary> /// <param name="inputFile">Path to source file</param> /// <param name="targetFps">Sets framerate of the source file</param> /// <param name="streamLength">Sets duration of the source file, in seconds</param> /// <param name="videoSize"></param> /// <param name="aspectRatio"></param> /// <param name="frameCount">Calculated amount of frames</param> /// <returns>Path to AviSynth script</returns> public string GenerateCropDetect(string inputFile, float targetFps, double streamLength, Size videoSize, float aspectRatio, out int frameCount) { var sb = new StringBuilder(); sb.AppendLine($"LoadPlugin(\"{Path.Combine(_appConfig.AvsPluginsPath, "ffms2.dll")}\")"); int fpsnum; int fpsden; VideoHelper.GetFpsNumDenom(targetFps, out fpsnum, out fpsden); if (fpsnum == 0) { fpsnum = (int)Math.Round(targetFps) * 1000; fpsden = (int)(Math.Round(Math.Ceiling(targetFps) - Math.Floor(targetFps)) + 1000); } sb.AppendLine($"inStream=FFVideoSource(\"{inputFile}\",fpsnum={fpsnum:0},fpsden={fpsden:0},threads=1)"); var randomList = new List <int>(); var rand = new Random(); for (var i = 0; i < 5; i++) { randomList.Add(rand.Next((int)Math.Round(streamLength * targetFps, 0))); } randomList.Sort(); frameCount = 0; var frameList = new List <string>(); foreach (var frame in randomList) { var endFrame = frame + (int)Math.Round(targetFps * 5f, 0); sb.AppendLine($"Frame{frame:0}=inStream.Trim({frame:0},{endFrame:0})"); frameList.Add("Frame" + frame.ToString(CInfo)); frameCount += (endFrame - frame); } var concString = "combined=" + string.Join("+", frameList); sb.AppendLine(concString); if (videoSize.Height * aspectRatio > videoSize.Width) { videoSize.Width = (int)(videoSize.Height * aspectRatio); int temp; Math.DivRem(videoSize.Width, 2, out temp); videoSize.Width += temp; } sb.AppendLine($"BicubicResize(combined,{videoSize.Width:0},{videoSize.Height:0})"); return(WriteScript(sb.ToString())); }
private IEnumerable <BasicContent> ConvertToBasicContent(IEnumerable <IntermediateVideoDataModel> dataModels) { var helper = new VideoHelper(); var entryPoint = ContentRepositry.Service.GetChildren <VideoFolder>(ContentReference.RootPage).FirstOrDefault(); var videoType = ContentTypeRepository.Service.Load <Video>(); var videoFolderType = ContentTypeRepository.Service.Load <VideoFolder>(); var videos = new List <Video>(); var folders = new List <VideoFolder>(); var rawcontents = dataModels as IList <IntermediateVideoDataModel> ?? dataModels.ToList(); foreach (IntermediateVideoDataModel dataModel in rawcontents.Where(_ => _.VideoContentType == VideoContentType.VideoFolder)) { var folder = ContentFactory.Service.CreateContent(videoFolderType, new BuildingContext(videoFolderType) { Parent = entryPoint, LanguageSelector = LanguageSelector.AutoDetect(), SetPropertyValues = true }) as VideoFolder; folder.Name = dataModel.Name; folder.EditorGroup = dataModel.EditorGroup; folder.ContentLink = dataModel.ContentLink; folder.ContentGuid = dataModel.Guid; folders.Add(folder); } foreach (IntermediateVideoDataModel dataModel in rawcontents.Where(_ => _.VideoContentType == VideoContentType.Video)) { var video = ContentFactory.Service.CreateContent(videoType, new BuildingContext(videoType) { Parent = folders.FirstOrDefault(x => x.ContentLink == dataModel.ParentLink), LanguageSelector = LanguageSelector.AutoDetect(), SetPropertyValues = true }) as Video; video.Id = dataModel.Id; video.ContentLink = dataModel.ContentLink; video.Name = dataModel.Name; video.oEmbedHtml = dataModel.oEmbedHtml; video.oEmbedVideoName = dataModel.oEmbedVideoName; video.VideoUrl = dataModel.VideoUrl; video.VideoDownloadUrl = dataModel.VideoDownloadUrl; video.Thumbnail = dataModel.Thumbnail; video.BinaryData = dataModel.Binarydata; video.ContentGuid = dataModel.Guid; video.OriginalHeight = dataModel.OriginalHeight; video.OriginalWidth = dataModel.OriginalWidth; helper.PopulateStandardVideoProperties(video); videos.Add(video); } foreach (VideoFolder folder in folders) { yield return(folder); } foreach (Video video in videos) { yield return(video); } }
public Image[] makeBigBlocks(int videoNo, int bigBlockNo, BigBlock[] bigBlockIndexes, int palleteNo, MapViewType smallObjectsViewType = MapViewType.Tiles, MapViewType curViewType = MapViewType.Tiles, int hierarchyLevel = 0) { int blockCount = ConfigScript.getBigBlocksCount(hierarchyLevel); var bigBlocks = new Image[blockCount]; Image[] smallBlocksPack; if (hierarchyLevel == 0) { smallBlocksPack = makeObjects(videoNo, bigBlockNo, palleteNo, smallObjectsViewType); } else { var bigBlockIndexesPrev = ConfigScript.getBigBlocksRecursive(hierarchyLevel - 1, bigBlockNo); smallBlocksPack = makeBigBlocks(videoNo, bigBlockNo, bigBlockIndexesPrev, palleteNo, smallObjectsViewType, curViewType, hierarchyLevel - 1); } //tt version hardcode Image[][] smallBlocksAll = null; bool smallBlockHasSubpals = bigBlockIndexes == null ? true : bigBlockIndexes[0].smallBlocksWithPal(); if (!smallBlockHasSubpals) { smallBlocksAll = new Image[4][]; for (int i = 0; i < 4; i++) { smallBlocksAll[i] = makeObjects(videoNo, bigBlockNo, palleteNo, smallObjectsViewType, i); } } else { smallBlocksAll = new Image[4][] { smallBlocksPack, smallBlocksPack, smallBlocksPack, smallBlocksPack }; } for (int btileId = 0; btileId < blockCount; btileId++) { Image b; if (ConfigScript.isBuildScreenFromSmallBlocks()) { var sb = smallBlocksPack[btileId]; //scale for small blocks b = UtilsGDI.ResizeBitmap(sb, (int)(sb.Width * 2), (int)(sb.Height * 2)); } else { b = bigBlockIndexes[btileId].makeBigBlock(smallBlocksAll); } if (curViewType == MapViewType.ObjNumbers) { b = VideoHelper.addObjNumber(b, btileId); } bigBlocks[btileId] = b; } return(bigBlocks); }
public async static Task <ObservableCollection <FolderVideoModel> > populateGrid(IReadOnlyList <IStorageItem> files) { var watch = Stopwatch.StartNew(); list.Clear(); if (files.Count > 0) { var model = new FolderVideoModel(); foreach (var item in files) { if (item is StorageFolder) { var folder = (StorageFolder)item; Debug.WriteLine($"{folder.DisplayName} is a folder"); var count = await VideoHelper.GetVideoCountFromFolder(folder); var bitmap = new BitmapImage(new Uri("ms-appx:///Assets/folder-icon.png")); model = new FolderVideoModel(folder.DisplayName, count.ToString(), folder.Path, bitmap, null, null); } else if (item is StorageFile) { var file = (StorageFile)item; if (VideoHelper.isVideo(file)) { var duration = await VideoHelper.GetVideoDuration(file); var bitmap = await ThumbnailHelper.getThumbnailForVideo(file); model = new FolderVideoModel(file.DisplayName, duration, file.Path, bitmap, null, null); } } list.Add(model); //list.Add(Task.Run(() => model)); } /* var results = await Task.WhenAll(list); * * foreach (var item in results) * { * videoFiles.Add(item); * }*/ } return(list); watch.Stop(); var time = watch.ElapsedMilliseconds; Debug.WriteLine($" Time ----------- {time}"); }
public void Init(string filePath) { if (!_isInitilized) { FilePath = filePath; Thumbnail = VideoHelper.GetThumbnail(FilePath, $"thumbnail.jpeg"); Name = System.IO.Path.GetFileNameWithoutExtension(FilePath); } ; }
/// <summary> /// Set the anti aliasing level /// </summary> public void SetAntiAliasingLevel() { TMPro.TMP_Dropdown dropdown = antiAliasingDropdown.GetComponent <TMPro.TMP_Dropdown>(); for (int i = 0; i < qualitySettings.Length; i++) { if (qualitySettings[i] == dropdown.itemText.text) { VideoHelper.SetQualityLevel(i); } } }
public void GetVideoModel_ProvidedYoutubeOrVimeoUrl_GetCorrectVideoModel(string videoUrl, string expectedVideoId, VideoKindEnum expectedVideoKind) { var actualModel = VideoHelper.GetVideoModel(videoUrl); Assert.That(actualModel, Is.Not.Null); Assert.Multiple(() => { Assert.That(actualModel.VideoUrl, Is.EqualTo(videoUrl)); Assert.That(actualModel.VideoId, Is.EqualTo(expectedVideoId)); Assert.That(actualModel.VideoKind, Is.EqualTo(expectedVideoKind)); }); }
private static void SetImage(Image image, byte[] source, byte[] result, long encodedSize) { var bmp = new WriteableBitmap(VideoConstants.Width, VideoConstants.Height); Buffer.BlockCopy(result, 0, bmp.Pixels, 0, Buffer.ByteLength(source)); bmp.Invalidate(); image.Source = bmp; var distance = VideoHelper.GetColorDistance(source, result); var tooltip = string.Format("Distance: {0:0.00}; EncodedSize: {1}", distance, encodedSize); ToolTipService.SetToolTip(image, tooltip); }
public void SetVideoFrame(byte[] frame, int stride) { if (isRecording) { if (stride <= 0) { VideoHelper.FlipAndReverse(frame, frame); } RecordedFrames.Add(frame); FramesRecorded++; } }
public void GetVideoModel_VideoUrlIsNull_RetursEmptyModel() { // Act var model = VideoHelper.GetVideoModel(null); // Assert Assert.Multiple(() => { Assert.IsNull(model.VideoId); Assert.IsNull(model.VideoUrl); Assert.AreEqual(VideoKindEnum.Unknown, model.VideoKind); }); }