Index: media/filters/text_decoder_impl.h |
diff --git a/media/filters/text_decoder_impl.h b/media/filters/text_decoder_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cb9b5749ff1a182465fe9356257617ac74f3ba8f |
--- /dev/null |
+++ b/media/filters/text_decoder_impl.h |
@@ -0,0 +1,51 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_FILTERS_TEXT_DECODER_IMPL_H_ |
+#define MEDIA_FILTERS_TEXT_DECODER_IMPL_H_ |
+ |
+#include <map> |
+ |
+#include "base/memory/weak_ptr.h" |
+#include "media/base/demuxer_stream.h" |
+#include "media/base/text_decoder.h" |
+ |
+namespace base { |
+class MessageLoopProxy; |
+} |
+ |
+namespace media { |
+ |
+class MEDIA_EXPORT TextDecoderImpl : public TextDecoder { |
+ public: |
+ explicit TextDecoderImpl( |
+ const scoped_refptr<base::MessageLoopProxy>& message_loop); |
+ virtual ~TextDecoderImpl(); |
+ |
+ // TextDecoder implementation. |
+ virtual void Initialize() OVERRIDE; |
+ virtual void Read(DemuxerStream* stream, const ReadCB& read_cb) OVERRIDE; |
+ |
+ private: |
+ // Callback delivered by the demuxer |text_stream| when |
+ // a read from the stream completes. |
+ void BufferReady(DemuxerStream* text_stream, |
+ DemuxerStream::Status status, |
+ const scoped_refptr<DecoderBuffer>& input); |
+ |
+ scoped_refptr<base::MessageLoopProxy> message_loop_; |
+ base::WeakPtrFactory<TextDecoderImpl> weak_factory_; |
+ base::WeakPtr<TextDecoderImpl> weak_this_; |
+ |
+ // Holds the callbacks for the read requests made by |
+ // the downstream text renderer. |
+ typedef std::map<DemuxerStream*, ReadCB> ReadCallbacks; |
+ ReadCallbacks read_callbacks_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TextDecoderImpl); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_FILTERS_TEXT_DECODER_IMPL_H_ |