| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 // Definition of class GtkVideoRenderer that implements the abstract class | 11 // Definition of class GtkVideoRenderer that implements the abstract class |
| 12 // cricket::VideoRenderer via GTK. | 12 // cricket::VideoRenderer via GTK. |
| 13 | 13 |
| 14 #ifndef WEBRTC_MEDIA_DEVICES_GTKVIDEORENDERER_H_ | 14 #ifndef WEBRTC_MEDIA_DEVICES_GTKVIDEORENDERER_H_ |
| 15 #define WEBRTC_MEDIA_DEVICES_GTKVIDEORENDERER_H_ | 15 #define WEBRTC_MEDIA_DEVICES_GTKVIDEORENDERER_H_ |
| 16 | 16 |
| 17 #include <memory> | 17 #include <memory> |
| 18 | 18 |
| 19 #include "webrtc/base/basictypes.h" | 19 #include "webrtc/base/basictypes.h" |
| 20 // TODO(nisse): Temporarily; to be replaced with a forward declaration | |
| 21 // of webrtc::VideoFrame when dependency on cricket::VideoFrame is deleted. | |
| 22 #include "webrtc/media/base/videoframe.h" | |
| 23 #include "webrtc/media/base/videosinkinterface.h" | 20 #include "webrtc/media/base/videosinkinterface.h" |
| 24 | 21 |
| 25 typedef struct _GtkWidget GtkWidget; // forward declaration, defined in gtk.h | 22 typedef struct _GtkWidget GtkWidget; // forward declaration, defined in gtk.h |
| 23 namespace webrtc { |
| 24 class VideoFrame; |
| 25 } |
| 26 | 26 |
| 27 namespace cricket { | 27 namespace cricket { |
| 28 | 28 |
| 29 class GtkVideoRenderer : public rtc::VideoSinkInterface<VideoFrame> { | 29 class GtkVideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
| 30 public: | 30 public: |
| 31 GtkVideoRenderer(int x, int y); | 31 GtkVideoRenderer(int x, int y); |
| 32 virtual ~GtkVideoRenderer(); | 32 virtual ~GtkVideoRenderer(); |
| 33 | 33 |
| 34 // Implementation of VideoSinkInterface. | 34 // Implementation of VideoSinkInterface. |
| 35 void OnFrame(const VideoFrame& frame) override; | 35 void OnFrame(const webrtc::VideoFrame& frame) override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 bool SetSize(int width, int height); | 38 bool SetSize(int width, int height); |
| 39 // Initialize the attributes when the first frame arrives. | 39 // Initialize the attributes when the first frame arrives. |
| 40 bool Initialize(int width, int height); | 40 bool Initialize(int width, int height); |
| 41 // Pump the Gtk event loop until there are no events left. | 41 // Pump the Gtk event loop until there are no events left. |
| 42 void Pump(); | 42 void Pump(); |
| 43 // Check if the window has been closed. | 43 // Check if the window has been closed. |
| 44 bool IsClosed() const; | 44 bool IsClosed() const; |
| 45 | 45 |
| 46 std::unique_ptr<uint8_t[]> image_; | 46 std::unique_ptr<uint8_t[]> image_; |
| 47 GtkWidget* window_; | 47 GtkWidget* window_; |
| 48 GtkWidget* draw_area_; | 48 GtkWidget* draw_area_; |
| 49 // The initial position of the window. | 49 // The initial position of the window. |
| 50 int initial_x_; | 50 int initial_x_; |
| 51 int initial_y_; | 51 int initial_y_; |
| 52 | 52 |
| 53 int width_; | 53 int width_; |
| 54 int height_; | 54 int height_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace cricket | 57 } // namespace cricket |
| 58 | 58 |
| 59 #endif // WEBRTC_MEDIA_DEVICES_GTKVIDEORENDERER_H_ | 59 #endif // WEBRTC_MEDIA_DEVICES_GTKVIDEORENDERER_H_ |
| OLD | NEW |