Chromium Code Reviews| 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 * - To signal end of stream to the decoder and shut down gracefully, call | |
| 26 * Flush() and wait for the callback. | |
| 27 * - To reset the decoder (e.g. to implement Seek), call Reset() and wait for | |
| 28 * the callback. | |
| 29 * - After Flush or Reset, the plugin can release any references on the decoder | |
|
dmichael (off chromium)
2014/04/17 20:23:26
any->all ?
bbudge
2014/04/18 17:03:17
Done.
| |
| 30 * to destroy it. | |
| 31 */ | |
| 32 interface PPB_MediaCodecVideoDecoder { | |
| 33 /** | |
| 34 * Creates a new video decoder resource. | |
| 35 * | |
| 36 * @param[in] instance A <code>PP_Instance</code> identifying the instance | |
| 37 * with the video decoder. | |
| 38 * | |
| 39 * @return A <code>PP_Resource</code> corresponding to a video decoder if | |
| 40 * successful or 0 otherwise. | |
| 41 */ | |
| 42 PP_Resource Create( | |
| 43 [in] PP_Instance instance); | |
| 44 | |
| 45 /** | |
| 46 * Determines if the given resource is a video decoder. | |
| 47 * | |
| 48 * @param[in] resource A <code>PP_Resource</code> identifying a resource. | |
| 49 * | |
| 50 * @return <code>PP_TRUE</code> if the resource is a | |
| 51 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the | |
| 52 * resource is invalid or some other type. | |
| 53 */ | |
| 54 PP_Bool IsMediaCodecVideoDecoder( | |
| 55 [in] PP_Resource resource); | |
| 56 | |
| 57 /** | |
| 58 * Initializes a video decoder resource. This should only be called once, | |
| 59 * after Create() and before any other functions. Video decoding is not | |
| 60 * supported on all platforms. | |
| 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_Profile</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 must 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 |user_id| parameter will be copied into the picture that is returned. | |
| 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] user_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 user_id, | |
|
dmichael (off chromium)
2014/04/17 20:23:26
Is the expectation that this id will be different
bbudge
2014/04/18 17:03:17
It was 'picture_id' and from your comment I think
dmichael (off chromium)
2014/04/21 17:25:33
But will you ever have more than 1 Decode call in
bbudge
2014/04/21 18:14:58
On further reflection, I think a better name than
| |
| 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 GetPictureBuffer() again after completion. | |
| 113 * When the plugin is finished using the picture, it should return it to the | |
| 114 * system by calling RecyclePictureBuffer(). | |
| 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, | |
|
igorc
2014/04/21 23:12:48
What is the order of resolved pictures? Does it so
bbudge
2014/04/21 23:29:06
According to Ami, pictures are always returned in
| |
| 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 should 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 |