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