| OLD | NEW |
| (Empty) | |
| 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 |
| 3 * found in the LICENSE file. |
| 4 */ |
| 5 |
| 6 /* From ppb_media_codec_video_decoder.idl modified Wed Apr 9 08:24:30 2014. */ |
| 7 |
| 8 #ifndef PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ |
| 9 #define PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ |
| 10 |
| 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_macros.h" |
| 15 #include "ppapi/c/pp_media_codec.h" |
| 16 #include "ppapi/c/pp_resource.h" |
| 17 #include "ppapi/c/pp_size.h" |
| 18 #include "ppapi/c/pp_stdint.h" |
| 19 |
| 20 #define PPB_MEDIACODECVIDEODECODER_INTERFACE_0_1 \ |
| 21 "PPB_MediaCodecVideoDecoder;0.1" /* dev */ |
| 22 /** |
| 23 * @file |
| 24 * This file defines the <code>PPB_MediaCodecVideoDecoder</code> interface. |
| 25 */ |
| 26 |
| 27 |
| 28 /** |
| 29 * @addtogroup Interfaces |
| 30 * @{ |
| 31 */ |
| 32 /** |
| 33 * Video decoder interface. |
| 34 * |
| 35 * Typical usage: |
| 36 * - Call Create() to create a new video decoder resource. |
| 37 * - Call Initialize() to initialize it with a 3d graphics context. |
| 38 * - Call GetBitstreamBuffer() to get a buffer to hold bitstream data. |
| 39 * - Fill the bitstream buffer with video data to decode. |
| 40 * - Call Decode() to send the bitstream data to the decoder. |
| 41 * - Call GetPictureBuffer() to get the next decoded picture. |
| 42 * - To signal end of stream to the decoder: call Flush() and wait for the |
| 43 * callback. |
| 44 * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for |
| 45 * the callback. |
| 46 */ |
| 47 struct PPB_MediaCodecVideoDecoder_0_1 { /* dev */ |
| 48 /** |
| 49 * Creates a new video decoder resource. |
| 50 * |
| 51 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
| 52 * with the video decoder. |
| 53 * |
| 54 * @return A <code>PP_Resource</code> corresponding to a video decoder if |
| 55 * successful or 0 otherwise. |
| 56 */ |
| 57 PP_Resource (*Create)(PP_Instance instance); |
| 58 /** |
| 59 * Determines if the given resource is a video decoder. |
| 60 * |
| 61 * @param[in] resource A <code>PP_Resource</code> identifying a resource. |
| 62 * |
| 63 * @return <code>PP_TRUE</code> if the resource is a |
| 64 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the |
| 65 * resource is invalid or some other type. |
| 66 */ |
| 67 PP_Bool (*IsMediaCodecVideoDecoder)(PP_Resource resource); |
| 68 /** |
| 69 * Initializes a video decoder resource. This should only be called once, |
| 70 * after Create() and before any other functions. Hardware video decoding is |
| 71 * not supported on all platforms. |
| 72 * |
| 73 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 74 * decoder. |
| 75 * @param[in] context A <code>PPB_Graphics3D</code> resource to use for |
| 76 * decoding. |
| 77 * @param[in] profile A <code>PP_MediaCodec_Profile</code> specifying the |
| 78 * video stream profile. |
| 79 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 80 * completion. |
| 81 * |
| 82 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 83 * Returns PP_ERROR_NOTSUPPORTED on platforms where hardware video decoding is |
| 84 * not available. |
| 85 */ |
| 86 int32_t (*Initialize)(PP_Resource video_decoder, |
| 87 PP_Resource context, |
| 88 PP_MediaCodec_Profile profile, |
| 89 struct PP_CompletionCallback callback); |
| 90 /** |
| 91 * Gets a bitstream buffer to hold video data to be decoded. The bitstream |
| 92 * buffer is a read-only struct describing the buffer. The plugin can have |
| 93 * multiple requests for bitstream buffers pending. It should bound the number |
| 94 * of decodes it has in flight to some constant number by throttling its calls |
| 95 * to GetBitstreamBuffer(). |
| 96 * |
| 97 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 98 * decoder. |
| 99 * @param[in] size The size of the buffer in bytes. |
| 100 * @param[out] bitstream_buffer A <code>PP_MediaCodec_BitstreamBuffer</code> |
| 101 * to hold the bitstream buffer. |
| 102 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 103 * completion. |
| 104 * |
| 105 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 106 */ |
| 107 int32_t (*GetBitstreamBuffer)( |
| 108 PP_Resource video_decoder, |
| 109 uint32_t size, |
| 110 struct PP_MediaCodec_BitstreamBuffer* bitstream_buffer, |
| 111 struct PP_CompletionCallback callback); |
| 112 /** |
| 113 * Decodes a bitstream buffer. The plugin should have first called |
| 114 * GetBitstreamBuffer() and filled the returned buffer with bitstream data. |
| 115 * Decode() takes back ownership of the bitstream buffer. The plugin should |
| 116 * not use |bitstream_buffer| after calling Decode(). |
| 117 * |
| 118 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 119 * decoder. |
| 120 * @param[in] bitstream_buffer A <code>PP_MediaCodec_BitstreamBuffer</code> |
| 121 * holding the bitstream data. This contains a |buffer_id| field that can be |
| 122 * used to associate bitstream buffers with picture buffers. |
| 123 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 124 * completion. |
| 125 * |
| 126 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 127 */ |
| 128 int32_t (*Decode)( |
| 129 PP_Resource video_decoder, |
| 130 const struct PP_MediaCodec_BitstreamBuffer* bitstream_buffer, |
| 131 struct PP_CompletionCallback callback); |
| 132 /** |
| 133 * Gets the next picture buffer from the decoder. When the plugin is finished |
| 134 * with the picture, it should call RecyclePictureBuffer() to return it to the |
| 135 * system. The plugin can call GetPictureBuffer() again in its callback to |
| 136 * request the next picture. |
| 137 * |
| 138 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 139 * decoder. |
| 140 * @param[out] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to |
| 141 * hold the decoded picture. |
| 142 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 143 * completion. |
| 144 * |
| 145 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 146 */ |
| 147 int32_t (*GetPictureBuffer)( |
| 148 PP_Resource video_decoder, |
| 149 struct PP_MediaCodec_PictureBuffer* picture_buffer, |
| 150 struct PP_CompletionCallback callback); |
| 151 /** |
| 152 * Recycles a picture buffer that the plugin has received from the decoder. |
| 153 * The plugin should call this as soon as it has finished using the texture so |
| 154 * the system can decode more pictures. |
| 155 * |
| 156 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 157 * decoder. |
| 158 * @param[in] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to |
| 159 * return to the system. |
| 160 */ |
| 161 void (*RecyclePictureBuffer)( |
| 162 PP_Resource video_decoder, |
| 163 const struct PP_MediaCodec_PictureBuffer* picture_buffer); |
| 164 /** |
| 165 * Flushes the decoder. Any pending decodes are completed including callbacks |
| 166 * to the plugin. Once done flushing, the decoder will call |callback|. While |
| 167 * flushing, the plugin should not attempt to decode more video. |
| 168 * |
| 169 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 170 * decoder. |
| 171 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 172 * completion. |
| 173 * |
| 174 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 175 */ |
| 176 int32_t (*Flush)(PP_Resource video_decoder, |
| 177 struct PP_CompletionCallback callback); |
| 178 /** |
| 179 * Resets the decoder as quickly as possible. Pending decodes are aborted |
| 180 * and the decoder is put back into a state ready to receive further decode |
| 181 * calls. Once all decodes are aborted and reset is complete, |callback| will |
| 182 * be called. |
| 183 * |
| 184 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 185 * decoder. |
| 186 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 187 * completion. |
| 188 * |
| 189 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 190 */ |
| 191 int32_t (*Reset)(PP_Resource video_decoder, |
| 192 struct PP_CompletionCallback callback); |
| 193 }; |
| 194 /** |
| 195 * @} |
| 196 */ |
| 197 |
| 198 #endif /* PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ */ |
| 199 |
| OLD | NEW |