private void TestGetParamCount() { int hr; int i; hr = m_impi.GetParamCount(out i); DMOError.ThrowExceptionForHR(hr); Debug.Assert(i == 7, "GetParamCount"); }
private void junk() { int hr; IEnumDMO idmo; Guid [] g = new Guid[1]; string [] sn = new string[1]; int iCount = 0; hr = DMOUtils.DMOEnum(Guid.Empty, DMOEnumerator.None, 0, null, 0, null, out idmo); DMOError.ThrowExceptionForHR(hr); do { DMOWrapperFilter dmoFilter = new DMOWrapperFilter(); IDMOWrapperFilter dmoWrapperFilter = (IDMOWrapperFilter)dmoFilter; hr = idmo.Next(1, g, sn, IntPtr.Zero); DMOError.ThrowExceptionForHR(hr); if (hr > 0) { break; } hr = dmoWrapperFilter.Init(g[0], Guid.Empty); if (hr >= 0) { m_impi = dmoWrapperFilter as IMediaParamInfo; if (m_impi != null) { hr = m_impi.GetParamCount(out iCount); } else { iCount = 0; } if (iCount > 0) { Debug.WriteLine(string.Format("{0} {1} {2}", sn[0], iCount, g[0])); } } } while (iCount >= 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); }
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); }