示例#1
0
 public override VideoFrame GetFrame(int n, ScriptEnvironment env)
 {
     lock (imageStream) {
         VideoFrame dst = NewVideoFrame(env);
         env.BitBlt(dst.GetWritePtr(), dst.GetPitch(), imageStream.GetBuffer(), imagePitch, vi.width * 4, vi.height);
         return(dst);
     }
 }
        public override VideoFrame GetFrame(int n, ScriptEnvironment env)
        {
            NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);

            binding.MaxBufferSize = 20000000;
            EndpointAddress             ep      = new EndpointAddress(InterProcessSampleServer.Program.Address);
            IInterProcessSampleContract channel = ChannelFactory <IInterProcessSampleContract> .CreateChannel(binding, ep);

            VideoFrame Src = Child.GetFrame(n, env);

            Stream[]   Planes = new Stream[] { Src.GetReadStream(YUVPlanes.PLANAR_Y), Src.GetReadStream(YUVPlanes.PLANAR_U), Src.GetReadStream(YUVPlanes.PLANAR_V) };
            byte[][]   Result = channel.Add(new RequestParameters(n, Planes));
            VideoFrame Dst    = NewVideoFrame(env);

            env.BitBlt(Dst.GetWritePtr(YUVPlanes.PLANAR_Y), Dst.GetPitch(YUVPlanes.PLANAR_Y), Result[0], Src.GetPitch(YUVPlanes.PLANAR_Y), Src.GetRowSize(YUVPlanes.PLANAR_Y), Src.GetHeight(YUVPlanes.PLANAR_Y));
            env.BitBlt(Dst.GetWritePtr(YUVPlanes.PLANAR_U), Dst.GetPitch(YUVPlanes.PLANAR_U), Result[1], Src.GetPitch(YUVPlanes.PLANAR_U), Src.GetRowSize(YUVPlanes.PLANAR_U), Src.GetHeight(YUVPlanes.PLANAR_U));
            env.BitBlt(Dst.GetWritePtr(YUVPlanes.PLANAR_V), Dst.GetPitch(YUVPlanes.PLANAR_V), Result[2], Src.GetPitch(YUVPlanes.PLANAR_V), Src.GetRowSize(YUVPlanes.PLANAR_V), Src.GetHeight(YUVPlanes.PLANAR_V));
            return(Dst);
        }