public MainForm(PXCMSession session) { InitializeComponent(); /* Put stream menu items to array */ streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_COLOR)] = ColorMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_DEPTH)] = DepthMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_IR)] = IRMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_LEFT)] = LeftMenu; streamMenus[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_RIGHT)] = RightMenu; /* Put stream buttons to array */ streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_COLOR)] = Color; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_DEPTH)] = Depth; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_IR)] = IR; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_LEFT)] = IRLeft; streamButtons[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_RIGHT)] = IRRight; /* Put panels buttons to array */ streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_COLOR)] = ColorPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_DEPTH)] = DepthPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_IR)] = IRPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_LEFT)] = IRLeftPanel; streamPanels[PXCMCapture.StreamTypeToIndex(PXCMCapture.StreamType.STREAM_TYPE_RIGHT)] = IRRightPanel; this.session = session; streaming.UpdateStatus += new EventHandler <UpdateStatusEventArgs>(UpdateStatusHandler); streaming.RenderFrame += new EventHandler <RenderFrameEventArgs>(RenderFrameHandler); FormClosing += new FormClosingEventHandler(FormClosingHandler); ColorPanel.Paint += new PaintEventHandler(PaintHandler); DepthPanel.Paint += new PaintEventHandler(PaintHandler); IRPanel.Paint += new PaintEventHandler(PaintHandler); IRLeftPanel.Paint += new PaintEventHandler(PaintHandler); IRRightPanel.Paint += new PaintEventHandler(PaintHandler); ColorPanel.Resize += new EventHandler(ResizeHandler); DepthPanel.Resize += new EventHandler(ResizeHandler); IRPanel.Resize += new EventHandler(ResizeHandler); IRLeftPanel.Resize += new EventHandler(ResizeHandler); IRRightPanel.Resize += new EventHandler(ResizeHandler); ResetStreamTypes(); PopulateDeviceMenu(); Scale2.CheckedChanged += new EventHandler(Scale_Checked); Mirror.CheckedChanged += new EventHandler(Mirror_Checked); foreach (RadioButton button in streamButtons) { if (button != null) { button.Click += new EventHandler(Stream_Click); } } renders[0].SetHWND(ColorPanel); renders[1].SetHWND(DepthPanel); renders[2].SetHWND(IRPanel); renders[3].SetHWND(IRLeftPanel); renders[4].SetHWND(IRRightPanel); }
private PXCMCapture.StreamType GetStreamAvailable(PXCMCapture.StreamType stream) { if (streamMenus[PXCMCapture.StreamTypeToIndex(stream)] != null && streamMenus[PXCMCapture.StreamTypeToIndex(stream)].Available == true) { return(stream); } return(PXCMCapture.StreamType.STREAM_TYPE_ANY); }
private PXCMCapture.Device.StreamProfile GetStreamConfiguration(PXCMCapture.StreamType st) { ToolStripMenuItem menu = streamMenus[PXCMCapture.StreamTypeToIndex(st)]; if (menu != null) { return(GetConfiguration(menu)); } else { return(new PXCMCapture.Device.StreamProfile()); } }
private ToolStripMenuItem GetMenuItem(PXCMCapture.StreamType st, PXCMCapture.Device.StreamProfile profile) { ToolStripMenuItem parent = streamMenus[PXCMCapture.StreamTypeToIndex(st)]; if (parent == null) { return(null); } foreach (ToolStripMenuItem key1 in parent.DropDownItems) { PXCMCapture.Device.StreamProfile profile1 = profiles[key1]; if (ProfileToString(profile1) == ProfileToString(profile)) { return(key1); } } return(null); }
public static Int32 ToIndex(this PXCMCapture.StreamType type) { return(PXCMCapture.StreamTypeToIndex(type)); }
private void CheckSelection() { if (!ModePlayback.Checked) { PXCMCapture.Device.StreamProfileSet allProfile = new PXCMCapture.Device.StreamProfileSet(); for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); allProfile[st] = GetStreamConfiguration(st); } PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc(); desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR; desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE; desc.iuid = current_device_iuid; desc.cuids[0] = PXCMCapture.CUID; PXCMCapture capture; PXCMCapture.DeviceInfo dinfo2 = GetCheckedDevice(); if (session.CreateImpl <PXCMCapture>(desc, out capture) >= pxcmStatus.PXCM_STATUS_NO_ERROR) { PXCMCapture.Device device = capture.CreateDevice(dinfo2.didx); if (device != null) { PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet(); PXCMCapture.Device.StreamProfileSet test = new PXCMCapture.Device.StreamProfileSet(); /* Loop over all stream types and profiles and enable only compatible in menu */ for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s); if (((int)dinfo2.streams & (int)st) != 0) { for (int s1 = 0; s1 < PXCMCapture.STREAM_LIMIT; s1++) { test[PXCMCapture.StreamTypeFromIndex(s1)] = allProfile[PXCMCapture.StreamTypeFromIndex(s1)]; } int num = device.QueryStreamProfileSetNum(st); for (int p = 0; p < num; p++) { if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) { break; } PXCMCapture.Device.StreamProfile sprofile = profile[st]; ToolStripMenuItem sm1 = GetMenuItem(st, sprofile); if (sm1 != null) { test[st] = sprofile; sm1.Enabled = device.IsStreamProfileSetValid(test); } } } } Start.Enabled = device.IsStreamProfileSetValid(allProfile); device.Dispose(); } capture.Dispose(); } } int sumEnabled = 0; for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++) { if (streamButtons[s] != null && streamNone[s] != null) { streamButtons[s].Enabled = !streamNone[s].Checked; sumEnabled += streamButtons[s].Enabled?1:0; } } PIP.Enabled = (sumEnabled >= 2); Mirror.Enabled = !ModePlayback.Checked; PXCMCapture.StreamType selectedStream = GetSelectedStream(); if (selectedStream != PXCMCapture.StreamType.STREAM_TYPE_ANY && !streamButtons[PXCMCapture.StreamTypeToIndex(selectedStream)].Enabled) { PXCMCapture.StreamType st = GetUnselectedStream(); streamButtons[PXCMCapture.StreamTypeToIndex(st)].Checked = true; streaming.ColorPanel = st; } //if (PIP.Enabled && streaming.DepthPanel == PXCMCapture.StreamType.STREAM_TYPE_ANY) //{ // streaming.DepthPanel = GetUnselectedStream(); //} }