[MediaRouter] Update MR-2-Extension's PostMessage to return boolean.
[chromium-blink-merge.git] / chromecast / media / cma / test / frame_generator_for_test.h
blobc3e3f57b6b1d6b01d36741c76ee080a2c7ad56af
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.
5 #ifndef CHROMECAST_MEDIA_CMA_TEST_FRAME_GENERATOR_FOR_TEST_H_
6 #define CHROMECAST_MEDIA_CMA_TEST_FRAME_GENERATOR_FOR_TEST_H_
8 #include <vector>
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
13 namespace chromecast {
14 namespace media {
15 class DecoderBufferBase;
17 class FrameGeneratorForTest {
18 public:
19 // Parameters used to generate frames.
20 struct FrameSpec {
21 FrameSpec();
22 ~FrameSpec();
24 // Indicates whether the frame comes with a new decoder configuration.
25 bool has_config;
27 bool is_eos;
28 base::TimeDelta timestamp;
29 bool has_decrypt_config;
30 size_t size;
33 explicit FrameGeneratorForTest(const std::vector<FrameSpec> frame_specs);
34 ~FrameGeneratorForTest();
36 // Indicates whether the next frame should come with a new decoder config.
37 bool HasDecoderConfig() const;
39 // Generates a frame.
40 // Returns NULL is there is no frame left to generate.
41 scoped_refptr<DecoderBufferBase> Generate();
43 // Number of frames not generated yet.
44 size_t RemainingFrameCount() const;
46 private:
47 std::vector<FrameSpec> frame_specs_;
48 size_t frame_idx_;
50 // Total size of A/V buffers generated so far.
51 size_t total_buffer_size_;
53 DISALLOW_COPY_AND_ASSIGN(FrameGeneratorForTest);
56 } // namespace media
57 } // namespace chromecast
59 #endif // CHROMECAST_MEDIA_CMA_TEST_TEST_FRAME_GENERATOR_H_