OLD | NEW |
---|---|
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 PPAPI_CPP_VIDEO_DECODER_H_ | 5 #ifndef PPAPI_CPP_VIDEO_DECODER_H_ |
6 #define PPAPI_CPP_VIDEO_DECODER_H_ | 6 #define PPAPI_CPP_VIDEO_DECODER_H_ |
7 | 7 |
8 #include "ppapi/c/pp_codecs.h" | 8 #include "ppapi/c/pp_codecs.h" |
9 #include "ppapi/c/pp_size.h" | 9 #include "ppapi/c/pp_size.h" |
10 #include "ppapi/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
11 #include "ppapi/cpp/graphics_3d.h" | 11 #include "ppapi/cpp/graphics_3d.h" |
12 #include "ppapi/cpp/resource.h" | 12 #include "ppapi/cpp/resource.h" |
13 #include "ppapi/cpp/size.h" | 13 #include "ppapi/cpp/size.h" |
14 | 14 |
15 /// @file | 15 /// @file |
16 /// This file defines the API to create and use a VideoDecoder resource. | 16 /// This file defines the API to create and use a VideoDecoder resource. |
17 | 17 |
18 struct PP_FileInfo; | 18 struct PP_Rect; |
19 | 19 |
20 namespace pp { | 20 namespace pp { |
21 | 21 |
22 class InstanceHandle; | 22 class InstanceHandle; |
23 | 23 |
24 /// Video decoder interface. | 24 /// Video decoder interface. |
25 /// | 25 /// |
26 /// Typical usage: | 26 /// Typical usage: |
27 /// - Call Create() to create a new video decoder resource. | 27 /// - Call Create() to create a new video decoder resource. |
28 /// - Call Initialize() to initialize it with a 3d graphics context and the | 28 /// - Call Initialize() to initialize it with a 3d graphics context and the |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 uint32_t size, | 112 uint32_t size, |
113 const void* buffer, | 113 const void* buffer, |
114 const CompletionCallback& callback); | 114 const CompletionCallback& callback); |
115 | 115 |
116 /// Gets the next picture from the decoder. The picture is valid after the | 116 /// Gets the next picture from the decoder. The picture is valid after the |
117 /// decoder signals completion by returning PP_OK or running |callback|. The | 117 /// decoder signals completion by returning PP_OK or running |callback|. The |
118 /// plugin can call GetPicture() again after the decoder signals completion. | 118 /// plugin can call GetPicture() again after the decoder signals completion. |
119 /// When the plugin is finished using the picture, it should return it to the | 119 /// When the plugin is finished using the picture, it should return it to the |
120 /// system by calling RecyclePicture(). | 120 /// system by calling RecyclePicture(). |
121 /// | 121 /// |
122 /// @param[in] visible_rect A <code>PP_Rect</code> to hold the visible | |
123 /// subrectangle of the picture. The plugin should only display the visible | |
124 /// area of the picture. | |
122 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be | 125 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be |
123 /// called on completion, and on success, to hold the picture descriptor. | 126 /// called on completion, and on success, to hold the picture descriptor. |
124 /// | 127 /// |
125 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 128 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
126 /// Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() | 129 /// Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() |
127 /// call is pending. | 130 /// call is pending. |
128 /// Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. | 131 /// Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. |
129 /// Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() | 132 /// Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() |
130 /// completes while GetPicture() is pending. | 133 /// completes while GetPicture() is pending. |
131 int32_t GetPicture( | 134 int32_t GetPicture( |
135 PP_Rect* visible_rect, | |
132 const CompletionCallbackWithOutput<PP_VideoPicture>& callback); | 136 const CompletionCallbackWithOutput<PP_VideoPicture>& callback); |
dmichael (off chromium)
2014/11/05 19:28:08
It seems pretty confusing that we have a callback
bbudge
2014/11/05 22:41:48
Using a new struct instead.
| |
133 | 137 |
134 /// Recycles a picture that the plugin has received from the decoder. | 138 /// Recycles a picture that the plugin has received from the decoder. |
135 /// The plugin should call this as soon as it has finished using the texture | 139 /// The plugin should call this as soon as it has finished using the texture |
136 /// so the decoder can decode more pictures. | 140 /// so the decoder can decode more pictures. |
137 /// | 141 /// |
138 /// @param[in] picture A <code>PP_VideoPicture</code> to return to the | 142 /// @param[in] picture A <code>PP_VideoPicture</code> to return to the |
139 /// decoder. | 143 /// decoder. |
140 void RecyclePicture(const PP_VideoPicture& picture); | 144 void RecyclePicture(const PP_VideoPicture& picture); |
141 | 145 |
142 /// Flushes the decoder. The plugin should call Flush() when it reaches the | 146 /// Flushes the decoder. The plugin should call Flush() when it reaches the |
(...skipping 26 matching lines...) Expand all Loading... | |
169 /// completion. | 173 /// completion. |
170 /// | 174 /// |
171 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 175 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
172 /// Returns PP_ERROR_FAILED if the decoder isn't initialized. | 176 /// Returns PP_ERROR_FAILED if the decoder isn't initialized. |
173 int32_t Reset(const CompletionCallback& callback); | 177 int32_t Reset(const CompletionCallback& callback); |
174 }; | 178 }; |
175 | 179 |
176 } // namespace pp | 180 } // namespace pp |
177 | 181 |
178 #endif // PPAPI_CPP_VIDEO_DECODER_H_ | 182 #endif // PPAPI_CPP_VIDEO_DECODER_H_ |
OLD | NEW |