| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 CarbonVideoRenderer that implements the abstract class | 11 // Definition of class CarbonVideoRenderer that implements the abstract class |
| 12 // cricket::VideoRenderer via Carbon. | 12 // cricket::VideoRenderer via Carbon. |
| 13 | 13 |
| 14 #ifndef WEBRTC_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ | 14 #ifndef WEBRTC_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ |
| 15 #define WEBRTC_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ | 15 #define WEBRTC_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ |
| 16 | 16 |
| 17 #include <memory> |
| 18 |
| 17 #include <Carbon/Carbon.h> | 19 #include <Carbon/Carbon.h> |
| 18 | 20 |
| 19 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
| 20 #include "webrtc/base/scoped_ptr.h" | |
| 21 #include "webrtc/media/base/videorenderer.h" | 22 #include "webrtc/media/base/videorenderer.h" |
| 22 | 23 |
| 23 namespace cricket { | 24 namespace cricket { |
| 24 | 25 |
| 25 class CarbonVideoRenderer : public VideoRenderer { | 26 class CarbonVideoRenderer : public VideoRenderer { |
| 26 public: | 27 public: |
| 27 CarbonVideoRenderer(int x, int y); | 28 CarbonVideoRenderer(int x, int y); |
| 28 virtual ~CarbonVideoRenderer(); | 29 virtual ~CarbonVideoRenderer(); |
| 29 | 30 |
| 30 // Implementation of pure virtual methods of VideoRenderer. | 31 // Implementation of pure virtual methods of VideoRenderer. |
| 31 // These two methods may be executed in different threads. | 32 // These two methods may be executed in different threads. |
| 32 // SetSize is called before RenderFrame. | 33 // SetSize is called before RenderFrame. |
| 33 virtual bool SetSize(int width, int height, int reserved); | 34 virtual bool SetSize(int width, int height, int reserved); |
| 34 virtual bool RenderFrame(const VideoFrame* frame); | 35 virtual bool RenderFrame(const VideoFrame* frame); |
| 35 | 36 |
| 36 // Needs to be called on the main thread. | 37 // Needs to be called on the main thread. |
| 37 bool Initialize(); | 38 bool Initialize(); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 bool DrawFrame(); | 41 bool DrawFrame(); |
| 41 | 42 |
| 42 static OSStatus DrawEventHandler(EventHandlerCallRef handler, | 43 static OSStatus DrawEventHandler(EventHandlerCallRef handler, |
| 43 EventRef event, | 44 EventRef event, |
| 44 void* data); | 45 void* data); |
| 45 rtc::scoped_ptr<uint8_t[]> image_; | 46 std::unique_ptr<uint8_t[]> image_; |
| 46 rtc::CriticalSection image_crit_; | 47 rtc::CriticalSection image_crit_; |
| 47 int image_width_; | 48 int image_width_; |
| 48 int image_height_; | 49 int image_height_; |
| 49 int x_; | 50 int x_; |
| 50 int y_; | 51 int y_; |
| 51 WindowRef window_ref_; | 52 WindowRef window_ref_; |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace cricket | 55 } // namespace cricket |
| 55 | 56 |
| 56 #endif // WEBRTC_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ | 57 #endif // WEBRTC_MEDIA_DEVICES_CARBONVIDEORENDERER_H_ |
| OLD | NEW |