unsafe int FrameAcceptedCallback(S2Frame *frm) { if (frm->Error != 0 || frm->Width == 0 || frm->Height == 0) { return(0); } if (FrameAccepted == null) { SnvBackend.FreeFrame(frm); return(0); } AppTools.TryInvoke(() => { bool changed = false; if (bitmap == null || bitmap.Width != frm->Width || bitmap.Height != frm->Height) { bitmap = new WriteableBitmap(frm->Width, frm->Height, 96, 96, PixelFormats.Bgr24, null); changed = true; } unsafe { bitmap.Lock(); UnmanagedTools.CopyMemory(bitmap.BackBuffer, frm->Pixels, (uint)(frm->Height * bitmap.BackBufferStride)); bitmap.AddDirtyRect(new Int32Rect(0, 0, frm->Width, frm->Height)); bitmap.Unlock(); SnvBackend.FreeFrame(frm); } FrameAccepted?.Invoke(this, new FrameAcceptedEventArgs(bitmap, changed)); }); return(0); }
public static unsafe extern void RecCommitFrame(RecorderContext *ctx, S2Frame *frm, int display);
public static unsafe extern int ScrCapture(S2Frame *frm, int display, uint den);
public static unsafe extern int S2Send(S2TransmitterContext *tctx, S2Frame *frm);
public static unsafe extern void FreeFrame(S2Frame *frm);
public static unsafe extern void AllocFrame(S2Frame *frm, ushort w, ushort h);