ROTにオブジェクトを登録する。
Наследование: IDisposable
Пример #1
0
        public void Load()
        {
            GraphBuilder = new FilgraphManager() as IGraphBuilder;

            MediaControl = GraphBuilder as IMediaControl;
            MediaSeeking = GraphBuilder as IMediaSeeking;
            MediaEventEx = GraphBuilder as IMediaEventEx;
            MediaFilter  = GraphBuilder as IMediaFilter;

            thread = new Tsukikage.Windows.Messaging.MessageThread(true);
            thread.Invoke(m => { window = new Tsukikage.Windows.Messaging.MessageWindow(); });

            const int WM_APP_MEDIA_EVENT = 0x8001;

            window.MessageHandlers[WM_APP_MEDIA_EVENT] = m =>
            {
                int ev, p1, p2;
                while (MediaEventEx.GetEvent(out ev, out p1, out p2, 0) == 0)
                {
                    if (ev == 0x01 && MediaComplete != null)
                    {
                        MediaComplete(this, EventArgs.Empty);
                    }
                    MediaEventEx.FreeEventParams(ev, p1, p2);
                }
            };
            MediaEventEx.SetNotifyWindow(window.Handle, WM_APP_MEDIA_EVENT, 0);

            BuildGraph(path);

            if (RegisterToROT)
            {
                RotEntry = new RunningObjectTableEntry(GraphBuilder, "FilterGraph");
            }

            MediaControl.Stop();
        }
Пример #2
0
        public void Release()
        {
            if (GraphBuilder != null)
            {
                MediaControl.Stop();
                ReleaseGraph();

                MediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, 0);
                window.Dispose(); window = null;
                thread.Dispose(); thread = null;

                Marshal.ReleaseComObject(MediaControl); MediaControl = null;
                Marshal.ReleaseComObject(MediaSeeking); MediaSeeking = null;
                Marshal.ReleaseComObject(MediaEventEx); MediaEventEx = null;
                Marshal.ReleaseComObject(MediaFilter); MediaFilter   = null;
                Marshal.ReleaseComObject(GraphBuilder); GraphBuilder = null;
            }

            if (RotEntry != null)
            {
                RotEntry.Revoke();
                RotEntry = null;
            }
        }
Пример #3
0
        public void Release()
        {
            if (GraphBuilder != null)
            {
                MediaControl.Stop();
                ReleaseGraph();

                MediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, 0);
                window.Dispose(); window = null;
                thread.Dispose(); thread = null;

                Marshal.ReleaseComObject(MediaControl); MediaControl = null;
                Marshal.ReleaseComObject(MediaSeeking); MediaSeeking = null;
                Marshal.ReleaseComObject(MediaEventEx); MediaEventEx = null;
                Marshal.ReleaseComObject(MediaFilter); MediaFilter = null;
                Marshal.ReleaseComObject(GraphBuilder); GraphBuilder = null;
            }

            if (RotEntry != null)
            {
                RotEntry.Revoke();
                RotEntry = null;
            }
        }
Пример #4
0
        public void Load()
        {
            GraphBuilder = new FilgraphManager() as IGraphBuilder;

            MediaControl = GraphBuilder as IMediaControl;
            MediaSeeking = GraphBuilder as IMediaSeeking;
            MediaEventEx = GraphBuilder as IMediaEventEx;
            MediaFilter = GraphBuilder as IMediaFilter;

            thread = new Tsukikage.Windows.Messaging.MessageThread(true);
            thread.Invoke(m => { window = new Tsukikage.Windows.Messaging.MessageWindow(); });

            const int WM_APP_MEDIA_EVENT = 0x8001;
            window.MessageHandlers[WM_APP_MEDIA_EVENT] = m =>
            {
                int ev, p1, p2;
                while (MediaEventEx.GetEvent(out ev, out p1, out p2, 0) == 0)
                {
                    if (ev == 0x01 && MediaComplete != null)
                        MediaComplete(this, EventArgs.Empty);
                    MediaEventEx.FreeEventParams(ev, p1, p2);
                }
            };
            MediaEventEx.SetNotifyWindow(window.Handle, WM_APP_MEDIA_EVENT, 0);

            BuildGraph(path);

            if (RegisterToROT)
                RotEntry = new RunningObjectTableEntry(GraphBuilder, "FilterGraph");

            MediaControl.Stop();
        }