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. | |
| 22 * - Call GetBitstreamBuffer() to get a buffer to hold bitstream data. | |
| 23 * - Fill the bitstream buffer with video data to decode. | |
| 24 * - Call Decode() to send the bitstream data to the decoder. | |
| 25 * - Call GetPictureBuffer() to get the next decoded picture. | |
| 26 * - To signal end of stream to the decoder: call Flush() and wait for the | |
| 27 * callback. | |
| 28 * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for | |
| 29 * the callback. | |
| 30 */ | |
| 31 interface PPB_MediaCodecVideoDecoder { | |
| 32 /** | |
| 33 * Creates a new video decoder resource. | |
| 34 * | |
| 35 * @param[in] instance A <code>PP_Instance</code> identifying the instance | |
| 36 * with the video decoder. | |
| 37 * | |
| 38 * @return A <code>PP_Resource</code> corresponding to a video decoder if | |
| 39 * successful or 0 otherwise. | |
| 40 */ | |
| 41 PP_Resource Create( | |
| 42 [in] PP_Instance instance); | |
| 43 | |
| 44 /** | |
| 45 * Determines if the given resource is a video decoder. | |
| 46 * | |
| 47 * @param[in] resource A <code>PP_Resource</code> identifying a resource. | |
| 48 * | |
| 49 * @return <code>PP_TRUE</code> if the resource is a | |
| 50 * <code>PPB_MediaCodecVideoDecoder</code>, <code>PP_FALSE</code> if the | |
| 51 * resource is invalid or some other type. | |
| 52 */ | |
| 53 PP_Bool IsMediaCodecVideoDecoder( | |
| 54 [in] PP_Resource resource); | |
| 55 | |
| 56 /** | |
| 57 * Initializes a video decoder resource. This should only be called once, | |
| 58 * after Create() and before any other functions. Hardware video decoding is | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
I thought the point of this take on the API was to
bbudge
2014/04/11 17:15:16
We aren't attempting to provide software fallback
| |
| 59 * not supported on all platforms. | |
| 60 * | |
| 61 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 62 * decoder. | |
| 63 * @param[in] context A <code>PPB_Graphics3D</code> resource to use for | |
| 64 * decoding. | |
| 65 * @param[in] profile A <code>PP_MediaCodec_Profile</code> specifying the | |
| 66 * video stream profile. | |
| 67 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 68 * completion. | |
| 69 * | |
| 70 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 71 * Returns PP_ERROR_NOTSUPPORTED on platforms where hardware video decoding is | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
I'm surprised status is not returned in the callba
bbudge
2014/04/11 17:15:16
Comment is a bit misleading since calling this wit
| |
| 72 * not available. | |
| 73 */ | |
| 74 int32_t Initialize( | |
| 75 [in] PP_Resource video_decoder, | |
| 76 [in] PP_Resource context, | |
|
dmichael (off chromium)
2014/04/09 21:54:07
might be good to name graphics3d_context
bbudge
2014/04/11 17:15:16
Done.
| |
| 77 [in] PP_MediaCodec_Profile profile, | |
|
dmichael (off chromium)
2014/04/09 21:54:07
Do you have a function yet for getting supported p
Ami GONE FROM CHROMIUM
2014/04/09 22:18:38
profile is a property of the video to be decoded.
bbudge
2014/04/16 00:51:05
So based on this discussion, I don't think we can
| |
| 78 [in] PP_CompletionCallback callback); | |
| 79 | |
| 80 /** | |
| 81 * Gets a bitstream buffer to hold video data to be decoded. The bitstream | |
| 82 * buffer is a read-only struct describing the buffer. The plugin can have | |
| 83 * multiple requests for bitstream buffers pending. It should bound the number | |
| 84 * of decodes it has in flight to some constant number by throttling its calls | |
| 85 * to GetBitstreamBuffer(). | |
|
dmichael (off chromium)
2014/04/09 21:54:07
I wonder if it might be possible for Chrome/PPAPI
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
why GBB() and not Decode() in this sentence?
bbudge
2014/04/11 17:15:16
I tried to think of a way to do this automatically
bbudge
2014/04/11 17:15:16
Throttling GBB would limit the number of pending d
bbudge
2014/04/16 00:51:05
I've changed the API to eliminate GBB. I've also c
| |
| 86 * | |
| 87 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 88 * decoder. | |
| 89 * @param[in] size The size of the buffer in bytes. | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
s/size/capacity/ ?
bbudge
2014/04/11 17:15:16
Eliminated GBB.
| |
| 90 * @param[out] bitstream_buffer A <code>PP_MediaCodec_BitstreamBuffer</code> | |
| 91 * to hold the bitstream buffer. | |
| 92 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 93 * completion. | |
| 94 * | |
| 95 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 96 */ | |
| 97 int32_t GetBitstreamBuffer( | |
| 98 [in] PP_Resource video_decoder, | |
| 99 [in] uint32_t size, | |
| 100 [out] PP_MediaCodec_BitstreamBuffer bitstream_buffer, | |
| 101 [in] PP_CompletionCallback callback); | |
| 102 | |
| 103 /** | |
| 104 * Decodes a bitstream buffer. The plugin should have first called | |
| 105 * GetBitstreamBuffer() and filled the returned buffer with bitstream data. | |
| 106 * Decode() takes back ownership of the bitstream buffer. The plugin should | |
| 107 * not use |bitstream_buffer| after calling Decode(). | |
| 108 * | |
| 109 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 110 * decoder. | |
| 111 * @param[in] bitstream_buffer A <code>PP_MediaCodec_BitstreamBuffer</code> | |
| 112 * holding the bitstream data. This contains a |buffer_id| field that can be | |
| 113 * used to associate bitstream buffers with picture buffers. | |
| 114 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 115 * completion. | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
what does "completion" mean in this context?
- d
bbudge
2014/04/11 17:15:16
Yes, completion means the buffer has been decoded.
bbudge
2014/04/16 00:51:05
I've changed the semantics slightly. Now this mean
| |
| 116 * | |
| 117 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 118 */ | |
| 119 int32_t Decode( | |
| 120 [in] PP_Resource video_decoder, | |
| 121 [in] PP_MediaCodec_BitstreamBuffer bitstream_buffer, | |
| 122 [in] PP_CompletionCallback callback); | |
| 123 | |
| 124 /** | |
| 125 * Gets the next picture buffer from the decoder. When the plugin is finished | |
| 126 * with the picture, it should call RecyclePictureBuffer() to return it to the | |
| 127 * system. The plugin can call GetPictureBuffer() again in its callback to | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
what callback?
bbudge
2014/04/11 17:15:16
The user-provided callback.
Made the comment clear
| |
| 128 * request the next picture. | |
| 129 * | |
| 130 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 131 * decoder. | |
| 132 * @param[out] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to | |
| 133 * hold the decoded picture. | |
| 134 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 135 * completion. | |
| 136 * | |
| 137 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 138 */ | |
| 139 int32_t GetPictureBuffer( | |
| 140 [in] PP_Resource video_decoder, | |
| 141 [out] PP_MediaCodec_PictureBuffer picture_buffer, | |
| 142 [in] PP_CompletionCallback callback); | |
| 143 | |
| 144 /** | |
| 145 * Recycles a picture buffer that the plugin has received from the decoder. | |
| 146 * The plugin should call this as soon as it has finished using the texture so | |
| 147 * the system can decode more pictures. | |
| 148 * | |
| 149 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 150 * decoder. | |
| 151 * @param[in] picture_buffer A <code>PP_MediaCodec_PictureBuffer</code> to | |
| 152 * return to the system. | |
| 153 */ | |
| 154 void RecyclePictureBuffer( | |
| 155 [in] PP_Resource video_decoder, | |
| 156 [in] PP_MediaCodec_PictureBuffer picture_buffer); | |
| 157 | |
| 158 /** | |
| 159 * Flushes the decoder. Any pending decodes are completed including callbacks | |
| 160 * to the plugin. Once done flushing, the decoder will call |callback|. While | |
| 161 * flushing, the plugin should not attempt to decode more video. | |
|
dmichael (off chromium)
2014/04/09 21:54:07
You could maybe flesh this comment out a bit with
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
what about calling reset during flush?
bbudge
2014/04/11 17:15:16
I'm going to say the plugin can't call anything du
bbudge
2014/04/16 00:51:05
Also, Flush is to signal end-of-stream, so the plu
| |
| 162 * | |
| 163 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 164 * decoder. | |
| 165 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 166 * completion. | |
| 167 * | |
| 168 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 169 */ | |
| 170 int32_t Flush( | |
| 171 [in] PP_Resource video_decoder, | |
| 172 [in] PP_CompletionCallback callback); | |
| 173 | |
| 174 /** | |
| 175 * Resets the decoder as quickly as possible. Pending decodes are aborted | |
| 176 * and the decoder is put back into a state ready to receive further decode | |
| 177 * calls. Once all decodes are aborted and reset is complete, |callback| will | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
Forbid decode & flush from being called during res
bbudge
2014/04/11 17:15:16
Done.
| |
| 178 * be called. | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
doco impact on ownership of picture and bitstream
bbudge
2014/04/11 17:15:16
Done.
| |
| 179 * | |
| 180 * @param[in] video_decoder A <code>PP_Resource</code> identifying the video | |
| 181 * decoder. | |
| 182 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 183 * completion. | |
| 184 * | |
| 185 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
| 186 */ | |
| 187 int32_t Reset( | |
| 188 [in] PP_Resource video_decoder, | |
| 189 [in] PP_CompletionCallback callback); | |
| 190 }; | |
|
Ami GONE FROM CHROMIUM
2014/04/09 22:12:41
How does teardown work?
(plugin needs to be able t
bbudge
2014/04/11 17:15:16
The plugin should just release its references on t
igorc
2014/04/11 22:16:28
Would be great to document this.
bbudge
2014/04/16 00:51:05
It's a Pepper convention, but I'll add a note at t
| |
| OLD | NEW |