Beispiel #1
0
        private void CloseInterfaces()
        {
            if (mediaControl != null)
            mediaControl.Stop();

              if (rot != null)
              {
            rot.Dispose();
            rot = null;
              }

              RemoveHandlers();

              if (compositor != null)
              {
            compositor.Dispose();
            compositor = null;
              }

              if (vmr9 != null)
              {
            Marshal.ReleaseComObject(vmr9);
            vmr9 = null;
            windowlessCtrl = null;
              }

              if (graphBuilder != null)
              {
            Marshal.ReleaseComObject(graphBuilder);
            graphBuilder = null;
            mediaControl = null;
              }
        }
Beispiel #2
0
        private void ConfigureVMR9InWindowlessMode()
        {
            int hr = 0;

              IVMRFilterConfig9 filterConfig = (IVMRFilterConfig9)vmr9;

              // Must be called before calling SetImageCompositor
              hr = filterConfig.SetNumberOfStreams(1);
              DsError.ThrowExceptionForHR(hr);

              // Create an instance of the Compositor
              compositor = new Compositor();

              // Configure the filter with the Compositor
              hr = filterConfig.SetImageCompositor(compositor);
              DsError.ThrowExceptionForHR(hr);

              // Change VMR9 mode to Windowless
              hr = filterConfig.SetRenderingMode(VMR9Mode.Windowless);
              DsError.ThrowExceptionForHR(hr);

              windowlessCtrl = (IVMRWindowlessControl9)vmr9;

              // Set rendering window
              hr = windowlessCtrl.SetVideoClippingWindow(renderingPanel.Handle);
              DsError.ThrowExceptionForHR(hr);

              // Set Aspect-Ratio
              hr = windowlessCtrl.SetAspectRatioMode(VMR9AspectRatioMode.LetterBox);
              DsError.ThrowExceptionForHR(hr);

              // Add delegates for Windowless operations
              AddHandlers();

              // Call the resize handler to configure the output size
              MainForm_ResizeMove(null, null);
        }