private void TestTimeFormats() { int hr; int i; Guid g; Guid g2; int t; hr = m_impi.GetNumTimeFormats(out i); DMOError.ThrowExceptionForHR(hr); Debug.Assert(i == 1, "GetNumTimeFormats"); hr = m_impi.GetCurrentTimeFormat(out g, out t); DMOError.ThrowExceptionForHR(hr); Debug.Assert(g == MediaParamTimeFormat.Reference, "GetCurrentTimeFormat"); for (int x = 0; x < i; x++) { hr = m_impi.GetSupportedTimeFormat(x, out g2); DMOError.ThrowExceptionForHR(hr); Debug.Assert(g2 == MediaParamTimeFormat.Reference, "GetSupportedTimeFormat"); } }
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); }