Exemplo n.º 1
0
 private void CueOneSelected()
 {
     if (CueListView.SelectedItems.Count > 0)
     {
         BufferCue cue = CueListView.SelectedObjects[0] as BufferCue;
         if (cue.Channel != null)
         {
             (new AmcpRequest(client, "PLAY", server.Channels[3], cue.Channel.Consumer.FileName, "SEEK", ((long)cue.InFrame + cue.Channel.Consumer.Offset).ToString(), "SPEED", "0", "AUDIO", "1")).GetResponse();
         }
         else
         {
             (new AmcpRequest(client, "PLAY", server.Channels[3], cue.FileName, "SEEK", ((long)cue.InFrame).ToString(), "SPEED", "0", "AUDIO", "1")).GetResponse();
         }
         SpeedBar.Value    = 0;
         currentPGMChannel = cue.Channel;
         UpdateCameraButtons();
         if (cue.Channel != null)
         {
             PlaybackName.Text = "IN" + cue.Channel.Id.ToString() + " (" + cue.Id.ToString("000") + ")";
         }
         else
         {
             PlaybackName.Text = cue.FileName + " (" + cue.Id.ToString("000") + ")";
         }
     }
 }
Exemplo n.º 2
0
 private void PlayOneSelected(double speed = -1)
 {
     if (CueListView.SelectedItems.Count > 0)
     {
         BufferCue cue = CueListView.SelectedObjects[0] as BufferCue;
         if (speed == -1)
         {
             if (cue.Channel != null)
             {
                 (new AmcpRequest(client, "PLAY", server.Channels[3], cue.Channel.Consumer.FileName, "SEEK", ((long)cue.InFrame + cue.Channel.Consumer.Offset).ToString(), "SPEED", ((double)SpeedBar.Value / (double)SpeedBar.Maximum).ToString().Replace(',', '.'), "AUDIO", "1")).GetResponse();
             }
             else
             {
                 (new AmcpRequest(client, "PLAY", server.Channels[3], cue.FileName, "SEEK", ((long)cue.InFrame).ToString(), "SPEED", ((double)SpeedBar.Value / (double)SpeedBar.Maximum).ToString().Replace(',', '.'), "AUDIO", "1")).GetResponse();
             }
         }
         else
         {
             if (cue.Channel != null)
             {
                 (new AmcpRequest(client, "PLAY", server.Channels[3], cue.Channel.Consumer.FileName, "SEEK", ((long)cue.InFrame + cue.Channel.Consumer.Offset).ToString(), "SPEED", (speed).ToString().Replace(',', '.'), "AUDIO", "1")).GetResponse();
             }
             else
             {
                 (new AmcpRequest(client, "PLAY", server.Channels[3], cue.FileName, "SEEK", ((long)cue.InFrame).ToString(), "SPEED", (speed).ToString().Replace(',', '.'), "AUDIO", "1")).GetResponse();
             }
             SpeedBar.Value = (int)(speed * SpeedBar.Maximum);
         }
         currentPGMChannel = cue.Channel;
         UpdateCameraButtons();
         PlaybackName.Text = "IN" + cue.Channel.Id.ToString() + " (" + cue.Id.ToString("000") + ")";
     }
 }
Exemplo n.º 3
0
        private void ImportCues(String FileName)
        {
            char[]       separators             = new char[] { ' ', '\t' };
            FileStream   fs                     = new FileStream(FileName, FileMode.Open);
            StreamReader sr                     = new StreamReader(fs, Encoding.ASCII);
            Dictionary <string, string> sources = new Dictionary <string, string>();
            string header = sr.ReadLine();

            if (header.StartsWith("mplayer EDL")) // valid EDL file
            {
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                    if (line.StartsWith("<")) // Source video defines
                    {
                        string[] elements = line.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                        sources.Add(elements[1], elements[2]);
                    }
                    else // Cue points
                    {
                        string[]  elements  = line.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                        string[]  timecodes = elements[1].Split('-');
                        BufferCue cue       = new BufferCue(UInt64.Parse(timecodes[0]), UInt64.Parse(timecodes[1]), sources[elements[0]]);
                        CueListView.AddObject(cue);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void PlayHighlightsPlaylist()
        {
            try
            {
                if (highlightCues.Count > 0)
                {
                    BufferCue cue = highlightCues.First.Value;
                    highlightCues.RemoveFirst();
                    (new AmcpRequest(client, "PLAY", server.Channels[3], cue.Channel.Consumer.FileName, "SEEK", ((long)cue.InFrame + cue.Channel.Consumer.Offset).ToString(), "SPEED", currentSpeed.ToString().Replace(',', '.'), "LENGTH", (cue.OutFrame - cue.InFrame).ToString())).GetResponse();

                    while (highlightCues.Count > 0)
                    {
                        BufferCue nextCue = highlightCues.First.Value;
                        highlightCues.RemoveFirst();
                        (new AmcpRequest(client, "LOADBG", server.Channels[3], nextCue.Channel.Consumer.FileName, "AUTO", "SEEK", ((long)nextCue.InFrame + nextCue.Channel.Consumer.Offset).ToString(), "SPEED", currentSpeed.ToString().Replace(',', '.'), "LENGTH", (nextCue.OutFrame - nextCue.InFrame).ToString(), "MIX", "10")).GetResponse();
                        Console.WriteLine("Scheduling " + nextCue.Channel.Consumer.FileName + " @ " + nextCue.InFrame);
                        while (server.Channels[3].Producer.virtualPlaybackHead < server.Channels[3].Producer.virtualTotalFrames - (3 * SystemFramerate))
                        {
                            Console.WriteLine(server.Channels[3].Producer.virtualPlaybackHead.ToString() + ", " + (server.Channels[3].Producer.virtualTotalFrames - (3 * SystemFramerate)).ToString());
                            Thread.Sleep(1000);
                        }
                    }
                }
            }
            catch (ThreadAbortException tae)
            {
                Console.WriteLine("Aborting highlights playback.");
            }
        }
Exemplo n.º 5
0
 private void ModifyCueCamera(int Camera)
 {
     if (CueListView.SelectedObjects.Count > 0)
     {
         BufferCue cue = CueListView.SelectedObjects[0] as BufferCue;
         cue.Channel = server.Channels[Camera];
         CueListView.RefreshObject(cue);
     }
 }
Exemplo n.º 6
0
 private void CloneSelected()
 {
     foreach (BufferCue item in CueListView.SelectedObjects)
     {
         BufferCue newCue = new BufferCue(item);
         //CueListView.AddObject(newCue);
         CueListView.AddObject(newCue);
         // AddCueToList(newCue);
     }
 }
Exemplo n.º 7
0
        public BufferCue(BufferCue source)
        {
            this.inFrame  = source.InFrame;
            this.outFrame = source.OutFrame;
            this.fileName = source.FileName;
            this.tags     = new LinkedList <string>();
            foreach (string tag in source.Tags)
            {
                this.tags.AddLast(tag);
            }
            this.channel = source.Channel;

            this.id          = BufferCue.lastId + 1;
            BufferCue.lastId = this.id;
        }
Exemplo n.º 8
0
        private void SetOutPointTemp()
        {
            OutPointTemp = server.Channels[3].Producer.PlaybackHead;
            if (OutPointTemp < NoInPointDiff)
            {
                InPointTemp = 1;
            }
            if (InPointTemp == 0)
            {
                InPointLabel.Text = FormatTime(OutPointTemp - NoInPointDiff, SystemFramerate);
            }
            OutPointLabel.Text = FormatTime(OutPointTemp, SystemFramerate);

            BufferCue cue = new BufferCue((InPointTemp > 0 ? InPointTemp : OutPointTemp - NoInPointDiff), OutPointTemp, currentPGMChannel);

            CueListView.AddObject(cue);

            // AddCueToList(cue);

            ClearPointTemp();
        }
Exemplo n.º 9
0
        public override void Render(System.Drawing.Graphics g, System.Drawing.Rectangle r)
        {
            BufferCue cue = this.RowObject as BufferCue;

            this.DrawBackground(g, r);

            PointF nextTagStart = new PointF(r.Left, r.Top);

            foreach (string Tag in cue.Tags)
            {
                Brush tagBrush = Brushes.DarkSlateGray;
                if (TagBrushes.ContainsKey(Tag))
                {
                    tagBrush = TagBrushes[Tag];
                }

                SizeF stringSize = g.MeasureString(Tag, this.ListView.Font);
                float tagWidth   = Math.Min(stringSize.Width, r.Width);
                g.FillRectangle(tagBrush, nextTagStart.X, nextTagStart.Y, tagWidth, r.Height);
                g.DrawString(Tag, this.ListView.Font, Brushes.White, new RectangleF(nextTagStart.X, nextTagStart.Y, tagWidth, r.Height));

                nextTagStart.X += tagWidth + MarginRight;
            }
        }