OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROMECAST_MEDIA_CMA_BASE_FRAME_GENERATOR_FOR_TEST_H_ | |
6 #define CHROMECAST_MEDIA_CMA_BASE_FRAME_GENERATOR_FOR_TEST_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/time/time.h" | |
12 | |
13 namespace chromecast { | |
14 namespace media { | |
15 class DecoderBufferBase; | |
16 | |
17 class FrameGeneratorForTest { | |
18 public: | |
19 // Parameters used to generate frames. | |
20 struct FrameSpec { | |
21 FrameSpec(); | |
22 ~FrameSpec(); | |
23 | |
24 // Indicates whether the frame comes with a new decoder configuration. | |
25 bool has_config; | |
26 | |
27 bool is_eos; | |
28 base::TimeDelta timestamp; | |
29 bool has_decrypt_config; | |
30 size_t size; | |
31 }; | |
32 | |
33 explicit FrameGeneratorForTest(const std::vector<FrameSpec> frame_specs); | |
34 ~FrameGeneratorForTest(); | |
35 | |
36 // Indicates whether the next frame should come with a new decoder config. | |
37 bool HasDecoderConfig() const; | |
38 | |
39 // Generates a frame. | |
40 // Returns NULL is there is no frame left to generate. | |
41 scoped_refptr<DecoderBufferBase> Generate(); | |
42 | |
43 // Number of frames not generated yet. | |
44 size_t RemainingFrameCount() const; | |
45 | |
46 private: | |
47 std::vector<FrameSpec> frame_specs_; | |
48 size_t frame_idx_; | |
49 | |
50 // Total size of A/V buffers generated so far. | |
51 size_t total_buffer_size_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(FrameGeneratorForTest); | |
54 }; | |
55 | |
56 } // namespace media | |
57 } // namespace chromecast | |
58 | |
59 #endif // CHROMECAST_MEDIA_CMA_BASE_TEST_FRAME_GENERATOR_H_ | |
OLD | NEW |