OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef MEDIA_FILTERS_TEXT_DECODER_IMPL_H_ |
| 6 #define MEDIA_FILTERS_TEXT_DECODER_IMPL_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/demuxer_stream.h" |
| 12 #include "media/base/text_decoder.h" |
| 13 |
| 14 namespace base { |
| 15 class MessageLoopProxy; |
| 16 } |
| 17 |
| 18 namespace media { |
| 19 |
| 20 class MEDIA_EXPORT TextDecoderImpl : public TextDecoder { |
| 21 public: |
| 22 explicit TextDecoderImpl( |
| 23 const scoped_refptr<base::MessageLoopProxy>& message_loop); |
| 24 virtual ~TextDecoderImpl(); |
| 25 |
| 26 // TextDecoder implementation. |
| 27 virtual void Initialize() OVERRIDE; |
| 28 virtual void Read(DemuxerStream* stream, const ReadCB& read_cb) OVERRIDE; |
| 29 |
| 30 private: |
| 31 // Callback delivered by the demuxer |text_stream| when |
| 32 // a read from the stream completes. |
| 33 void BufferReady(DemuxerStream* text_stream, |
| 34 DemuxerStream::Status status, |
| 35 const scoped_refptr<DecoderBuffer>& input); |
| 36 |
| 37 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 38 base::WeakPtrFactory<TextDecoderImpl> weak_factory_; |
| 39 base::WeakPtr<TextDecoderImpl> weak_this_; |
| 40 |
| 41 // Holds the callbacks for the read requests made by |
| 42 // the downstream text renderer. |
| 43 typedef std::map<DemuxerStream*, ReadCB> ReadCallbacks; |
| 44 ReadCallbacks read_callbacks_; |
| 45 |
| 46 DISALLOW_IMPLICIT_CONSTRUCTORS(TextDecoderImpl); |
| 47 }; |
| 48 |
| 49 } // namespace media |
| 50 |
| 51 #endif // MEDIA_FILTERS_TEXT_DECODER_IMPL_H_ |
OLD | NEW |