| 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 16 16:23:01 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 and the |
| 38 * desired codec profile. |
| 39 * - Call Decode() to send a bitstream buffer to the decoder. |
| 40 * - Call GetPicture() to get the next decoded picture. |
| 41 * - To signal end of stream to the decoder and shut down gracefully, call |
| 42 * Flush() and wait for the callback. |
| 43 * - To reset the decoder (e.g. to implement Seek), call Reset() and wait for |
| 44 * the callback. |
| 45 * - After Flush or Reset, the plugin can release any references on the decoder |
| 46 * to destroy it. |
| 47 */ |
| 48 struct PPB_MediaCodecVideoDecoder_0_1 { /* dev */ |
| 49 /** |
| 50 * Creates a new video decoder resource. |
| 51 * |
| 52 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
| 53 * with the video decoder. |
| 54 * |
| 55 * @return A <code>PP_Resource</code> corresponding to a video decoder if |
| 56 * successful or 0 otherwise. |
| 57 */ |
| 58 PP_Resource (*Create)(PP_Instance instance); |
| 59 /** |
| 60 * Determines if the given resource is a video decoder. |
| 61 * |
| 62 * @param[in] resource A <code>PP_Resource</code> identifying a resource. |
| 63 * |
| 64 * @return <code>PP_TRUE</code> if the resource is a |
| 65 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the |
| 66 * resource is invalid or some other type. |
| 67 */ |
| 68 PP_Bool (*IsMediaCodecVideoDecoder)(PP_Resource resource); |
| 69 /** |
| 70 * Initializes a video decoder resource. This should only be called once, |
| 71 * after Create() and before any other functions. Video decoding is not |
| 72 * supported on all platforms. |
| 73 * |
| 74 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 75 * decoder. |
| 76 * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use |
| 77 * during decoding. |
| 78 * @param[in] profile A <code>PP_MediaCodec_Profile</code> specifying the |
| 79 * video's codec profile. |
| 80 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 81 * completion. |
| 82 * |
| 83 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 84 * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the |
| 85 * requested profile is not supported. |
| 86 */ |
| 87 int32_t (*Initialize)(PP_Resource video_decoder, |
| 88 PP_Resource context, |
| 89 PP_MediaCodec_VideoProfile profile, |
| 90 struct PP_CompletionCallback callback); |
| 91 /** |
| 92 * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's |
| 93 * |buffer|. The plugin must maintain the buffer and not call Decode() again |
| 94 * until the decoder signals completion by returning PP_OK or running the |
| 95 * |callback|. |
| 96 * If the call to Decode() eventually causes GetPicture() to return a picture, |
| 97 * the |user_id| parameter will be copied into the picture that is returned. |
| 98 * The plugin can use this to associate decoded pictures with Decode() calls |
| 99 * (e.g. to assign timestamps or frame numbers to pictures.) |
| 100 * |
| 101 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 102 * decoder. |
| 103 * @param[in] user_id An identifier that can be used to associate calls to |
| 104 * Decode() with decoded pictures returned by GetPicture(). |
| 105 * @param[in] size Buffer size in bytes. |
| 106 * @param[in] buffer Starting address of buffer. |
| 107 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 108 * completion. |
| 109 * |
| 110 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 111 */ |
| 112 int32_t (*Decode)(PP_Resource video_decoder, |
| 113 uint32_t user_id, |
| 114 uint32_t size, |
| 115 const void* buffer, |
| 116 struct PP_CompletionCallback callback); |
| 117 /** |
| 118 * Gets the next picture from the decoder. The picture is valid after the |
| 119 * decoder signals completion by returning PP_OK or running the callback. The |
| 120 * plugin can call GetPictureBuffer() again after completion. |
| 121 * When the plugin is finished using the picture, it should return it to the |
| 122 * system by calling RecyclePictureBuffer(). |
| 123 * |
| 124 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 125 * decoder. |
| 126 * @param[out] picture A <code>PP_MediaCodec_Picture</code> to hold the |
| 127 * decoded picture. |
| 128 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 129 * completion. |
| 130 * |
| 131 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 132 */ |
| 133 int32_t (*GetPicture)(PP_Resource video_decoder, |
| 134 struct PP_MediaCodec_Picture* picture, |
| 135 struct PP_CompletionCallback callback); |
| 136 /** |
| 137 * Recycles a picture that the plugin has received from the decoder. |
| 138 * The plugin should call this as soon as it has finished using the texture so |
| 139 * the decoder can decode more pictures. |
| 140 * |
| 141 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 142 * decoder. |
| 143 * @param[in] picture A <code>PP_MediaCodec_Picture</code> to return to |
| 144 * the decoder. |
| 145 */ |
| 146 void (*RecyclePicture)(PP_Resource video_decoder, |
| 147 const struct PP_MediaCodec_Picture* picture); |
| 148 /** |
| 149 * Flushes the decoder. The plugin should call this when it reaches the end of |
| 150 * its video stream in order to stop cleanly. The decoder will run all pending |
| 151 * calls to completion. The plugin should make no calls to the decoder other |
| 152 * than RecyclePicture() until the decoder signals completion by running the |
| 153 * callback. |
| 154 * |
| 155 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 156 * decoder. |
| 157 * @param[in] callback A <code>PP_CompletionCallback</code> to be called when |
| 158 * flushing is complete. |
| 159 * |
| 160 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 161 */ |
| 162 int32_t (*Flush)(PP_Resource video_decoder, |
| 163 struct PP_CompletionCallback callback); |
| 164 /** |
| 165 * Resets the decoder as quickly as possible. The plugin should call Reset to |
| 166 * skip to another position in the video stream. Pending calls to Decode() and |
| 167 * GetPicture()) are aborted, causing their callbacks to run with |
| 168 * PP_ERROR_ABORTED. The plugin should not make any further calls to the |
| 169 * decoder until the decoder signals completion by running the callback. |
| 170 * |
| 171 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video |
| 172 * decoder. |
| 173 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 174 * completion. |
| 175 * |
| 176 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 177 */ |
| 178 int32_t (*Reset)(PP_Resource video_decoder, |
| 179 struct PP_CompletionCallback callback); |
| 180 }; |
| 181 /** |
| 182 * @} |
| 183 */ |
| 184 |
| 185 #endif /* PPAPI_C_PPB_MEDIA_CODEC_VIDEO_DECODER_H_ */ |
| 186 |
| OLD | NEW |