Example #1
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    d3dImage.Dispose();
                }
                GenLock.TimerStop();
                ShutdownD3D();
                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Example #2
0
        public MediaElement(int id, Window window)
        {
            if (window == null)
            {
                throw new NullReferenceException("Window is Null");
            }

            ID = id;
            if (CurrentHWDecode == HWDecode.D3D11)
            {
                //Set Grid as base control with nested Image with D3DSource
                Content         = host;
                host.Margin     = new Thickness(0);
                host.Background = Brushes.Black;
                host.Loaded    += Host_Loaded;
                host.Children.Add(ViewBox);

                ViewBox.Source = d3dImage;
                HostWindow     = window;

                this.SizeChanged += Img_SizeChanged;
            }
            else
            {
                Content         = host;
                host.Margin     = new Thickness(0);
                host.Background = Brushes.Black;
                host.Children.Add(ViewBox);
            }

            //Register FFmpeg DLL's
            RegisterFFmpeg();

            this.Unloaded += MediaElement_Unloaded;

            GenLock.TimerStart();
        }