| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/dev/pp_video_dev.h" | 8 #include "ppapi/c/dev/pp_video_dev.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
| 11 | 11 |
| 12 #define PPB_VIDEODECODER_DEV_INTERFACE_0_14 "PPB_VideoDecoder(Dev);0.14" | 12 #define PPB_VIDEODECODER_DEV_INTERFACE_0_15 "PPB_VideoDecoder(Dev);0.15" |
| 13 #define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_14 | 13 #define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_15 |
| 14 | 14 |
| 15 // Video decoder interface. | 15 // Video decoder interface. |
| 16 // | 16 // |
| 17 // Typical usage: | 17 // Typical usage: |
| 18 // - Use Create() to get a new PPB_VideoDecoder_Dev resource. | 18 // - Use Create() to create & configure a new PPB_VideoDecoder_Dev resource. |
| 19 // - Call Initialize() to create the underlying resources in the GPU process and | |
| 20 // configure the decoder there. | |
| 21 // - Call Decode() to decode some video data. | 19 // - Call Decode() to decode some video data. |
| 22 // - Receive ProvidePictureBuffers callback | 20 // - Receive ProvidePictureBuffers callback |
| 23 // - Supply the decoder with textures using AssignPictureBuffers. | 21 // - Supply the decoder with textures using AssignPictureBuffers. |
| 24 // - Receive PictureReady callbacks | 22 // - Receive PictureReady callbacks |
| 25 // - Hand the textures back to the decoder using ReusePictureBuffer. | 23 // - Hand the textures back to the decoder using ReusePictureBuffer. |
| 26 // - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone | 24 // - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone |
| 27 // callback. | 25 // callback. |
| 28 // - To reset the decoder (e.g. to implement Seek): call Reset() and wait for | 26 // - To reset the decoder (e.g. to implement Seek): call Reset() and wait for |
| 29 // NotifyResetDone callback. | 27 // NotifyResetDone callback. |
| 30 // - To tear down the decoder call Destroy(). | 28 // - To tear down the decoder call Destroy(). |
| 31 // | 29 // |
| 32 // See PPP_VideoDecoder_Dev for the notifications the decoder may send the | 30 // See PPP_VideoDecoder_Dev for the notifications the decoder may send the |
| 33 // plugin. | 31 // plugin. |
| 34 struct PPB_VideoDecoder_Dev { | 32 struct PPB_VideoDecoder_Dev { |
| 35 // Creates a video decoder. Initialize() must be called afterwards to | 33 // Creates & initializes a video decoder. |
| 36 // set its configuration. | |
| 37 // | 34 // |
| 38 // Parameters: | 35 // Parameters: |
| 39 // |instance| pointer to the plugin instance. | 36 // |instance| pointer to the plugin instance. |
| 37 // |context_3d| a PPB_Context3D_Dev resource in which decoding will happen. |
| 38 // |decoder_config| the configuration to use to initialize the decoder. |
| 40 // | 39 // |
| 41 // The created decoder is returned as PP_Resource. 0 means failure. | 40 // The created decoder is returned as PP_Resource. 0 means failure. |
| 42 PP_Resource (*Create)(PP_Instance instance); | 41 PP_Resource (*Create)(PP_Instance instance, |
| 42 PP_Resource context, |
| 43 const PP_VideoConfigElement* decoder_config); |
| 43 | 44 |
| 44 // Tests whether |resource| is a video decoder created through Create | 45 // Tests whether |resource| is a video decoder created through Create |
| 45 // function of this interface. | 46 // function of this interface. |
| 46 // | 47 // |
| 47 // Parameters: | 48 // Parameters: |
| 48 // |resource| is handle to resource to test. | 49 // |resource| is handle to resource to test. |
| 49 // | 50 // |
| 50 // Returns true if is a video decoder, false otherwise. | 51 // Returns true if is a video decoder, false otherwise. |
| 51 PP_Bool (*IsVideoDecoder)(PP_Resource resource); | 52 PP_Bool (*IsVideoDecoder)(PP_Resource resource); |
| 52 | 53 |
| 53 // Initializes the video decoder with requested configuration. | |
| 54 // | |
| 55 // Parameters: | |
| 56 // |video_decoder| is the previously created handle to the decoder resource. | |
| 57 // |context| the GL context in which decoding will happen. This should be a | |
| 58 // resource of type PPB_Context3D_Dev. | |
| 59 // |decoder_config| the configuration to use to initialize the decoder. | |
| 60 // |callback| called after initialization is complete. | |
| 61 // | |
| 62 // Returns an error code from pp_errors.h. | |
| 63 int32_t (*Initialize)(PP_Resource video_decoder, | |
| 64 PP_Resource context, | |
| 65 const PP_VideoConfigElement* decoder_config, | |
| 66 struct PP_CompletionCallback callback); | |
| 67 | |
| 68 // Dispatches bitstream buffer to the decoder. | 54 // Dispatches bitstream buffer to the decoder. |
| 69 // | 55 // |
| 70 // Parameters: | 56 // Parameters: |
| 71 // |video_decoder| is the previously created handle to the decoder resource. | 57 // |video_decoder| is the previously created handle to the decoder resource. |
| 72 // |bitstream_buffer| is the bitstream buffer that contains the input data. | 58 // |bitstream_buffer| is the bitstream buffer that contains the input data. |
| 73 // |callback| will be called when |bitstream_buffer| has been processed by | 59 // |callback| will be called when |bitstream_buffer| has been processed by |
| 74 // the decoder. | 60 // the decoder. |
| 75 // | 61 // |
| 76 // Returns an error code from pp_errors.h. | 62 // Returns an error code from pp_errors.h. |
| 77 int32_t (*Decode)(PP_Resource video_decoder, | 63 int32_t (*Decode)(PP_Resource video_decoder, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // may be freed asynchronously, after this method returns no more callbacks | 123 // may be freed asynchronously, after this method returns no more callbacks |
| 138 // will be made on the client. Any resources held by the client at that point | 124 // will be made on the client. Any resources held by the client at that point |
| 139 // may be freed. | 125 // may be freed. |
| 140 // | 126 // |
| 141 // Parameters: | 127 // Parameters: |
| 142 // |video_decoder| is the previously created handle to the decoder resource. | 128 // |video_decoder| is the previously created handle to the decoder resource. |
| 143 void (*Destroy)(PP_Resource video_decoder); | 129 void (*Destroy)(PP_Resource video_decoder); |
| 144 }; | 130 }; |
| 145 | 131 |
| 146 #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */ | 132 #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */ |
| OLD | NEW |