| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_util.h" | 5 #include "base/file_util.h" | 
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" | 
| 7 #include "media/base/filter_host.h" | 7 #include "media/base/filter_host.h" | 
| 8 #include "media/base/filters.h" | 8 #include "media/base/filters.h" | 
| 9 #include "media/base/pipeline.h" | 9 #include "media/base/pipeline.h" | 
| 10 #include "media/filters/file_data_source.h" | 10 #include "media/filters/file_data_source.h" | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 50     file_util::CloseFile(file_); | 50     file_util::CloseFile(file_); | 
| 51     file_ = NULL; | 51     file_ = NULL; | 
| 52     file_size_ = 0; | 52     file_size_ = 0; | 
| 53   } | 53   } | 
| 54 } | 54 } | 
| 55 | 55 | 
| 56 const MediaFormat* FileDataSource::GetMediaFormat() { | 56 const MediaFormat* FileDataSource::GetMediaFormat() { | 
| 57   return &media_format_; | 57   return &media_format_; | 
| 58 } | 58 } | 
| 59 | 59 | 
| 60 size_t FileDataSource::Read(char* data, size_t size) { | 60 size_t FileDataSource::Read(uint8* data, size_t size) { | 
| 61   DCHECK(file_); | 61   DCHECK(file_); | 
| 62   AutoLock l(lock_); | 62   AutoLock l(lock_); | 
| 63   if (file_) { | 63   if (file_) { | 
| 64     size_t size_read = fread(data, 1, size, file_); | 64     size_t size_read = fread(data, 1, size, file_); | 
| 65     if (size_read == size || !ferror(file_)) { | 65     if (size_read == size || !ferror(file_)) { | 
| 66       return size_read; | 66       return size_read; | 
| 67     } | 67     } | 
| 68   } | 68   } | 
| 69   return kReadError; | 69   return kReadError; | 
| 70 } | 70 } | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 105 | 105 | 
| 106 bool FileDataSource::GetSize(int64* size_out) { | 106 bool FileDataSource::GetSize(int64* size_out) { | 
| 107   DCHECK(size_out); | 107   DCHECK(size_out); | 
| 108   DCHECK(file_); | 108   DCHECK(file_); | 
| 109   AutoLock l(lock_); | 109   AutoLock l(lock_); | 
| 110   *size_out = file_size_; | 110   *size_out = file_size_; | 
| 111   return (NULL != file_); | 111   return (NULL != file_); | 
| 112 } | 112 } | 
| 113 | 113 | 
| 114 }  // namespace media | 114 }  // namespace media | 
| OLD | NEW | 
|---|