private void TimeLine_MouseDown(object sender, MouseEventArgs e) { if (shots == null) { return; } PointF startPoint = new PointF(débutDessin, topTrack); shots.ForEach(s => { s.Selected = false; s.Current = false; }); Refresh(); List <Shots> sh = new List <Shots>(); if (currentScene == null) { return; } currentScene.SequenceScene.ToList().ForEach(c => sh.Add(c.Shots)); for (int i = 0; i < shotsWidth.Count; i++) { RectangleF rect = new RectangleF(startPoint, new SizeF(shotsWidth[i], trackHeight)); if (rect.Contains(e.Location)) { Shots s = shots[i]; s.Selected = true; Refresh(); ShotSelected?.Invoke(this, new ShotSelectedArgs { Shot = s }); break; } startPoint.X += shotsWidth[i]; } }
/// <summary> /// Intégration de nouveaux films non présents dans la base /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NouveauToolStripButton_Click(object sender, EventArgs e) { FolderBrowserDialog fld = new FolderBrowserDialog { SelectedPath = @"H:\Vidéos\HDWRITER", Description = "Choisir le répertoire du film" }; if (fld.ShowDialog() == DialogResult.OK) { string an = Path.GetFileNameWithoutExtension(fld.SelectedPath); foreach (string fol in Directory.GetDirectories(fld.SelectedPath)) { string folder = fol + @"\PRIVATE\AVCHDL\BDMV\STREAM"; string[] files = Directory.GetFiles(folder, "*.m2ts"); Videos vid = new Videos { Periode = an, Titre = Path.GetFileNameWithoutExtension(fol), Directory = fol, Hauteur = 1080, Largeur = 1920, Mode = "AVC" }; foreach (string f in files) { Shots shot = ShotFromFile(f, vid); // new Shots { Videos = vid, Fichier = f }; md.Shots.Add(shot); videos.Items.Add(vid); } md.Videos.Add(vid); vid.Ordre = vid.Code_Bande; } } md.SaveChanges(); }
public DragDropItem(Shots mdf, Segment onTrack, Segment inMedia) { mediaFile = mdf; StartInMedia = inMedia.Start; EndInMedia = inMedia.End; StartOnTrack = onTrack.Start; EndOnTrack = onTrack.End; }
public void SetStart(Shots shot) { if (shot.Current) { débutDessin = -shot.FrameStart / pixelsParSecondes;; } Refresh(); }
public MediaItem(Shots mdf, Segment onTrack, Segment inMedia) { mediaFile = mdf; startInMedia = inMedia.Start; endInMedia = inMedia.End; startOnTrack = onTrack.Start; endOnTrack = onTrack.End; // mediaType = mdf.MediaType; }
public void AddShotToScene(Shots s) { SequenceScene sq = new SequenceScene { Shots = s, Scenes = this }; if (SequenceScene.Where(c => c.Shots == s).Count() == 0) { SequenceScene.Add(sq); } }
private void Trouve(MouseEventArgs e) { if (media == null) { return; } int x = 0; int y = 0; int w = (int)(media[0].Largeur * ImageZoomFactor) / Facteur; int h = (int)(media[0].Hauteur * ImageZoomFactor) / Facteur; int interval = (int)(2 * size * ImageZoomFactor); media.ForEach(s => s.Selected = false); Refresh(); for (int i = startImage; i < media.Count; i++) { Rectangle rec = new Rectangle(x, y, w, h); if (rec.Contains(e.Location)) { Shots s = media[i]; s.Selected = true; Refresh(); if (ShotSelected != null) { ShotSelected(this, new ShotSelectedArgs { Shot = s }); } Trace.WriteLine(s.Fichier); return; } x += w + 10; if (x > Width - w) { x = 0; y += h; if (Détails) { y += 4 * interval; } } if (y > Height) { return; } } }
public void SetStart(Scenes scene) { currentScene = scene; if (scene.SequenceScene.Count > 0) { Shots shot = scene.SequenceScene.First().Shots; float début = 0; foreach (Shots s in shots) { if (s == shot) { débutDessin = -début; break; } début += (int)s.FrameCount / pixelsParSecondes; } Refresh(); } }
private void Analyse(Videos video, string videoName) { string[] files = Directory.GetFiles(videoName + @"\PRIVATE\AVCHDL\BDMV\STREAM", "*.m2ts"); foreach (string f in files) { Shots s = ShotFromFile(f, video); string thumb = f.Replace(@"H:\Vidéos\HDWRITER", @"D:\VideoThumbs\").Replace(@"\PRIVATE\AVCHDL\BDMV\STREAM", "") .Replace("m2ts", "jpg"); Image im = Image.FromFile(thumb); s.FichierImage = thumb; using (var ms = new MemoryStream()) { im.Save(ms, im.RawFormat); s.Image = ms.GetBuffer(); } im.Dispose(); md.Shots.Add(s); } md.SaveChanges(); }
private void DisplayPanel_Paint(object sender, PaintEventArgs e) { if (media == null) { return; } int x = 0; int y = 0; int w = (int)(media[0].Largeur * ImageZoomFactor) / Facteur; int h = (int)(media[0].Hauteur * ImageZoomFactor) / Facteur; int fontSize = (int)(size * ImageZoomFactor); int interval = (int)(2 * size * ImageZoomFactor); Font f = new Font("Times New Roman", fontSize); imagesPerRow = Math.Max(1, Width / w); scrollPictures.Maximum = 10; scrollPictures.Maximum = media.Count; scrollPictures.Value = startImage / imagesPerRow; x = 0; y = 0; Shots s = media.FirstOrDefault(m => m.Selected); if (s != null) { startImage = media.IndexOf(s); } for (int i = startImage; i < media.Count; i++) { try { #region Show image Data scrollPictures.Value = startImage; Shots clip = media[i]; if (clip.Selected) { Pen p = new Pen(new SolidBrush(Color.Red), 3); e.Graphics.DrawRectangle(p, new Rectangle(x, y, w, h)); } if (clip.Image != null) { MemoryStream mi = new MemoryStream(clip.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, w, h)); imi.Dispose(); } //else //{ // string d = Path.GetDirectoryName(clip.FichierImage); // int ix = d.LastIndexOf(@"\"); // string c = d.Substring(ix); // string fi = Path.GetFileNameWithoutExtension(clip.FichierImage); // Image im = Image.FromFile(@"E:\VideoThumbs\" + c + "\\" + fi + ".jpg"); // e.Graphics.DrawImage(im, x, y, w, h); // e.Graphics.DrawRectangle(Pens.Red, x, y, w, h); //} if (Détails) { List <String> textes = new List <string>(); string longueur = Videos.DuréeShot((int)clip.FrameCount); textes.Add(clip.DateShot?.ToLongDateString() + " " + clip.DateShot?.ToLongTimeString()); textes.Add(clip.FrameCount.ToString() + " Frames soit " + longueur); textes.Add("Tape " + clip.Code_Bande.ToString() + " Shot : " + Path.GetFileNameWithoutExtension(clip.Fichier)); textes.Add(clip.Commentaire + " " + clip.Lieux?.Lieu); if (clip.Largeur == 1980) { size = 14; } e.Graphics.DrawString(clip.DateShot?.ToLongDateString() + " " + clip.DateShot?.ToLongTimeString(), f, Brushes.Black, new Point(x, y + h)); e.Graphics.DrawString(clip.FrameCount.ToString() + " Frames soit " + longueur, f, Brushes.Black, new Point(x, y + h + interval)); e.Graphics.DrawString("Tape " + clip.Code_Bande.ToString() + " Shot : " + Path.GetFileNameWithoutExtension(clip.Fichier), f, Brushes.Black, new Point(x, y + h + 2 * interval)); e.Graphics.DrawString(clip.Commentaire + " " + clip.Lieux?.Lieu, f, Brushes.Black, new Point(x, y + h + 3 * interval)); } x += w + 10; if (x > Width - w) { x = 0; y += h; if (Détails) { y += 4 * interval; } } #endregion if (y > Height) { return; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } }