- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / video_engine / test / libvietest / include / vie_external_render_filter.h
1 /*
2  *  Copyright (c) 2012 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 #ifndef WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_EXTERNAL_RENDER_H_
11 #define WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_EXTERNAL_RENDER_H_
12
13 #include "webrtc/system_wrappers/interface/tick_util.h"
14 #include "webrtc/video_engine/include/vie_render.h"
15
16 namespace webrtc {
17
18 // A render filter which passes frames directly to an external renderer. This
19 // is different from plugging the external renderer directly into the sending
20 // side since this will only run on frames that actually get sent and not on
21 // frames that only get captured.
22 class ExternalRendererEffectFilter : public webrtc::ViEEffectFilter {
23  public:
24   explicit ExternalRendererEffectFilter(webrtc::ExternalRenderer* renderer)
25       : width_(0), height_(0), renderer_(renderer) {}
26   virtual ~ExternalRendererEffectFilter() {}
27   virtual int Transform(int size, unsigned char* frame_buffer,
28                         unsigned int time_stamp90KHz, unsigned int width,
29                         unsigned int height) {
30     if (width != width_ || height_ != height) {
31       renderer_->FrameSizeChange(width, height, 1);
32       width_ = width;
33       height_ = height;
34     }
35     return renderer_->DeliverFrame(frame_buffer,
36                                    size,
37                                    time_stamp90KHz,
38                                    webrtc::TickTime::MillisecondTimestamp(),
39                                    NULL);
40   }
41
42  private:
43   unsigned int width_;
44   unsigned int height_;
45   webrtc::ExternalRenderer* renderer_;
46 };
47
48 }  // namespace webrtc
49
50 #endif  // WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_EXTERNAL_RENDER_H_