public MacroEntryMetric(string pluginName, string mementoName, IVideo vidRef, IVideo vidProc) { this._pluginName = pluginName; this._mementoName = mementoName; this._vidRef = vidRef; this._vidProc = vidProc; }
private static Node GetVideoNode(IVideo video) { var node = new Node(); node.Id = video.Provider.GetType().GetShortAssemblyName() + "|" + video.Id; node.Text = video.Title; return node; }
/// <summary> /// Creates a new SmartNode from a given path to a video file. /// </summary> public SmartNode(IVideo vid, int id, int idFather, ObservableCollection<SmartNode> smartTree = null) { this.video =(Video) vid; this.id = id; this.idFather = idFather; if (smartTree != null) this.smartTree = smartTree; }
public void SaveCommit(IVideo video, bool success) { using (IUnitOfWork uow = UnitOfWork.Begin()) { Save(video, out success); if (success) uow.Commit(); } }
public ShaderResource(IVideo video, int location, int index, string name) { this.video = (Video)video; this.location = location; this.index = index; this.Name = name; Apply = setNothing; }
public async Task Map_Should_Return_Null_If_Meetup_Is_Null() { VideoModelMapperMock mock = VideoModelMapperMock.Create(); IVideo video = null; VideoModel videoModel = await mock.Map(video); Assert.Null(videoModel); }
//make it delete any shows it is related to. or not if you want those always kept. public void Delete(IVideo video) { Checks.Argument.IsNotNull(video, "video"); using (IUnitOfWork u = UnitOfWork.Begin()) { _repo.Remove(video); u.Commit(); } }
public void AddVideo(IVideo video) { try { video.Id = TestData.vidoes.Max(b => b.Value.Id) + 1; TestData.vidoes.Add(video.Id, video); } catch { throw; } }
private void Close() { //Stop playback Stop(); _targetSource = null; //Reset fields chkLoop.Checked = false; }
private void GeneratePreview(IVideo video) { Image <Gray, Byte> binaryBackground; IEnumerable <IBoundaryBase> boundaries; VideoSettings.MotionLength = 100; VideoSettings.StartFrame = 0; VideoSettings.GeneratePreview(video, out binaryBackground, out boundaries); BinaryBackground = binaryBackground; }
public Video(IVideo video) { Id = video.Id; GenreId = video.GenreId; Name = video.Name; RentalDays = video.RentalDays; BasicRentalPrice = video.BasicRentalPrice; LateReturnFee = video.LateReturnFee; IsRented = video.IsRented; }
// TODO: Optional<Mat> public HistChessboardModel Do(IVideo video) { HistChessboardModel model = null; Mat frame; Mat gray = new Mat(); Mat thresh = new Mat(); var corners = new Point2f[4]; var patternSize = new Size(7, 3); var threshWin = new Window("Adaptive Threshold"); // TODO: each iteration, try different block sizes for the adaptive threshold (height / 4, height / 2, etc) do { frame = video.GetNextFrame(); if (frame != null && frame.Width + frame.Height > 0) { Cv2.CvtColor(frame, gray, ColorConversionCodes.BGR2GRAY); //Cv2.MedianBlur(gray, gray, 5); // Disallows chessboard to be found, because of how it opens/closes corners Cv2.AdaptiveThreshold(gray, thresh, maxValue: 255.0, adaptiveMethod: AdaptiveThresholdTypes.GaussianC, thresholdType: ThresholdTypes.Binary, blockSize: (gray.Height / 4) | 1, c: 0.0); threshWin.ShowImage(thresh); var found = Cv2.FindChessboardCorners(thresh, patternSize, out corners, ChessboardFlags.None); //, ChessboardFlags.AdaptiveThresh | ChessboardFlags.NormalizeImage); //frame.CopyTo(output); //Cv2.DrawChessboardCorners(output, patternSize, corners, found); //if (!found) Console.Out.WriteLine("Chessboard not found :( "); if (found) { var boardPoints = new Point2d[21]; Point2d[] foundPoints = OCVUtil.Point2fTo2d(corners); for (int c = 0; c < 7; c++) { for (int r = 0; r < 3; r++) { boardPoints[r * 7 + c] = new Point2d((c + 1.0), (r + 3.0)); } } var boardToImageTransform = Cv2.FindHomography(boardPoints, foundPoints); var imageToBoardTransform = boardToImageTransform.Inv(); //Cv2.FindHomography(foundPoints, boardPoints); model = new HistChessboardModel(boardToImageTransform, imageToBoardTransform, frame); } } } while (frame != null && model == null); return(model); }
public double CalculatePrice(IVideo video, int duration) { if (video.RentalDays < duration) { return(video.BasicRentalPrice * duration + video.LateReturnFee * (duration - video.RentalDays)); } else { return(video.BasicRentalPrice * duration); } }
public void SaveCommit(IVideo video, bool success) { using (IUnitOfWork uow = UnitOfWork.Begin()) { Save(video, out success); if (success) { uow.Commit(); } } }
public byte[] ToBytes() { List <byte> dados = new List <byte>(); unsafe { long quantidadeBytes = (long)(sizeof(FormatoVideo04) - sizeof(UInt32)); quantidadeBytes += (listaFrames.Count * (sizeof(FormatoFrame) - sizeof(UInt32))); foreach (VideoV02 video in listaVideos) { quantidadeBytes += video.ToBytes().Length; } Byte[] resultado = new Byte[quantidadeBytes]; dados.AddRange(BitConverter.GetBytes((uint)quantidadeBytes)); dados.Add(this.versao); //dados.AddRange(BitConverter.GetBytes()); dados.AddRange(this.formato); dados.AddRange(BitConverter.GetBytes((uint)listaFrames.Count)); int indice = (sizeof(FormatoVideo04) - sizeof(UInt32)); for (int i = 0; i < listaFrames.Count; i++) { dados.AddRange(BitConverter.GetBytes(listaFrames[i].x)); dados.AddRange(BitConverter.GetBytes(listaFrames[i].y)); dados.AddRange(BitConverter.GetBytes(listaFrames[i].height)); dados.AddRange(BitConverter.GetBytes(listaFrames[i].width)); IVideo video = listaVideos[i]; if (video is VideoV01) { dados.AddRange((video as VideoV01).ToBytes()); } else if (video is VideoV02) { dados.AddRange((video as VideoV02).ToBytes()); } else if (video is VideoV03) { dados.AddRange((video as VideoV03).ToBytes()); } else if (video is Arquivo_PLS) { dados.AddRange((video as Arquivo_PLS).ToBytes()); } } resultado = dados.ToArray(); return(resultado); } }
public RentalTest() { rentals = new List <Rental>(); clients = new List <Client>(); videos = new List <IVideo>(); logic = new VideoRentalLogic(videos, rentals, clients); data = new TestDataGenerator(); video = new Tape(2001, "Gladiator", "Ridley Scott", "Drama"); client = new Client("John", "Exemplary"); videos.Add(video); clients.Add(client); }
public IVideo Add(IVideo entity) { using (var conn = new SQLiteConnection(Database.DatabasePath)) { using (var context = new DatabaseContext(conn)) { context.Video.Add((Video)entity); context.SaveChanges(); } } return(entity); }
public DiskIIController(IVideo video, byte[] diskIIRom) { _video = video; _romRegionC1C7 = diskIIRom; Drive1 = new DiskIIDrive(this); Drive2 = new DiskIIDrive(this); _phaseStates = 0; SetMotorOn(false); SetDriveNumber(0); _loadMode = false; _writeMode = false; }
public bool TryParseVideo(Stream s, out IVideo video) { video = null; if (!IsVbc(s)) { return(false); } video = new Vbc(s); return(true); }
public YoutubeMedia(IVideo video) : this() { this._videoId = video.Id; this.Author = video.Author.Title; this.Title = video.Title; this.Duration = video.Duration.Value; var thumbnailUrl = video.Thumbnails.OrderByDescending(t => t.Resolution.Area).First().Url; this.SetBitmapImage(uri: new Uri(thumbnailUrl)); }
public bool TryParseVideo(Stream s, bool useFramePadding, out IVideo video) { video = null; if (!IsWestwoodVqa(s)) { return(false); } video = new VqaVideo(s, useFramePadding); return(true); }
public bool TryParseVideo(Stream s, out IVideo video) { video = null; if (!IsWestwoodVqa(s)) { return(false); } video = new VqaReader(s); return(true); }
public async Task CreateVoiceService(IVoiceChannel channel, IVideo video, IAudioClient audioClient) { var service = new VoiceService(_client, channel, channel.GuildId, audioClient); activeVoiceServices.Add(channel.GuildId, service); service.AddToQueue(video); Console.WriteLine($"Created voice service for {channel.GuildId}"); await service.PlayAudioAsync(); //Play DestroyVoiceService(channel.GuildId); //Then once the task completes destroy the service }
public static void PlayFMVInRadar(IVideo movie, Action onComplete) { var player = Ui.Root.Get <VideoPlayerWidget>("PLAYER"); player.Open(movie); player.PlayThen(() => { onComplete(); player.CloseVideo(); }); }
/// <summary> /// Downloads a video's thumbnail. /// </summary> /// <param name="video">The video with thumbnail to download.</param> /// <param name="cancellationToken">Used to cancel asynchronous operations.</param> public static async Task DownloadThumbnailAsync(IVideo video, CancellationToken cancellationToken) { using (var response = await Http.Client.GetAsync( video.Thumbnails.OrderByDescending(o => o.Resolution.Area).FirstOrDefault().Url, cancellationToken)) { using (var stream = new FileStream($@"{App.ThumbnailFolderPath}/{video.Id.Value}.jpg", FileMode.Create)) { await response.Content.CopyToAsync(stream); } } }
public async Task VoiceQueue() { if ((Context.User as IGuildUser).VoiceChannel == null) { await ReplyAsync("Enter a voice channel to use voice commands!"); return; } IVideo playing = _voiceManager.GetCurrentlyPlaying(Context.Guild.Id); TimeSpan?uptime = _voiceManager.GetFFMpegUptime(Context.Guild.Id); if (!uptime.HasValue) { await ReplyAsync("No song currently playing!"); return; } int playPercent = (int)(100 * uptime.Value.TotalSeconds / playing.Duration.Value.TotalSeconds); string progressBar = new string('#', playPercent / 5) + new string('.', 20 - (playPercent / 5)); string progress = uptime.Value.ToString(@"m\:ss"); string duration = playing.Duration.Value.ToString(@"m\:ss"); EmbedBuilder builder = new EmbedBuilder(); builder.WithTitle(":musical_note: Queue"); builder.WithThumbnailUrl(playing.Thumbnails[1].Url); builder.AddField("Now Playing", $"**{playing.Title}**\n" + $"`{progressBar}`\n{progress} / {duration}\n" + $"By: {playing.Author}"); TimeSpan totalLength = new TimeSpan(); //To calculate total length of the queue foreach (Video video in _voiceManager.GetQueue(Context.Guild.Id).Take(9)) //make it restricted to 10 total elements { string s = video.Duration.Value.ToString(@"m\:ss"); builder.AddField($"**{video.Title}** ({s})", $"By: {video.Author}"); } foreach (Video video in _voiceManager.GetQueue(Context.Guild.Id)) { totalLength += video.Duration.Value; } totalLength += playing.Duration.Value - uptime.Value; //Add the remaining time in the current song string totalLengthStr = totalLength.ToString(@"hh\:mm\:ss"); builder.WithFooter($"Queue length: {totalLengthStr}"); await ReplyAsync("", false, builder.Build()); }
protected bool Remove(IVideo entity) { if (entity == null) { return(true); } // No entity found to remove, consider it passed // Remove it VideosRepository.Remove(entity); // Try to Save Changes VideosRepository.SaveChanges(); // Finished! return(true); }
public IVideo FindByTitle(string title) { IVideo result = null; using (var conn = new SQLiteConnection(Database.DatabasePath)) { using (var context = new DatabaseContext(conn)) { result = context.Video.FirstOrDefault(x => x.Title == title); } } return(result); }
public bool Rent(IVideo video, Client client) { if (video.GetStatus() == false) //if video taken { return(false); //fail } else //if video available { video.SetStatus(false); //set video taken rentals.Add(new Rental(video, client)); return(true); //video rented } }
private void TargetChanged(IVideo newTarget) { if (_targetSource == newTarget) { return; } Close(); if ((_targetSource = newTarget) == null) { return; } previewPanel1.RenderingTarget = _targetSource; IAudioStream s = _targetSource.Audio; //Create provider if (_provider == null && s != null) { _provider = AudioProvider.Create(null); _provider.Attach(this); } chkLoop.Checked = false; //Create buffer for stream if (s != null) { _buffer = _provider.CreateBuffer(s); } if (_targetSource.FrameRate > 0) { _frameTime = new DateTime((long)((float)_targetSource.NumFrames * 10000000.0f / _targetSource.FrameRate)); } trackBar1.TickStyle = TickStyle.None; trackBar1.Maximum = (int)_targetSource.NumFrames; trackBar1.Minimum = 1; trackBar1.Value = 1; if (_targetSource.FrameRate > 0) { UpdateTimeDisplay(); } Enabled = _targetSource.NumFrames > 0; }
public static void AddVideoOutput(this WebDocument document, string outputPath, Presentation pres) { List <VideoFrame> videoFrames = ShapeHelper.GetListOfShapes <VideoFrame>(pres); for (int i = 0; i < videoFrames.Count; i++) { IVideo video = videoFrames[i].EmbeddedVideo; string ext = MimeTypesMap.GetExtension(videoFrames[i].EmbeddedVideo.ContentType); string path = Path.Combine(outputPath, string.Format("video{0}.{1}", i, ext)); var outputFile = document.Output.Add(path, video); document.Output.BindResource(outputFile, video); } }
public KinnectDevice(VideoModel video, User user, DbModel.DomainClasses.Entities.Words thword, int?ty) { uow = ObjectFactory.GetInstance <IUnitOfWork>(); ops = ObjectFactory.GetInstance <IOptionService>(); videoservice = ObjectFactory.GetInstance <IVideo>(); app = ops.GetAll(); VideoInfo = new VideoModel(); registerMessenger(); InitializeComponent(); thisword = thword; ttt = ty; //SavingPath = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); //listitem = new ListItems(); string wtype = UtilityClass.IntToWordTypeString(thword.WordType);//listitem.GetWordType().FirstOrDefault(x => x.ID == UtilityClass.WordTypeToInt(thword.WordType)).Value; SavingPath = app.FileUrl + @"\" + thword.Languages.Name + "_" + wtype + "_" + thword.Name; //textBoxPath.Text = SavingPath; textBoxComment.Text = SavingPath; // textBoxComment.IsEnabled = false; _sensor = KinectSensor.GetDefault(); if (_sensor != null) { _sensor.Open(); _ProcessingInstance = new ProcessingsAndRendering(); _ProcessingInstance.initializeCoordinateMapper(_sensor); _ProcessingInstance.InitializeColor(_sensor); _ProcessingInstance.InitializeIR(_sensor); _ProcessingInstance.InitializeDepth(_sensor); _ProcessingInstance.InitializeBodyIndex(_sensor);; _ProcessingInstance.InitializeBody(_sensor); // set the status text _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body | FrameSourceTypes.BodyIndex); _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived; // textBlockLogs.Text = textBlockLogs.Text + "\n --- Kinect not Found :|"; } DataContext = this; } /// end method mainwindow
public VideoControl(object parent, IVideo video, bool inTimeline = false) : base(parent) { InitializeComponent(); this._inTimeline = inTimeline; this.Video = video; if (CustomParent != null) { SearchHelper.RegisterSearchable(this); } if (inTimeline) { EventHelper.TimelineFilterChanged += UpdateTypeVisibility; } }
public static void Run() { //ExStart:ExportBlobFromPresentation // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Conversion(); const string hugePresentationWithAudiosAndVideosFile = @"c:\bin\aspose\Tasks\020, 38595\orig\Large Video File Test1.pptx"; LoadOptions loadOptions = new LoadOptions { BlobManagementOptions = { // lock the source file and don't load it into memory PresentationLockingBehavior = PresentationLockingBehavior.KeepLocked, } }; // create the Presentation's instance, lock the "hugePresentationWithAudiosAndVideos.pptx" file. using (Presentation pres = new Presentation(hugePresentationWithAudiosAndVideosFile, loadOptions)) { // let's save each video to a file. to prevent memory usage we need a buffer which will be used // to exchange tha data from the presentation's video stream to a stream for newly created video file. byte[] buffer = new byte[8 * 1024]; // iterate through the videos for (var index = 0; index < pres.Videos.Count; index++) { IVideo video = pres.Videos[index]; // open the presentation video stream. Please note that we intentionally avoid accessing properties // like video.BinaryData - this property returns a byte array containing full video, and that means // this bytes will be loaded into memory. We will use video.GetStream, which will return Stream and // that allows us to not load the whole video into memory. using (Stream presVideoStream = video.GetStream()) { using (FileStream outputFileStream = File.OpenWrite($"video{index}.avi")) { int bytesRead; while ((bytesRead = presVideoStream.Read(buffer, 0, buffer.Length)) > 0) { outputFileStream.Write(buffer, 0, bytesRead); } } } // memory consumption will stay low no matter what size the videos or presentation is. } // do the same for audios if needed. } }
public Kinnect() { uow = ObjectFactory.GetInstance <IUnitOfWork>(); user = ObjectFactory.GetInstance <IUser>(); language = ObjectFactory.GetInstance <ILanguages>(); word = ObjectFactory.GetInstance <IWords>(); video = ObjectFactory.GetInstance <IVideo>(); wordData = new Words_ViewModel(new WordsModel(), 2, uow); registerMessenger(); InitializeComponent(); //ImageBrush myBrush = new ImageBrush(); //myBrush.ImageSource = // new BitmapImage(new Uri("pack://siteoforigin:,,,/back3.jpg", UriKind.Absolute)); //this.Background = myBrush; //wordData.charttest = wordData.PerVideoPartCount(); //MessageBox.Show(wordData.charttest[0].ToString()); string[] datax = new string[] { "Cat1", "Cat2", "Cat3", "Cat4", "Cat5", "Cat6", "Cat7", "Cat8" }; //double[] datay = new double[] { wordData.WordCount1(), wordData.WordCount2() // , wordData.WordCount3(),wordData.WordCount4(), // wordData.WordCount5(), wordData.WordCount6(), // wordData.WordCount7(), wordData.WordCount8() }; double[] datay = new double[] { wordData.VideoCount1(LeapKinnectType.Kinnect), wordData.VideoCount2(LeapKinnectType.Kinnect), wordData.VideoCount3(LeapKinnectType.Kinnect), wordData.VideoCount4(LeapKinnectType.Kinnect), wordData.VideoCount5(LeapKinnectType.Kinnect), wordData.VideoCount6(LeapKinnectType.Kinnect), wordData.VideoCount7(LeapKinnectType.Kinnect), wordData.VideoCount8(LeapKinnectType.Kinnect) }; //double[] datay = new double[] { 32, 56, 35, 12, 35, 6, 23, 56 }; BindableCollection <Series> SeriesCollection = new BindableCollection <Series>(); Series ds = new Series(); ds.ChartType = SeriesChartType.Column; ds["DrawingStyle"] = "Cylinder"; //ds.Points.DataBindY(data1); ds.Points.DataBindXY(datax, datay); SeriesCollection.Add(ds); MsChart chm = new MsChart(); wordData.charttest = SeriesCollection; chart1.SeriesCollection = SeriesCollection;// nn.BarSeriesCollection; chart1.Title = "Capturing Status by Kinect"; MsChart.StartChart(chart1, new DependencyPropertyChangedEventArgs()); DataContext = this; }
public virtual bool AreEqual(IVideoModel model, IVideo entity) { return NameableEntityMapper.AreEqual(model, entity) // Video Properties && model.LowUrl == entity.LowUrl && model.HighUrl == entity.HighUrl && model.HdUrl == entity.HdUrl && model.Url == entity.Url && model.LengthSeconds == entity.LengthSeconds && model.PublishDate == entity.PublishDate // Related Objects && model.PrimaryImageFileId == entity.PrimaryImageFileId && model.AuthorId == entity.AuthorId && model.VideoTypeId == entity.VideoTypeId ; }
//consider changing the out parameter to a validation type object public void Save(IVideo video, out bool success) { Checks.Argument.IsNotNull(video, "video"); success = false; if (null == _repo.FindByVideoId(video.VideoId)) { try { _repo.Add(video); success = true; } catch (Exception ex) { success = false; } } }
public void DisplayVideos(IVideo[] videos) { Items.Clear(); ItemHeight = CalculateItemHeight(); // clear all pending downloads _thumbnailManager.ClearPendingDownloads(); // initiate a download for each video foreach (IVideo video in videos) _thumbnailManager.DownloadThumbnail(video); // add the videos to the list foreach (IVideo video in videos) Items.Add(video); // update status text if (Items.Count == 0) DisplayNoVideosFound(); else QueryStatusText = null; }
public virtual void MapToEntity(IVideoModel model, ref IVideo entity, int currentDepth = 1) { currentDepth++; // Assign Base properties NameableEntityMapper.MapToEntity(model, ref entity); // Video Properties entity.LowUrl = model.LowUrl; entity.HighUrl = model.HighUrl; entity.HdUrl = model.HdUrl; entity.Url = model.Url; entity.LengthSeconds = model.LengthSeconds; entity.PublishDate = model.PublishDate; // Related Objects entity.PrimaryImageFileId = model.PrimaryImageFileId; entity.PrimaryImageFile = (ImageFile)model.PrimaryImageFile?.MapToEntity(); entity.AuthorId = model.AuthorId; entity.Author = (Person)model.Author?.MapToEntity(); entity.VideoTypeId = model.VideoTypeId; entity.VideoType = (VideoType)model.VideoType?.MapToEntity(); // Associated Objects // <None> }
/// <summary> /// Download the thumbnail for the specified video (only if it isn't already in our cache) /// </summary> public void DownloadThumbnail(IVideo video) { if (!_thumbnails.Contains(video)) { // if we can get a version of the thumbnail from the cache // then just save this version PluginHttpRequest pluginHttpRequest = new PluginHttpRequest(video.ThumbnailUrl, HttpRequestCacheLevel.CacheOnly); using (Stream cachedStream = pluginHttpRequest.GetResponse()) { if (cachedStream != null) { MemoryStream memoryStream = new MemoryStream(); StreamHelper.Transfer(cachedStream, memoryStream); _thumbnails[video] = new VideoThumbnail(memoryStream); } // otherwise mark it as 'downloading' and enque the download else { _thumbnails[video] = new DownloadingVideoThumbnail(); _workQueue.Enqueue(video); } } } }
private void _thumbnailManager_ThumbnailDownloadCompleted(IVideo listBoxVideo) { // if the listBoxVideo whose download completed is visible then invalidate its rectangle int maxItemsDisplayed = Height / ItemHeight; int itemsDisplayed = Math.Min(maxItemsDisplayed, Items.Count - TopIndex); for (int i = 0; i < itemsDisplayed; i++) { // get the current listBoxVideo IVideo currentListBoxVideo = Items[TopIndex + i] as IVideo; if (listBoxVideo == currentListBoxVideo) { // invalidate just the rectangle containing the listBoxVideo Rectangle invalidateRect = new Rectangle( HORIZONTAL_INSET, (i * ItemHeight) + VERTICAL_INSET, THUMBNAIL_IMAGE_WIDTH, THUMBNAIL_IMAGE_HEIGHT); Invalidate(invalidateRect); break; } }; }
/// <summary> This method copy's each database field into the <paramref name="target"/> interface. </summary> public void Copy_To(IVideo target, bool includePrimaryKey = false) { if (includePrimaryKey) target.Id = this.Id; target.DiagnosticText = this.DiagnosticText; target.ParentPageId = this.ParentPageId; target.SortOrder = this.SortOrder; target.Extension = this.Extension; target.VideoId = this.VideoId; target.MarginThickness = this.MarginThickness; target.BorderThickness = this.BorderThickness; target.Background = this.Background; target.BorderColor = this.BorderColor; target.Rotation = this.Rotation; target.FileIdentifier = this.FileIdentifier; }
private void video_HorizonCallback(object sender, IVideo.HorizonEventArgs e) { if (this.InvokeRequired) this.Invoke(new HorizonCallback(video_HorizonCallback), new object[] { sender, e }); else { if (nUDHorizon.Value == e.Horizon) isGetHorizon = false; else if (isStop)video.PTZStop(); nUDHorizon.Value = e.Horizon; } }
private void video_VerticalCallback(object sender, IVideo.VerticalEventArgs e) { if (this.InvokeRequired) this.Invoke(new VerticalCallback(video_VerticalCallback), new object[] { sender, e }); else { if (nUDVertical.Value == e.Vertical) isGetVertical = false; else if (isStop) video.PTZStop(); nUDVertical.Value = e.Vertical; } }
void video_HorizonCallback(object sender, IVideo.HorizonEventArgs e) { if (this.InvokeRequired) { this.Invoke(new SetHorizonCallback(video_HorizonCallback), sender, e); } else { nUDHorizon.Value = e.Horizon; } }
/// <summary> This method copy's each database field from the <paramref name="source"/> interface to this data row.</summary> public void Copy_From(IVideo source, bool includePrimaryKey = false) { if (includePrimaryKey) this.Id = source.Id; this.DiagnosticText = source.DiagnosticText; this.ParentPageId = source.ParentPageId; this.SortOrder = source.SortOrder; this.Extension = source.Extension; this.VideoId = source.VideoId; this.MarginThickness = source.MarginThickness; this.BorderThickness = source.BorderThickness; this.Background = source.Background; this.BorderColor = source.BorderColor; this.Rotation = source.Rotation; this.FileIdentifier = source.FileIdentifier; }
/// <summary> /// check if video is compatible with other, already loaded video. /// (e.g. has same dimensions as the one to be compared to) /// </summary> private bool isCompatibleVideo(IVideo vid1, IVideo vid2) { if (vid1 != null && vid2 != null) { if(vid1 == vid2) { //video should only be loaded once MessageBox.Show("Das Video wurde bereits geladen und kann nicht mehrfach hinzugefügt werden.", "Video bereits geladen"); return false; } if (vid1.vidInfo.height != vid2.vidInfo.height || vid1.vidInfo.width != vid2.vidInfo.width || vid1.vidInfo.frameCount != vid2.vidInfo.frameCount) { MessageBox.Show("Das Video muss gleiche Framezahl und Abmessungen haben, um mit dem vorhanden Video verglichen zu werden.", "Video nicht kompatibel"); return false; } } return true; }
private void ConnectToDriver(IVideo driverInstance) { try { Cursor = Cursors.WaitCursor; initializationErrorMessages.Clear(); m_PrevStateWasDisconnected = true; videoObject = m_VideoRenderingController.ConnectToDriver(driverInstance); if (videoObject.Connected) { imageWidth = videoObject.Width; imageHeight = videoObject.Height; picVideoFrame.Image = new Bitmap(imageWidth, imageHeight); ResizeVideoFrameTo(imageWidth, imageHeight); tssIntegrationRate.Visible = Settings.Default.IsIntegrating && OccuRecContext.Current.IsAAV; pnlAAV.Visible = OccuRecContext.Current.IsAAV; tsbtnDisplayMode.Visible = true; if (videoObject.SupporstFreeStyleGain) videoObject.SetFreeRangeGainIntervals(0); m_OverlayManager = new OverlayManager(videoObject.Width, videoObject.Height, initializationErrorMessages, m_AnalysisManager, m_StateManager); m_VideoFrameInteractionController.OnNewVideoSource(videoObject); OccuRecContext.Current.IsConnected = true; if (Settings.Default.RecordStatusSectionOnly) MessageBox.Show( this, "The 'Record Status Section Only' flag is currently enabled. No video images will be recorded.", "OccuRec", MessageBoxButtons.OK, MessageBoxIcon.Warning); } m_StateManager.CameraConnected(driverInstance, videoObject, m_OverlayManager, Settings.Default.OcrMaxErrorsPerCameraTestRun, OccuRecContext.Current.IsAAV); UpdateScheduleDisplay(); } finally { Cursor = Cursors.Default; if (videoObject == null || !videoObject.Connected) { foreach (string error in initializationErrorMessages) { MessageBox.Show(this, error, "OccuRec", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } picVideoFrame.Width = videoObject.Width; picVideoFrame.Height = videoObject.Height; UpdateCameraState(true); ucVideoControl.Initialize(videoObject); }
/// <summary> /// This method copy's each database field which is in the <paramref name="includedColumns"/> /// from the <paramref name="source"/> interface to this data row. /// </summary> public void Copy_From_But_TakeOnly(IVideo source, params string[] includedColumns) { if (includedColumns.Contains(VideosTable.IdCol)) this.Id = source.Id; if (includedColumns.Contains(VideosTable.DiagnosticTextCol)) this.DiagnosticText = source.DiagnosticText; if (includedColumns.Contains(VideosTable.ParentPageIdCol)) this.ParentPageId = source.ParentPageId; if (includedColumns.Contains(VideosTable.SortOrderCol)) this.SortOrder = source.SortOrder; if (includedColumns.Contains(VideosTable.ExtensionCol)) this.Extension = source.Extension; if (includedColumns.Contains(VideosTable.VideoIdCol)) this.VideoId = source.VideoId; if (includedColumns.Contains(VideosTable.MarginThicknessCol)) this.MarginThickness = source.MarginThickness; if (includedColumns.Contains(VideosTable.BorderThicknessCol)) this.BorderThickness = source.BorderThickness; if (includedColumns.Contains(VideosTable.BackgroundCol)) this.Background = source.Background; if (includedColumns.Contains(VideosTable.BorderColorCol)) this.BorderColor = source.BorderColor; if (includedColumns.Contains(VideosTable.RotationCol)) this.Rotation = source.Rotation; if (includedColumns.Contains(VideosTable.FileIdentifierCol)) this.FileIdentifier = source.FileIdentifier; }
void video_ReceiveVertical(object sender, IVideo.VerticalEventArgs e) { if (this.InvokeRequired) { this.Invoke(new SetVerticalCallback(video_ReceiveVertical), sender, e); } else { nUDVertical.Value = e.Vertical; } }
public Preferences(string sWorkFolder, string sData) { _bUseOutput = true; XmlDocument cXmlDocument = new XmlDocument(); XmlNode cXmlNode; string sExclamationTarget; bool bExclamationExists = false; bool bOutput = true; if (null == _sPath) { cXmlDocument.Load(Path.Combine(sWorkFolder, "preferences.xml")); cXmlNode = cXmlDocument.NodeGet("preferences/blender"); _sPath = cXmlNode.AttributeValueGet("path"); _sCache = cXmlNode.AttributeValueGet("cache"); if (!Directory.Exists(_sCache)) Directory.CreateDirectory(_sCache); } cXmlDocument.LoadXml(sData); cXmlNode = cXmlDocument.NodeGet("data"); string sValue = cXmlNode.AttributeValueGet("data", false); if (null != sValue) cData = new Data(this, sValue); _sOutputTarget = cXmlNode.AttributeValueGet("output", false); if(null != _sOutputTarget && _sOutputTarget.StartsWith("*")) { _bUseOutput = false; if((_sOutputTarget = _sOutputTarget.Substring(1)).IsNullOrEmpty()) _sOutputTarget = null; } if ((null == _sOutputTarget)) // ЛЁХ! если output есть, всегда ли надо чтобы было !_bExists даже если папка существует???????? раньше так было, но правильно ли это???? { bOutput = false; int nHash = sData.GetHashCode(); _sOutputTarget = Path.Combine(_sCache, nHash.ToString()); } sExclamationTarget = AddExclamationToFolder(_sOutputTarget); lock (_oLock) { if (!(_bExists = Directory.Exists(_sOutputTarget))) { bExclamationExists = Directory.Exists(sExclamationTarget); if (bExclamationExists && Directory.GetLastWriteTime(sExclamationTarget) < DateTime.Now.AddHours(-3)) // временная папка заброшена { Directory.Delete(sExclamationTarget, true); (new Logger()).WriteWarning("Удалили заброшенную Папку: " + sExclamationTarget); bExclamationExists = false; } if (!bExclamationExists) Directory.CreateDirectory(sExclamationTarget); } } if (bExclamationExists) { _bExists = WaitForTargetFolder(_sOutputTarget); if (!_bExists) throw new Exception("imposible state - folder vanished: " + _sOutputTarget); } DateTime dtNow = DateTime.Now; if (_bExists) { try { Directory.SetLastWriteTime(_sOutputTarget, dtNow); } catch { } } if (!bOutput) { if (!_bExists) { TimeSpan tsAgeMaximum = TimeSpan.FromDays(7); string sFilesDeleted = "", sFilesDeleteFailed = ""; foreach (FileSystemInfo cFSInf in (new DirectoryInfo(_sCache)).GetFileSystemInfos()) { if (!cFSInf.Attributes.HasFlag(FileAttributes.Directory) || tsAgeMaximum > dtNow.Subtract(cFSInf.LastWriteTime)) continue; try { Directory.Delete(cFSInf.FullName, true); sFilesDeleted += cFSInf.Name + ","; } catch (Exception ex) { (new Logger()).WriteError(ex); sFilesDeleteFailed += cFSInf.Name + ","; } } if (0 < sFilesDeleted.Length) (new Logger()).WriteNotice("Папки удалены из кэша:" + sFilesDeleted.TrimEnd(',') + ". Не удалось удалить:" + sFilesDeleteFailed.TrimEnd(','));//TODO LANG } } XmlNode cChildNode = null; _sEngine = cXmlNode.AttributeValueGet("engine", false); _sThreads = cXmlNode.AttributeValueGet("threads", false); cChildNode = cXmlNode.NodeGet("python", false); if (null != cChildNode) _sPython = cChildNode.InnerXml.Trim().FromXML(); _sPythonFile = null; _sBlendFile = cXmlNode.AttributeValueGet("blend"); if (null != (cChildNode = cXmlNode.NodeGet("animation", false))) { _iVideo = new Animation() { nLoopsQty= (null == (sValue = cChildNode.AttributeValueGet("loops", false)) ? (ushort)1 : sValue.ToUShort()) }; } else if (null != (cChildNode = cXmlNode.NodeGet("video", false))) { _iVideo = new Video(); } if(null != _iVideo) { if(null != (sValue = cChildNode.AttributeValueGet("cuda", false))) _iVideo.bCUDA = sValue.ToBool(); if(null != (sValue = cChildNode.AttributeValueGet("opacity", false))) _iVideo.bOpacity = sValue.ToBool(); if(null != (sValue = cChildNode.AttributeValueGet("layer", false))) ((IEffect)_iVideo).nLayer = sValue.ToUShort(); if (null != (cChildNode = cChildNode.NodeGet("size", false))) { _iVideo.stArea = new Area( cChildNode.AttributeGet<short>("left"), cChildNode.AttributeGet<short>("top"), cChildNode.AttributeGet<ushort>("width"), cChildNode.AttributeGet<ushort>("height") ); } } /* Plugin (all)plugin@file - обязательный параметр. путь к dll плагина (all)plugin@class - обязательный параметр. название класса плагина (chat)plugin/data - не используется (rssroll)plugin/data - не используется (blender)plugin/data - обязательный параметр. содержит текст python-скрипта (blender)plugin/data@effect - обязательный параметр. может принимать значения: animation, video (blender)plugin/data@blend - обязательный параметр. путь к blend-файлу (blender)plugin/data@engine - необязательный параметр. может принимать значения из списка: BLENDER_RENDER, BLENDER_GAME, CYCLES (blender)plugin/data@threads - необязательный параметр. кол-во нитей. может принимать значения от 0 до 64. 0 - кол-во нитей равное кол-ву системных процессоров пример: <plugin file="c:/.../blender.dll" class="Blender"> <data effect="animation" blend="c:/.../target.blend" engine="CYCLES" threads="0"> import bpy bpy.ops.render.render(animation=True) </data> </plugin> */ }
public void EffectAdd(IVideo iVideo, float nSpeed, Keyframe[] aKeyframes, bool bSticky) { EffectAdd(iVideo, nSpeed, aKeyframes, bSticky, 0); }
public void EffectAdd(IVideo iVideo, float nSpeed, Keyframe[] aKeyframes, bool bSticky, uint nStartDelay) { IEffect iEffect = (IEffect)iVideo; iEffect.Prepared += OnEffectPrepared; iEffect.Started += OnEffectStarted; iEffect.Stopped += OnEffectStopped; iEffect.Failed += OnEffectFailed; Area stEffectArea = ((IVideo)iVideo).stArea; Point stEffectPosition = new Point(); if (stArea.nWidth == 0 && stArea.nHeight == 0) { Area stAreaNew = stArea; stAreaNew.nWidth = stEffectArea.nWidth; stAreaNew.nHeight = stEffectArea.nHeight; stArea = stAreaNew; } if (EffectStatus.Idle < ((IEffect)this).eStatus) iEffect.Prepare(); lock (_aEffects) { if (0 < _aEffects.Count && _aEffects[0].iVideo.bCUDA != iVideo.bCUDA) throw new Exception("некорректна¤ среда вычислений"); //TODO LANG if (1 > _aEffects.Count && null != _cPixelsMap && iVideo.bCUDA != _cPixelsMap.bCUDA) { _cPixelsMap.Dispose(true); _cPixelsMap = new PixelsMap(iVideo.bCUDA, stArea, PixelsMap.Format.ARGB32); _cPixelsMap.bKeepAlive = true; if (1 > _cPixelsMap.nLength) (new Logger()).WriteNotice("1 > _cPixelsMap.nLength. roll.effectadd"); _cPixelsMap.Allocate(); } if (eDirection == Direction.Up) { stEffectPosition.X = 0; stEffectPosition.Y = stArea.nHeight; } else if (eDirection == Direction.Down) { stEffectPosition.X = 0; stEffectPosition.Y = - stEffectArea.nHeight; } else if (eDirection == Direction.Right) { stEffectPosition.X = - stEffectArea.nWidth; stEffectPosition.Y = 0; } else if (eDirection == Direction.Left) { stEffectPosition.X = stArea.nWidth; stEffectPosition.Y = 0; } _aEffects.Add(new Item(iVideo, stEffectPosition, nSpeed, aKeyframes, bSticky, nStartDelay)); } (new Logger()).WriteDebug2("roll_effect_add: [pos=" + stEffectPosition + "] [speed=" + nSpeed + "] [keyframes=" + aKeyframes + "] [sticky=" + bSticky + "]"); OnEffectAdded((Effect)iVideo); }
public void EffectAdd(IVideo iVideo, Keyframe[] aKeyframes) { EffectAdd(iVideo, float.MinValue, aKeyframes, false, 0); }
/// <summary> /// This methode will be called if a videoLoad event is raised, i.e. /// if user selects a video from the SmartTree, the <see cref="VM_Macro"/> /// wants to pass a filter preview or filter- / metricresults /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void onVideoLoad(object sender, VideoEventArgs e) { if (e.video.isAnalysis) { if(vtype != ViewType.AnalyzeView) PluginManager.pluginManager.raiseEvent(EventType.toggleView, new ViewTypeEventArgs(ViewType.AnalyzeView)); this.videoProc = (IVideo)e.video; this.playerProc.setVideo(videoProc); this.diagram.setVideo(videoProc); } else if (e.isRefVid) { if (isCompatibleVideo(e.video, this.videoProc)) { if (vtype != ViewType.MetricView) PluginManager.pluginManager.raiseEvent(EventType.toggleView, new ViewTypeEventArgs(ViewType.MetricView)); this.videoRef = (IVideo)e.video; this.idRef = e.id; this.playerRef.setVideo(videoRef); } } else { //only toggle away from AnalyzeView, keep MetricView if it is loaded if (vtype == ViewType.AnalyzeView) PluginManager.pluginManager.raiseEvent(EventType.toggleView, new ViewTypeEventArgs(ViewType.FilterView)); if (!isCompatibleVideo(e.video, this.videoRef)) { this.videoRef = null; this.playerRef.flush(); } this.videoProc = (IVideo)e.video; this.idProc = e.id; this.playerProc.setVideo(videoProc); if (vtype == ViewType.FilterView) { this.videoRef = null; this.idRef = -1; this.playerRef.flush(); } } setMacroVideoContext(); }
public void EffectAdd(IVideo iVideo, bool bSteaky) { EffectAdd(iVideo, float.MaxValue, null, bSteaky); }
public void EffectAdd(IVideo iVideo, Keyframe[] aKeyframes, uint nStartDelay) { EffectAdd(iVideo, float.MinValue, aKeyframes, false, nStartDelay); }
public void EffectAdd(IVideo iVideo, float nSpeed) { EffectAdd(iVideo, nSpeed, null, false); }
public void EffectAdd(IVideo iVideo) { EffectAdd(iVideo, true); }