| 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 #include <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "media/base/filter_host.h" | 10 #include "media/base/filter_host.h" |
| 11 #include "media/base/filters.h" | 11 #include "media/base/filters.h" |
| 12 #include "media/base/pipeline.h" | 12 #include "media/base/pipeline.h" |
| 13 #include "media/filters/file_data_source.h" | 13 #include "media/filters/file_data_source.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 FileDataSource::FileDataSource() | 17 FileDataSource::FileDataSource() |
| 18 : file_(NULL), | 18 : file_(NULL), |
| 19 file_size_(0) { | 19 file_size_(0) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 FileDataSource::~FileDataSource() { | 22 FileDataSource::~FileDataSource() { |
| 23 DCHECK(!file_); | 23 DCHECK(!file_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 PipelineError FileDataSource::Initialize(const std::string& url) { | 26 PipelineStatus FileDataSource::Initialize(const std::string& url) { |
| 27 DCHECK(!file_); | 27 DCHECK(!file_); |
| 28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 29 FilePath file_path(UTF8ToWide(url)); | 29 FilePath file_path(UTF8ToWide(url)); |
| 30 #else | 30 #else |
| 31 FilePath file_path(url); | 31 FilePath file_path(url); |
| 32 #endif | 32 #endif |
| 33 if (file_util::GetFileSize(file_path, &file_size_)) { | 33 if (file_util::GetFileSize(file_path, &file_size_)) { |
| 34 file_ = file_util::OpenFile(file_path, "rb"); | 34 file_ = file_util::OpenFile(file_path, "rb"); |
| 35 } | 35 } |
| 36 if (!file_) { | 36 if (!file_) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 base::AutoLock l(lock_); | 110 base::AutoLock l(lock_); |
| 111 *size_out = file_size_; | 111 *size_out = file_size_; |
| 112 return (NULL != file_); | 112 return (NULL != file_); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool FileDataSource::IsStreaming() { | 115 bool FileDataSource::IsStreaming() { |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace media | 119 } // namespace media |
| OLD | NEW |