Re-enable index-basics-workers test to see if still times
[chromium-blink-merge.git] / media / filters / fake_demuxer_stream.h
blob1b20ba7b6c36657575a2dbd3032cbd03c34a5326
1 // Copyright (c) 2013 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 MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_
6 #define MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "media/base/audio_decoder_config.h"
11 #include "media/base/demuxer_stream.h"
12 #include "media/base/media_export.h"
13 #include "media/base/video_decoder_config.h"
15 namespace base {
16 class MessageLoopProxy;
17 } // namespace base
19 namespace media {
21 class MEDIA_EXPORT FakeDemuxerStream : public DemuxerStream {
22 public:
23 // Constructs an object that outputs |num_configs| different configs in
24 // sequence with |num_frames_in_one_config| buffers for each config. The
25 // output buffers are encrypted if |is_encrypted| is true.
26 FakeDemuxerStream(int num_configs,
27 int num_buffers_in_one_config,
28 bool is_encrypted);
29 virtual ~FakeDemuxerStream();
31 // DemuxerStream implementation.
32 virtual void Read(const ReadCB& read_cb) OVERRIDE;
33 virtual const AudioDecoderConfig& audio_decoder_config() OVERRIDE;
34 virtual const VideoDecoderConfig& video_decoder_config() OVERRIDE;
35 virtual Type type() OVERRIDE;
36 virtual void EnableBitstreamConverter() OVERRIDE;
38 // Upon the next read, holds the read callback until SatisfyRead() or Reset()
39 // is called.
40 void HoldNextRead();
42 // Satisfies the pending read with the next scheduled status and buffer.
43 void SatisfyRead();
45 // Satisfies the pending read (if any) with kAborted and NULL. This call
46 // always clears |hold_next_read_|.
47 void Reset();
49 private:
50 void UpdateVideoDecoderConfig();
51 void DoRead();
53 scoped_refptr<base::MessageLoopProxy> message_loop_;
55 int num_configs_left_;
56 int num_buffers_in_one_config_;
57 bool is_encrypted_;
59 // Number of frames left with the current decoder config.
60 int num_buffers_left_in_current_config_;
62 base::TimeDelta current_timestamp_;
63 base::TimeDelta duration_;
65 AudioDecoderConfig audio_decoder_config_;
67 gfx::Size next_coded_size_;
68 VideoDecoderConfig video_decoder_config_;
70 ReadCB read_cb_;
71 bool hold_next_read_;
73 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream);
76 } // namespace media
78 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_