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 #ifndef CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 5 #ifndef CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
6 #define CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 6 #define CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
7 | 7 |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 uint32_t crop_width = 0; | 45 uint32_t crop_width = 0; |
46 uint32_t crop_top = 0; | 46 uint32_t crop_top = 0; |
47 uint32_t crop_height = 0; | 47 uint32_t crop_height = 0; |
48 }; | 48 }; |
49 | 49 |
50 // The IPC interface between Android and Chromium for video decoding and | 50 // The IPC interface between Android and Chromium for video decoding and |
51 // encoding. Input buffers are sent from Android side and get processed in | 51 // encoding. Input buffers are sent from Android side and get processed in |
52 // Chromium and the output buffers are returned back to Android side. | 52 // Chromium and the output buffers are returned back to Android side. |
53 class ArcVideoAccelerator { | 53 class ArcVideoAccelerator { |
54 public: | 54 public: |
55 enum Error { | 55 enum Error { |
Pawel Osciak
2016/06/03 03:56:18
Should we call it Result instead of Error, if NO_E
kcwu
2016/06/03 13:14:15
Done.
Note, OnError becomes:
void OnError(Result
| |
56 NO_ERROR = 0, | |
56 ILLEGAL_STATE = 1, | 57 ILLEGAL_STATE = 1, |
57 INVALID_ARGUMENT = 2, | 58 INVALID_ARGUMENT = 2, |
58 UNREADABLE_INPUT = 3, | 59 UNREADABLE_INPUT = 3, |
59 PLATFORM_FAILURE = 4, | 60 PLATFORM_FAILURE = 4, |
61 INSUFFICIENT_RESOURCES = 5, | |
60 }; | 62 }; |
61 | 63 |
62 struct Config { | 64 struct Config { |
63 enum DeviceType { | 65 enum DeviceType { |
64 DEVICE_ENCODER = 0, | 66 DEVICE_ENCODER = 0, |
65 DEVICE_DECODER = 1, | 67 DEVICE_DECODER = 1, |
66 }; | 68 }; |
67 | 69 |
68 DeviceType device_type = DEVICE_DECODER; | 70 DeviceType device_type = DEVICE_DECODER; |
69 size_t num_input_buffers = 0; | 71 size_t num_input_buffers = 0; |
(...skipping 27 matching lines...) Expand all Loading... | |
97 | 99 |
98 // Called as a completion notification for Reset(). | 100 // Called as a completion notification for Reset(). |
99 virtual void OnResetDone() = 0; | 101 virtual void OnResetDone() = 0; |
100 | 102 |
101 // Called as a completion notification for Flush(). | 103 // Called as a completion notification for Flush(). |
102 virtual void OnFlushDone() = 0; | 104 virtual void OnFlushDone() = 0; |
103 }; | 105 }; |
104 | 106 |
105 // Initializes the ArcVideoAccelerator with specific configuration. This | 107 // Initializes the ArcVideoAccelerator with specific configuration. This |
106 // must be called before any other methods. This call is synchronous and | 108 // must be called before any other methods. This call is synchronous and |
107 // returns true iff initialization is successful. | 109 // returns true iff initialization is successful. |
Pawel Osciak
2016/06/03 03:56:18
Please update documentation.
| |
108 virtual bool Initialize(const Config& config, Client* client) = 0; | 110 virtual Error Initialize(const Config& config, Client* client) = 0; |
109 | 111 |
110 // Assigns a shared memory to be used for the accelerator at the specified | 112 // Assigns a shared memory to be used for the accelerator at the specified |
111 // port and index. A buffer must be successfully bound before it can be passed | 113 // port and index. A buffer must be successfully bound before it can be passed |
112 // to the accelerator via UseBuffer(). Already bound buffers may be reused | 114 // to the accelerator via UseBuffer(). Already bound buffers may be reused |
113 // multiple times without additional bindings. | 115 // multiple times without additional bindings. |
114 virtual void BindSharedMemory(PortType port, | 116 virtual void BindSharedMemory(PortType port, |
115 uint32_t index, | 117 uint32_t index, |
116 base::ScopedFD ashmem_fd, | 118 base::ScopedFD ashmem_fd, |
117 off_t offset, | 119 off_t offset, |
118 size_t length) = 0; | 120 size_t length) = 0; |
(...skipping 29 matching lines...) Expand all Loading... | |
148 // called. | 150 // called. |
149 virtual void Flush() = 0; | 151 virtual void Flush() = 0; |
150 | 152 |
151 virtual ~ArcVideoAccelerator() {} | 153 virtual ~ArcVideoAccelerator() {} |
152 }; | 154 }; |
153 | 155 |
154 } // namespace arc | 156 } // namespace arc |
155 } // namespace chromeos | 157 } // namespace chromeos |
156 | 158 |
157 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 159 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
OLD | NEW |