| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // have been removed from AudioDecoder and plumbed elsewhere. | 91 // have been removed from AudioDecoder and plumbed elsewhere. |
| 92 Decoder* decoder() { return decoder_.get(); } | 92 Decoder* decoder() { return decoder_.get(); } |
| 93 | 93 |
| 94 // Allows callers to register for notification of splice buffers from the | 94 // Allows callers to register for notification of splice buffers from the |
| 95 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). | 95 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). |
| 96 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; | 96 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; |
| 97 void set_splice_observer(const SpliceObserverCB& splice_observer) { | 97 void set_splice_observer(const SpliceObserverCB& splice_observer) { |
| 98 splice_observer_cb_ = splice_observer; | 98 splice_observer_cb_ = splice_observer; |
| 99 } | 99 } |
| 100 | 100 |
| 101 // Allows callers to register for notification of config changes; this is |
| 102 // called immediately after recieving the 'kConfigChanged' status from the |
| 103 // DemuxerStream, before any action is taken to handle the config change. |
| 104 typedef base::Closure ConfigChangeObserverCB; |
| 105 void set_config_change_observer( |
| 106 const ConfigChangeObserverCB& config_change_observer) { |
| 107 config_change_observer_cb_ = config_change_observer; |
| 108 } |
| 109 |
| 101 private: | 110 private: |
| 102 enum State { | 111 enum State { |
| 103 STATE_UNINITIALIZED, | 112 STATE_UNINITIALIZED, |
| 104 STATE_INITIALIZING, | 113 STATE_INITIALIZING, |
| 105 STATE_NORMAL, // Includes idle, pending decoder decode/reset/stop. | 114 STATE_NORMAL, // Includes idle, pending decoder decode/reset/stop. |
| 106 STATE_FLUSHING_DECODER, | 115 STATE_FLUSHING_DECODER, |
| 107 STATE_PENDING_DEMUXER_READ, | 116 STATE_PENDING_DEMUXER_READ, |
| 108 STATE_REINITIALIZING_DECODER, | 117 STATE_REINITIALIZING_DECODER, |
| 109 STATE_STOPPED, | 118 STATE_STOPPED, |
| 110 STATE_ERROR | 119 STATE_ERROR |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 176 |
| 168 DemuxerStream* stream_; | 177 DemuxerStream* stream_; |
| 169 | 178 |
| 170 scoped_ptr<DecoderSelector<StreamType> > decoder_selector_; | 179 scoped_ptr<DecoderSelector<StreamType> > decoder_selector_; |
| 171 | 180 |
| 172 // These two will be set by DecoderSelector::SelectDecoder(). | 181 // These two will be set by DecoderSelector::SelectDecoder(). |
| 173 scoped_ptr<Decoder> decoder_; | 182 scoped_ptr<Decoder> decoder_; |
| 174 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; | 183 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; |
| 175 | 184 |
| 176 SpliceObserverCB splice_observer_cb_; | 185 SpliceObserverCB splice_observer_cb_; |
| 186 ConfigChangeObserverCB config_change_observer_cb_; |
| 177 | 187 |
| 178 // NOTE: Weak pointers must be invalidated before all other member variables. | 188 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 179 base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_; | 189 base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_; |
| 180 | 190 |
| 181 // This is required so the VideoFrameStream can access private members in | 191 // This is required so the VideoFrameStream can access private members in |
| 182 // FinishInitialization() and ReportStatistics(). | 192 // FinishInitialization() and ReportStatistics(). |
| 183 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); | 193 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); |
| 184 }; | 194 }; |
| 185 | 195 |
| 186 template <> | 196 template <> |
| 187 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; | 197 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; |
| 188 | 198 |
| 189 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 199 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
| 190 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 200 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
| 191 | 201 |
| 192 } // namespace media | 202 } // namespace media |
| 193 | 203 |
| 194 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 204 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
| OLD | NEW |