Пример #1
0
        private void TestParamInfo()
        {
            int       hr;
            ParamInfo pInfo = new ParamInfo();

            hr = m_impi.GetParamInfo(0, out pInfo);
            DMOError.ThrowExceptionForHR(hr);

            Debug.Assert(pInfo.szUnitText == "%", "GetParamInfo");
        }
Пример #2
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);
        }
Пример #3
0
        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);
        }