OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_DECODER_STREAM_H_ | 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_H_ |
6 #define MEDIA_FILTERS_DECODER_STREAM_H_ | 6 #define MEDIA_FILTERS_DECODER_STREAM_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // it is stopped. This method can be called at any time but not during another | 81 // it is stopped. This method can be called at any time but not during another |
82 // pending Stop(). | 82 // pending Stop(). |
83 void Stop(const base::Closure& closure); | 83 void Stop(const base::Closure& closure); |
84 | 84 |
85 // Returns true if the decoder currently has the ability to decode and return | 85 // Returns true if the decoder currently has the ability to decode and return |
86 // an Output. | 86 // an Output. |
87 // TODO(rileya): Remove the need for this by refactoring Decoder queueing | 87 // TODO(rileya): Remove the need for this by refactoring Decoder queueing |
88 // behavior. | 88 // behavior. |
89 bool CanReadWithoutStalling() const; | 89 bool CanReadWithoutStalling() const; |
90 | 90 |
| 91 // Returns maximum concurrent decode requests for the current |decoder_|. |
| 92 int GetMaxDecodeRequests() const; |
| 93 |
91 // Returns true if one more decode request can be submitted to the decoder. | 94 // Returns true if one more decode request can be submitted to the decoder. |
92 bool CanDecodeMore() const; | 95 bool CanDecodeMore() const; |
93 | 96 |
94 // Allows callers to register for notification of splice buffers from the | 97 // Allows callers to register for notification of splice buffers from the |
95 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). | 98 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). |
96 // | 99 // |
97 // The observer will be notified of all buffers with a splice_timestamp() and | 100 // The observer will be notified of all buffers with a splice_timestamp() and |
98 // the first buffer after which has a splice_timestamp() of kNoTimestamp(). | 101 // the first buffer after which has a splice_timestamp() of kNoTimestamp(). |
99 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; | 102 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; |
100 void set_splice_observer(const SpliceObserverCB& splice_observer) { | 103 void set_splice_observer(const SpliceObserverCB& splice_observer) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const scoped_refptr<Output>& output); | 137 const scoped_refptr<Output>& output); |
135 | 138 |
136 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). | 139 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). |
137 void Decode(const scoped_refptr<DecoderBuffer>& buffer); | 140 void Decode(const scoped_refptr<DecoderBuffer>& buffer); |
138 | 141 |
139 // Flushes the decoder with an EOS buffer to retrieve internally buffered | 142 // Flushes the decoder with an EOS buffer to retrieve internally buffered |
140 // decoder output. | 143 // decoder output. |
141 void FlushDecoder(); | 144 void FlushDecoder(); |
142 | 145 |
143 // Callback for Decoder::Decode(). | 146 // Callback for Decoder::Decode(). |
144 void OnDecodeOutputReady(int buffer_size, | 147 void OnDecodeDone(int buffer_size, bool end_of_stream, DecoderStatus status); |
145 DecoderStatus status, | 148 |
146 const scoped_refptr<Output>& output); | 149 // Output callback passed to Decoder::Initialize(). |
| 150 void OnDecodeOutputReady(const scoped_refptr<Output>& output); |
147 | 151 |
148 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). | 152 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). |
149 void ReadFromDemuxerStream(); | 153 void ReadFromDemuxerStream(); |
150 | 154 |
151 // Callback for DemuxerStream::Read(). | 155 // Callback for DemuxerStream::Read(). |
152 void OnBufferReady(DemuxerStream::Status status, | 156 void OnBufferReady(DemuxerStream::Status status, |
153 const scoped_refptr<DecoderBuffer>& buffer); | 157 const scoped_refptr<DecoderBuffer>& buffer); |
154 | 158 |
155 void ReinitializeDecoder(); | 159 void ReinitializeDecoder(); |
156 | 160 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 205 |
202 // This is required so the VideoFrameStream can access private members in | 206 // This is required so the VideoFrameStream can access private members in |
203 // FinishInitialization() and ReportStatistics(). | 207 // FinishInitialization() and ReportStatistics(). |
204 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); | 208 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); |
205 }; | 209 }; |
206 | 210 |
207 template <> | 211 template <> |
208 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; | 212 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; |
209 | 213 |
210 template <> | 214 template <> |
211 bool DecoderStream<DemuxerStream::AUDIO>::CanDecodeMore() const; | 215 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
212 | 216 |
213 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 217 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
214 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 218 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
215 | 219 |
216 } // namespace media | 220 } // namespace media |
217 | 221 |
218 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 222 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
OLD | NEW |