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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 /// associated. | 54 /// associated. |
55 explicit VideoDecoder(const InstanceHandle& instance); | 55 explicit VideoDecoder(const InstanceHandle& instance); |
56 | 56 |
57 /// The copy constructor for <code>VideoDecoder</code>. | 57 /// The copy constructor for <code>VideoDecoder</code>. |
58 /// @param[in] other A reference to a <code>VideoDecoder</code>. | 58 /// @param[in] other A reference to a <code>VideoDecoder</code>. |
59 VideoDecoder(const VideoDecoder& other); | 59 VideoDecoder(const VideoDecoder& other); |
60 | 60 |
61 /// Initializes a video decoder resource. This should be called after Create() | 61 /// Initializes a video decoder resource. This should be called after Create() |
62 /// and before any other functions. | 62 /// and before any other functions. |
63 /// | 63 /// |
64 /// @param[in] video_decoder A <code>PP_Resource</code> identifying the video | 64 /// @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to |
65 /// decoder. | 65 /// use during decoding. |
66 /// @param[in] profile A <code>PP_VideoProfile</code> specifying the video | 66 /// @param[in] profile A <code>PP_VideoProfile</code> specifying the video |
67 /// codec profile. | 67 /// codec profile. |
68 /// @param[in] allow_software_fallback A <code>PP_Bool</code> specifying | 68 /// @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying |
69 /// whether the decoder can fall back to software decoding if a suitable | 69 /// whether to use a hardware accelerated or a software implementation. |
70 /// hardware decoder isn't available. | 70 /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
71 /// @param[in] callback A <code>CompletionCallback</code> to be called on | |
72 /// completion. | 71 /// completion. |
73 /// | 72 /// |
74 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 73 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
75 /// Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the | 74 /// Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the |
76 /// requested profile is not supported. In this case, the client may call | 75 /// requested profile is not supported. In this case, the client may call |
77 /// Initialize() again with different parameters to find a good configuration. | 76 /// Initialize() again with different parameters to find a good configuration. |
78 int32_t Initialize(const Graphics3D& graphics3d_context, | 77 int32_t Initialize(const Graphics3D& graphics3d_context, |
79 PP_VideoProfile profile, | 78 PP_VideoProfile profile, |
80 bool allow_software_fallback, | 79 PP_HardwareAcceleration acceleration, |
81 const CompletionCallback& callback); | 80 const CompletionCallback& callback); |
82 | 81 |
83 /// Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's | 82 /// Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's |
84 /// |buffer|. The plugin should wait until the decoder signals completion by | 83 /// |buffer|. The plugin should wait until the decoder signals completion by |
85 /// returning PP_OK or by running |callback| before calling Decode() again. | 84 /// returning PP_OK or by running |callback| before calling Decode() again. |
86 /// | 85 /// |
87 /// In general, each bitstream buffer should contain a demuxed bitstream frame | 86 /// In general, each bitstream buffer should contain a demuxed bitstream frame |
88 /// for the selected video codec. For example, H264 decoders expect to receive | 87 /// for the selected video codec. For example, H264 decoders expect to receive |
89 /// one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 | 88 /// one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 |
90 /// decoders expect to receive a bitstream frame without the IVF frame header. | 89 /// decoders expect to receive a bitstream frame without the IVF frame header. |
(...skipping 22 matching lines...) Expand all Loading... |
113 uint32_t size, | 112 uint32_t size, |
114 const void* buffer, | 113 const void* buffer, |
115 const CompletionCallback& callback); | 114 const CompletionCallback& callback); |
116 | 115 |
117 /// 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 |
118 /// decoder signals completion by returning PP_OK or running |callback|. The | 117 /// decoder signals completion by returning PP_OK or running |callback|. The |
119 /// plugin can call GetPicture() again after the decoder signals completion. | 118 /// plugin can call GetPicture() again after the decoder signals completion. |
120 /// 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 |
121 /// system by calling RecyclePicture(). | 120 /// system by calling RecyclePicture(). |
122 /// | 121 /// |
123 /// @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
124 /// decoder. | |
125 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be | 122 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be |
126 /// called on completion, and on success, to hold the picture descriptor. | 123 /// called on completion, and on success, to hold the picture descriptor. |
127 /// | 124 /// |
128 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 125 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
129 /// Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() | 126 /// Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() |
130 /// call is pending. | 127 /// call is pending. |
131 /// Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. | 128 /// Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. |
132 /// Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() | 129 /// Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() |
133 /// completes while GetPicture() is pending. | 130 /// completes while GetPicture() is pending. |
134 int32_t GetPicture( | 131 int32_t GetPicture( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 /// completion. | 169 /// completion. |
173 /// | 170 /// |
174 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 171 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
175 /// Returns PP_ERROR_FAILED if the decoder isn't initialized. | 172 /// Returns PP_ERROR_FAILED if the decoder isn't initialized. |
176 int32_t Reset(const CompletionCallback& callback); | 173 int32_t Reset(const CompletionCallback& callback); |
177 }; | 174 }; |
178 | 175 |
179 } // namespace pp | 176 } // namespace pp |
180 | 177 |
181 #endif // PPAPI_CPP_VIDEO_DECODER_H_ | 178 #endif // PPAPI_CPP_VIDEO_DECODER_H_ |
OLD | NEW |