blob: 61dacf065f3b7f9193e8bf76f8e87637a2334722 [file] [log] [blame]
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef TEST_FAKE_DECODER_H_
12#define TEST_FAKE_DECODER_H_
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000013
14#include <vector>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "modules/video_coding/include/video_codec_interface.h"
17#include "system_wrappers/include/clock.h"
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000018
19namespace webrtc {
20namespace test {
21
22class FakeDecoder : public VideoDecoder {
23 public:
24 FakeDecoder();
stefan@webrtc.org79c33592014-08-06 09:24:53 +000025 virtual ~FakeDecoder() {}
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000026
stefan@webrtc.org48ac2262015-03-02 16:18:56 +000027 int32_t InitDecode(const VideoCodec* config,
28 int32_t number_of_cores) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000029
stefan@webrtc.org48ac2262015-03-02 16:18:56 +000030 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.org0181b5f2013-09-09 08:26:30 +000035
stefan@webrtc.org48ac2262015-03-02 16:18:56 +000036 int32_t RegisterDecodeCompleteCallback(
37 DecodedImageCallback* callback) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000038
stefan@webrtc.org48ac2262015-03-02 16:18:56 +000039 int32_t Release() override;
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000040
Peter Boströmb7d9a972015-12-18 16:01:11 +010041 const char* ImplementationName() const override;
42
43 static const char* kImplementationName;
44
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000045 private:
46 VideoCodec config_;
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000047 DecodedImageCallback* callback_;
48};
stefan@webrtc.org79c33592014-08-06 09:24:53 +000049
50class FakeH264Decoder : public FakeDecoder {
51 public:
52 virtual ~FakeH264Decoder() {}
53
stefan@webrtc.org48ac2262015-03-02 16:18:56 +000054 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
61class 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.org79c33592014-08-06 09:24:53 +000072};
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000073} // namespace test
74} // namespace webrtc
75
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020076#endif // TEST_FAKE_DECODER_H_