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