public void testCustomRendering() { // 1. Set proper video capture device Dictionary<string, string> devs = null; ; _service.getVideoCaptureDeviceNames(createDevsResponder()); devs = awaitDictResult("getVideoCaptureDeviceNames", 15000); Assert.IsTrue(devs.Count > 0); Console.Error.WriteLine("Setting the device"); _service.setVideoCaptureDevice(createVoidResponder(), devs.Keys.First()); awaitVoidResult("setVideoCaptureDevice", 15000); // 2. Do the real test Console.Error.WriteLine("Starting local video"); _service.startLocalVideo(createStringResponder()); string sinkId = awaitStringResult("startLocalVideo", 15000); Assert.That(sinkId.Length > 0); Console.Error.WriteLine("Creating renderer"); RenderOptions ro = new RenderOptions(); ro.filter = VideoScalingFilter.FAST_BILINEAR; ro.mirror = true; ro.sinkId = sinkId; Console.Error.WriteLine("Starting rendering"); _service.manualRenderSink(createManualRendererResponder(), ro); ManualRenderer mRenderer = awaitManualRendererResult(); Console.Error.WriteLine("Rendering started"); TestRenderingForm renderingForm = new TestRenderingForm(mRenderer); renderingForm.ShowDialog(); _service.stopLocalVideo(createVoidResponder()); awaitVoidResult(); }
// ===================================================================== /// <summary> /// /// </summary> /// <param name="responder"></param> /// <param name="options"></param> public void renderSink(Responder<RenderingWidget> responder, RenderOptions options) { PendingCall call = new PendingCall(responder); renderSinkInternal(call, options); }
public void manualRenderSink(Responder<ManualRenderer> responder, RenderOptions options) { PendingCall call = new PendingCall(responder); renderSinkInternal(call, options); }
/** * Private helpers * ===================================================================== */ private void renderSinkInternal(PendingCall call, RenderOptions options) { int callId = _callIdGenerator++; ManualRenderer renderer = new ManualRenderer(_platformHandle, onRendererPreDispose); call.manualRenderer = renderer; _pendingCalls[callId] = call; CDORenderRequest nReq = RenderOptions.toNative(options); nReq.invalidateCallback = renderer.getInvalidateClbck(); Console.Error.WriteLine("Requesting SDK to start rendering sink"); NativeAPI.cdo_render_sink(_renderResponder, _platformHandle, new IntPtr(callId), ref nReq); }
private void startRenderBtn_Click(object sender, EventArgs e) { RenderOptions rOptions = new RenderOptions(); rOptions.mirror = false; rOptions.filter = VideoScalingFilter.FAST_BILINEAR; rOptions.sinkId = _localPreviewSinkId; Platform.renderSink(Platform.R<RenderingWidget>(onRenderStarted), rOptions); }
public void testRenderingWidget() { // 1. Set proper video capture device Dictionary<string, string> devs = null; ; _service.getVideoCaptureDeviceNames(createDevsResponder()); devs = awaitDictResult("getVideoCaptureDeviceNames", 15000); Assert.IsTrue(devs.Count > 0); Console.Error.WriteLine("Setting the device"); _service.setVideoCaptureDevice(createVoidResponder(), devs.Keys.First()); awaitVoidResult("setVideoCaptureDevice", 15000); // 2. Do the real test Console.Error.WriteLine("Starting local video"); _service.startLocalVideo(createStringResponder()); string sinkId = awaitStringResult("startLocalVideo", 15000); Assert.That(sinkId.Length > 0); Console.Error.WriteLine("Creating renderer"); RenderOptions ro = new RenderOptions(); ro.filter = VideoScalingFilter.FAST_BILINEAR; ro.mirror = true; ro.sinkId = sinkId; Console.Error.WriteLine("Starting rendering"); Form renderingForm = new Form(); renderingForm.Width = 360; renderingForm.Height = 240; _service.renderSink(createRendererResponder(), ro); RenderingWidget renderer = awaitRendererResult(); renderer.Width = 320; renderer.Height = 240; renderer.SetBounds(10, 10, 320, 240); renderingForm.Controls.Add(renderer); renderingForm.ShowDialog(); _service.stopLocalVideo(createVoidResponder()); awaitVoidResult(); }
internal static CDORenderRequest toNative(RenderOptions options) { CDORenderRequest result = new CDORenderRequest(); result.sinkId = StringHelper.toNative(options.sinkId); result.mirror = options.mirror; result.filter = StringHelper.toNative(options.filter.StringValue); result.opaque = IntPtr.Zero; return result; }