| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BASE_TEXT_RENDERER_H_ | 5 #ifndef MEDIA_BASE_TEXT_RENDERER_H_ | 
| 6 #define MEDIA_BASE_TEXT_RENDERER_H_ | 6 #define MEDIA_BASE_TEXT_RENDERER_H_ | 
| 7 | 7 | 
| 8 #include <map> | 8 #include <map> | 
|  | 9 #include <memory> | 
| 9 #include <set> | 10 #include <set> | 
| 10 | 11 | 
| 11 #include "base/callback.h" | 12 #include "base/callback.h" | 
| 12 #include "base/macros.h" | 13 #include "base/macros.h" | 
| 13 #include "base/memory/scoped_ptr.h" |  | 
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" | 
| 15 #include "media/base/demuxer_stream.h" | 15 #include "media/base/demuxer_stream.h" | 
| 16 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" | 
| 17 #include "media/base/pipeline_status.h" | 17 #include "media/base/pipeline_status.h" | 
| 18 #include "media/base/text_ranges.h" | 18 #include "media/base/text_ranges.h" | 
| 19 #include "media/base/text_track.h" | 19 #include "media/base/text_track.h" | 
| 20 | 20 | 
| 21 namespace base { | 21 namespace base { | 
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; | 
| 23 } | 23 } | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 69   bool HasTracks() const; | 69   bool HasTracks() const; | 
| 70 | 70 | 
| 71  private: | 71  private: | 
| 72   struct TextTrackState { | 72   struct TextTrackState { | 
| 73     // To determine read progress. | 73     // To determine read progress. | 
| 74     enum ReadState { | 74     enum ReadState { | 
| 75       kReadIdle, | 75       kReadIdle, | 
| 76       kReadPending | 76       kReadPending | 
| 77     }; | 77     }; | 
| 78 | 78 | 
| 79     explicit TextTrackState(scoped_ptr<TextTrack> text_track); | 79     explicit TextTrackState(std::unique_ptr<TextTrack> text_track); | 
| 80     ~TextTrackState(); | 80     ~TextTrackState(); | 
| 81 | 81 | 
| 82     ReadState read_state; | 82     ReadState read_state; | 
| 83     scoped_ptr<TextTrack> text_track; | 83     std::unique_ptr<TextTrack> text_track; | 
| 84     TextRanges text_ranges_; | 84     TextRanges text_ranges_; | 
| 85   }; | 85   }; | 
| 86 | 86 | 
| 87   // Callback delivered by the demuxer |text_stream| when | 87   // Callback delivered by the demuxer |text_stream| when | 
| 88   // a read from the stream completes. | 88   // a read from the stream completes. | 
| 89   void BufferReady(DemuxerStream* text_stream, | 89   void BufferReady(DemuxerStream* text_stream, | 
| 90                    DemuxerStream::Status status, | 90                    DemuxerStream::Status status, | 
| 91                    const scoped_refptr<DecoderBuffer>& input); | 91                    const scoped_refptr<DecoderBuffer>& input); | 
| 92 | 92 | 
| 93   // Dispatches the decoded cue delivered on the demuxer's |text_stream|. | 93   // Dispatches the decoded cue delivered on the demuxer's |text_stream|. | 
| 94   void CueReady(DemuxerStream* text_stream, | 94   void CueReady(DemuxerStream* text_stream, | 
| 95                 const scoped_refptr<TextCue>& text_cue); | 95                 const scoped_refptr<TextCue>& text_cue); | 
| 96 | 96 | 
| 97   // Dispatched when the AddTextTrackCB completes, after having created | 97   // Dispatched when the AddTextTrackCB completes, after having created | 
| 98   // the TextTrack object associated with |text_stream|. | 98   // the TextTrack object associated with |text_stream|. | 
| 99   void OnAddTextTrackDone(DemuxerStream* text_stream, | 99   void OnAddTextTrackDone(DemuxerStream* text_stream, | 
| 100                           scoped_ptr<TextTrack> text_track); | 100                           std::unique_ptr<TextTrack> text_track); | 
| 101 | 101 | 
| 102   // Utility function to post a read request on |text_stream|. | 102   // Utility function to post a read request on |text_stream|. | 
| 103   void Read(TextTrackState* state, DemuxerStream* text_stream); | 103   void Read(TextTrackState* state, DemuxerStream* text_stream); | 
| 104 | 104 | 
| 105   scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 105   scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 
| 106   const AddTextTrackCB add_text_track_cb_; | 106   const AddTextTrackCB add_text_track_cb_; | 
| 107 | 107 | 
| 108   // Callbacks provided during Initialize(). | 108   // Callbacks provided during Initialize(). | 
| 109   base::Closure ended_cb_; | 109   base::Closure ended_cb_; | 
| 110 | 110 | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 133 | 133 | 
| 134   // NOTE: Weak pointers must be invalidated before all other member variables. | 134   // NOTE: Weak pointers must be invalidated before all other member variables. | 
| 135   base::WeakPtrFactory<TextRenderer> weak_factory_; | 135   base::WeakPtrFactory<TextRenderer> weak_factory_; | 
| 136 | 136 | 
| 137   DISALLOW_IMPLICIT_CONSTRUCTORS(TextRenderer); | 137   DISALLOW_IMPLICIT_CONSTRUCTORS(TextRenderer); | 
| 138 }; | 138 }; | 
| 139 | 139 | 
| 140 }  // namespace media | 140 }  // namespace media | 
| 141 | 141 | 
| 142 #endif  // MEDIA_BASE_TEXT_RENDERER_H_ | 142 #endif  // MEDIA_BASE_TEXT_RENDERER_H_ | 
| OLD | NEW | 
|---|