pbos@webrtc.org | dc8c883 | 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 | |
| 11 | #include "webrtc/video_engine/test/common/video_renderer.h" |
| 12 | |
| 13 | #include "webrtc/modules/video_capture/include/video_capture_factory.h" |
| 14 | #include "webrtc/video_engine/new_include/video_send_stream.h" |
| 15 | |
| 16 | #ifdef WEBRTC_TEST_XV |
| 17 | #include "webrtc/video_engine/test/common/linux/xv_renderer.h" |
| 18 | #endif // WEBRTC_TEST_XV |
| 19 | |
| 20 | // Platform-specific renderers preferred over NullRenderer |
| 21 | #ifdef WEBRTC_TEST_GLX |
| 22 | #include "webrtc/video_engine/test/common/linux/glx_renderer.h" |
| 23 | #endif // WEBRTC_TEST_GLX |
| 24 | |
| 25 | // TODO(pbos): Mac renderer |
| 26 | // TODO(pbos): Windows renderer |
| 27 | // TODO(pbos): Android renderer |
| 28 | |
| 29 | namespace webrtc { |
| 30 | namespace test { |
| 31 | |
| 32 | class NullRenderer : public VideoRenderer { |
| 33 | virtual void RenderFrame(const I420VideoFrame& video_frame, |
| 34 | int time_to_render_ms) OVERRIDE {} |
| 35 | }; |
| 36 | |
pbos@webrtc.org | 3d6a8bf | 2013-05-23 12:20:16 +0000 | [diff] [blame^] | 37 | VideoRenderer* VideoRenderer::Create(const char* window_title, |
| 38 | size_t width, |
| 39 | size_t height) { |
pbos@webrtc.org | dc8c883 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 40 | #ifdef WEBRTC_TEST_XV |
| 41 | XvRenderer* xv_renderer = XvRenderer::Create(window_title, width, height); |
| 42 | if (xv_renderer != NULL) { |
| 43 | return xv_renderer; |
| 44 | } |
| 45 | #endif // WEBRTC_TEST_XV |
| 46 | #ifdef WEBRTC_TEST_GLX |
| 47 | GlxRenderer* glx_renderer = GlxRenderer::Create(window_title, width, height); |
| 48 | if (glx_renderer != NULL) { |
| 49 | return glx_renderer; |
| 50 | } |
| 51 | #endif // WEBRTC_TEST_GLX |
| 52 | |
| 53 | // Avoid initialized-but-not-referenced errors when only building a |
| 54 | // NullRenderer |
| 55 | (void) width; |
| 56 | (void) height; |
| 57 | |
| 58 | return new NullRenderer(); |
| 59 | } |
| 60 | } // test |
| 61 | } // webrtc |