diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 21:28:28 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 21:28:28 +0000 |
commit | dd4393148b9bded2cfbc54c2c91f7da5c6450ce0 (patch) | |
tree | 2db730e0a17dd701b97cf13946fac9588cb3a982 /ppapi/c | |
parent | e1fffb8ef5c80c1f1f6a3e363ef2eca24244a781 (diff) | |
download | chromium_src-dd4393148b9bded2cfbc54c2c91f7da5c6450ce0.zip chromium_src-dd4393148b9bded2cfbc54c2c91f7da5c6450ce0.tar.gz chromium_src-dd4393148b9bded2cfbc54c2c91f7da5c6450ce0.tar.bz2 |
Convert video capture/decoder stuff to IDL.
I revved the PPP_VideoDecoder interface since IDL wants to pass PP_Picture_Dev
by pointer instead of by value. This also renames the VIDEO_CAPTURE interface
string/define to VIDEOCAPTURE for consistency (what IDL wants to do).
Review URL: http://codereview.chromium.org/8144008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r-- | ppapi/c/dev/pp_video_capture_dev.h | 25 | ||||
-rw-r--r-- | ppapi/c/dev/pp_video_dev.h | 146 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_video_capture_dev.h | 26 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_video_decoder_dev.h | 237 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_video_layer_dev.h | 230 | ||||
-rw-r--r-- | ppapi/c/dev/ppp_video_decoder_dev.h | 139 |
6 files changed, 505 insertions, 298 deletions
diff --git a/ppapi/c/dev/pp_video_capture_dev.h b/ppapi/c/dev/pp_video_capture_dev.h index 6f35313..fe73f9e 100644 --- a/ppapi/c/dev/pp_video_capture_dev.h +++ b/ppapi/c/dev/pp_video_capture_dev.h @@ -2,12 +2,26 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +/* From dev/pp_video_capture_dev.idl modified Wed Oct 5 15:55:11 2011. */ + #ifndef PPAPI_C_DEV_PP_VIDEO_CAPTURE_DEV_H_ #define PPAPI_C_DEV_PP_VIDEO_CAPTURE_DEV_H_ +#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" /** + * @file + * Structs for dealing with video capture. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** * PP_VideoCaptureDeviceInfo_Dev is a structure that represent a video capture * configuration, such as resolution and frame rate. */ @@ -17,8 +31,15 @@ struct PP_VideoCaptureDeviceInfo_Dev { uint32_t frames_per_second; }; PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoCaptureDeviceInfo_Dev, 12); +/** + * @} + */ /** + * @addtogroup Enums + * @{ + */ +/** * PP_VideoCaptureStatus_Dev is an enumeration that defines the various possible * states of a VideoCapture. */ @@ -45,5 +66,9 @@ typedef enum { PP_VIDEO_CAPTURE_STATUS_STOPPING } PP_VideoCaptureStatus_Dev; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCaptureStatus_Dev, 4); +/** + * @} + */ #endif /* PPAPI_C_DEV_PP_VIDEO_CAPTURE_DEV_H_ */ + diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h index eed1575..6f9c70e 100644 --- a/ppapi/c/dev/pp_video_dev.h +++ b/ppapi/c/dev/pp_video_dev.h @@ -2,27 +2,36 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +/* From dev/pp_video_dev.idl modified Wed Oct 5 08:49:09 2011. */ + #ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_ #define PPAPI_C_DEV_PP_VIDEO_DEV_H_ -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_size.h" #include "ppapi/c/pp_stdint.h" -#include "ppapi/c/ppb_opengles2.h" -// Video decoder configuration-related enums. +/** + * @file + * NOTE: these must be kept in sync with the versions in + * media/video/video_decode_accelerator.h! + */ -// NOTE: these must be kept in sync with the versions in -// media/video/video_decode_accelerator.h! -// Video stream profile. -enum PP_VideoDecoder_Profile { - // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, - // for example), and keep the values for a particular format grouped together - // for clarity. +/** + * @addtogroup Enums + * @{ + */ +/** + * Video format. + * + * Keep the values in this enum unique, as they imply format (h.264 vs. VP8, + * for example), and keep the values for a particular format grouped together + * for clarity. + */ +typedef enum { PP_VIDEODECODER_H264PROFILE_NONE = 0, PP_VIDEODECODER_H264PROFILE_BASELINE, PP_VIDEODECODER_H264PROFILE_MAIN, @@ -35,59 +44,108 @@ enum PP_VideoDecoder_Profile { PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH, PP_VIDEODECODER_H264PROFILE_STEREOHIGH, PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH -}; +} PP_VideoDecoder_Profile; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoDecoder_Profile, 4); +/** + * @} + */ -// The data structure for video bitstream buffer. +/** + * @addtogroup Structs + * @{ + */ +/** + * The data structure for video bitstream buffer. + */ struct PP_VideoBitstreamBuffer_Dev { - // Client-specified identifier for the bitstream buffer. + /** + * Client-specified identifier for the bitstream buffer. + */ int32_t id; - - // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer - // interface for consistent interprocess behaviour. + /** + * Buffer to hold the bitstream data. Should be allocated using the + * PPB_Buffer interface for consistent interprocess behaviour. + */ PP_Resource data; - - // Size of the bitstream contained in buffer (in bytes). + /** + * Size of the bitstream contained in buffer (in bytes). + */ int32_t size; }; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12); -// Struct for specifying texture-backed picture data. +/** + * Struct for specifying texture-backed picture data. + */ struct PP_PictureBuffer_Dev { - // Client-specified id for the picture buffer. By using this value client can - // keep track of the buffers it has assigned to the video decoder and how they - // are passed back to it. + /** + * Client-specified id for the picture buffer. By using this value client can + * keep track of the buffers it has assigned to the video decoder and how they + * are passed back to it. + */ int32_t id; - - // Dimensions of the buffer. + /** + * Dimensions of the buffer. + */ struct PP_Size size; - - // Texture ID in the given context where picture is stored. - GLuint texture_id; + /** + * Texture ID in the given context where picture is stored. + */ + uint32_t texture_id; }; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PictureBuffer_Dev, 16); -// Structure to describe a decoded output frame. +/** + * Structure to describe a decoded output frame. + */ struct PP_Picture_Dev { - // ID of the picture buffer where the picture is stored. + /** + * ID of the picture buffer where the picture is stored. + */ int32_t picture_buffer_id; - - // ID of the bitstream from which this data was decoded. + /** + * ID of the bitstream from which this data was decoded. + */ int32_t bitstream_buffer_id; }; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Picture_Dev, 8); +/** + * @} + */ -// Decoder error codes reported to the plugin. A reasonable naive -// error handling policy is for the plugin to Destroy() the decoder on error. -// Note: Keep these in sync with media::VideoDecodeAccelerator::Error. -enum PP_VideoDecodeError_Dev { - // An operation was attempted during an incompatible decoder state. +/** + * @addtogroup Enums + * @{ + */ +/** + * Decoder error codes reported to the plugin. A reasonable naive + * error handling policy is for the plugin to Destroy() the decoder on error. + * Note: Keep these in sync with media::VideoDecodeAccelerator::Error. + */ +typedef enum { + /** + * An operation was attempted during an incompatible decoder state. + */ PP_VIDEODECODERERROR_ILLEGAL_STATE = 1, - // Invalid argument was passed to an API method. + /** + * Invalid argument was passed to an API method. + */ PP_VIDEODECODERERROR_INVALID_ARGUMENT, - // Encoded input is unreadable. + /** + * Encoded input is unreadable. + */ PP_VIDEODECODERERROR_UNREADABLE_INPUT, - // A failure occurred at the browser layer or lower. Examples of such - // failures include GPU hardware failures, GPU driver failures, GPU library - // failures, browser programming errors, and so on. + /** + * A failure occurred at the browser layer or lower. Examples of such + * failures include GPU hardware failures, GPU driver failures, GPU library + * failures, browser programming errors, and so on. + */ PP_VIDEODECODERERROR_PLATFORM_FAILURE -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); +} PP_VideoDecodeError_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); +/** + * @} + */ #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */ + diff --git a/ppapi/c/dev/ppb_video_capture_dev.h b/ppapi/c/dev/ppb_video_capture_dev.h index 21a18de..6c3beb3 100644 --- a/ppapi/c/dev/ppb_video_capture_dev.h +++ b/ppapi/c/dev/ppb_video_capture_dev.h @@ -2,19 +2,33 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +/* From dev/ppb_video_capture_dev.idl modified Wed Oct 5 09:11:07 2011. */ + #ifndef PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ #include "ppapi/c/dev/pp_video_capture_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" -#define PPB_VIDEO_CAPTURE_DEV_INTERFACE_0_1 "PPB_VideoCapture(Dev);0.1" -#define PPB_VIDEO_CAPTURE_DEV_INTERFACE PPB_VIDEO_CAPTURE_DEV_INTERFACE_0_1 +#define PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1 "PPB_VideoCapture(Dev);0.1" +#define PPB_VIDEOCAPTURE_DEV_INTERFACE PPB_VIDEOCAPTURE_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VideoCapture_Dev</code> interface. + */ + /** + * @addtogroup Interfaces + * @{ + */ +/** * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. * * Theory of operation: @@ -44,12 +58,10 @@ struct PPB_VideoCapture_Dev { * Creates a new VideoCapture. */ PP_Resource (*Create)(PP_Instance instance); - /** * Returns PP_TRUE if the given resource is a VideoCapture. */ PP_Bool (*IsVideoCapture)(PP_Resource video_capture); - /** * Starts the capture. |requested_info| is a pointer to a structure containing * the requested resolution and frame rate. |buffer_count| is the number of @@ -67,7 +79,6 @@ struct PPB_VideoCapture_Dev { PP_Resource video_capture, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count); - /** * Allows the browser to reuse a buffer that was previously sent by * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in @@ -78,7 +89,6 @@ struct PPB_VideoCapture_Dev { * is not currently owned by the plugin. Returns PP_OK otherwise. */ int32_t (*ReuseBuffer)(PP_Resource video_capture, uint32_t buffer); - /** * Stops the capture. * @@ -87,5 +97,9 @@ struct PPB_VideoCapture_Dev { */ int32_t (*StopCapture)(PP_Resource video_capture); }; +/** + * @} + */ #endif /* PPAPI_C_DEV_PPB_VIDEO_CAPTURE_DEV_H_ */ + diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h index aab226e..154b395 100644 --- a/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -2,131 +2,164 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +/* From dev/ppb_video_decoder_dev.idl modified Wed Oct 5 09:00:09 2011. */ + #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ #include "ppapi/c/dev/pp_video_dev.h" +#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_var.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" #define PPB_VIDEODECODER_DEV_INTERFACE_0_16 "PPB_VideoDecoder(Dev);0.16" #define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_16 -// Video decoder interface. -// -// Typical usage: -// - Use Create() to create & configure a new PPB_VideoDecoder_Dev resource. -// - Call Decode() to decode some video data. -// - Receive ProvidePictureBuffers callback -// - Supply the decoder with textures using AssignPictureBuffers. -// - Receive PictureReady callbacks -// - Hand the textures back to the decoder using ReusePictureBuffer. -// - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone -// callback. -// - To reset the decoder (e.g. to implement Seek): call Reset() and wait for -// NotifyResetDone callback. -// - To tear down the decoder call Destroy(). -// -// See PPP_VideoDecoder_Dev for the notifications the decoder may send the -// plugin. +/** + * @file + * This file defines the <code>PPB_VideoDecoder_Dev</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video decoder interface. + * + * Typical usage: + * - Use Create() to create & configure a new PPB_VideoDecoder_Dev resource. + * - Call Decode() to decode some video data. + * - Receive ProvidePictureBuffers callback + * - Supply the decoder with textures using AssignPictureBuffers. + * - Receive PictureReady callbacks + * - Hand the textures back to the decoder using ReusePictureBuffer. + * - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone + * callback. + * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for + * NotifyResetDone callback. + * - To tear down the decoder call Destroy(). + * + * See PPP_VideoDecoder_Dev for the notifications the decoder may send the + * plugin. + */ struct PPB_VideoDecoder_Dev { - // Creates & initializes a video decoder. - // - // Parameters: - // |instance| pointer to the plugin instance. - // |context_3d| a PPB_Context3D_Dev resource in which decoding will happen. - // |profile| the video stream's format profile. - // - // The created decoder is returned as PP_Resource. 0 means failure. + /** + * Creates & initializes a video decoder. + * + * Parameters: + * |instance| pointer to the plugin instance. + * |context_3d| a PPB_Context3D_Dev resource in which decoding will happen. + * |profile| the video stream's format profile. + * + * The created decoder is returned as PP_Resource. 0 means failure. + */ PP_Resource (*Create)(PP_Instance instance, PP_Resource context, - enum PP_VideoDecoder_Profile profile); - - // Tests whether |resource| is a video decoder created through Create - // function of this interface. - // - // Parameters: - // |resource| is handle to resource to test. - // - // Returns true if is a video decoder, false otherwise. + PP_VideoDecoder_Profile profile); + /** + * Tests whether |resource| is a video decoder created through Create + * function of this interface. + * + * Parameters: + * |resource| is handle to resource to test. + * + * Returns true if is a video decoder, false otherwise. + */ PP_Bool (*IsVideoDecoder)(PP_Resource resource); - - // Dispatches bitstream buffer to the decoder. - // - // Parameters: - // |video_decoder| is the previously created handle to the decoder resource. - // |bitstream_buffer| is the bitstream buffer that contains the input data. - // |callback| will be called when |bitstream_buffer| has been processed by - // the decoder. - // - // Returns an error code from pp_errors.h. + /** + * Dispatches bitstream buffer to the decoder. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |bitstream_buffer| is the bitstream buffer that contains the input data. + * |callback| will be called when |bitstream_buffer| has been processed by + * the decoder. + * + * Returns an error code from pp_errors.h. + */ int32_t (*Decode)(PP_Resource video_decoder, const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, struct PP_CompletionCallback callback); - - // Provides the decoder with texture-backed picture buffers for video - // decoding. - // - // This function should be called when the plugin has its - // ProvidePictureBuffers method called. The decoder will stall until it has - // received all the buffers it's asked for. - // - // Parameters: - // |video_decoder| is the previously created handle to the decoder resource. - // |no_of_buffers| how many buffers are behind picture buffer pointer. - // |buffers| contains the reference to the picture buffer that was - // allocated. - void (*AssignPictureBuffers)( - PP_Resource video_decoder, uint32_t no_of_buffers, - const struct PP_PictureBuffer_Dev* buffers); - - // Tells the decoder to reuse the given picture buffer. Typical use of this - // function is to call from PictureReady callback to recycle picture buffer - // back to the decoder after blitting the image so that decoder can use the - // image for output again. - // - // Parameters: - // |video_decoder| is the previously created handle to the decoder resource. - // |picture_buffer_id| contains the id of the picture buffer that was - // processed. + /** + * Provides the decoder with texture-backed picture buffers for video + * decoding. + * + * This function should be called when the plugin has its + * ProvidePictureBuffers method called. The decoder will stall until it has + * received all the buffers it's asked for. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |no_of_buffers| how many buffers are behind picture buffer pointer. + * |buffers| contains the reference to the picture buffer that was + * allocated. + */ + void (*AssignPictureBuffers)(PP_Resource video_decoder, + uint32_t no_of_buffers, + const struct PP_PictureBuffer_Dev buffers[]); + /** + * Tells the decoder to reuse the given picture buffer. Typical use of this + * function is to call from PictureReady callback to recycle picture buffer + * back to the decoder after blitting the image so that decoder can use the + * image for output again. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |picture_buffer_id| contains the id of the picture buffer that was + * processed. + */ void (*ReusePictureBuffer)(PP_Resource video_decoder, int32_t picture_buffer_id); - - // Flush input and output buffers in the decoder. Any pending inputs are - // decoded and pending outputs are delivered to the plugin. Once done - // flushing, the decoder will call |callback|. - // - // Parameters: - // |video_decoder| is the previously created handle to the decoder resource. - // |callback| is one-time callback that will be called once the flushing - // request has been completed. - // - // Returns an error code from pp_errors.h. + /** + * Flush input and output buffers in the decoder. Any pending inputs are + * decoded and pending outputs are delivered to the plugin. Once done + * flushing, the decoder will call |callback|. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |callback| is one-time callback that will be called once the flushing + * request has been completed. + * + * Returns an error code from pp_errors.h. + */ int32_t (*Flush)(PP_Resource video_decoder, struct PP_CompletionCallback callback); - - // Reset the decoder as quickly as possible. Pending inputs and outputs are - // dropped and the decoder is put back into a state ready to receive further - // Decode() calls. |callback| will be called when the reset is done. - // - // Parameters: - // |video_decoder| is the previously created handle to the decoder resource. - // |callback| is one-time callback that will be called once the reset - // request has been completed. - // - // Returns an error code from pp_errors.h. + /** + * Reset the decoder as quickly as possible. Pending inputs and outputs are + * dropped and the decoder is put back into a state ready to receive further + * Decode() calls. |callback| will be called when the reset is done. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |callback| is one-time callback that will be called once the reset + * request has been completed. + * + * Returns an error code from pp_errors.h. + */ int32_t (*Reset)(PP_Resource video_decoder, struct PP_CompletionCallback callback); - - // Tear down the decoder as quickly as possible. Pending inputs and outputs - // are dropped and the decoder frees all of its resources. Although resources - // may be freed asynchronously, after this method returns no more callbacks - // will be made on the client. Any resources held by the client at that point - // may be freed. - // - // Parameters: - // |video_decoder| is the previously created handle to the decoder resource. + /** + * Tear down the decoder as quickly as possible. Pending inputs and outputs + * are dropped and the decoder frees all of its resources. Although resources + * may be freed asynchronously, after this method returns no more callbacks + * will be made on the client. Any resources held by the client at that point + * may be freed. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + */ void (*Destroy)(PP_Resource video_decoder); }; +/** + * @} + */ #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */ + diff --git a/ppapi/c/dev/ppb_video_layer_dev.h b/ppapi/c/dev/ppb_video_layer_dev.h index 46895a2..370a4d7 100644 --- a/ppapi/c/dev/ppb_video_layer_dev.h +++ b/ppapi/c/dev/ppb_video_layer_dev.h @@ -2,112 +2,160 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +/* From dev/ppb_video_layer_dev.idl modified Wed Oct 5 09:15:37 2011. */ + #ifndef PPAPI_C_DEV_PPB_VIDEO_LAYER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_LAYER_DEV_H_ -#include "ppapi/c/dev/pp_video_dev.h" -#include "ppapi/c/pp_completion_callback.h" - -#define PPB_VIDEOLAYER_DEV_INTERFACE "PPB_VideoLayer(Dev);0.1" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" -// Enumeration for pixel format of the video layer. -enum PP_VideoLayerPixelFormat_Dev { - PP_VIDEOLAYERPIXELFORMAT_RGBA = 0, - PP_VIDEOLAYERPIXELFORMAT_YV12 = 1, -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoLayerPixelFormat_Dev, 4); +#define PPB_VIDEOLAYER_DEV_INTERFACE_0_1 "PPB_VideoLayer(Dev);0.1" +#define PPB_VIDEOLAYER_DEV_INTERFACE PPB_VIDEOLAYER_DEV_INTERFACE_0_1 -// TODO(hclam): Add options to customize color conversion. +/** + * @file + * This file defines the <code>PPB_VideoDecoder_Dev</code> interface. + */ -// Enumeration for operation mode of the video layer. -// PPB_VideoLayer_Dev needs to be created with one of these enums in order to -// determine the operation mode. -enum PP_VideoLayerMode_Dev { - // In this mode user needs to update content of the video layer manually by - // calling UpdateContent(). - PP_VIDEOLAYERMODE_SOFTWARE = 0, - // In this mode content of the video layer is updated by a hardware video - // decoder, calling UpdateContent() will always return PP_FALSE. - PP_VIDEOLAYERMODE_HARDWARE = 1, -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoLayerMode_Dev, 4); +/** + * @addtogroup Enums + * @{ + */ +/** + * Enumeration for pixel format of the video layer. + */ +typedef enum { + PP_VIDEOLAYERPIXELFORMAT_RGBA = 0, + PP_VIDEOLAYERPIXELFORMAT_YV12 = 1 +} PP_VideoLayerPixelFormat_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoLayerPixelFormat_Dev, 4); -// PPB_VideoLayer is a mechanism to enhance rendering performance of video -// content. Rendering is generally done by using PPB_Context3D or -// PPB_Graphics2D, however for video content it is redundant to go through -// PPB_Context3D or PPB_Graphics2D. PPB_VideoLayer allows video content to be -// rendered directly. +/** TODO(hclam): Add options to customize color conversion. */ +/** + * Enumeration for operation mode of the video layer. + * PPB_VideoLayer_Dev needs to be created with one of these enums in order to + * determine the operation mode. + */ +typedef enum { + /** + * In this mode user needs to update content of the video layer manually by + * calling UpdateContent(). + */ + PP_VIDEOLAYERMODE_SOFTWARE = 0, + /** + * In this mode content of the video layer is updated by a hardware video + * decoder, calling UpdateContent() will always return PP_FALSE. + */ + PP_VIDEOLAYERMODE_HARDWARE = 1 +} PP_VideoLayerMode_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoLayerMode_Dev, 4); +/** + * @} + */ -// PPB_VideoLayer can be used in two modes: -// -// Software Decoding Mode -// In this mode the video layer needs to be updated with system memory manually -// using UpdateContent(). -// -// Hardware Decoding Mode -// In this mode the content of the video layer is updated by a hardware video -// decoder. +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_VideoLayer is a mechanism to enhance rendering performance of video + * content. Rendering is generally done by using PPB_Context3D or + * PPB_Graphics2D, however for video content it is redundant to go through + * PPB_Context3D or PPB_Graphics2D. PPB_VideoLayer allows video content to be + * rendered directly. + * + * PPB_VideoLayer can be used in two modes: + * + * Software Decoding Mode + * In this mode the video layer needs to be updated with system memory manually + * using UpdateContent(). + * + * Hardware Decoding Mode + * In this mode the content of the video layer is updated by a hardware video + * decoder. + */ struct PPB_VideoLayer_Dev { - // Creates a video layer. - PP_Resource (*Create)(PP_Instance instance, enum PP_VideoLayerMode_Dev mode); - - // Returns true if the input parameter is a video layer. + /** + * Creates a video layer. + */ + PP_Resource (*Create)(PP_Instance instance, PP_VideoLayerMode_Dev mode); + /** + * Returns true if the input parameter is a video layer. + */ PP_Bool (*IsVideoLayer)(PP_Resource layer); - - // Set the pixel format of this video layer. By default it is RGBA. - // - // This method must be called before the video layer can be displayed. - // - // The updated size will be effective after SwapBuffers() is called. + /** + * Set the pixel format of this video layer. By default it is RGBA. + * + * This method must be called before the video layer can be displayed. + * + * The updated size will be effective after SwapBuffers() is called. + */ void (*SetPixelFormat)(PP_Resource layer, - enum PP_VideoLayerPixelFormat_Dev pixel_format); - - // Set the native size of the video layer. This method must be called before - // the video layer can be displayed. - // - // The updated size will be effective after SwapBuffers() is called. + PP_VideoLayerPixelFormat_Dev pixel_format); + /** + * Set the native size of the video layer. This method must be called before + * the video layer can be displayed. + * + * The updated size will be effective after SwapBuffers() is called. + */ void (*SetNativeSize)(PP_Resource layer, const struct PP_Size* size); - - // Set the clipping rectangle for this video layer relative to the native - // size. Only content within this rect is displayed. - // - // The clip rectangle will be effective after SwapBuffers() is called. + /** + * Set the clipping rectangle for this video layer relative to the native + * size. Only content within this rect is displayed. + * + * The clip rectangle will be effective after SwapBuffers() is called. + */ void (*SetClipRect)(PP_Resource layer, const struct PP_Rect* clip_rect); - - // Return PP_TRUE if this video layer can be displayed. If this returns - // PP_FALSE it can mean that the size is unknown or the video layer doesn't - // have video memory allocated or not initialized. + /** + * Return PP_TRUE if this video layer can be displayed. If this returns + * PP_FALSE it can mean that the size is unknown or the video layer doesn't + * have video memory allocated or not initialized. + */ PP_Bool (*IsReady)(PP_Resource layer); - - // Update the content of a video layer from system memory. SetNativeSize() - // must be called before making this method call. - // - // NOTE: This method has no effect in hardware decoding mode. - // - // |no_of_planes| is the number of planes in |planes|. - // |planes| is an array of memory planes to be uploaded. - // - // Number of planes and format for planes is based on pixel format. - // - // PP_VIDEOLAYERPIXELFORMAT_RGBA: - // - // There will be one memory plane in RGBA format. - // - // planes[0] - RGBA plane, packed - // - // PP_VIDEOLAYERPIXELFORMAT_YV12: - // - // There will be three planes. In the order of Y, U and V. U and V planes - // are 2x2 subsampled. - // - // planes[0] - Y plane - // planes[1] - U plane, 2x2 subsampled - // planes[2] - V plane, 2x2 subsampled - // - // Return true if successful. - PP_Bool (*UpdateContent)(PP_Resource layer, uint32_t no_of_planes, - const void** planes); + /** + * Update the content of a video layer from system memory. SetNativeSize() + * must be called before making this method call. + * + * NOTE: This method has no effect in hardware decoding mode. + * + * |no_of_planes| is the number of planes in |planes|. + * |planes| is an array of memory planes to be uploaded. + * + * Number of planes and format for planes is based on pixel format. + * + * PP_VIDEOLAYERPIXELFORMAT_RGBA: + * + * There will be one memory plane in RGBA format. + * + * planes[0] - RGBA plane, packed + * + * PP_VIDEOLAYERPIXELFORMAT_YV12: + * + * There will be three planes. In the order of Y, U and V. U and V planes + * are 2x2 subsampled. + * + * planes[0] - Y plane + * planes[1] - U plane, 2x2 subsampled + * planes[2] - V plane, 2x2 subsampled + * + * Return true if successful. + */ + PP_Bool (*UpdateContent)(PP_Resource layer, + uint32_t no_of_planes, + const void* planes[]); }; +/** + * @} + */ #endif /* PPAPI_C_DEV_PPB_VIDEO_LAYER_DEV_H_ */ + diff --git a/ppapi/c/dev/ppp_video_decoder_dev.h b/ppapi/c/dev/ppp_video_decoder_dev.h index b924fd4..e3d1d41 100644 --- a/ppapi/c/dev/ppp_video_decoder_dev.h +++ b/ppapi/c/dev/ppp_video_decoder_dev.h @@ -2,80 +2,109 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +/* From dev/ppp_video_decoder_dev.idl modified Wed Oct 5 15:59:17 2011. */ + #ifndef PPAPI_C_DEV_PPP_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPP_VIDEO_DECODER_DEV_H_ +#include "ppapi/c/dev/pp_video_dev.h" #include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" -#include "ppapi/c/dev/pp_video_dev.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" -#define PPP_VIDEODECODER_DEV_INTERFACE "PPP_VideoDecoder(Dev);0.8" +#define PPP_VIDEODECODER_DEV_INTERFACE_0_9 "PPP_VideoDecoder(Dev);0.9" +#define PPP_VIDEODECODER_DEV_INTERFACE PPP_VIDEODECODER_DEV_INTERFACE_0_9 -// PPP_VideoDecoder_Dev structure contains the function pointers that the -// plugin MUST implement to provide services needed by the video decoder -// implementation. -// See PPB_VideoDecoder_Dev for general usage tips. +/** + * @file + * This file defines the <code>PPP_VideoDecoder_Dev</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPP_VideoDecoder_Dev structure contains the function pointers that the + * plugin MUST implement to provide services needed by the video decoder + * implementation. + * + * See PPB_VideoDecoder_Dev for general usage tips. + */ struct PPP_VideoDecoder_Dev { - // Callback function to provide buffers for the decoded output pictures. If - // succeeds plugin must provide buffers through AssignPictureBuffers function - // to the API. If |req_num_of_bufs| matching exactly the specification - // given in the parameters cannot be allocated decoder should be destroyed. - // - // Decoding will not proceed until buffers have been provided. - // - // Parameters: - // |instance| the plugin instance to which the callback is responding. - // |decoder| the PPB_VideoDecoder_Dev resource. - // |req_num_of_bufs| tells how many buffers are needed by the decoder. - // |dimensions| tells the dimensions of the buffer to allocate. - // |type| specifies whether the buffer lives in system memory or GL texture. + /** + * Callback function to provide buffers for the decoded output pictures. If + * succeeds plugin must provide buffers through AssignPictureBuffers function + * to the API. If |req_num_of_bufs| matching exactly the specification + * given in the parameters cannot be allocated decoder should be destroyed. + * + * Decoding will not proceed until buffers have been provided. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |req_num_of_bufs| tells how many buffers are needed by the decoder. + * |dimensions| tells the dimensions of the buffer to allocate. + */ void (*ProvidePictureBuffers)(PP_Instance instance, PP_Resource decoder, uint32_t req_num_of_bufs, - struct PP_Size dimensions); - - // Callback function for decoder to deliver unneeded picture buffers back to - // the plugin. - // - // Parameters: - // |instance| the plugin instance to which the callback is responding. - // |decoder| the PPB_VideoDecoder_Dev resource. - // |picture_buffer| points to the picture buffer that is no longer needed. + const struct PP_Size* dimensions); + /** + * Callback function for decoder to deliver unneeded picture buffers back to + * the plugin. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |picture_buffer| points to the picture buffer that is no longer needed. + */ void (*DismissPictureBuffer)(PP_Instance instance, PP_Resource decoder, int32_t picture_buffer_id); - - // Callback function for decoder to deliver decoded pictures ready to be - // displayed. Decoder expects the plugin to return the buffer back to the - // decoder through ReusePictureBuffer function in PPB Video Decoder API. - // - // Parameters: - // |instance| the plugin instance to which the callback is responding. - // |decoder| the PPB_VideoDecoder_Dev resource. - // |picture| is the picture that is ready. + /** + * Callback function for decoder to deliver decoded pictures ready to be + * displayed. Decoder expects the plugin to return the buffer back to the + * decoder through ReusePictureBuffer function in PPB Video Decoder API. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |picture| is the picture that is ready. + */ void (*PictureReady)(PP_Instance instance, PP_Resource decoder, - struct PP_Picture_Dev picture); - - // Callback function to tell the plugin that decoder has decoded end of stream - // marker and output all the pictures that should be displayed from the - // stream. - // - // Parameters: - // |instance| the plugin instance to which the callback is responding. - // |decoder| the PPB_VideoDecoder_Dev resource. + const struct PP_Picture_Dev* picture); + /** + * Callback function to tell the plugin that decoder has decoded end of stream + * marker and output all the pictures that should be displayed from the + * stream. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + */ void (*EndOfStream)(PP_Instance instance, PP_Resource decoder); - - // Error handler callback for decoder to deliver information about detected - // errors to the plugin. - // - // Parameters: - // |instance| the plugin instance to which the callback is responding. - // |decoder| the PPB_VideoDecoder_Dev resource. - // |error| error is the enumeration specifying the error. + /** + * Error handler callback for decoder to deliver information about detected + * errors to the plugin. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |error| error is the enumeration specifying the error. + */ void (*NotifyError)(PP_Instance instance, PP_Resource decoder, - enum PP_VideoDecodeError_Dev error); + PP_VideoDecodeError_Dev error); }; +/** + * @} + */ #endif /* PPAPI_C_DEV_PPP_VIDEO_DECODER_DEV_H_ */ + |