| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_DEMUXER_STREAM_H_ | 5 #ifndef MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
| 6 #define MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ | 6 #define MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 int num_buffers_in_one_config, | 26 int num_buffers_in_one_config, |
| 27 bool is_encrypted); | 27 bool is_encrypted); |
| 28 virtual ~FakeDemuxerStream(); | 28 virtual ~FakeDemuxerStream(); |
| 29 | 29 |
| 30 // DemuxerStream implementation. | 30 // DemuxerStream implementation. |
| 31 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 31 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 32 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; | 32 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; |
| 33 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; | 33 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; |
| 34 virtual Type type() OVERRIDE; | 34 virtual Type type() OVERRIDE; |
| 35 virtual void EnableBitstreamConverter() OVERRIDE; | 35 virtual void EnableBitstreamConverter() OVERRIDE; |
| 36 virtual bool SupportsConfigChanges() OVERRIDE; |
| 36 | 37 |
| 37 int num_buffers_returned() const { return num_buffers_returned_; } | 38 int num_buffers_returned() const { return num_buffers_returned_; } |
| 38 | 39 |
| 39 // Upon the next read, holds the read callback until SatisfyRead() or Reset() | 40 // Upon the next read, holds the read callback until SatisfyRead() or Reset() |
| 40 // is called. | 41 // is called. |
| 41 void HoldNextRead(); | 42 void HoldNextRead(); |
| 42 | 43 |
| 43 // Upon the next config change read, holds the read callback until | 44 // Upon the next config change read, holds the read callback until |
| 44 // SatisfyRead() or Reset() is called. If there is no config change any more, | 45 // SatisfyRead() or Reset() is called. If there is no config change any more, |
| 45 // no read will be held. | 46 // no read will be held. |
| 46 void HoldNextConfigChangeRead(); | 47 void HoldNextConfigChangeRead(); |
| 47 | 48 |
| 48 // Satisfies the pending read with the next scheduled status and buffer. | 49 // Satisfies the pending read with the next scheduled status and buffer. |
| 49 void SatisfyRead(); | 50 void SatisfyRead(); |
| 50 | 51 |
| 51 // Satisfies the pending read (if any) with kAborted and NULL. This call | 52 // Satisfies the pending read (if any) with kAborted and NULL. This call |
| 52 // always clears |hold_next_read_|. | 53 // always clears |hold_next_read_|. |
| 53 void Reset(); | 54 void Reset(); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 void UpdateVideoDecoderConfig(); | 57 void UpdateVideoDecoderConfig(); |
| 57 void DoRead(); | 58 void DoRead(); |
| 58 | 59 |
| 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 60 | 61 |
| 61 int num_configs_left_; | 62 int num_configs_left_; |
| 62 int num_buffers_in_one_config_; | 63 int num_buffers_in_one_config_; |
| 64 bool config_changes_; |
| 63 bool is_encrypted_; | 65 bool is_encrypted_; |
| 64 | 66 |
| 65 // Number of frames left with the current decoder config. | 67 // Number of frames left with the current decoder config. |
| 66 int num_buffers_left_in_current_config_; | 68 int num_buffers_left_in_current_config_; |
| 67 | 69 |
| 68 int num_buffers_returned_; | 70 int num_buffers_returned_; |
| 69 | 71 |
| 70 base::TimeDelta current_timestamp_; | 72 base::TimeDelta current_timestamp_; |
| 71 base::TimeDelta duration_; | 73 base::TimeDelta duration_; |
| 72 | 74 |
| 73 gfx::Size next_coded_size_; | 75 gfx::Size next_coded_size_; |
| 74 VideoDecoderConfig video_decoder_config_; | 76 VideoDecoderConfig video_decoder_config_; |
| 75 | 77 |
| 76 ReadCB read_cb_; | 78 ReadCB read_cb_; |
| 77 | 79 |
| 78 int next_read_num_; | 80 int next_read_num_; |
| 79 // Zero-based number indicating which read operation should be held. -1 means | 81 // Zero-based number indicating which read operation should be held. -1 means |
| 80 // no read shall be held. | 82 // no read shall be held. |
| 81 int read_to_hold_; | 83 int read_to_hold_; |
| 82 | 84 |
| 83 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); | 85 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace media | 88 } // namespace media |
| 87 | 89 |
| 88 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ | 90 #endif // MEDIA_FILTERS_FAKE_DEMUXER_STREAM_H_ |
| OLD | NEW |