Ejemplo n.º 1
0
        // The ShowBitmap now devided into 2 methods, for MIPSDK 2014
        private void ShowBitmap(BitmapData bitmapData)
        {
            // Next 15 lines new for MIPSDK 2014
            if (_currentTimeInformation != null &&
                _currentTimeInformation.PreviousTime < bitmapData.DateTime &&
                _currentTimeInformation.NextTime > bitmapData.DateTime)
            {
                Debug.WriteLine("----> Duplicate bitmap at " + bitmapData.DateTime);                    // this should only happen a few times during startup
                return;
            }
            _currentTimeInformation = new PlaybackTimeInformationData()
            {
                Item         = _selectedItem.FQID,
                CurrentTime  = bitmapData.DateTime,
                NextTime     = bitmapData.NextDateTime,
                PreviousTime = bitmapData.PreviousDateTime
            };

            _requestInProgress = true;
            if (InvokeRequired)
            {
                Invoke(new ShowBitmapDelegate(ShowBitmap2), bitmapData);
            }
            else
            {
                ShowBitmap2(bitmapData);
            }
        }
Ejemplo n.º 2
0
 private void OnScrollChange(object sender, ScrollEventArgs e)
 {
     transform.SetVectors(vScrollBarR.Value * hScrollBarExpose.Value, vScrollBarG.Value * hScrollBarExpose.Value, vScrollBarB.Value * hScrollBarExpose.Value, hScrollBarOffset.Value);
     if (_mode == PlaybackPlayModeData.Stop)
     {
         _nextToFetchTime        = _currentShownTime;
         _currentTimeInformation = null;
         _redisplay = true;
     }
 }
        // The ShowBitmap now devided into 2 methods, for MIPSDK 2014
        private void ShowBitmap(BitmapData bitmapData)
        {
            // Next 15 lines new for MIPSDK 2014
            if (_currentTimeInformation != null &&
                _currentTimeInformation.PreviousTime < bitmapData.DateTime &&
                _currentTimeInformation.NextTime > bitmapData.DateTime)
            {
                Debug.WriteLine("----> Duplicate bitmap at " + bitmapData.DateTime);                    // this should only happen a few times during startup
                if (Selected)
                {
                    EnvironmentManager.Instance.SendMessage(new Message(
                                                                MessageId.SmartClient.PlaybackTimeInformation, _currentTimeInformation), null, _viewItemManager.FQID);
                }
                return;
            }

            // Set here to avoid race-condition. And we should use some locking to ensure thread-safety.
            _nextToFetchTime = bitmapData.DateTime;

            _currentTimeInformation = new PlaybackTimeInformationData
            {
                Item         = _selectedItem.FQID,
                CurrentTime  = bitmapData.DateTime,
                NextTime     = bitmapData.NextDateTime,
                PreviousTime = bitmapData.PreviousDateTime
            };

            if (Selected)
            {
                EnvironmentManager.Instance.SendMessage(new Message(
                                                            MessageId.SmartClient.PlaybackTimeInformation, _currentTimeInformation), null, _viewItemManager.FQID);
            }

            _requestInProgress = true;
            if (InvokeRequired)
            {
                Invoke(new ShowBitmapDelegate(ShowBitmap2), bitmapData);
            }
            else
            {
                ShowBitmap2(bitmapData);
            }
        }
Ejemplo n.º 4
0
        private void ShowMetadata(MetadataPlaybackData metadata)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new ShowMetadataDelegate(ShowMetadata), metadata);
            }
            else
            {
                Debug.WriteLine("ShowMetadata imagetime:" + metadata.DateTime.ToLocalTime());
                if (metadata.DateTime != _currentShownTime && _selectedItem != null)
                {
                    textOutput.Text  = metadata.Content.GetMetadataString();
                    textBoxTime.Text = metadata.DateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff");

                    // Inform the PlybackController of the time information - so skipping can be done correctly
                    _currentTimeInformation = new PlaybackTimeInformationData
                    {
                        Item         = _selectedItem.FQID,
                        CurrentTime  = metadata.DateTime,
                        NextTime     = metadata.NextDateTime ?? metadata.DateTime.AddMilliseconds(1),
                        PreviousTime = metadata.PreviousDateTime ?? metadata.DateTime.AddMilliseconds(-1)
                    };
                    EnvironmentManager.Instance.SendMessage(
                        new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.PlaybackTimeInformation, _currentTimeInformation), _playbackFQID);

                    _currentShownTime = metadata.DateTime;
                    if (_mode == PlaybackPlayModeData.Stop)
                    {
                        // When playback is stopped, we move the time to where the user have scrolled, or if the user pressed
                        // one of the navigation buttons (Next..., Prev...)
                        EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.PlaybackCommand,
                                                                                                       new PlaybackCommandData
                        {
                            Command  = PlaybackData.Goto,
                            DateTime = metadata.DateTime
                        }),
                                                                _playbackFQID);
                    }
                    Debug.WriteLine("Image time: " + metadata.DateTime.ToLocalTime().ToString("HH.mm.ss.fff") + ", Mode=" + _mode);
                }
                _requestInProgress = false;
            }
        }
Ejemplo n.º 5
0
        private void ShowJPEG(JPEGData jpegData)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new ShowJpegDelegate(ShowJPEG), jpegData);
            }
            else
            {
                Debug.WriteLine("ShowJPEG imagetime:" + jpegData.DateTime.ToLocalTime());
                Trace.WriteLine("ShowJPEG imagetime:" + jpegData.DateTime.ToLocalTime() + ", Decoding:" + jpegData.HardwareDecodingStatus);
                if (jpegData.DateTime != _currentShownTime && _selectedItem != null)
                {
                    MemoryStream ms        = new MemoryStream(jpegData.Bytes);
                    Bitmap       newBitmap = new Bitmap(ms);
                    if (newBitmap.Width != pictureBox.Width || newBitmap.Height != pictureBox.Height)
                    {
                        pictureBox.Image = new Bitmap(newBitmap, pictureBox.Size);
                    }
                    else
                    {
                        pictureBox.Image = newBitmap;
                    }

                    if (jpegData.CroppingDefined)
                    {
                        Debug.WriteLine("Image has been cropped: " + jpegData.CropWidth + "x" + jpegData.CropHeight);
                    }

                    ms.Close();
                    ms.Dispose();

                    textBoxTime.Text = jpegData.DateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff");

                    // Inform the PlybackController of the time information - so skipping can be done correctly
                    _currentTimeInformation = new PlaybackTimeInformationData()
                    {
                        Item         = _selectedItem.FQID,
                        CurrentTime  = jpegData.DateTime,
                        NextTime     = jpegData.NextDateTime,
                        PreviousTime = jpegData.PreviousDateTime
                    };
                    EnvironmentManager.Instance.SendMessage(
                        new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.PlaybackTimeInformation, _currentTimeInformation), _playbackFQID);

                    _currentShownTime = jpegData.DateTime;
                    if (_mode == PlaybackPlayModeData.Stop)
                    {
                        // When playback is stopped, we move the time to where the user have scrolled, or if the user pressed
                        // one of the navigation buttons (Next..., Prev...)
                        EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.PlaybackCommand,
                                                                                                       new PlaybackCommandData()
                        {
                            Command  = PlaybackData.Goto,
                            DateTime = jpegData.DateTime
                        }),
                                                                _playbackFQID);
                    }
                    Debug.WriteLine("Image time: " + jpegData.DateTime.ToLocalTime().ToString("HH.mm.ss.fff") + ", Mode=" + _mode);
                }
                _requestInProgress = false;
            }
        }