Inheritance: IPayloadChannel
コード例 #1
0
ファイル: GLSketchViewer.cs プロジェクト: Wiladams/NewTOAPIA
        public GLSketchViewer(GraphicsInterface gi, int width, int height)
        {
            fDynamicTexture = new SnapNGLView.DynamicTexture(gi, width, height, 3);

            // Create the backing buffer to retain the image
            backingBuffer = new PixelBuffer24(width, height);
            //backingBuffer.DeviceContext.ClearToWhite();

            // 1.  Show a dialog box to allow the user to type in the 
            // group IP address and port number.
            HostForm groupForm = new HostForm();
            groupForm.ShowDialog();

            // 2. Get the address and port from the form, and use
            // them to setup the MultiSession object
            string groupIP = groupForm.groupAddressField.Text;
            int groupPort = int.Parse(groupForm.groupPortField.Text);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            // Create the session
            fSession = new MultiSession(Guid.NewGuid().ToString(), ipep);

            // Add the channel for graphics commands
            fSketchChannel = fSession.CreateChannel(PayloadType.Whiteboard);

            // 3. Setup the chunk decoder so we can receive new images
            // when they come in
            fChunkDecoder = new GraphPortChunkDecoder(backingBuffer, fSketchChannel);
            fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24;
            fChunkDecoder.PixBltLumbHandler += this.PixBltLum24;

            //fSketchChannel.FrameReceivedEvent += FrameReceived;

        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Wiladams/NewTOAPIA
        public Form1()
            : base("Snap N Viewer", 20, 20, 640, 480)
        {
            fAutoScale = true;

            // Create the backing buffer to retain the image
            fBackingBuffer = new GDIDIBSection(1600, 1200);

            // 1.  Show a dialog box to allow the user to type in the 
            // group IP address and port number.
            HostForm groupForm = new HostForm();
            //groupForm.ShowDialog();

            // 2. Get the address and port from the form, and use
            // them to setup the MultiSession object
            string groupIP = groupForm.groupAddressField.Text;
            int groupPort = int.Parse(groupForm.groupPortField.Text);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            Title = "Snap N Viewer - " + ipep.ToString();

            fSession = new MultiSession(Guid.NewGuid().ToString(), ipep);
            fSketchChannel = fSession.CreateChannel(PayloadType.dynamicPresentation);

            // 3. Setup the chunk decoder so we can receive new images
            // when they come in
            fChunkDecoder = new GraphPortChunkDecoder(fBackingBuffer, fSketchChannel);
            fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24;
            fChunkDecoder.PixBltLumbHandler += this.PixBltLum24;
        }
コード例 #3
0
        public GraphPortChunkDecoder(GDIDIBSection pixMap, PayloadChannel channel)
        {
            fGrayImage = new PixelArray<Lumb>(pixMap.Width, pixMap.Height);
            fChannel = channel;
            fChannel.FrameReceivedEvent += FrameReceived;

            fPixMap = pixMap;
        }
コード例 #4
0
ファイル: GraphicsChannel.cs プロジェクト: Wiladams/NewTOAPIA
        public UICommandSender(PayloadChannel channel)
        {
            fCollaborationChannel = channel;

            // Create the sending graph port
            fChunkEncoder = new GraphPortChunkEncoder();
            fChunkEncoder.ChunkPackedEvent += new GraphPortChunkEncoder.ChunkPacked(GDIChunkPacked);
            AddPort(fChunkEncoder);
            
        }
コード例 #5
0
ファイル: VideoSender.cs プロジェクト: Wiladams/NewTOAPIA
        public VideoSender(int deviceIndex, PayloadChannel channel)
        {           
            fChannel = channel;

            fImageStream = new MemoryStream(1024);

            fCamera = VideoCaptureDevice.CreateCaptureDeviceFromIndex(0, -1, -1);
            PrintCamera(fCamera);

            fCamera.NewFrame += new CameraEventHandler(ReceiveFrameFromCamera);
        }
コード例 #6
0
ファイル: SketchViewer.cs プロジェクト: Wiladams/NewTOAPIA
        public SketchViewer(PayloadChannel channel, int width, int height)
        {
            fSketchChannel = channel;

            // Create the backing buffer to retain the image
            fBackingBuffer = new PixelBuffer24(width, height);

            // Create the decoder and assign ourself to received 
            // decoded methods
            fChunkDecoder = new GraphPortChunkDecoder(fBackingBuffer, fSketchChannel);
            fChunkDecoder.AddPort(this);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: Wiladams/NewTOAPIA
        public Form1()
            :base("Camera Server", 10, 10, 320, 240)
        {
            string groupIP = "234.5.7.15";
            int groupPort = 5004;
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            fSession = new MultiSession(Guid.NewGuid().ToString(), ipep);
            fChannel = fSession.CreateChannel(PayloadType.xApplication3);

            fCameraSender = new VideoSender(0, fChannel);
            fCameraSender.Start();
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: Wiladams/NewTOAPIA
        public Form1()
        {
            InitializeComponent();


            // Setup the audio processing stuff
            fSpeakers = new WaveSpeaker();

            
            IPAddress address = IPAddress.Parse("239.5.7.15");
            IPEndPoint ep = new IPEndPoint(address, 5004);
            fSession = new MultiSession(ep, Guid.NewGuid().ToString(), Environment.UserName, true, true, null);
            
            fAudioChannel = fSession.CreateChannel(PayloadType.dynamicAudio);
            fAudioChannel.FrameReceivedEvent += new RtpStream.FrameReceivedEventHandler(ReceivedAudioEvent);
        }
コード例 #9
0
ファイル: DDHostTrayApp.cs プロジェクト: Wiladams/NewTOAPIA
        DesktopSnapper fSnapper;    // The object that managers the snapshots

        public DDHostTrayApp()
        {
            // Create a simple tray menu with only one item.   
            trayMenu = new ContextMenu();

            menu_Settings=new MenuItem("Settings", OnSettingsSelect);
            menu_Sharing = new MenuItem("Sharing", OnChangeSharing);
            menu_RemoteControl = new MenuItem("Remote Control", OnRemoteControl);
            menu_Gray = new MenuItem("Gray", OnChangeGray);
            menu_Exit = new MenuItem("Exit", OnExit);

            trayMenu.MenuItems.Add(menu_Settings);
            trayMenu.MenuItems.Add(menu_RemoteControl);
            trayMenu.MenuItems.Add(menu_Sharing);
            trayMenu.MenuItems.Add(menu_Gray);
            trayMenu.MenuItems.Add(new MenuItem("-"));
            trayMenu.MenuItems.Add(menu_Exit);
            
            // Create a tray icon. In this example we use a   
            // standard system icon for simplicity, but you   
            // can of course use your own custom icon too.   
            trayIcon = new NotifyIcon();
            trayIcon.Text = "DD Host";
            trayIcon.Icon = new Icon("computer.ico");

            // Add menu to tray icon and show it.   
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;
            trayIcon.MouseDown += new System.Windows.Forms.MouseEventHandler(DDHostTrayApp_MouseDown);

            trayIcon.ShowBalloonTip(0, "DD Host", "Right Click for Settings", ToolTipIcon.Info);
            trayIcon.BalloonTipShown += new EventHandler(trayIcon_BalloonTipShown);

            // Create the communications sessions
            fGroupEndPoint = new IPEndPoint(IPAddress.Parse("234.5.7.15"), 5004);
            fSession = new MultiSession(Guid.NewGuid().ToString(), fGroupEndPoint);

            fGraphicsChannel = fSession.CreateChannel(PayloadType.dynamicPresentation);
            fUserIOChannel = fSession.CreateChannel(PayloadType.xApplication2);

            
            fSnapper = new DesktopSnapper(fGraphicsChannel, fUserIOChannel, true);

            menu_Gray.Checked = fSnapper.SendLuminance;
            menu_RemoteControl.Checked = fSnapper.AllowRemoteControl;
            menu_Sharing.Checked = fSnapper.ActivelySharing;
        }
コード例 #10
0
ファイル: SketchView.cs プロジェクト: Wiladams/NewTOAPIA
        public SketchView(MultiSession session, int width, int height)
        {
            fSession = session;

            // Create the backing buffer to retain the image
            backingBuffer = GDIDIBSection.Create(width, height);
            GDIContext bufferContext = GDIContext.CreateForBitmap(backingBuffer);

            bufferContext.ClearToWhite();
            fBackingGraphPort = new GDIRenderer(bufferContext);
            //fBackingGraphPort.ClearToWhite();

            // Add the channel for graphics commands
            fSketchChannel = fSession.CreateChannel(PayloadType.Whiteboard);

            fChunkDecoder = new GraphPortChunkDecoder();
            fChunkDecoder.AddGraphPort(fBackingGraphPort);

            fSketchChannel.FrameReceivedEvent += new RtpStream.FrameReceivedEventHandler(GDICommandReceived);
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: Wiladams/NewTOAPIA
        //Bitmap fPreviewBitmap;
        //GDIRenderer fRenderer;
        //GDIContext fRendererContext;

        public MainForm()
        {
            InitializeComponent();

            fSetupControl = new CaptureDeviceSetupPage();
            //this.Controls.Add(fSetupControl);
            splitContainer1.Panel1.Controls.Add(fSetupControl);

            string groupIP = "234.5.7.15";
            int groupPort = 5004;
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            fSession = new MultiSession(Guid.NewGuid().ToString(), ipep);
            fChannel = fSession.CreateChannel(PayloadType.dynamicPresentation);

            fCameraSender = new VideoSender(0, fChannel);
            //fPreviewBitmap = new Bitmap(fCameraSender.Width, fCameraSender.Height, 
            fCameraSender.ReceivedVideoFrameEvent += new VideoSender.ReceivedVideoFrameHandler(fCameraSender_ReceivedVideoFrameEvent);
            fCameraSender.Start();
        }
コード例 #12
0
ファイル: Form1.cs プロジェクト: Wiladams/NewTOAPIA
        public Form1()
        {
            InitializeComponent();

            IPAddress address = IPAddress.Parse("239.5.7.15");
            IPEndPoint ep = new IPEndPoint(address, 5010);
            fSession = new MultiSession(ep, Guid.NewGuid().ToString(), Environment.UserName, true, true, null);
            fAudioChannel = fSession.CreateChannel(PayloadType.dynamicAudio);

            fMicrophone = new WaveMicrophone(1, 11025, 8, 1.0 / 10.0);
            fSpeakers = new WaveSpeaker(1, 11025, 8, 1.0/10.0) ;

            // Startup a thread to process the audio as it comes in
            stopProcessing = false;
            processingStopped = new AutoResetEvent(false);

            audioProcessor = new Thread(ProcessAudio);
            audioProcessor.IsBackground = true;
            audioProcessor.Start();
        }
コード例 #13
0
        ConferenceSession(IPEndPoint endPoint, string uniqueName, string friendlyName, bool rtpTraffic, bool receiveData, IPEndPoint reflector)
            : base()
        {
            fModel = new ShowItModel(this);


            // Step 1
            fLocalParticipant = new RtpParticipant(uniqueName, friendlyName);

            if (null == reflector)
                Session = new RtpSession(endPoint, fLocalParticipant, true, true);
            else
                Session = new RtpSession(endPoint, fLocalParticipant, true, true, reflector);

            HookRtpEvents();


            // After everything is setup, initialize the session, which will
            // start the network messages flowing.
            Session.Initialize();

        
            // Create the three channels that are used in the conference
            fDesktopChannel = CreateChannel(PayloadType.xApplication2);
            fDesktopChannel.FrameReceivedEvent += new RtpStream.FrameReceivedEventHandler(ReceiveDesktopFrame);
            
            fAudioChannel = CreateChannel(PayloadType.xApplication3);
            fAudioChannel.FrameReceivedEvent += new RtpStream.FrameReceivedEventHandler(ReceiveAudioFrame);
            
            fVideoChannel = CreateChannel(PayloadType.xApplication4);
            fVideoChannel.FrameReceivedEvent += new RtpStream.FrameReceivedEventHandler(ReceiveVideoFrame);

            // Wait until the channels are ready
            // to send before proceeding
            do
            {
                Thread.Sleep(10);
            } while (!fDesktopChannel.IsReadyToSend && !fAudioChannel.IsReadyToSend && !fVideoChannel.IsReadyToSend);

        }
コード例 #14
0
ファイル: SketchWindow.cs プロジェクト: Wiladams/NewTOAPIA
 protected virtual void AddChannels()
 {
     // Add the channel for graphics commands
     fSketchChannel = fSession.CreateChannel(PayloadType.Whiteboard);
     fGraphicsChannel = new GraphicsChannel(fRetainedGraphPort, fSketchChannel);
 }
コード例 #15
0
ファイル: MiniSnapper.cs プロジェクト: Wiladams/NewTOAPIA
        public SnapperWindow(int x, int y, int width, int height)
            : base("Snap N Share", 10, 10, 640, 480)
        {
            // Show a form so we can capture the desired group IP and port number
            ServerForm groupForm = new ServerForm();
            //IPAddress randomAddress = NewTOAPIA.Net.Utility.GetRandomMulticastAddress();
            //groupForm.groupAddressField.Text = randomAddress.ToString();
            groupForm.ShowDialog();

            // Get the address and port from the form
            fUseGray = groupForm.checkBox1.Checked;
            string groupIP = groupForm.groupAddressField.Text;
            int groupPort = int.Parse(groupForm.groupPortField.Text);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            // Set our title to the address specified so the user
            // can easily identify their session.
            Title = "SnapNShare - " + ipep.ToString();
            
            fSnapper = new ScreenSnapper();

            fClientOrigin = new POINT();
            int pwidth = ClientRectangle.Width;
            int pheight = ClientRectangle.Height;
            fScreenImage = new GDIDIBSection(width, height, BitCount.Bits24);
            fGrayImage = new PixelArray<Lumb>(width, height,fScreenImage.Orientation, new Lumb());

            BackgroundColor = RGBColor.White;
            this.Opacity = 0.5;

            // Create the MultiSession object so we can send stuff out to a group
            //fSession = new MultiSession(Guid.NewGuid().ToString(), ipep);
            fSession = new MultiSession(ipep, Guid.NewGuid().ToString(), "William", true, true, null);

            // Add the channel for graphics commands
            PayloadChannel payloadChannel = fSession.CreateChannel(PayloadType.dynamicPresentation);
            fCommandDispatcher = new GraphPortChunkEncoder(payloadChannel);

            fUserIOChannel = fSession.CreateChannel(PayloadType.xApplication2);
            //fUserIOEncoder = new UserIOChannelEncoder(fUserIOChannel);
            //fUserIODecoder = new UserIOChannelDecoder(fUserIOChannel);
            //fUserIODecoder.MouseActivityEvent += new MouseActivityEventHandler(fUserIODecoder_MouseActivityEvent);
            //fUserIODecoder.KeyboardActivityEvent += new KeyboardActivityEventHandler(fUserIODecoder_KeyboardActivityEvent);

            // Start the thread that will take snapshots of the screen
            fGlobalTimer = new PrecisionTimer();
            fFrameRate = 2; // Frames per second
            fSnapperRunning = true;
            snapperThread = new Thread(RunSnaps);
            snapperThread.Start();
        }
コード例 #16
0
 public UserIOChannelDecoder(PayloadChannel commandChannel)
 {
     fCommandChannel = commandChannel;
     fCommandChannel.FrameReceivedEvent += FrameReceived;
 }
コード例 #17
0
 public GraphPortChunkEncoder(PayloadChannel aChannel)
 {
     fCollaborationChannel = aChannel;
 }