1c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org/* 2c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 3c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * 4c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * Use of this source code is governed by a BSD-style license 5c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * that can be found in the LICENSE file in the root of the source 6c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * tree. An additional intellectual property rights grant can be found 7c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * in the file PATENTS. All contributing project authors may 8c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org */ 10c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_ 11c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_ 12c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 132f02da89501237cefea455cf31a1553125f62ad7pbos@webrtc.org#include "webrtc/system_wrappers/interface/scoped_ptr.h" 1424e2089750e9e51228b82d6c7ebf4fa064c797bapbos@webrtc.org#include "webrtc/test/video_capturer.h" 15c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org#include "webrtc/typedefs.h" 16c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 17c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.orgnamespace webrtc { 18c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 19c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.orgclass CriticalSectionWrapper; 202f02da89501237cefea455cf31a1553125f62ad7pbos@webrtc.orgclass EventWrapper; 21c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.orgclass ThreadWrapper; 22c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 23c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.orgnamespace test { 24c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 25c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.orgclass FrameGenerator; 26c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 27c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.orgclass FrameGeneratorCapturer : public VideoCapturer { 28c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org public: 29c1797061756f40b9b1f3f3e82fc040ce18ecd43cpbos@webrtc.org static FrameGeneratorCapturer* Create(VideoSendStreamInput* input, 3028631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org size_t width, 3128631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org size_t height, 3228631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org int target_fps, 3328631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org Clock* clock); 3428631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org 3528631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org static FrameGeneratorCapturer* CreateFromYuvFile(VideoSendStreamInput* input, 3628631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org const char* file_name, 3728631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org size_t width, 3828631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org size_t height, 3928631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org int target_fps, 4028631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org Clock* clock); 41c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org virtual ~FrameGeneratorCapturer(); 42c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 43c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org virtual void Start() OVERRIDE; 44c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org virtual void Stop() OVERRIDE; 45c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 46093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org int64_t first_frame_capture_time() const { return first_frame_capture_time_; } 47093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org 48c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org private: 4928631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org FrameGeneratorCapturer(Clock* clock, 5028631e76cf7bcb40532069eecfe65f6290c05cd4andresp@webrtc.org VideoSendStreamInput* input, 51c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org FrameGenerator* frame_generator, 522f02da89501237cefea455cf31a1553125f62ad7pbos@webrtc.org int target_fps); 53c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org bool Init(); 54c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org void InsertFrame(); 55c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org static bool Run(void* obj); 56c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 57c476e64d056c5e342bc5b23eecd493abf6d85d7fpbos@webrtc.org Clock* const clock_; 58c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org bool sending_; 59c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 602f02da89501237cefea455cf31a1553125f62ad7pbos@webrtc.org scoped_ptr<EventWrapper> tick_; 612f02da89501237cefea455cf31a1553125f62ad7pbos@webrtc.org scoped_ptr<CriticalSectionWrapper> lock_; 622f02da89501237cefea455cf31a1553125f62ad7pbos@webrtc.org scoped_ptr<ThreadWrapper> thread_; 637deb3351eab29ad7a89db0237a9e3ebbc04b1058pbos@webrtc.org scoped_ptr<FrameGenerator> frame_generator_; 64c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 65c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org int target_fps_; 66093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org 67093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org int64_t first_frame_capture_time_; 68c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org}; 69c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org} // test 70c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org} // webrtc 71c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org 72c1506a215f1376938c91459abeb1cd05201df278pbos@webrtc.org#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_ 73