blob: d6f4f46e22e7d7e11942db1b5c4ffd01e27660e7 [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
11#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_DECODER_H_
12#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_DECODER_H_
13
14#include <vector>
15
Henrik Kjellander2557b862015-11-18 22:00:21 +010016#include "webrtc/modules/video_coding/include/video_codec_interface.h"
Henrik Kjellander98f53512015-10-28 18:17:40 +010017#include "webrtc/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;
40 int32_t Reset() override;
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000041
42 private:
43 VideoCodec config_;
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070044 VideoFrame frame_;
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000045 DecodedImageCallback* callback_;
46};
stefan@webrtc.org79c33592014-08-06 09:24:53 +000047
48class FakeH264Decoder : public FakeDecoder {
49 public:
50 virtual ~FakeH264Decoder() {}
51
stefan@webrtc.org48ac2262015-03-02 16:18:56 +000052 int32_t Decode(const EncodedImage& input,
53 bool missing_frames,
54 const RTPFragmentationHeader* fragmentation,
55 const CodecSpecificInfo* codec_specific_info,
56 int64_t render_time_ms) override;
57};
58
59class FakeNullDecoder : public FakeDecoder {
60 public:
61 virtual ~FakeNullDecoder() {}
62
63 int32_t Decode(const EncodedImage& input,
64 bool missing_frames,
65 const RTPFragmentationHeader* fragmentation,
66 const CodecSpecificInfo* codec_specific_info,
67 int64_t render_time_ms) override {
68 return 0;
69 }
stefan@webrtc.org79c33592014-08-06 09:24:53 +000070};
pbos@webrtc.org0181b5f2013-09-09 08:26:30 +000071} // namespace test
72} // namespace webrtc
73
74#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_DECODER_H_