示例#1
0
 public static byte[] GetSdkFrameBytes(IBMDSwitcherFrame frame)
 {
     byte[] res = new byte[frame.GetWidth() * frame.GetHeight() * 4];
     frame.GetBytes(out IntPtr buffer);
     Marshal.Copy(buffer, res, 0, res.Length);
     return(res);
 }
示例#2
0
 public void Start()
 {
     this.currentStatus = Upload.Status.Started;
     this.frame         = this.GetFrame();
     this.lockCallback  = (IBMDSwitcherLockCallback) new UploadLock(this);
     this.stills.Lock(this.lockCallback);
 }
示例#3
0
            public void Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int frameIndex, IBMDSwitcherAudio audio,
                               int clipIndex)
            {
                switch (eventType)
                {
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeValidChanged:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeNameChanged:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeHashChanged:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioValidChanged:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioNameChanged:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioHashChanged:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockBusy:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockIdle:
                    break;

                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCancelled:
                case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferFailed:
                    Result = eventType;
                    Frame  = frame;
                    Audio  = audio;
                    Wait.Set();
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(eventType), eventType, null);
                }
            }
示例#4
0
文件: Upload.cs 项目: cleitet/atemlib
        protected void uploadClipFrame()
        {
            // Switcher frame counter is 1-indexed while this.framepaths is 0-indexed
            this.currentframepath = (string)this.framepaths.GetValue(this.currentFrameNumber);
            this.frame            = this.GetFrame();
            Log.Debug(String.Format("Uploading clip frame {0}: {1}", this.currentFrameNumber + 1, this.currentframepath));

            //UploadFrame triggers onClipFrameUploadCompleted via a callback when finished
            this.clip.UploadFrame(this.currentFrameNumber, this.frame);
        }
示例#5
0
        public void Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int index)
        {
            Log.Debug(String.Format("Stills Callback: {0}", eventType.ToString()));
            _BMDSwitcherMediaPoolEventType mediaPoolEventType = eventType;

            if (mediaPoolEventType != _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted)
            {
                return;
            }
            this.upload.TransferCompleted();
        }
示例#6
0
文件: Frame.cs 项目: cleitet/atemlib
        public void Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int frameIndex, IBMDSwitcherAudio audio, int clipIndex)
        {
            Log.Debug(String.Format("Clip Callback: {0}", eventType.ToString()));
            _BMDSwitcherMediaPoolEventType mediaPoolEventType = eventType;

            if (mediaPoolEventType != _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted)
            {
                return;
            }
            this.upload.onClipFrameUploadCompleted((uint)frameIndex);
        }
示例#7
0
        public void Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int index)
        {
            Log.Debug(String.Format("Stills Callback: {0}", eventType.ToString()));
            _BMDSwitcherMediaPoolEventType mediaPoolEventType = eventType;

            if (mediaPoolEventType != _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted)
            {
                return;
            }
            this.upload.TransferCompleted();
        }
示例#8
0
        public void UploadImage(string filename, uint slot)
        {
            m_slot    = slot;
            m_imgname = Path.GetFileNameWithoutExtension(filename);
            dispatcher.Invoke(() =>
            {
                m_frame = CreateFrame(filename);

                m_stillsmonitor = new StillsMonitor()
                {
                    OnLockIdle = GetLock
                };
            });
        }
        void UploadStillSdk(uint index, string name, IBMDSwitcherFrame frame)
        {
            m_mediaPool.GetStills(out IBMDSwitcherStills stills);
            if (stills == null)
            {
                WaitForExit("Failed to get stills pool");
                return;
            }

            // Wait for lock
            var evt = new AutoResetEvent(false);
            var cb  = new LockCallback(() => { evt.Set(); });

            stills.Lock(cb);
            if (!evt.WaitOne(TimeSpan.FromSeconds(3)))
            {
                WaitForExit("Timed out getting lock");
                return;
            }
            var cb2 = new TransferCompleteCallback(fr =>
            {
                if (fr != null)
                {
                    stills.Unlock(cb);
                    evt.Set();
                }
            }, (int)index);

            stills.AddCallback(cb2);

            Stopwatch sw = new Stopwatch();

            evt.Reset();
            sw.Start();
            stills.Upload(index, name, frame);

            if (!evt.WaitOne(TimeSpan.FromSeconds(10)))
            {
                WaitForExit("Timed out doing upload");
                return;
            }

            sw.Stop();

            Console.WriteLine("Upload inner #{0} took {1}ms", index, sw.ElapsedMilliseconds);

            stills.RemoveCallback(cb2);
        }
示例#10
0
        public void Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int index)
        {
            if (index != _index)
            {
                return;
            }

            switch (eventType)
            {
            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted:
                _action(frame);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCancelled:
                _action(null);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferFailed:
                _action(null);
                break;
            }
        }
 public void UploadFrame(uint frameIndex, IBMDSwitcherFrame frame)
 {
     this.Clip.UploadFrame(frameIndex, frame);
 }
示例#12
0
        void IBMDSwitcherStillsCallback.Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int index)
        {
            switch (eventType)
            {
            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeValidChanged:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeNameChanged:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeHashChanged:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioValidChanged:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioNameChanged:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioHashChanged:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockBusy:
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockIdle:
                OnLockIdle?.Invoke();
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted:
                OnTransferCompleted?.Invoke();
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCancelled:
                OnTransferCancelled?.Invoke();
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferFailed:
                OnTransferFailled?.Invoke();
                break;

            default:
                break;
            }
        }
示例#13
0
        void IBMDSwitcherClipCallback.Notify(_BMDSwitcherMediaPoolEventType EventType, IBMDSwitcherFrame Frame, int FrameIndex, IBMDSwitcherAudio Audio, int ClipIndex)
        {
            switch (EventType)
            {
                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioValidChanged):
                    if (AudioValidChanged != null)
                        AudioValidChanged(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeHashChanged):
                    if (HashChanged != null)
                        HashChanged(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockBusy):
                    if (LockBusy != null)
                        LockBusy(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockIdle):
                    if (LockIdle != null)
                        LockIdle(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeNameChanged):
                    if (NameChanged != null)
                        NameChanged(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCancelled):
                    if (TransferCancelled != null)
                        TransferCancelled(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted):
                    if (TransferCompleted != null)
                        TransferCompleted(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferFailed):
                    if (TransferFailed != null)
                        TransferFailed(this, null);
                    break;

                case (_BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeValidChanged):
                    if (ValidChanged != null)
                        ValidChanged(this, null);
                    break;
            }
        }
示例#14
0
 public void StartBlocking()
 {
     this.currentStatus = Upload.Status.Started;
     this.frame = this.GetFrame();
     this.lockCallback = (IBMDSwitcherLockCallback)new UploadLock(this);
     this.stills.Lock(this.lockCallback);
     while (currentStatus != Status.Completed)
     {
                    }
 }
示例#15
0
 public void Start()
 {
     this.currentStatus = Upload.Status.Started;
     this.frame = this.GetFrame();
     this.lockCallback = (IBMDSwitcherLockCallback)new UploadLock(this);
     this.stills.Lock(this.lockCallback);
 }
        void IBMDSwitcherClipCallback.Notify(_BMDSwitcherMediaPoolEventType eventType, IBMDSwitcherFrame frame, int frameIndex, IBMDSwitcherAudio audio, int clipIndex)
        {
            this._switcherClipEventArgs = new SwitcherClipEventArgs {
                _frame = frame, _frameIndex = frameIndex, _audio = audio, _clipIndex = clipIndex
            };
            switch (eventType)
            {
            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioHashChanged:
                this.SwitcherMediaPoolEventTypeAudioHashChanged?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioNameChanged:
                this.SwitcherMediaPoolEventTypeAudioNameChanged?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeAudioValidChanged:
                this.SwitcherMediaPoolEventTypeAudioValidChanged?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeHashChanged:
                this.SwitcherMediaPoolEventTypeHashChanged?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockBusy:
                this.SwitcherMediaPoolEventTypeLockBusy?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeLockIdle:
                this.SwitcherMediaPoolEventTypeLockIdle?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeNameChanged:
                this.SwitcherMediaPoolEventTypeNameChanged?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCancelled:
                this.SwitcherMediaPoolEventTypeTransferCancelled?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferCompleted:
                this.SwitcherMediaPoolEventTypeTransferCompleted?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeTransferFailed:
                this.SwitcherMediaPoolEventTypeTransferFailed?.Invoke(this, this._switcherClipEventArgs);
                break;

            case _BMDSwitcherMediaPoolEventType.bmdSwitcherMediaPoolEventTypeValidChanged:
                this.SwitcherMediaPoolEventTypeValidChanged?.Invoke(this, this._switcherClipEventArgs);
                break;
            }
        }
 public void Upload(uint index, string name, IBMDSwitcherFrame frame)
 {
     this.Stills.Upload(index, name, frame);
 }
示例#18
0
 public static void FillSdkFrame(IBMDSwitcherFrame frame, byte[] bytes)
 {
     frame.GetBytes(out IntPtr buffer);
     Marshal.Copy(bytes, 0, buffer, bytes.Length);
 }
示例#19
0
 public void Upload(string name, IBMDSwitcherFrame frame)
 {
     this.Stills.Upload((uint)this._indexnr, name, frame);
 }
示例#20
0
 public void Start()
 {
     frame = GetFrame();
 }