예제 #1
0
        /// <summary>
        /// Creates the parameter connection for the gaze and mouse location
        /// properties of the dmo filter.
        /// </summary>
        /// <param name="dmoWrapperFilter">
        /// The <see cref="IBaseFilter"/> interface
        /// of the dmo wrapper filter.
        /// </param>
        private void SetDMOParams(IBaseFilter dmoWrapperFilter)
        {
            if (dmoWrapperFilter == null)
            {
                return;
            }

            int hr;

            this.dmoParams = dmoWrapperFilter as IMediaParams;

            this.gazeX      = new MPData();
            this.gazeX.vInt = 0;
            hr = this.dmoParams.SetParam(0, this.gazeX);
            DMOError.ThrowExceptionForHR(hr);

            this.gazeY      = new MPData();
            this.gazeY.vInt = 0;
            hr = this.dmoParams.SetParam(1, this.gazeY);
            DMOError.ThrowExceptionForHR(hr);

            this.mouseX      = new MPData();
            this.mouseX.vInt = 0;
            hr = this.dmoParams.SetParam(2, this.mouseX);
            DMOError.ThrowExceptionForHR(hr);

            this.mouseY      = new MPData();
            this.mouseY.vInt = 0;
            hr = this.dmoParams.SetParam(3, this.mouseY);
            DMOError.ThrowExceptionForHR(hr);
        }
예제 #2
0
        public DMOEnumParam(string[] sEnum, IMediaParams param, int paramNum, ParamInfo pInfo)
        {
            DropDownStyle = ComboBoxStyle.DropDownList;
            Dock          = DockStyle.Fill;
            _param        = param;
            _paramNum     = paramNum;
            _pInfo        = pInfo;

            for (int i = 0; i < sEnum.Length; i++)
            {
                Items.Add(sEnum[i]);
            }
            MPData val;

            param.GetParam(_paramNum, out val);
            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                SelectedIndex = val.vInt;
            }
            else
            {
                SelectedIndex = (int)((float)(Items.Count - 1) * val.vFloat);
            }
            SelectedIndexChanged += new EventHandler(DMOEnumParam_SelectedIndexChanged);
        }
예제 #3
0
        private void Configure()
        {
            int hr;

            DMOWrapperFilter  dmoFilter        = new DMOWrapperFilter();
            IDMOWrapperFilter dmoWrapperFilter = (IDMOWrapperFilter)dmoFilter;

            // Chorus - {efe6629c-81f7-4281-bd91-c9d604a95af6}
            // DmoFlip - {7EF28FD7-E88F-45bb-9CDD-8A62956F2D75}
            //hr = dmoWrapperFilter.Init(new Guid("{7EF28FD7-E88F-45bb-9CDD-8A62956F2D75}"), DMOCategory.AudioEffect);
            hr = dmoWrapperFilter.Init(new Guid("{efe6629c-81f7-4281-bd91-c9d604a95af6}"), DMOCategory.AudioEffect);
            DMOError.ThrowExceptionForHR(hr);

            m_imp = dmoWrapperFilter as IMediaParams;
        }
예제 #4
0
        public DMONumericalParam(IMediaParams param, int paramNum, ParamInfo pInfo)
        {
            InitializeComponent();
            Dock = DockStyle.Fill;

            _param    = param;
            _paramNum = paramNum;
            _pInfo    = pInfo;

            MPData val;

            param.GetParam(_paramNum, out val);

            if (pInfo.mpType == MPType.FLOAT)
            {
                numericUpDown1.DecimalPlaces = 3;
                numericUpDown1.Increment     = 0.001M;
            }

            if (pInfo.mpType == MPType.INT && pInfo.mopCaps == MPCaps.Jump)
            {
                // a regular int control
                numericUpDown1.Minimum = _pInfo.mpdMinValue.vInt;
                numericUpDown1.Maximum = _pInfo.mpdMaxValue.vInt;
                numericUpDown1.Value   = val.vInt;
            }
            else
            {
                // float
                numericUpDown1.Minimum = (decimal)_pInfo.mpdMinValue.vFloat;
                numericUpDown1.Maximum = (decimal)_pInfo.mpdMaxValue.vFloat;
                numericUpDown1.Value   = (decimal)val.vFloat;
            }

            numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged);
            colorTrackBar1.ValueChanged += new ColorTrackBar.ValueChangedEventHandler(colorTrackBar1_ValueChanged);

            // force the colorTrackbar to update it's value and caption
            numericUpDown1_ValueChanged(null, null);
            _initialzed = true;
        }
예제 #5
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            base.Dispose( disposing );
            if (m_param != null)
            {
                Marshal.ReleaseComObject(m_param);
                m_param = null;
            }

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

            if (graphBuilder != null)
            {
                (graphBuilder as IMediaControl).Stop();
                Marshal.ReleaseComObject(graphBuilder);
                graphBuilder = null;
            }
        }
예제 #6
0
파일: Form1.cs 프로젝트: d3x0r/xperdex
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (m_param != null)
            {
                Marshal.ReleaseComObject(m_param);
                m_param = null;
            }

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

            if (graphBuilder != null)
            {
                (graphBuilder as IMediaControl).Stop();
                Marshal.ReleaseComObject(graphBuilder);
                graphBuilder = null;
            }
        }
예제 #7
0
        public DMOBoolParam(IMediaParams param, int paramNum, ParamInfo pInfo)
        {
            _param    = param;
            _paramNum = paramNum;
            _pInfo    = pInfo;

            Text   = "";
            Size   = new System.Drawing.Size(15, 19);
            Anchor = AnchorStyles.Top | AnchorStyles.Bottom;

            MPData val;

            param.GetParam(_paramNum, out val);
            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                Checked = val.vBool;
            }
            else
            {
                Checked = (val.vFloat == 0) ? false : true;
            }

            CheckedChanged += new EventHandler(DMOBoolParam_CheckedChanged);
        }
예제 #8
0
        /// <summary>
        /// Sets the parameters for the mixer DMO according to
        /// the given <see cref="VideoExportProperties"/>
        /// </summary>
        /// <param name="dmoWrapperFilter">The <see cref="IBaseFilter"/>
        /// that contains the DMO.</param>
        /// <param name="exportProperties">The <see cref="VideoExportProperties"/>
        /// to use.</param>
        private void SetDMOParams(IBaseFilter dmoWrapperFilter, VideoExportProperties exportProperties)
        {
            int hr;

            IMediaParams dmoParams        = dmoWrapperFilter as IMediaParams;
            MPData       outputBackground = new MPData();
            MPData       streamTop        = new MPData();
            MPData       streamLeft       = new MPData();
            MPData       streamHeight     = new MPData();
            MPData       streamWidth      = new MPData();
            MPData       streamAlpha      = new MPData();

            // Get Background color
            Color bkg = exportProperties.OutputVideoColor;

            // Convert to integer value AARRGGBB
            outputBackground.vInt = bkg.ToArgb();

            // Set DMO param
            hr = dmoParams.SetParam(0, outputBackground);
            DMOError.ThrowExceptionForHR(hr);

            streamLeft.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Left;
            hr = dmoParams.SetParam(1, streamLeft);
            DMOError.ThrowExceptionForHR(hr);

            streamTop.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Top;
            hr = dmoParams.SetParam(2, streamTop);
            DMOError.ThrowExceptionForHR(hr);

            streamWidth.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Width;
            hr = dmoParams.SetParam(3, streamWidth);
            DMOError.ThrowExceptionForHR(hr);

            streamHeight.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Height;
            hr = dmoParams.SetParam(4, streamHeight);
            DMOError.ThrowExceptionForHR(hr);

            streamAlpha.vFloat = exportProperties.GazeVideoProperties.StreamAlpha;
            hr = dmoParams.SetParam(5, streamAlpha);
            DMOError.ThrowExceptionForHR(hr);

            streamLeft.vFloat = exportProperties.UserVideoProperties.StreamPosition.Left;
            hr = dmoParams.SetParam(6, streamLeft);
            DMOError.ThrowExceptionForHR(hr);

            streamTop.vFloat = exportProperties.UserVideoProperties.StreamPosition.Top;
            hr = dmoParams.SetParam(7, streamTop);
            DMOError.ThrowExceptionForHR(hr);

            streamWidth.vFloat = exportProperties.UserVideoProperties.StreamPosition.Width;
            hr = dmoParams.SetParam(8, streamWidth);
            DMOError.ThrowExceptionForHR(hr);

            streamHeight.vFloat = exportProperties.UserVideoProperties.StreamPosition.Height;
            hr = dmoParams.SetParam(9, streamHeight);
            DMOError.ThrowExceptionForHR(hr);

            streamAlpha.vFloat = exportProperties.UserVideoProperties.StreamAlpha;
            hr = dmoParams.SetParam(10, streamAlpha);
            DMOError.ThrowExceptionForHR(hr);
        }
예제 #9
0
        private void SetDMOParams(DirectShowLib.IBaseFilter dmoWrapperFilter)
        {
            int hr;
            Guid g;
            int i;
            int pc;
            ParamInfo pInfo;
            IMediaParamInfo paramInfo = dmoWrapperFilter as IMediaParamInfo;

            // With a little effort, a generic parameter handling routine
            // could be produced.  You know the number of parameters (GetParamCount),
            // the type of the parameter (pInfo.mpType), the range of values for
            // int and float (pInfo.mpdMinValue, pInfo.mpdMaxValue), if the parameter is an
            // enum, you have the strings (GetParamText).

            hr = paramInfo.GetParamCount(out pc);
            DMOError.ThrowExceptionForHR(hr);

            // Walk all the parameters
            for (int pCur = 0; pCur < pc; pCur++)
            {
                IntPtr ip;

                hr = paramInfo.GetParamInfo(pCur, out pInfo);
                DMOError.ThrowExceptionForHR(hr);

                hr = paramInfo.GetParamText(0, out ip);
                DMOError.ThrowExceptionForHR(hr);

                try
                {
                    string sName, sUnits;
                    string[] sEnum;
                    ParseParamText(ip, out sName, out sUnits, out sEnum);

                    Debug.WriteLine(string.Format("Parameter name: {0}", sName));
                    Debug.WriteLine(string.Format("Parameter units: {0}", sUnits));

                    // Not all params will have enumerated strings.
                    if (pInfo.mpType == MPType.ENUM)
                    {
                        // The final entry in "splitted" will be a blank (used to terminate the list).
                        for (int x = 0; x < sEnum.Length; x++)
                        {
                            Debug.WriteLine(string.Format("Parameter Enum strings: {0} = {1}", x, sEnum[x]));
                        }
                    }
                }
                finally
                {
                    Marshal.FreeCoTaskMem(ip);
                }
            }

            hr = paramInfo.GetCurrentTimeFormat(out g, out i);
            DMOError.ThrowExceptionForHR(hr);

            hr = paramInfo.GetSupportedTimeFormat(0, out g);
            DMOError.ThrowExceptionForHR(hr);

            MPData o = new MPData();
            m_param = dmoWrapperFilter as IMediaParams;

            o.vInt = 0;
            hr = m_param.SetParam(0, o);
            DMOError.ThrowExceptionForHR(hr);
        }
예제 #10
0
        private TabPage SetDMOParams()
        {
            int hr;

            // create the tab page and the layout grid
            TabPage          tp = new TabPage("DMO Parameters");
            TableLayoutPanel tl = new TableLayoutPanel();

            tl.Dock         = DockStyle.Top;
            tl.ColumnCount  = 2;
            tl.AutoSizeMode = AutoSizeMode.GrowOnly;
            tl.AutoSize     = true;
            tp.Controls.Add(tl);

            IMediaParamInfo paramInfo = this._dsfilternode._filter as IMediaParamInfo;

            if (paramInfo == null)
            {
                Resizable = false;
                InternalControl.Visible = false;
                return(tp);
            }

            IMediaParams m_param = this._dsfilternode._filter as IMediaParams;

            hr = paramInfo.GetParamCount(out _dmoPropertyCount);
            DMOError.ThrowExceptionForHR(hr);

            tl.RowCount = _dmoPropertyCount;

            // Walk all the parameters
            for (int pCur = 0; pCur < _dmoPropertyCount; pCur++)
            {
                ParamInfo pInfo;
                IntPtr    ip;

                hr = paramInfo.GetParamInfo(pCur, out pInfo);
                DMOError.ThrowExceptionForHR(hr);

                hr = paramInfo.GetParamText(pCur, out ip);
                DMOError.ThrowExceptionForHR(hr);

                string   sName, sUnits;
                string[] sEnum;

                try
                {
                    ParseParamText(ip, out sName, out sUnits, out sEnum);
                }
                finally
                {
                    Marshal.FreeCoTaskMem(ip);
                }

                Label l = new Label();
                l.Text = pInfo.szLabel;
                tl.Controls.Add(l);

                switch (pInfo.mpType)
                {
                case MPType.BOOL:
                {
                    tl.Controls.Add(new DMOBoolParam(m_param, pCur, pInfo));
                }
                break;

                case MPType.ENUM:
                {
                    tl.Controls.Add(new DMOEnumParam(sEnum, m_param, pCur, pInfo));
                }
                break;

                case MPType.FLOAT:
                {
                    tl.Controls.Add(new DMONumericalParam(m_param, pCur, pInfo));
                }
                break;

                case MPType.INT:
                {
                    tl.Controls.Add(new DMONumericalParam(m_param, pCur, pInfo));
                }
                break;

                case MPType.MAX:
                {
                    tl.Controls.Add(new Label());
                }
                break;

                default:
                    break;
                }
            }

            for (int i = 0; i < tl.RowCount; i++)
            {
                tl.RowStyles.Add(new RowStyle(SizeType.Absolute, 23f));
            }
            tl.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            tl.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, .5f));

            return(tp);
        }
예제 #11
0
    /// <summary>
    /// Creates the parameter connection for the gaze and mouse location
    /// properties of the dmo filter.
    /// </summary>
    /// <param name="dmoWrapperFilter">
    /// The <see cref="IBaseFilter"/> interface
    /// of the dmo wrapper filter.
    /// </param>
    private void SetDMOParams(IBaseFilter dmoWrapperFilter)
    {
      if (dmoWrapperFilter == null)
      {
        return;
      }

      int hr;
      this.dmoParams = dmoWrapperFilter as IMediaParams;

      this.gazeX = new MPData();
      this.gazeX.vInt = 0;
      hr = this.dmoParams.SetParam(0, this.gazeX);
      DMOError.ThrowExceptionForHR(hr);

      this.gazeY = new MPData();
      this.gazeY.vInt = 0;
      hr = this.dmoParams.SetParam(1, this.gazeY);
      DMOError.ThrowExceptionForHR(hr);

      this.mouseX = new MPData();
      this.mouseX.vInt = 0;
      hr = this.dmoParams.SetParam(2, this.mouseX);
      DMOError.ThrowExceptionForHR(hr);

      this.mouseY = new MPData();
      this.mouseY.vInt = 0;
      hr = this.dmoParams.SetParam(3, this.mouseY);
      DMOError.ThrowExceptionForHR(hr);
    }
예제 #12
0
파일: Form1.cs 프로젝트: d3x0r/xperdex
        private void SetDMOParams(IBaseFilter dmoWrapperFilter)
        {
            int             hr;
            Guid            g;
            int             i;
            int             pc;
            ParamInfo       pInfo;
            IMediaParamInfo paramInfo = dmoWrapperFilter as IMediaParamInfo;

            // With a little effort, a generic parameter handling routine
            // could be produced.  You know the number of parameters (GetParamCount),
            // the type of the parameter (pInfo.mpType), the range of values for
            // int and float (pInfo.mpdMinValue, pInfo.mpdMaxValue), if the parameter is an
            // enum, you have the strings (GetParamText).

            hr = paramInfo.GetParamCount(out pc);
            DMOError.ThrowExceptionForHR(hr);

            // Walk all the parameters
            for (int pCur = 0; pCur < pc; pCur++)
            {
                IntPtr ip;

                hr = paramInfo.GetParamInfo(pCur, out pInfo);
                DMOError.ThrowExceptionForHR(hr);

                hr = paramInfo.GetParamText(0, out ip);
                DMOError.ThrowExceptionForHR(hr);

                try
                {
                    string    sName, sUnits;
                    string [] sEnum;
                    ParseParamText(ip, out sName, out sUnits, out sEnum);

                    Debug.WriteLine(string.Format("Parameter name: {0}", sName));
                    Debug.WriteLine(string.Format("Parameter units: {0}", sUnits));

                    // Not all params will have enumerated strings.
                    if (pInfo.mpType == MPType.ENUM)
                    {
                        // The final entry in "splitted" will be a blank (used to terminate the list).
                        for (int x = 0; x < sEnum.Length; x++)
                        {
                            Debug.WriteLine(string.Format("Parameter Enum strings: {0} = {1}", x, sEnum[x]));
                        }
                    }
                }
                finally
                {
                    Marshal.FreeCoTaskMem(ip);
                }
            }

            hr = paramInfo.GetCurrentTimeFormat(out g, out i);
            DMOError.ThrowExceptionForHR(hr);

            hr = paramInfo.GetSupportedTimeFormat(0, out g);
            DMOError.ThrowExceptionForHR(hr);

            MPData o = new MPData();

            m_param = dmoWrapperFilter as IMediaParams;

            o.vInt = 0;
            hr     = m_param.SetParam(0, o);
            DMOError.ThrowExceptionForHR(hr);
        }