pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 | |
pbos@webrtc.org | 281cff8 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 11 | #include "webrtc/video_engine/test/common/video_capturer.h" |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 12 | |
pbos@webrtc.org | e835019 | 2013-07-10 15:02:02 +0000 | [diff] [blame] | 13 | #include "webrtc/test/testsupport/fileutils.h" |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 14 | #include "webrtc/video_engine/test/common/file_capturer.h" |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 15 | #include "webrtc/video_engine/test/common/frame_generator.h" |
| 16 | #include "webrtc/video_engine/test/common/frame_generator_capturer.h" |
| 17 | #include "webrtc/video_engine/test/common/vcm_capturer.h" |
| 18 | |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 19 | namespace webrtc { |
| 20 | namespace test { |
| 21 | |
| 22 | class NullCapturer : public VideoCapturer { |
| 23 | public: |
| 24 | NullCapturer() : VideoCapturer(NULL) {} |
| 25 | virtual ~NullCapturer() {} |
| 26 | |
| 27 | virtual void Start() {} |
| 28 | virtual void Stop() {} |
| 29 | }; |
| 30 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 31 | VideoCapturer::VideoCapturer(VideoSendStreamInput* input) |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 32 | : input_(input) {} |
| 33 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 34 | VideoCapturer* VideoCapturer::Create(VideoSendStreamInput* input, |
pbos@webrtc.org | 074eb20 | 2013-05-23 12:20:16 +0000 | [diff] [blame] | 35 | size_t width, |
| 36 | size_t height, |
pbos@webrtc.org | e3e4615 | 2013-05-29 15:13:12 +0000 | [diff] [blame] | 37 | int fps, |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 38 | Clock* clock) { |
pbos@webrtc.org | 074eb20 | 2013-05-23 12:20:16 +0000 | [diff] [blame] | 39 | VcmCapturer* vcm_capturer = VcmCapturer::Create(input, width, height, fps); |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 40 | |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 41 | if (vcm_capturer != NULL) { |
| 42 | return vcm_capturer; |
| 43 | } |
| 44 | // TODO(pbos): Log a warning that this failed. |
| 45 | |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 46 | FrameGeneratorCapturer* frame_generator_capturer = |
| 47 | FrameGeneratorCapturer::Create( |
pbos@webrtc.org | 2f02da8 | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 48 | input, FrameGenerator::Create(width, height, clock), fps); |
pbos@webrtc.org | c1506a2 | 2013-05-29 13:41:03 +0000 | [diff] [blame] | 49 | if (frame_generator_capturer != NULL) { |
| 50 | return frame_generator_capturer; |
| 51 | } |
| 52 | // TODO(pbos): Log a warning that this failed. |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 53 | |
| 54 | return new NullCapturer(); |
| 55 | } |
| 56 | } // test |
| 57 | } // webrtc |