Ejemplo n.º 1
0
        private static void ListInputs(ATEMInputs.Format format, IList<string> args)
        {
            if (args.Count < 1)
            {
                ATEMInputs.Help();
                throw new SwitcherLibException("Invalid arguments");
            }

            Switcher switcher = new Switcher(args[0]);
            Log.Debug(String.Format("Switcher: {0}", switcher.GetProductName()));
            IList<SwitcherInput> inputs = switcher.GetInputs();

            switch (format)
            {
                case ATEMInputs.Format.Text:
                    foreach (SwitcherInput input in inputs)
                    {
                        Console.Out.WriteLine();
                        Console.Out.WriteLine(String.Format("       Name: {0}", input.Name));
                        Console.Out.WriteLine(String.Format("         ID: {0}", input.ID.ToString()));
                        Console.Out.WriteLine(String.Format("      Label: {0}", input.Label));
                        Console.Out.WriteLine(String.Format(" Input Type: {0}", input.PortType));
                    }
                    break;

                default:
                    Console.Out.WriteLine(inputs.ToString());
                    break;
            }
        }
Ejemplo n.º 2
0
        public Upload(Switcher switcher, String filename, int uploadSlot)
        {
            this.switcher = switcher;
            this.filename = filename;
            this.uploadSlot = uploadSlot;
            //check

            if (!File.Exists(filename))
            {
                throw new SwitcherLibException(String.Format("{0} does not exist", filename));
            }

            this.switcher.Connect();
            this.stills = this.GetStills();
        }
Ejemplo n.º 3
0
        private static void ListMediaPool(MediaPool.Format format, IList<string> args)
        {
            if (args.Count < 1)
            {
                MediaPool.Help();
                throw new SwitcherLibException("Invalid arguments");
            }

            Switcher switcher = new Switcher(args[0]);
            Log.Debug(String.Format("Switcher: {0}", switcher.GetProductName()));
            IList<MediaStill> stills = switcher.GetStills();

            switch (format)
            {
                case MediaPool.Format.Text:
                    foreach (MediaStill still in stills)
                    {
                        Console.Out.WriteLine();
                        Console.Out.WriteLine(String.Format("         Name: {0}", still.Name));
                        Console.Out.WriteLine(String.Format("         Hash: {0}", still.Hash));
                        Console.Out.WriteLine(String.Format("         Slot: {0}", still.Slot.ToString()));
                        Console.Out.WriteLine(String.Format(" Media Player: {0}", still.MediaPlayer.ToString()));
                    }
                    break;

                case MediaPool.Format.JSON:
                    Console.Out.WriteLine(JsonConvert.SerializeObject(stills));
                    break;

                case MediaPool.Format.XML:
                    XmlSerializer xml = new XmlSerializer(stills.GetType());
                    xml.Serialize(Console.Out, stills);
                    break;

                case MediaPool.Format.CSV:
                    foreach (MediaStill still in stills)
                    {
                        Console.Out.WriteLine(still.ToCSV());
                    }
                    break;

                default:
                    Console.Out.WriteLine(stills.ToString());
                    break;
            }
        }
Ejemplo n.º 4
0
        private static void ListAux(IList<string> args)
        {
            if (args.Count < 1)
            {
                ATEMAux.Help();
                throw new SwitcherLibException("Invalid arguments");
            }

            Switcher switcher = new Switcher(args[0]);
            Log.Debug(String.Format("Switcher: {0}", switcher.GetProductName()));
            IList<SwitcherAuxPort> inputs = switcher.GetAuxInputs();

                    foreach (SwitcherAuxPort input in inputs)
                    {
                        Console.Out.WriteLine();
                        Console.Out.WriteLine(String.Format("   Name: {0}", input.Name));
                        Console.Out.WriteLine(String.Format("     ID: {0}", input.ID.ToString()));
                        Console.Out.WriteLine(String.Format("  Label: {0}", input.Label));
                        Console.Out.WriteLine(String.Format(" Source: {0}", input.Source));
                    }
        }
Ejemplo n.º 5
0
        private static void Upload(string name, IList<string> args)
        {
            if (args.Count < 3)
            {
                MediaUpload.Help();
                throw new SwitcherLibException("Invalid arguments");
            }

            Switcher switcher = new Switcher(args[0]);
            int slot = MediaUpload.GetSlot(args[1]);
            Log.Debug(String.Format("Switcher: {0}", switcher.GetProductName()));
            Log.Debug(String.Format("Resolution: {0}x{1}", switcher.GetVideoWidth().ToString(), switcher.GetVideoHeight().ToString()));
            args.RemoveAt(0);
            args.RemoveAt(0);

            string filename = String.Join(" ", args);
            Upload upload = new Upload(switcher, filename, slot);
            if (name != "")
            {
                upload.SetName(name);
            }
            upload.Start();
            while (upload.InProgress())
            {
                Log.Info(String.Format("Progress: {0}%", upload.GetProgress().ToString()));
                Thread.Sleep(100);
            }
        }
Ejemplo n.º 6
0
        private static void SetAux(ATEMAux.Format format, IList<string> args, int aux, int source)
        {
            Switcher switcher = new Switcher(args[0]);
            Log.Debug(String.Format("Switcher: {0}", switcher.GetProductName()));
            if (aux < 1 )
            {
                IList<SwitcherAuxPort> inputs = switcher.GetAuxInputs();

                foreach (SwitcherAuxPort input in inputs)
                {
                    Console.Out.WriteLine();
                    Console.Out.WriteLine(String.Format("   Name: {0}", input.Name));
                    Console.Out.WriteLine(String.Format("     ID: {0}", input.ID.ToString()));
                    Console.Out.WriteLine(String.Format("  Label: {0}", input.Label));
                    Console.Out.WriteLine(String.Format(" Source: {0}", input.Source));
                }

            }
            else {
                switcher.SetAuxInput((long)aux, (long)source);
                 }
        }
Ejemplo n.º 7
0
        public Upload(Switcher switcher, String path, uint uploadSlot)
        {
            this.isClip     = false;
            this.switcher   = switcher;
            this.path       = path;
            this.uploadSlot = uploadSlot;
            this.switcher.Connect();
            this.switcherMediaPool = (IBMDSwitcherMediaPool)this.switcher.GetSwitcher();


            // Is a directory of clips
            if (Directory.Exists(path))
            {
                this.isClip     = true;
                this.framepaths = (Array)Directory.GetFiles(path, "*.bmp").OrderBy(f => f).ToArray();
                if (this.framepaths.Length < 1)
                {
                    this.framepaths = (Array)Directory.GetFiles(path, "*.jpg").OrderBy(f => f).ToArray();
                }
                if (this.framepaths.Length < 1)
                {
                    this.framepaths = (Array)Directory.GetFiles(path, "*.jpeg").OrderBy(f => f).ToArray();
                }
                if (this.framepaths.Length < 1)
                {
                    this.framepaths = (Array)Directory.GetFiles(path, "*.gif").OrderBy(f => f).ToArray();
                }
                if (this.framepaths.Length < 1)
                {
                    this.framepaths = (Array)Directory.GetFiles(path, "*.png").OrderBy(f => f).ToArray();
                }
                if (this.framepaths.Length < 1)
                {
                    this.framepaths = (Array)Directory.GetFiles(path, "*.tiff").OrderBy(f => f).ToArray();
                }
                if (this.framepaths.Length < 1)
                {
                    this.framepaths = (Array)Directory.GetFiles(path, "*.tif").OrderBy(f => f).ToArray();
                }
                if (this.framepaths.Length < 1)
                {
                    throw new SwitcherLibException(String.Format("No bmp, jpg, jpeg, gif, png, tiff or tif files found in {0}", path));
                }
                Log.Debug(String.Format("Found {0} media files in {1}", this.framepaths.Length, path));

                this.clip = this.GetClip();


                UInt32 maxclips;
                this.switcherMediaPool.GetFrameTotalForClips(out maxclips);
                // Checking whether the files can fit
                if (maxclips < this.framepaths.Length)
                {
                    throw new SwitcherLibException(String.Format("The clip pool can contain up to {0} clips, but there are {1} files found in {2}", maxclips, this.framepaths.Length, this.path));
                }
            }
            // Is a file with a still
            else if (File.Exists(path))
            {
                this.currentframepath = path;
                this.stills           = this.GetStills();
            }
            else
            {
                throw new SwitcherLibException(String.Format("The file or directory {0} could not be found", path));
            }
        }