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 "media/bench/file_protocol.h" | 5 #include "media/bench/file_protocol.h" |
6 | 6 |
| 7 #include <stdio.h> |
7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "media/filters/ffmpeg_common.h" | 10 #include "media/filters/ffmpeg_common.h" |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 FILE* ToFile(void* data) { | 14 FILE* ToFile(void* data) { |
14 return reinterpret_cast<FILE*>(data); | 15 return reinterpret_cast<FILE*>(data); |
15 } | 16 } |
16 | 17 |
(...skipping 13 matching lines...) Expand all Loading... |
30 return fread(buf, 1, size, ToFile(h->priv_data)); | 31 return fread(buf, 1, size, ToFile(h->priv_data)); |
31 } | 32 } |
32 | 33 |
33 int WriteContext(URLContext* h, unsigned char* buf, int size) { | 34 int WriteContext(URLContext* h, unsigned char* buf, int size) { |
34 NOTIMPLEMENTED(); | 35 NOTIMPLEMENTED(); |
35 return AVERROR_IO; | 36 return AVERROR_IO; |
36 } | 37 } |
37 | 38 |
38 offset_t SeekContext(URLContext* h, offset_t offset, int whence) { | 39 offset_t SeekContext(URLContext* h, offset_t offset, int whence) { |
39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
40 return _fseeki64(ToFile(h->priv_data), offset, whence); | 41 return static_cast<offset_t> (_fseeki64(ToFile(h->priv_data), |
| 42 static_cast<int64>(offset), |
| 43 whence)); |
41 #else | 44 #else |
42 return fseek(ToFile(h->priv_data), offset, whence); | 45 return fseek(ToFile(h->priv_data), offset, whence); |
43 #endif | 46 #endif |
44 } | 47 } |
45 | 48 |
46 int CloseContext(URLContext* h) { | 49 int CloseContext(URLContext* h) { |
47 if (file_util::CloseFile(ToFile(h->priv_data))) | 50 if (file_util::CloseFile(ToFile(h->priv_data))) |
48 return 0; | 51 return 0; |
49 return AVERROR_IO; | 52 return AVERROR_IO; |
50 } | 53 } |
51 | 54 |
52 } // namespace | 55 } // namespace |
53 | 56 |
54 URLProtocol kFFmpegFileProtocol = { | 57 URLProtocol kFFmpegFileProtocol = { |
55 "file", | 58 "file", |
56 &OpenContext, | 59 &OpenContext, |
57 &ReadContext, | 60 &ReadContext, |
58 &WriteContext, | 61 &WriteContext, |
59 &SeekContext, | 62 &SeekContext, |
60 &CloseContext, | 63 &CloseContext, |
61 }; | 64 }; |
OLD | NEW |