OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ | 11 #ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ |
12 #define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ | 12 #define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ |
13 #pragma once | 13 #pragma once |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <string> | 17 #include <string> |
18 | 18 |
19 #include "webrtc/api/mediastreaminterface.h" | 19 #include "webrtc/api/mediastreaminterface.h" |
20 #include "webrtc/base/win32.h" | 20 #include "webrtc/base/win32.h" |
21 #include "webrtc/examples/peerconnection/client/peer_connection_client.h" | 21 #include "webrtc/examples/peerconnection/client/peer_connection_client.h" |
22 #include "webrtc/media/base/mediachannel.h" | 22 #include "webrtc/media/base/mediachannel.h" |
23 #include "webrtc/media/base/videocommon.h" | 23 #include "webrtc/media/base/videocommon.h" |
24 #include "webrtc/video_frame.h" | 24 #include "webrtc/media/base/videoframe.h" |
25 | 25 |
26 class MainWndCallback { | 26 class MainWndCallback { |
27 public: | 27 public: |
28 virtual void StartLogin(const std::string& server, int port) = 0; | 28 virtual void StartLogin(const std::string& server, int port) = 0; |
29 virtual void DisconnectFromServer() = 0; | 29 virtual void DisconnectFromServer() = 0; |
30 virtual void ConnectToPeer(int peer_id) = 0; | 30 virtual void ConnectToPeer(int peer_id) = 0; |
31 virtual void DisconnectFromCurrentPeer() = 0; | 31 virtual void DisconnectFromCurrentPeer() = 0; |
32 virtual void UIThreadCallback(int msg_id, void* data) = 0; | 32 virtual void UIThreadCallback(int msg_id, void* data) = 0; |
33 virtual void Close() = 0; | 33 virtual void Close() = 0; |
34 protected: | 34 protected: |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 virtual void StartLocalRenderer(webrtc::VideoTrackInterface* local_video); | 96 virtual void StartLocalRenderer(webrtc::VideoTrackInterface* local_video); |
97 virtual void StopLocalRenderer(); | 97 virtual void StopLocalRenderer(); |
98 virtual void StartRemoteRenderer(webrtc::VideoTrackInterface* remote_video); | 98 virtual void StartRemoteRenderer(webrtc::VideoTrackInterface* remote_video); |
99 virtual void StopRemoteRenderer(); | 99 virtual void StopRemoteRenderer(); |
100 | 100 |
101 virtual void QueueUIThreadCallback(int msg_id, void* data); | 101 virtual void QueueUIThreadCallback(int msg_id, void* data); |
102 | 102 |
103 HWND handle() const { return wnd_; } | 103 HWND handle() const { return wnd_; } |
104 | 104 |
105 class VideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 105 class VideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> { |
106 public: | 106 public: |
107 VideoRenderer(HWND wnd, int width, int height, | 107 VideoRenderer(HWND wnd, int width, int height, |
108 webrtc::VideoTrackInterface* track_to_render); | 108 webrtc::VideoTrackInterface* track_to_render); |
109 virtual ~VideoRenderer(); | 109 virtual ~VideoRenderer(); |
110 | 110 |
111 void Lock() { | 111 void Lock() { |
112 ::EnterCriticalSection(&buffer_lock_); | 112 ::EnterCriticalSection(&buffer_lock_); |
113 } | 113 } |
114 | 114 |
115 void Unlock() { | 115 void Unlock() { |
116 ::LeaveCriticalSection(&buffer_lock_); | 116 ::LeaveCriticalSection(&buffer_lock_); |
117 } | 117 } |
118 | 118 |
119 // VideoSinkInterface implementation | 119 // VideoSinkInterface implementation |
120 void OnFrame(const webrtc::VideoFrame& frame) override; | 120 void OnFrame(const cricket::VideoFrame& frame) override; |
121 | 121 |
122 const BITMAPINFO& bmi() const { return bmi_; } | 122 const BITMAPINFO& bmi() const { return bmi_; } |
123 const uint8_t* image() const { return image_.get(); } | 123 const uint8_t* image() const { return image_.get(); } |
124 | 124 |
125 protected: | 125 protected: |
126 void SetSize(int width, int height); | 126 void SetSize(int width, int height); |
127 | 127 |
128 enum { | 128 enum { |
129 SET_SIZE, | 129 SET_SIZE, |
130 RENDER_FRAME, | 130 RENDER_FRAME, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 MainWndCallback* callback_; | 193 MainWndCallback* callback_; |
194 static ATOM wnd_class_; | 194 static ATOM wnd_class_; |
195 std::string server_; | 195 std::string server_; |
196 std::string port_; | 196 std::string port_; |
197 bool auto_connect_; | 197 bool auto_connect_; |
198 bool auto_call_; | 198 bool auto_call_; |
199 }; | 199 }; |
200 #endif // WIN32 | 200 #endif // WIN32 |
201 | 201 |
202 #endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ | 202 #endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_MAIN_WND_H_ |
OLD | NEW |