コード例 #1
0
        static void Main(string[] args)
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += ApplicationOnThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            if (!MWCapture.Init())
            {
                MessageBox.Show($"Error starting plugin: MagewellVideowall");
                return;
            }
            var inputId    = int.Parse(args[0]);
            var closeAfter = int.Parse(args[1]);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            magewellForm = new MagewellForm(inputId);

            ThreadPool.QueueUserWorkItem(state =>
            {
                Thread.Sleep(TimeSpan.FromSeconds(closeAfter));
                magewellForm.Close();
            });

            Application.Run(magewellForm);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += ApplicationOnThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            try
            {
                if (!MWCapture.Init())
                {
                    Console.WriteLine($"Error starting plugin: MagewellVideowall");
                    return;
                }
                // every 5 sec updates list of files in inputs folders
                inputsUpdater = new MagewellInputsUpdater("Magewell", "vmfu");
                inputsUpdater.Init();

                ThreadPool.QueueUserWorkItem(state => RunManager());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadLine();
        }
コード例 #3
0
        public override Input[] GetInputs()
        {
            MWCapture.RefreshDevices();
            var videoChannelCount = MWCapture.GetChannelCount();
            var newInputs         = new List <Input>();

            for (int i = 0; i < videoChannelCount; i++)
            {
                LibMWCapture.MWCAP_CHANNEL_INFO channelInfo = new LibMWCapture.MWCAP_CHANNEL_INFO();
                MWCapture.GetChannelInfobyIndex(i, ref channelInfo);

                var  hasSignal   = false;
                Size channelSize = new Size();

                MWCapture.GetSignalStatus(channelInfo.byChannelIndex, out var audioStatus)
                ?.HasSignal(out hasSignal)
                ?.GetChannelSize(out channelSize);

                var audioVolume = audioStatus?.GetAudioVolume() ?? 0;
                var mute        = audioStatus?.GetMute() ?? false;

                newInputs.Add(new Input
                {
                    OrderId   = channelInfo.byChannelIndex,
                    Available = hasSignal,
                    Width     = channelSize.Width,
                    Height    = channelSize.Height,
                    Muted     = mute,
                    Volume    = audioVolume
                });
            }
            return(newInputs.ToArray());
        }
コード例 #4
0
 void VLCForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         _capture.Destory();
         MWCapture.Exit();
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Error opening channel in Magewell plugin. {ex.Message}");
     }
 }
コード例 #5
0
        public void Init(int inputId, bool muteAudio, int volume, Size mediaSize)
        {
            try
            {
                try
                {
                    this.FormClosing += VLCForm_FormClosing;

                    var channelInfo = MWCapture.GetChannelInfoByIndex(inputId);


                    if (!channelInfo.HasValue || !_capture.OpenVideoChannel(channelInfo.Value, _fourcc, mediaSize.Width,
                                                                            mediaSize.Height, _frameDuration, Handle))
                    {
                        MessageBox.Show($"Error opening channel in Magewell plugin. " +
                                        $"_inputId: {inputId}{Environment.NewLine}" +
                                        $"HasVideoChannel: {_capture.HasVideoChannel} " +
                                        $"HasD3DRenderer: {_capture.HasD3DRenderer} " +
                                        $"HasVideo: {_capture.HasVideo} " +
                                        $"HasAudioRender: {_capture.HasAudioRender} " +
                                        $"HasAudio: {_capture.HasAudio}{Environment.NewLine}");

                        Close();
                        return;
                    }
                    _capture.SetMute(muteAudio);
                    _capture.SetAudioVolume(volume);

                    OnResize(EventArgs.Empty);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error opening channel in Magewell plugin. {ex.Message}");
            }
        }