Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
 private void DoDispose()
 {
     if (!_disposed)
     {
         _myFrameEncodedCallback = null;
         if (Environment.Is64BitProcess)
         {
             Interop64.DestroyEncoder(_encoderHandle);
         }
         else
         {
             Interop32.DestroyEncoder(_encoderHandle);
         }
         _disposed = true;
     }
 }
Beispiel #4
0
 internal static extern WebRTCErrorCode SetVideoFrameEncodedCb(IntPtr handle, FrameEncodedCallback callback, IntPtr userData = default);
Beispiel #5
0
 public static extern int CreateEncoder(out IntPtr hEncoder, int width, int height, int frameRate, FrameEncodedCallback frameEncodedCallback);