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 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 cb_data->callback->UIThreadCallback(cb_data->msg_id, cb_data->data); | 109 cb_data->callback->UIThreadCallback(cb_data->msg_id, cb_data->data); |
110 delete cb_data; | 110 delete cb_data; |
111 return false; | 111 return false; |
112 } | 112 } |
113 | 113 |
114 gboolean Redraw(gpointer data) { | 114 gboolean Redraw(gpointer data) { |
115 GtkMainWnd* wnd = reinterpret_cast<GtkMainWnd*>(data); | 115 GtkMainWnd* wnd = reinterpret_cast<GtkMainWnd*>(data); |
116 wnd->OnRedraw(); | 116 wnd->OnRedraw(); |
117 return false; | 117 return false; |
118 } | 118 } |
119 } // end anonymous | 119 |
120 } // namespace | |
120 | 121 |
121 // | 122 // |
122 // GtkMainWnd implementation. | 123 // GtkMainWnd implementation. |
123 // | 124 // |
124 | 125 |
125 GtkMainWnd::GtkMainWnd(const char* server, int port, bool autoconnect, | 126 GtkMainWnd::GtkMainWnd(const char* server, int port, bool autoconnect, |
126 bool autocall) | 127 bool autocall) |
127 : window_(NULL), draw_area_(NULL), vbox_(NULL), server_edit_(NULL), | 128 : window_(NULL), draw_area_(NULL), vbox_(NULL), server_edit_(NULL), |
128 port_edit_(NULL), peer_list_(NULL), callback_(NULL), | 129 port_edit_(NULL), peer_list_(NULL), callback_(NULL), |
129 server_(server), autoconnect_(autoconnect), autocall_(autocall) { | 130 server_(server), autoconnect_(autoconnect), autocall_(autocall) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 | 168 |
168 | 169 |
169 void GtkMainWnd::StartLocalRenderer(webrtc::VideoTrackInterface* local_video) { | 170 void GtkMainWnd::StartLocalRenderer(webrtc::VideoTrackInterface* local_video) { |
170 local_renderer_.reset(new VideoRenderer(this, local_video)); | 171 local_renderer_.reset(new VideoRenderer(this, local_video)); |
171 } | 172 } |
172 | 173 |
173 void GtkMainWnd::StopLocalRenderer() { | 174 void GtkMainWnd::StopLocalRenderer() { |
174 local_renderer_.reset(); | 175 local_renderer_.reset(); |
175 } | 176 } |
176 | 177 |
177 void GtkMainWnd::StartRemoteRenderer(webrtc::VideoTrackInterface* remote_video) { | 178 void GtkMainWnd::StartRemoteRenderer( |
179 webrtc::VideoTrackInterface* remote_video) { | |
178 remote_renderer_.reset(new VideoRenderer(this, remote_video)); | 180 remote_renderer_.reset(new VideoRenderer(this, remote_video)); |
179 } | 181 } |
180 | 182 |
181 void GtkMainWnd::StopRemoteRenderer() { | 183 void GtkMainWnd::StopRemoteRenderer() { |
182 remote_renderer_.reset(); | 184 remote_renderer_.reset(); |
183 } | 185 } |
184 | 186 |
185 void GtkMainWnd::QueueUIThreadCallback(int msg_id, void* data) { | 187 void GtkMainWnd::QueueUIThreadCallback(int msg_id, void* data) { |
186 g_idle_add(HandleUIThreadCallback, | 188 g_idle_add(HandleUIThreadCallback, |
187 new UIThreadCallbackData(callback_, msg_id, data)); | 189 new UIThreadCallbackData(callback_, msg_id, data)); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 void GtkMainWnd::VideoRenderer::RenderFrame( | 483 void GtkMainWnd::VideoRenderer::RenderFrame( |
482 const cricket::VideoFrame* video_frame) { | 484 const cricket::VideoFrame* video_frame) { |
483 gdk_threads_enter(); | 485 gdk_threads_enter(); |
484 | 486 |
485 const cricket::VideoFrame* frame = video_frame->GetCopyWithRotationApplied(); | 487 const cricket::VideoFrame* frame = video_frame->GetCopyWithRotationApplied(); |
486 | 488 |
487 SetSize(static_cast<int>(frame->GetWidth()), | 489 SetSize(static_cast<int>(frame->GetWidth()), |
488 static_cast<int>(frame->GetHeight())); | 490 static_cast<int>(frame->GetHeight())); |
489 | 491 |
490 int size = width_ * height_ * 4; | 492 int size = width_ * height_ * 4; |
491 // TODO: Convert directly to RGBA | 493 // TODO: Convert directly to RGBA |
joachim
2015/12/08 23:23:44
This fails with "Missing username in TODO", who sh
kjellander_webrtc
2015/12/09 14:41:47
henrike in this case too.
| |
492 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, | 494 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, |
493 image_.get(), | 495 image_.get(), |
494 size, | 496 size, |
495 width_ * 4); | 497 width_ * 4); |
496 // Convert the B,G,R,A frame to R,G,B,A, which is accepted by GTK. | 498 // Convert the B,G,R,A frame to R,G,B,A, which is accepted by GTK. |
497 // The 'A' is just padding for GTK, so we can use it as temp. | 499 // The 'A' is just padding for GTK, so we can use it as temp. |
498 uint8_t* pix = image_.get(); | 500 uint8_t* pix = image_.get(); |
499 uint8_t* end = image_.get() + size; | 501 uint8_t* end = image_.get() + size; |
500 while (pix < end) { | 502 while (pix < end) { |
501 pix[3] = pix[0]; // Save B to A. | 503 pix[3] = pix[0]; // Save B to A. |
502 pix[0] = pix[2]; // Set Red. | 504 pix[0] = pix[2]; // Set Red. |
503 pix[2] = pix[3]; // Set Blue. | 505 pix[2] = pix[3]; // Set Blue. |
504 pix[3] = 0xFF; // Fixed Alpha. | 506 pix[3] = 0xFF; // Fixed Alpha. |
505 pix += 4; | 507 pix += 4; |
506 } | 508 } |
507 | 509 |
508 gdk_threads_leave(); | 510 gdk_threads_leave(); |
509 | 511 |
510 g_idle_add(Redraw, main_wnd_); | 512 g_idle_add(Redraw, main_wnd_); |
511 } | 513 } |
512 | 514 |
513 | 515 |
OLD | NEW |