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 #include "media/filters/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 437 } |
438 } | 438 } |
439 | 439 |
440 void FFmpegDemuxer::Initialize(DemuxerHost* host, | 440 void FFmpegDemuxer::Initialize(DemuxerHost* host, |
441 const PipelineStatusCB& status_cb, | 441 const PipelineStatusCB& status_cb, |
442 bool enable_text_tracks) { | 442 bool enable_text_tracks) { |
443 DCHECK(task_runner_->BelongsToCurrentThread()); | 443 DCHECK(task_runner_->BelongsToCurrentThread()); |
444 host_ = host; | 444 host_ = host; |
445 text_enabled_ = enable_text_tracks; | 445 text_enabled_ = enable_text_tracks; |
446 | 446 |
447 // TODO(scherkus): DataSource should have a host by this point, | |
448 // see http://crbug.com/122071 | |
449 data_source_->set_host(host); | |
450 | |
451 url_protocol_.reset(new BlockingUrlProtocol(data_source_, BindToCurrentLoop( | 447 url_protocol_.reset(new BlockingUrlProtocol(data_source_, BindToCurrentLoop( |
452 base::Bind(&FFmpegDemuxer::OnDataSourceError, base::Unretained(this))))); | 448 base::Bind(&FFmpegDemuxer::OnDataSourceError, base::Unretained(this))))); |
453 glue_.reset(new FFmpegGlue(url_protocol_.get())); | 449 glue_.reset(new FFmpegGlue(url_protocol_.get())); |
454 AVFormatContext* format_context = glue_->format_context(); | 450 AVFormatContext* format_context = glue_->format_context(); |
455 | 451 |
456 // Disable ID3v1 tag reading to avoid costly seeks to end of file for data we | 452 // Disable ID3v1 tag reading to avoid costly seeks to end of file for data we |
457 // don't use. FFmpeg will only read ID3v1 tags if no other metadata is | 453 // don't use. FFmpeg will only read ID3v1 tags if no other metadata is |
458 // available, so add a metadata entry to ensure some is always present. | 454 // available, so add a metadata entry to ensure some is always present. |
459 av_dict_set(&format_context->metadata, "skip_id3v1_tags", "", 0); | 455 av_dict_set(&format_context->metadata, "skip_id3v1_tags", "", 0); |
460 | 456 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 } | 980 } |
985 for (size_t i = 0; i < buffered.size(); ++i) | 981 for (size_t i = 0; i < buffered.size(); ++i) |
986 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 982 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
987 } | 983 } |
988 | 984 |
989 void FFmpegDemuxer::OnDataSourceError() { | 985 void FFmpegDemuxer::OnDataSourceError() { |
990 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 986 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
991 } | 987 } |
992 | 988 |
993 } // namespace media | 989 } // namespace media |
OLD | NEW |