OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
26 } | 26 } |
27 | 27 |
28 namespace media { | 28 namespace media { |
29 | 29 |
30 class FakeVideoDecoder : public VideoDecoder { | 30 class FakeVideoDecoder : public VideoDecoder { |
31 public: | 31 public: |
32 // Constructs an object with a decoding delay of |decoding_delay| frames. | 32 // Constructs an object with a decoding delay of |decoding_delay| frames. |
33 explicit FakeVideoDecoder(int decoding_delay); | 33 explicit FakeVideoDecoder(int decoding_delay, |
| 34 bool supports_get_decode_output); |
34 virtual ~FakeVideoDecoder(); | 35 virtual ~FakeVideoDecoder(); |
35 | 36 |
36 // VideoDecoder implementation. | 37 // VideoDecoder implementation. |
37 virtual void Initialize(const VideoDecoderConfig& config, | 38 virtual void Initialize(const VideoDecoderConfig& config, |
38 const PipelineStatusCB& status_cb) OVERRIDE; | 39 const PipelineStatusCB& status_cb) OVERRIDE; |
39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 40 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
40 const DecodeCB& decode_cb) OVERRIDE; | 41 const DecodeCB& decode_cb) OVERRIDE; |
41 virtual void Reset(const base::Closure& closure) OVERRIDE; | 42 virtual void Reset(const base::Closure& closure) OVERRIDE; |
42 virtual void Stop(const base::Closure& closure) OVERRIDE; | 43 virtual void Stop(const base::Closure& closure) OVERRIDE; |
| 44 virtual scoped_refptr<VideoFrame> GetDecodeOutput() OVERRIDE; |
43 | 45 |
44 // Holds the next init/read/reset/stop callback from firing. | 46 // Holds the next init/read/reset/stop callback from firing. |
45 void HoldNextInit(); | 47 void HoldNextInit(); |
46 void HoldNextRead(); | 48 void HoldNextRead(); |
47 void HoldNextReset(); | 49 void HoldNextReset(); |
48 void HoldNextStop(); | 50 void HoldNextStop(); |
49 | 51 |
50 // Satisfies the pending init/read/reset/stop callback, which must be ready | 52 // Satisfies the pending init/read/reset/stop callback, which must be ready |
51 // to fire when these methods are called. | 53 // to fire when these methods are called. |
52 void SatisfyInit(); | 54 void SatisfyInit(); |
(...skipping 17 matching lines...) Expand all Loading... |
70 | 72 |
71 void DoReset(); | 73 void DoReset(); |
72 void DoStop(); | 74 void DoStop(); |
73 | 75 |
74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 76 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
75 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; | 77 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; |
76 base::WeakPtr<FakeVideoDecoder> weak_this_; | 78 base::WeakPtr<FakeVideoDecoder> weak_this_; |
77 | 79 |
78 const int decoding_delay_; | 80 const int decoding_delay_; |
79 | 81 |
| 82 bool supports_get_decode_output_; |
| 83 |
80 State state_; | 84 State state_; |
81 | 85 |
82 CallbackHolder<PipelineStatusCB> init_cb_; | 86 CallbackHolder<PipelineStatusCB> init_cb_; |
83 CallbackHolder<DecodeCB> decode_cb_; | 87 CallbackHolder<DecodeCB> decode_cb_; |
84 CallbackHolder<base::Closure> reset_cb_; | 88 CallbackHolder<base::Closure> reset_cb_; |
85 CallbackHolder<base::Closure> stop_cb_; | 89 CallbackHolder<base::Closure> stop_cb_; |
86 | 90 |
87 VideoDecoderConfig current_config_; | 91 VideoDecoderConfig current_config_; |
88 | 92 |
89 std::list<scoped_refptr<VideoFrame> > decoded_frames_; | 93 std::list<scoped_refptr<VideoFrame> > decoded_frames_; |
90 | 94 |
91 int total_bytes_decoded_; | 95 int total_bytes_decoded_; |
92 | 96 |
93 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); | 97 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); |
94 }; | 98 }; |
95 | 99 |
96 } // namespace media | 100 } // namespace media |
97 | 101 |
98 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 102 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
OLD | NEW |