| 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 | |
| 94 // Returns true if one more decode request can be submitted to the decoder. | 91 // Returns true if one more decode request can be submitted to the decoder. |
| 95 bool CanDecodeMore() const; | 92 bool CanDecodeMore() const; |
| 96 | 93 |
| 97 // Allows callers to register for notification of splice buffers from the | 94 // Allows callers to register for notification of splice buffers from the |
| 98 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). | 95 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). |
| 99 // | 96 // |
| 100 // The observer will be notified of all buffers with a splice_timestamp() and | 97 // The observer will be notified of all buffers with a splice_timestamp() and |
| 101 // the first buffer after which has a splice_timestamp() of kNoTimestamp(). | 98 // the first buffer after which has a splice_timestamp() of kNoTimestamp(). |
| 102 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; | 99 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; |
| 103 void set_splice_observer(const SpliceObserverCB& splice_observer) { | 100 void set_splice_observer(const SpliceObserverCB& splice_observer) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 const scoped_refptr<Output>& output); | 134 const scoped_refptr<Output>& output); |
| 138 | 135 |
| 139 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). | 136 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). |
| 140 void Decode(const scoped_refptr<DecoderBuffer>& buffer); | 137 void Decode(const scoped_refptr<DecoderBuffer>& buffer); |
| 141 | 138 |
| 142 // Flushes the decoder with an EOS buffer to retrieve internally buffered | 139 // Flushes the decoder with an EOS buffer to retrieve internally buffered |
| 143 // decoder output. | 140 // decoder output. |
| 144 void FlushDecoder(); | 141 void FlushDecoder(); |
| 145 | 142 |
| 146 // Callback for Decoder::Decode(). | 143 // Callback for Decoder::Decode(). |
| 147 void OnDecodeDone(int buffer_size, bool end_of_stream, DecoderStatus status); | 144 void OnDecodeOutputReady(int buffer_size, |
| 148 | 145 DecoderStatus status, |
| 149 // Output callback passed to Decoder::Initialize(). | 146 const scoped_refptr<Output>& output); |
| 150 void OnDecodeOutputReady(const scoped_refptr<Output>& output); | |
| 151 | 147 |
| 152 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). | 148 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). |
| 153 void ReadFromDemuxerStream(); | 149 void ReadFromDemuxerStream(); |
| 154 | 150 |
| 155 // Callback for DemuxerStream::Read(). | 151 // Callback for DemuxerStream::Read(). |
| 156 void OnBufferReady(DemuxerStream::Status status, | 152 void OnBufferReady(DemuxerStream::Status status, |
| 157 const scoped_refptr<DecoderBuffer>& buffer); | 153 const scoped_refptr<DecoderBuffer>& buffer); |
| 158 | 154 |
| 159 void ReinitializeDecoder(); | 155 void ReinitializeDecoder(); |
| 160 | 156 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 201 |
| 206 // This is required so the VideoFrameStream can access private members in | 202 // This is required so the VideoFrameStream can access private members in |
| 207 // FinishInitialization() and ReportStatistics(). | 203 // FinishInitialization() and ReportStatistics(). |
| 208 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); | 204 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); |
| 209 }; | 205 }; |
| 210 | 206 |
| 211 template <> | 207 template <> |
| 212 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; | 208 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; |
| 213 | 209 |
| 214 template <> | 210 template <> |
| 215 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 211 bool DecoderStream<DemuxerStream::AUDIO>::CanDecodeMore() const; |
| 216 | 212 |
| 217 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 213 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
| 218 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 214 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
| 219 | 215 |
| 220 } // namespace media | 216 } // namespace media |
| 221 | 217 |
| 222 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 218 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
| OLD | NEW |