pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef TEST_FAKE_DECODER_H_ |
| 12 | #define TEST_FAKE_DECODER_H_ |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 16 | #include "modules/video_coding/include/video_codec_interface.h" |
| 17 | #include "system_wrappers/include/clock.h" |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | namespace test { |
| 21 | |
| 22 | class FakeDecoder : public VideoDecoder { |
| 23 | public: |
| 24 | FakeDecoder(); |
stefan@webrtc.org | 79c3359 | 2014-08-06 09:24:53 | [diff] [blame] | 25 | virtual ~FakeDecoder() {} |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 26 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 27 | int32_t InitDecode(const VideoCodec* config, |
| 28 | int32_t number_of_cores) override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 29 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 30 | int32_t Decode(const EncodedImage& input, |
| 31 | bool missing_frames, |
| 32 | const RTPFragmentationHeader* fragmentation, |
| 33 | const CodecSpecificInfo* codec_specific_info, |
| 34 | int64_t render_time_ms) override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 35 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 36 | int32_t RegisterDecodeCompleteCallback( |
| 37 | DecodedImageCallback* callback) override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 38 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 39 | int32_t Release() override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 40 | |
Peter Boström | b7d9a97 | 2015-12-18 15:01:11 | [diff] [blame] | 41 | const char* ImplementationName() const override; |
| 42 | |
| 43 | static const char* kImplementationName; |
| 44 | |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 45 | private: |
| 46 | VideoCodec config_; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 47 | DecodedImageCallback* callback_; |
| 48 | }; |
stefan@webrtc.org | 79c3359 | 2014-08-06 09:24:53 | [diff] [blame] | 49 | |
| 50 | class FakeH264Decoder : public FakeDecoder { |
| 51 | public: |
| 52 | virtual ~FakeH264Decoder() {} |
| 53 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 54 | int32_t Decode(const EncodedImage& input, |
| 55 | bool missing_frames, |
| 56 | const RTPFragmentationHeader* fragmentation, |
| 57 | const CodecSpecificInfo* codec_specific_info, |
| 58 | int64_t render_time_ms) override; |
| 59 | }; |
| 60 | |
| 61 | class FakeNullDecoder : public FakeDecoder { |
| 62 | public: |
| 63 | virtual ~FakeNullDecoder() {} |
| 64 | |
| 65 | int32_t Decode(const EncodedImage& input, |
| 66 | bool missing_frames, |
| 67 | const RTPFragmentationHeader* fragmentation, |
| 68 | const CodecSpecificInfo* codec_specific_info, |
| 69 | int64_t render_time_ms) override { |
| 70 | return 0; |
| 71 | } |
stefan@webrtc.org | 79c3359 | 2014-08-06 09:24:53 | [diff] [blame] | 72 | }; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 73 | } // namespace test |
| 74 | } // namespace webrtc |
| 75 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 76 | #endif // TEST_FAKE_DECODER_H_ |