OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FILTERS_CHUNK_DEMUXER_H_ | 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
7 | 7 |
8 #include <list> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "media/base/byte_queue.h" | 14 #include "media/base/byte_queue.h" |
15 #include "media/base/demuxer.h" | 15 #include "media/base/demuxer.h" |
16 #include "media/base/stream_parser.h" | 16 #include "media/base/stream_parser.h" |
17 #include "media/filters/source_buffer_stream.h" | 17 #include "media/filters/source_buffer_stream.h" |
18 | 18 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Returns true if any stream has seeked to a time without buffered data. | 106 // Returns true if any stream has seeked to a time without buffered data. |
107 bool IsSeekPending_Locked() const; | 107 bool IsSeekPending_Locked() const; |
108 | 108 |
109 // Returns true if all streams can successfully call EndOfStream, | 109 // Returns true if all streams can successfully call EndOfStream, |
110 // false if any can not. | 110 // false if any can not. |
111 bool CanEndOfStream_Locked() const; | 111 bool CanEndOfStream_Locked() const; |
112 | 112 |
113 // StreamParser callbacks. | 113 // StreamParser callbacks. |
114 void OnStreamParserInitDone(bool success, base::TimeDelta duration); | 114 void OnStreamParserInitDone(bool success, base::TimeDelta duration); |
115 bool OnNewConfigs(const AudioDecoderConfig& audio_config, | 115 bool OnNewConfigs(bool has_audio, bool has_video, |
| 116 const AudioDecoderConfig& audio_config, |
116 const VideoDecoderConfig& video_config); | 117 const VideoDecoderConfig& video_config); |
117 bool OnAudioBuffers(const StreamParser::BufferQueue& buffers); | 118 bool OnAudioBuffers(const StreamParser::BufferQueue& buffers); |
118 bool OnVideoBuffers(const StreamParser::BufferQueue& buffers); | 119 bool OnVideoBuffers(const StreamParser::BufferQueue& buffers); |
119 bool OnKeyNeeded(scoped_array<uint8> init_data, int init_data_size); | 120 bool OnKeyNeeded(scoped_array<uint8> init_data, int init_data_size); |
120 | 121 |
121 mutable base::Lock lock_; | 122 mutable base::Lock lock_; |
122 State state_; | 123 State state_; |
123 | 124 |
124 DemuxerHost* host_; | 125 DemuxerHost* host_; |
125 ChunkDemuxerClient* client_; | 126 ChunkDemuxerClient* client_; |
126 PipelineStatusCB init_cb_; | 127 PipelineStatusCB init_cb_; |
127 PipelineStatusCB seek_cb_; | 128 PipelineStatusCB seek_cb_; |
128 | 129 |
129 scoped_refptr<ChunkDemuxerStream> audio_; | 130 scoped_refptr<ChunkDemuxerStream> audio_; |
130 scoped_refptr<ChunkDemuxerStream> video_; | 131 scoped_refptr<ChunkDemuxerStream> video_; |
131 | 132 |
132 int64 buffered_bytes_; | 133 int64 buffered_bytes_; |
133 | 134 |
134 base::TimeDelta duration_; | 135 base::TimeDelta duration_; |
135 | 136 |
136 scoped_ptr<StreamParser> stream_parser_; | 137 typedef std::map<std::string, StreamParser*> StreamParserMap; |
| 138 StreamParserMap stream_parser_map_; |
137 | 139 |
138 // TODO(annacc): Remove these when fixing: http://crbug.com/122909 | 140 // Used to ensure that (1) config data matches the type and codec provided in |
139 // Used to ensure config data matches the type and codec provided in AddId(). | 141 // AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be |
140 bool has_audio_; | 142 // removed with RemoveID() but can not be re-added (yet). |
141 bool has_video_; | 143 std::string source_id_audio_; |
142 | 144 std::string source_id_video_; |
143 // TODO(acolwell): Remove this when fixing http://crbug.com/122909 | |
144 std::string source_id_; | |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 146 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
147 }; | 147 }; |
148 | 148 |
149 } // namespace media | 149 } // namespace media |
150 | 150 |
151 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 151 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |