Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: services/media/framework/parts/file_reader.cc

Issue 1686363002: Motown: ffmpeg implementations of framework 'parts' (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changed the way AVBuffer allocation/deallocation is done in the ffmpeg audio decoder. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698