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_FFMPEG_TEXT_DECODER_H_ |
| 6 #define MEDIA_FILTERS_FFMPEG_TEXT_DECODER_H_ |
| 7 |
| 8 #include <vector> |
| 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 FFmpegTextDecoder : public TextDecoder { |
| 21 public: |
| 22 explicit FFmpegTextDecoder( |
| 23 const scoped_refptr<base::MessageLoopProxy>& message_loop); |
| 24 virtual ~FFmpegTextDecoder(); |
| 25 |
| 26 // TextDecoder implementation. |
| 27 virtual void Initialize(Demuxer* demuxer) OVERRIDE; |
| 28 virtual void Read(int index, const ReadCB& read_cb) OVERRIDE; |
| 29 |
| 30 private: |
| 31 // Callback delivered by the demuxer stream at |index| when |
| 32 // a read from the stream completes. |
| 33 void BufferReady(int index, |
| 34 DemuxerStream::Status status, |
| 35 const scoped_refptr<DecoderBuffer>& input); |
| 36 |
| 37 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 38 base::WeakPtrFactory<FFmpegTextDecoder> weak_factory_; |
| 39 base::WeakPtr<FFmpegTextDecoder> weak_this_; |
| 40 |
| 41 // All the demuxer streams having type TEXT. The index |
| 42 // position matches its index position in the demuxer. |
| 43 // Index positions of streams that are not TEXT streams |
| 44 // are set to NULL. |
| 45 std::vector<DemuxerStream*> demuxer_streams_; |
| 46 |
| 47 // Holds the callbacks for the read requests made by |
| 48 // the downstream text renderer. |
| 49 std::vector<ReadCB> read_callbacks_; |
| 50 |
| 51 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegTextDecoder); |
| 52 }; |
| 53 |
| 54 } // namespace media |
| 55 |
| 56 #endif // MEDIA_FILTERS_FFMPEG_TEXT_DECODER_H_ |
OLD | NEW |