15600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org/* 25600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 35600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * 45600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * Use of this source code is governed by a BSD-style license 55600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * that can be found in the LICENSE file in the root of the source 65600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * tree. An additional intellectual property rights grant can be found 75600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * in the file PATENTS. All contributing project authors may 85600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org * be found in the AUTHORS file in the root of the source tree. 95600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org */ 105600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org#ifndef WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_EXTERNAL_RENDER_H_ 115600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org#define WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_EXTERNAL_RENDER_H_ 125600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org 135600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org#include "webrtc/system_wrappers/interface/tick_util.h" 145600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org#include "webrtc/video_engine/include/vie_render.h" 155600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org 165600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.orgnamespace webrtc { 175600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org 185600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org// A render filter which passes frames directly to an external renderer. This 195600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org// is different from plugging the external renderer directly into the sending 205600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org// side since this will only run on frames that actually get sent and not on 215600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org// frames that only get captured. 225600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.orgclass ExternalRendererEffectFilter : public webrtc::ViEEffectFilter { 235600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org public: 245600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org explicit ExternalRendererEffectFilter(webrtc::ExternalRenderer* renderer) 255600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org : width_(0), height_(0), renderer_(renderer) {} 265600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org virtual ~ExternalRendererEffectFilter() {} 279d10769e109601915022fea44ec392645c3b0704wu@webrtc.org virtual int Transform(int size, 289d10769e109601915022fea44ec392645c3b0704wu@webrtc.org unsigned char* frame_buffer, 299d10769e109601915022fea44ec392645c3b0704wu@webrtc.org int64_t ntp_time_ms, 309d10769e109601915022fea44ec392645c3b0704wu@webrtc.org unsigned int timestamp, 319d10769e109601915022fea44ec392645c3b0704wu@webrtc.org unsigned int width, 325600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org unsigned int height) { 335600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org if (width != width_ || height_ != height) { 345600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org renderer_->FrameSizeChange(width, height, 1); 355600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org width_ = width; 365600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org height_ = height; 375600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org } 385600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org return renderer_->DeliverFrame(frame_buffer, 395600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org size, 409d10769e109601915022fea44ec392645c3b0704wu@webrtc.org ntp_time_ms, 419d10769e109601915022fea44ec392645c3b0704wu@webrtc.org timestamp, 42ea7b33ee032bd2d1528384e26ba079dee0d280fbwu@webrtc.org webrtc::TickTime::MillisecondTimestamp(), 43ea7b33ee032bd2d1528384e26ba079dee0d280fbwu@webrtc.org NULL); 445600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org } 455600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org 465600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org private: 475600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org unsigned int width_; 485600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org unsigned int height_; 495600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org webrtc::ExternalRenderer* renderer_; 505600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org}; 515600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org 525600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org} // namespace webrtc 535600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org 545600f6e86d3994726249fd1c77377c1d8534f107phoglund@webrtc.org#endif // WEBRTC_VIDEO_ENGINE_TEST_LIBVIETEST_INCLUDE_VIE_EXTERNAL_RENDER_H_ 55