OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implements a Demuxer that can switch among different data sources mid-stream. | 5 // Implements a Demuxer that can switch among different data sources mid-stream. |
6 // Uses FFmpegDemuxer under the covers, so see the caveats at the top of | 6 // Uses FFmpegDemuxer under the covers, so see the caveats at the top of |
7 // ffmpeg_demuxer.h. | 7 // ffmpeg_demuxer.h. |
8 | 8 |
9 #include "media/filters/chunk_demuxer.h" | 9 #include "media/filters/chunk_demuxer.h" |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "media/base/audio_decoder_config.h" | 14 #include "media/base/audio_decoder_config.h" |
15 #include "media/base/filter_host.h" | |
16 #include "media/base/data_buffer.h" | 15 #include "media/base/data_buffer.h" |
17 #include "media/base/video_decoder_config.h" | 16 #include "media/base/video_decoder_config.h" |
18 #include "media/ffmpeg/ffmpeg_common.h" | 17 #include "media/ffmpeg/ffmpeg_common.h" |
19 #include "media/filters/chunk_demuxer_client.h" | 18 #include "media/filters/chunk_demuxer_client.h" |
20 #include "media/filters/ffmpeg_glue.h" | 19 #include "media/filters/ffmpeg_glue.h" |
21 #include "media/filters/in_memory_url_protocol.h" | 20 #include "media/filters/in_memory_url_protocol.h" |
22 #include "media/webm/webm_cluster_parser.h" | 21 #include "media/webm/webm_cluster_parser.h" |
23 #include "media/webm/webm_constants.h" | 22 #include "media/webm/webm_constants.h" |
24 #include "media/webm/webm_info_parser.h" | 23 #include "media/webm/webm_info_parser.h" |
25 #include "media/webm/webm_tracks_parser.h" | 24 #include "media/webm/webm_tracks_parser.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 base::AutoLock auto_lock(lock_); | 315 base::AutoLock auto_lock(lock_); |
317 DCHECK_EQ(state_, WAITING_FOR_INIT); | 316 DCHECK_EQ(state_, WAITING_FOR_INIT); |
318 | 317 |
319 ChangeState_Locked(INITIALIZING); | 318 ChangeState_Locked(INITIALIZING); |
320 init_cb_ = cb; | 319 init_cb_ = cb; |
321 } | 320 } |
322 | 321 |
323 client_->DemuxerOpened(this); | 322 client_->DemuxerOpened(this); |
324 } | 323 } |
325 | 324 |
326 void ChunkDemuxer::set_host(FilterHost* filter_host) { | 325 void ChunkDemuxer::set_host(DemuxerHost* host) { |
327 DCHECK_EQ(state_, INITIALIZED); | 326 DCHECK_EQ(state_, INITIALIZED); |
328 Demuxer::set_host(filter_host); | 327 Demuxer::set_host(host); |
329 filter_host->SetDuration(duration_); | 328 host->SetDuration(duration_); |
330 filter_host->SetCurrentReadPosition(0); | 329 host->SetCurrentReadPosition(0); |
331 } | 330 } |
332 | 331 |
333 void ChunkDemuxer::Stop(const base::Closure& callback) { | 332 void ChunkDemuxer::Stop(const base::Closure& callback) { |
334 VLOG(1) << "Stop()"; | 333 VLOG(1) << "Stop()"; |
335 Shutdown(); | 334 Shutdown(); |
336 callback.Run(); | 335 callback.Run(); |
337 } | 336 } |
338 | 337 |
339 void ChunkDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { | 338 void ChunkDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { |
340 VLOG(1) << "Seek(" << time.InSecondsF() << ")"; | 339 VLOG(1) << "Seek(" << time.InSecondsF() << ")"; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 if (audio_.get()) | 803 if (audio_.get()) |
805 audio_->Shutdown(); | 804 audio_->Shutdown(); |
806 | 805 |
807 if (video_.get()) | 806 if (video_.get()) |
808 video_->Shutdown(); | 807 video_->Shutdown(); |
809 } | 808 } |
810 | 809 |
811 { | 810 { |
812 base::AutoUnlock auto_unlock(lock_); | 811 base::AutoUnlock auto_unlock(lock_); |
813 if (cb.is_null()) { | 812 if (cb.is_null()) { |
814 host()->SetError(error); | 813 host()->OnDemuxerError(error); |
815 return; | 814 return; |
816 } | 815 } |
817 cb.Run(error); | 816 cb.Run(error); |
818 } | 817 } |
819 } | 818 } |
820 | 819 |
821 } // namespace media | 820 } // namespace media |
OLD | NEW |