Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Unified Diff: media/filters/text_decoder_impl.h

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: incorporate aaron's comments (9/28) Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698