예제 #1
0
파일: Form1.cs 프로젝트: d3x0r/xperdex
        private void button2_Click(object sender, System.EventArgs e)
        {
            int    hr;
            MPData o;

            hr = m_param.GetParam(0, out o);
            DMOError.ThrowExceptionForHR(hr);

            o.vInt ^= 2;

            hr = m_param.SetParam(0, o);
            DMOError.ThrowExceptionForHR(hr);
        }
예제 #2
0
        void DMOBoolParam_CheckedChanged(object sender, EventArgs e)
        {
            MPData val = new MPData();

            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                val.vBool = Checked;
            }
            else
            {
                val.vFloat = Checked ? 1f : 0f;
            }

            _param.SetParam(_paramNum, val);
        }
예제 #3
0
        private void TestParam()
        {
            int    hr;
            MPData pData = new MPData();

            pData.vFloat = 51;

            hr = m_imp.SetParam(0, pData);
            DMOError.ThrowExceptionForHR(hr);

            hr = m_imp.GetParam(0, out pData);
            DMOError.ThrowExceptionForHR(hr);

            Debug.Assert(pData.vFloat == 51, "GetParam");
        }
예제 #4
0
        void DMOEnumParam_SelectedIndexChanged(object sender, EventArgs e)
        {
            MPData val = new MPData();

            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                val.vInt = SelectedIndex;
            }
            else
            {
                if (SelectedIndex == 0)
                {
                    val.vFloat = 0f;
                }
                else
                {
                    val.vFloat = (float)SelectedIndex / (float)(Items.Count - 1);
                }
            }
            _param.SetParam(_paramNum, val);
        }
예제 #5
0
        void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (!colorTrackBar1.Tracking)
            {
                colorTrackBar1.Value = (int)((((0 - numericUpDown1.Minimum) + numericUpDown1.Value) / ((0 - numericUpDown1.Minimum) + numericUpDown1.Maximum)) * 1000);
            }

            if (_initialzed)
            {
                // only set the value if the control is fully inititalized
                MPData val = new MPData();
                if (_pInfo.mopCaps == MPCaps.Jump)
                {
                    val.vInt = (int)numericUpDown1.Value;
                }
                else
                {
                    val.vFloat = (float)numericUpDown1.Value;
                }
                _param.SetParam(_paramNum, val);
            }
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
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);
        }