private void OnSelChange(object sender, EventArgs e) { try { int i = listBox.SelectedIndex; if (i == 0) { selected_mt = null; } if (i == 1) { selected_mt = new AMMediaType(); } if (i >= 2) { AMMediaType mt; int hr = isc.GetStreamCaps(i - 2, out mt, scc); DsError.ThrowExceptionForHR(hr); selected_mt = mt; } propertyGrid.SelectedObject = selected_mt != null? MediaTypeProps.CreateMTProps(selected_mt) : null; } catch (COMException ex) { Graph.ShowCOMException(ex, "Error trying to GetStreamCaps"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void MediaTypeListForm_Load(object sender, EventArgs e) { int count; try { listBox.Items.Add("null (resets to default on some filters)"); listBox.Items.Add(MediaTypeProps.CreateMTProps(new AMMediaType()).ToString()); if (isc.GetNumberOfCapabilities(out count, out size) >= 0) { scc = Marshal.AllocHGlobal(size); for (int i = 0; i < count; i++) { AMMediaType mt; int hr = isc.GetStreamCaps(i, out mt, scc); DsError.ThrowExceptionForHR(hr); string s = MediaTypeProps.CreateMTProps(mt).ToString(); listBox.Items.Add(s); } } } catch (COMException ex) { Graph.ShowCOMException(ex, "Error getting stream capabilities"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void SelectConnection(int con_id) { foreach (PinConnection con in connections) { if (con.ID == con_id) { SelectedConnection = con; AMMediaType mt = new AMMediaType(); con.pins[0].IPin.ConnectionMediaType(mt); MediaTypeProps mtp = MediaTypeProps.CreateMTProps(mt); //new MediaTypeProps(mt); Program.mainform.propform.SetObject(mtp); break; } } }
private void OnLButtonUp() { if (movingFilter != null) foreach (Filter f in graph.SelectedFilters) f.movingStartCoords = f.Coords; movingFilter = null; if (connectingPin != null) { if (mousepos == movingStart) //just click on pin { if (connectingPin.Connection != null) { AMMediaType mt = new AMMediaType(); connectingPin.IPin.ConnectionMediaType(mt); MediaTypeProps mtp = MediaTypeProps.CreateMTProps(mt); //new MediaTypeProps(mt); Program.mainform.propform.SetObject(mtp); } else { IEnumMediaTypes mtenum; if (connectingPin.IPin.EnumMediaTypes(out mtenum) >= 0) { AMMediaType[] mts = new AMMediaType[1]; List<MediaTypeProps> mtypes = new List<MediaTypeProps>(); IntPtr fetched = Marshal.AllocHGlobal(4); while (mtenum.Next(1, mts, fetched) == 0) mtypes.Add(MediaTypeProps.CreateMTProps(mts[0])); Marshal.FreeHGlobal(fetched); Program.mainform.propform.SetObject(mtypes.ToArray()); } } } else { if (otherPin != null) { Pin inpin, outpin; if (connectingPin.Direction == PinDirection.Input) { inpin = connectingPin; outpin = otherPin; } else { inpin = otherPin; outpin = connectingPin; } graph.Connect(outpin, inpin, true); } } Invalidate(); } if (selecting) { Rectangle rc = new Rectangle(Math.Min(mousepos.X, movingStart.X), Math.Min(mousepos.Y, movingStart.Y), Math.Abs(mousepos.X - movingStart.X), Math.Abs(mousepos.Y - movingStart.Y)); if (ModifierKeys != Keys.Shift) graph.ClearFiltersSelection(); graph.SelectSeveralFilters(rc); selecting = false; Invalidate(); } connectingPin = null; otherPin = null; }
public StreamCaps(AMMediaType _mt, T _caps) { mt = MediaTypeProps.CreateMTProps(_mt); caps = _caps; }