コード例 #1
0
 public int Write(Packet packet)
 {
     _currentFramePts = packet.Properties.Pts;
     _currentFrame?.Dispose();
     _currentFrame = _uploader.Upload(packet.Properties.DataPtr, IntPtr.Zero, IntPtr.Zero);
     return(0);
 }
コード例 #2
0
 public void Dispose()
 {
     _currentFrame?.Dispose();
     _dx?.RemoveRef();
     _uploader?.Dispose();
     _uploader     = null;
     _currentFrame = null;
     _dx           = null;
 }
コード例 #3
0
        public void InitFromDirectX(DirectXResource currentFrame, long currentFramePts)
        {
            DirectXResourceRef = new RefCounted <DirectXResource>(currentFrame);

            Properties = new FrameProperties
            {
                Pts = currentFramePts
            };
        }
コード例 #4
0
        public object CreateCopy(Texture2D texture)
        {
            var d   = texture.Description;
            var res = Pool.Get("CreateCopy", DirectXResource.Desc(d.Width, d.Height, d.Format));

            RunOnContext(ctx =>
            {
                ctx.CopyResource(texture, res.Texture2D);
            }, "CreateCopy");

            return(res);
        }
コード例 #5
0
 public ErrorCodes Read(Frame frame)
 {
     if (_currentFrame == null)
     {
         return(ErrorCodes.TryAgainLater);
     }
     else
     {
         frame.InitFromDirectX(_currentFrame, _currentFramePts);
         _currentFrame = null;
         return(ErrorCodes.Ok);
     }
 }