OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <cstdio> | 5 #include <cstdio> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "services/media/framework/parts/file_reader.h" | 8 #include "services/media/framework/parts/file_reader.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 file_ = nullptr; | 33 file_ = nullptr; |
34 return Result::kUnsupportedOperation; | 34 return Result::kUnsupportedOperation; |
35 } | 35 } |
36 } else { | 36 } else { |
37 size_ = -1; | 37 size_ = -1; |
38 } | 38 } |
39 | 39 |
40 return Result::kOk; | 40 return Result::kOk; |
41 } | 41 } |
42 | 42 |
43 size_t FileReader::Read(uint8* buffer, int bytes_to_read) { | 43 size_t FileReader::Read(uint8_t* buffer, size_t bytes_to_read) { |
44 return fread(buffer, 1, bytes_to_read, file_); | 44 return fread(buffer, 1, bytes_to_read, file_); |
45 } | 45 } |
46 | 46 |
47 int64_t FileReader::GetPosition() const { | 47 int64_t FileReader::GetPosition() const { |
48 return ftell(file_); | 48 return ftell(file_); |
49 } | 49 } |
50 | 50 |
51 int64_t FileReader::SetPosition(int64 position) { | 51 int64_t FileReader::SetPosition(int64_t position) { |
52 if (fseek(file_, position, SEEK_SET) < 0) { | 52 if (fseek(file_, position, SEEK_SET) < 0) { |
53 return -1; | 53 return -1; |
54 } | 54 } |
55 return position; | 55 return position; |
56 } | 56 } |
57 | 57 |
58 size_t FileReader::GetSize() const { | 58 size_t FileReader::GetSize() const { |
59 return size_; | 59 return size_; |
60 } | 60 } |
61 | 61 |
62 bool FileReader::CanSeek() const { | 62 bool FileReader::CanSeek() const { |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 } // namespace media | 66 } // namespace media |
67 } // namespace mojo | 67 } // namespace mojo |
OLD | NEW |