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 10 matching lines...) Expand all Loading... |
21 HAL_PIXEL_FORMAT_H264 = 0x34363248, | 21 HAL_PIXEL_FORMAT_H264 = 0x34363248, |
22 HAL_PIXEL_FORMAT_VP8 = 0x00385056, | 22 HAL_PIXEL_FORMAT_VP8 = 0x00385056, |
23 }; | 23 }; |
24 | 24 |
25 enum PortType { | 25 enum PortType { |
26 PORT_INPUT = 0, | 26 PORT_INPUT = 0, |
27 PORT_OUTPUT = 1, | 27 PORT_OUTPUT = 1, |
28 PORT_COUNT = 2, | 28 PORT_COUNT = 2, |
29 }; | 29 }; |
30 | 30 |
31 enum BufferFlag { | |
32 BUFFER_FLAG_EOS = 1 << 0, | |
33 }; | |
34 | |
35 struct BufferMetadata { | 31 struct BufferMetadata { |
36 int64_t timestamp = 0; // in microseconds | 32 int64_t timestamp = 0; // in microseconds |
37 uint32_t flags = 0; // Flags defined in BufferFlag. | |
38 uint32_t bytes_used = 0; | 33 uint32_t bytes_used = 0; |
39 }; | 34 }; |
40 | 35 |
41 struct VideoFormat { | 36 struct VideoFormat { |
42 uint32_t pixel_format = 0; | 37 uint32_t pixel_format = 0; |
43 uint32_t buffer_size = 0; | 38 uint32_t buffer_size = 0; |
44 | 39 |
45 // Minimum number of buffers required to decode/encode the stream. | 40 // Minimum number of buffers required to decode/encode the stream. |
46 uint32_t min_num_buffers = 0; | 41 uint32_t min_num_buffers = 0; |
47 uint32_t coded_width = 0; | 42 uint32_t coded_width = 0; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 virtual void OnBufferDone(PortType port, | 90 virtual void OnBufferDone(PortType port, |
96 uint32_t index, | 91 uint32_t index, |
97 const BufferMetadata& metadata) = 0; | 92 const BufferMetadata& metadata) = 0; |
98 | 93 |
99 // Called when the output format has changed or the output format | 94 // Called when the output format has changed or the output format |
100 // becomes available at beginning of the stream after initial parsing. | 95 // becomes available at beginning of the stream after initial parsing. |
101 virtual void OnOutputFormatChanged(const VideoFormat& format) = 0; | 96 virtual void OnOutputFormatChanged(const VideoFormat& format) = 0; |
102 | 97 |
103 // Called as a completion notification for Reset(). | 98 // Called as a completion notification for Reset(). |
104 virtual void OnResetDone() = 0; | 99 virtual void OnResetDone() = 0; |
| 100 |
| 101 // Called as a completion notification for Flush(). |
| 102 virtual void OnFlushDone() = 0; |
105 }; | 103 }; |
106 | 104 |
107 // Initializes the ArcVideoAccelerator with specific configuration. This | 105 // Initializes the ArcVideoAccelerator with specific configuration. This |
108 // must be called before any other methods. This call is synchronous and | 106 // must be called before any other methods. This call is synchronous and |
109 // returns true iff initialization is successful. | 107 // returns true iff initialization is successful. |
110 virtual bool Initialize(const Config& config, Client* client) = 0; | 108 virtual bool Initialize(const Config& config, Client* client) = 0; |
111 | 109 |
112 // Assigns a shared memory to be used for the accelerator at the specified | 110 // Assigns a shared memory to be used for the accelerator at the specified |
113 // port and index. A buffer must be successfully bound before it can be passed | 111 // port and index. A buffer must be successfully bound before it can be passed |
114 // to the accelerator via UseBuffer(). Already bound buffers may be reused | 112 // to the accelerator via UseBuffer(). Already bound buffers may be reused |
(...skipping 21 matching lines...) Expand all Loading... |
136 | 134 |
137 // Sets the number of output buffers. When it fails, Client::OnError() will | 135 // Sets the number of output buffers. When it fails, Client::OnError() will |
138 // be called. | 136 // be called. |
139 virtual void SetNumberOfOutputBuffers(size_t number) = 0; | 137 virtual void SetNumberOfOutputBuffers(size_t number) = 0; |
140 | 138 |
141 // Resets the accelerator. When it is done, Client::OnResetDone() will | 139 // Resets the accelerator. When it is done, Client::OnResetDone() will |
142 // be called. Afterwards, all buffers won't be accessed by the accelerator | 140 // be called. Afterwards, all buffers won't be accessed by the accelerator |
143 // and there won't be more callbacks. | 141 // and there won't be more callbacks. |
144 virtual void Reset() = 0; | 142 virtual void Reset() = 0; |
145 | 143 |
| 144 // Flushes the accelerator. After all the output buffers pending decode have |
| 145 // been returned to client by OnBufferDone(), Client::OnFlushDone() will be |
| 146 // called. |
| 147 virtual void Flush() = 0; |
| 148 |
146 virtual ~ArcVideoAccelerator() {} | 149 virtual ~ArcVideoAccelerator() {} |
147 }; | 150 }; |
148 | 151 |
149 } // namespace arc | 152 } // namespace arc |
150 } // namespace chromeos | 153 } // namespace chromeos |
151 | 154 |
152 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 155 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
OLD | NEW |