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_LINUX_MAIN_WND_H_ | 11 #ifndef WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ |
12 #define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ | 12 #define WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "webrtc/examples/peerconnection/client/main_wnd.h" | 17 #include "webrtc/examples/peerconnection/client/main_wnd.h" |
18 #include "webrtc/examples/peerconnection/client/peer_connection_client.h" | 18 #include "webrtc/examples/peerconnection/client/peer_connection_client.h" |
19 | 19 |
20 // Forward declarations. | 20 // Forward declarations. |
21 typedef struct _GtkWidget GtkWidget; | 21 typedef struct _GtkWidget GtkWidget; |
22 typedef union _GdkEvent GdkEvent; | 22 typedef union _GdkEvent GdkEvent; |
23 typedef struct _GdkEventKey GdkEventKey; | 23 typedef struct _GdkEventKey GdkEventKey; |
24 typedef struct _GtkTreeView GtkTreeView; | 24 typedef struct _GtkTreeView GtkTreeView; |
25 typedef struct _GtkTreePath GtkTreePath; | 25 typedef struct _GtkTreePath GtkTreePath; |
26 typedef struct _GtkTreeViewColumn GtkTreeViewColumn; | 26 typedef struct _GtkTreeViewColumn GtkTreeViewColumn; |
| 27 typedef struct _cairo cairo_t; |
27 | 28 |
28 // Implements the main UI of the peer connection client. | 29 // Implements the main UI of the peer connection client. |
29 // This is functionally equivalent to the MainWnd class in the Windows | 30 // This is functionally equivalent to the MainWnd class in the Windows |
30 // implementation. | 31 // implementation. |
31 class GtkMainWnd : public MainWindow { | 32 class GtkMainWnd : public MainWindow { |
32 public: | 33 public: |
33 GtkMainWnd(const char* server, int port, bool autoconnect, bool autocall); | 34 GtkMainWnd(const char* server, int port, bool autoconnect, bool autocall); |
34 ~GtkMainWnd(); | 35 ~GtkMainWnd(); |
35 | 36 |
36 virtual void RegisterObserver(MainWndCallback* callback); | 37 virtual void RegisterObserver(MainWndCallback* callback); |
(...skipping 27 matching lines...) Expand all Loading... |
64 // Callback for keystrokes. Used to capture Esc and Return. | 65 // Callback for keystrokes. Used to capture Esc and Return. |
65 void OnKeyPress(GtkWidget* widget, GdkEventKey* key); | 66 void OnKeyPress(GtkWidget* widget, GdkEventKey* key); |
66 | 67 |
67 // Callback when the user double clicks a peer in order to initiate a | 68 // Callback when the user double clicks a peer in order to initiate a |
68 // connection. | 69 // connection. |
69 void OnRowActivated(GtkTreeView* tree_view, GtkTreePath* path, | 70 void OnRowActivated(GtkTreeView* tree_view, GtkTreePath* path, |
70 GtkTreeViewColumn* column); | 71 GtkTreeViewColumn* column); |
71 | 72 |
72 void OnRedraw(); | 73 void OnRedraw(); |
73 | 74 |
| 75 void Draw(GtkWidget* widget, cairo_t* cr); |
| 76 |
74 protected: | 77 protected: |
75 class VideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 78 class VideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
76 public: | 79 public: |
77 VideoRenderer(GtkMainWnd* main_wnd, | 80 VideoRenderer(GtkMainWnd* main_wnd, |
78 webrtc::VideoTrackInterface* track_to_render); | 81 webrtc::VideoTrackInterface* track_to_render); |
79 virtual ~VideoRenderer(); | 82 virtual ~VideoRenderer(); |
80 | 83 |
81 // VideoSinkInterface implementation | 84 // VideoSinkInterface implementation |
82 void OnFrame(const webrtc::VideoFrame& frame) override; | 85 void OnFrame(const webrtc::VideoFrame& frame) override; |
83 | 86 |
(...skipping 23 matching lines...) Expand all Loading... |
107 GtkWidget* server_edit_; | 110 GtkWidget* server_edit_; |
108 GtkWidget* port_edit_; | 111 GtkWidget* port_edit_; |
109 GtkWidget* peer_list_; // The list of peers. | 112 GtkWidget* peer_list_; // The list of peers. |
110 MainWndCallback* callback_; | 113 MainWndCallback* callback_; |
111 std::string server_; | 114 std::string server_; |
112 std::string port_; | 115 std::string port_; |
113 bool autoconnect_; | 116 bool autoconnect_; |
114 bool autocall_; | 117 bool autocall_; |
115 std::unique_ptr<VideoRenderer> local_renderer_; | 118 std::unique_ptr<VideoRenderer> local_renderer_; |
116 std::unique_ptr<VideoRenderer> remote_renderer_; | 119 std::unique_ptr<VideoRenderer> remote_renderer_; |
| 120 int width_; |
| 121 int height_; |
117 std::unique_ptr<uint8_t[]> draw_buffer_; | 122 std::unique_ptr<uint8_t[]> draw_buffer_; |
118 int draw_buffer_size_; | 123 int draw_buffer_size_; |
119 }; | 124 }; |
120 | 125 |
121 #endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ | 126 #endif // WEBRTC_EXAMPLES_PEERCONNECTION_CLIENT_LINUX_MAIN_WND_H_ |
OLD | NEW |