public Encoder(int width, int height, int frameRate) { _myFrameEncodedCallback = MyFrameEncodedCallback; var result = Environment.Is64BitProcess ? Interop64.CreateEncoder(out _encoderHandle, width, height, frameRate, _myFrameEncodedCallback) : Interop32.CreateEncoder(out _encoderHandle, width, height, frameRate, _myFrameEncodedCallback); if (result != 0) { throw new PusherException(result); } }
public Encoder(int width, int height, int frameRate, int bitRate) { _myFrameEncodedCallback = MyFrameEncodedCallback; var result = Environment.Is64BitProcess ? Interop64.CreateEncoder(out _encoderHandle, width, height, frameRate, bitRate, _myFrameEncodedCallback) : Interop32.CreateEncoder(out _encoderHandle, width, height, frameRate, bitRate, _myFrameEncodedCallback); if (result != 0) { throw new PusherException(result); } _layerImage = new Bitmap(width, height); _layerGraphics = Graphics.FromImage(_layerImage); _layerRect = new Rectangle(0, 0, width, height); _layerDataSzie = width * height * 4; }
private void DoDispose() { if (!_disposed) { _myFrameEncodedCallback = null; if (Environment.Is64BitProcess) { Interop64.DestroyEncoder(_encoderHandle); } else { Interop32.DestroyEncoder(_encoderHandle); } _disposed = true; } }
internal static extern WebRTCErrorCode SetVideoFrameEncodedCb(IntPtr handle, FrameEncodedCallback callback, IntPtr userData = default);
public static extern int CreateEncoder(out IntPtr hEncoder, int width, int height, int frameRate, FrameEncodedCallback frameEncodedCallback);