OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 buffer_queue_.clear(); | 142 buffer_queue_.clear(); |
143 } | 143 } |
144 | 144 |
145 void FFmpegDemuxerStream::Stop() { | 145 void FFmpegDemuxerStream::Stop() { |
146 DCHECK_EQ(MessageLoop::current(), demuxer_->message_loop()); | 146 DCHECK_EQ(MessageLoop::current(), demuxer_->message_loop()); |
147 buffer_queue_.clear(); | 147 buffer_queue_.clear(); |
148 STLDeleteElements(&read_queue_); | 148 STLDeleteElements(&read_queue_); |
149 stopped_ = true; | 149 stopped_ = true; |
150 } | 150 } |
151 | 151 |
| 152 base::TimeDelta FFmpegDemuxerStream::duration() { |
| 153 return duration_; |
| 154 } |
| 155 |
152 const MediaFormat& FFmpegDemuxerStream::media_format() { | 156 const MediaFormat& FFmpegDemuxerStream::media_format() { |
153 return media_format_; | 157 return media_format_; |
154 } | 158 } |
155 | 159 |
156 void FFmpegDemuxerStream::Read(Callback1<Buffer*>::Type* read_callback) { | 160 void FFmpegDemuxerStream::Read(Callback1<Buffer*>::Type* read_callback) { |
157 DCHECK(read_callback); | 161 DCHECK(read_callback); |
158 demuxer_->message_loop()->PostTask(FROM_HERE, | 162 demuxer_->message_loop()->PostTask(FROM_HERE, |
159 NewRunnableMethod(this, &FFmpegDemuxerStream::ReadTask, read_callback)); | 163 NewRunnableMethod(this, &FFmpegDemuxerStream::ReadTask, read_callback)); |
160 } | 164 } |
161 | 165 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 filter_name = "vc1_asftoannexg"; | 216 filter_name = "vc1_asftoannexg"; |
213 } | 217 } |
214 | 218 |
215 if (filter_name) { | 219 if (filter_name) { |
216 bitstream_converter_.reset( | 220 bitstream_converter_.reset( |
217 new FFmpegBitstreamConverter(filter_name, stream_->codec)); | 221 new FFmpegBitstreamConverter(filter_name, stream_->codec)); |
218 CHECK(bitstream_converter_->Initialize()); | 222 CHECK(bitstream_converter_->Initialize()); |
219 } | 223 } |
220 } | 224 } |
221 | 225 |
| 226 AVStream* FFmpegDemuxerStream::GetAVStream() { |
| 227 return stream_; |
| 228 } |
| 229 |
222 // static | 230 // static |
223 base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( | 231 base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( |
224 const AVRational& time_base, int64 timestamp) { | 232 const AVRational& time_base, int64 timestamp) { |
225 if (timestamp == static_cast<int64>(AV_NOPTS_VALUE)) | 233 if (timestamp == static_cast<int64>(AV_NOPTS_VALUE)) |
226 return kNoTimestamp; | 234 return kNoTimestamp; |
227 | 235 |
228 return ConvertTimestamp(time_base, timestamp); | 236 return ConvertTimestamp(time_base, timestamp); |
229 } | 237 } |
230 | 238 |
231 // | 239 // |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 read_event_.Wait(); | 614 read_event_.Wait(); |
607 return last_read_bytes_; | 615 return last_read_bytes_; |
608 } | 616 } |
609 | 617 |
610 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 618 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
611 last_read_bytes_ = size; | 619 last_read_bytes_ = size; |
612 read_event_.Signal(); | 620 read_event_.Signal(); |
613 } | 621 } |
614 | 622 |
615 } // namespace media | 623 } // namespace media |
OLD | NEW |