diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 18:32:13 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 18:32:13 +0000 |
commit | acda308500fea6641a79f7584516d7d153a4a241 (patch) | |
tree | 7ce924637edc497b81c96829f6c754c60f2575e6 /ppapi/c | |
parent | 100421d5653b09d8b61f14bee5465dfe9d1b934c (diff) | |
download | chromium_src-acda308500fea6641a79f7584516d7d153a4a241.zip chromium_src-acda308500fea6641a79f7584516d7d153a4a241.tar.gz chromium_src-acda308500fea6641a79f7584516d7d153a4a241.tar.bz2 |
Checking in major revision of Pepper video decode APIs.
Part of a patch by vmr@chromium.org:
http://codereview.chromium.org/6541068/
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6776008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r-- | ppapi/c/dev/pp_video_dev.h | 598 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_video_decoder_dev.h | 223 | ||||
-rw-r--r-- | ppapi/c/dev/ppp_video_decoder_dev.h | 70 |
3 files changed, 538 insertions, 353 deletions
diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h index 0699994..f568105 100644 --- a/ppapi/c/dev/pp_video_dev.h +++ b/ppapi/c/dev/pp_video_dev.h @@ -1,337 +1,339 @@ -/* Copyright (c) 2010 The Chromium Authors. All rights reserved. +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_ #define PPAPI_C_DEV_PP_VIDEO_DEV_H_ +#include "ppapi/c/dev/ppb_opengles_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" -enum PP_VideoKey_Dev { - PP_VIDEOKEY_NONE = 0, - // Value is type of PP_VideoCodecId. - PP_VIDEOKEY_CODECID, - // Value is type of PP_VideoOperation. - PP_VIDEOKEY_OPERATION, - // Value is type of PP_VideoCodecProfile. - PP_VIDEOKEY_CODECPROFILE, - // Value is type of PP_VideoCodecLevel. - PP_VIDEOKEY_CODECLEVEL, - // Value is 0 or 1. - PP_VIDEOKEY_ACCELERATION, - // Value is type of PP_VideoPayloadFormat. - PP_VIDEOKEY_PAYLOADFORMAT, - // Value is type of PP_VideoFrameColorType. - PP_VIDEOKEY_COLORTYPE, - // Value is type of PP_VideoFrameSurfaceType. - PP_VIDEOKEY_SURFACETYPE, - // Value is type of PP_VideoFrameInfoFlag. - PP_VIDEOKEY_FRAMEINFOFLAG, - - // Subset for H.264 features, value of 1 means supported. This is needed in - // case decoder has partial support for certain profile. - PP_VIDEOKEY_H264FEATURE_FMO = 0x100, - PP_VIDEOKEY_H264FEATURE_ASO, - PP_VIDEOKEY_H264FEATURE_INTERLACE, - PP_VIDEOKEY_H264FEATURE_CABAC, - PP_VIDEOKEY_H264FEATURE_WEIGHTEDPREDICTION -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoKey_Dev, 4); - -enum PP_VideoDecoderEvent_Dev { - PP_VIDEODECODEREVENT_NONE = 0, - // Signaling that an error has been hit. - PP_VIDEODECODEREVENT_ERROR, - // Signaling new width/height of video frame - PP_VIDEODECODEREVENT_NEWDIMENSION, - // Signaling new cropping rectangle - PP_VIDEODECODEREVENT_NEWCROP +// Enumeration defining global dictionary ranges for various purposes that are +// used to handle the configurations of the video decoder. +enum PP_VideoAttributeDictionary { + PP_VIDEOATTR_DICTIONARY_TERMINATOR = 0, + + PP_VIDEOATTR_DICTIONARY_BITSTREAM_FORMAT_BASE = 0x100, + // Array of key/value pairs describing video configuration. + // It could include any keys from PP_VideoKey. Its last element shall be + // PP_VIDEOATTR_BITSTREAMFORMATKEY_NONE with no corresponding value. + // An example: + // { + // PP_VIDEOATTR_BITSTREAMFORMATKEY_FOURCC, PP_VIDEODECODECID_VP8, + // PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_PROFILE, (PP_VP8PROFILE_1 | + // PP_VP8PROFILE_2 | + // PP_VP8PROFILE_3), + // PP_VIDEOATTR_DICTIONARY_TERMINATOR + // }; + // Keys for defining video bitstream format. + // Terminating entry for bitstream format descriptions. + PP_VIDEOATTR_BITSTREAMFORMATKEY_NONE, + // Value is type of PP_VideoCodecFourcc. Commonly known attributes values are + // defined in PP_VideoCodecFourcc enumeration. + PP_VIDEOATTR_BITSTREAMFORMATKEY_FOURCC, + // Bitrate in bits/s. Attribute value is 32-bit unsigned integer. + PP_VIDEOATTR_BITSTREAMFORMATKEY_BITRATE, + // Width and height of the input video bitstream, if known by the application. + // Decoder will expect the bitstream to match these values and does memory + // considerations accordingly. + PP_VIDEOATTR_BITSTREAMFORMATKEY_WIDTH, + PP_VIDEOATTR_BITSTREAMFORMATKEY_HEIGHT, + // Following attributes are applicable only in case of VP8. + // Key for VP8 profile attribute. Attribute value is bitmask of flags defined + // in PP_VP8Profile_Dev enumeration. + PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_PROFILE, + // Number of partitions per picture. Attribute value is unsigned 32-bit + // integer. + PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_NUM_OF_PARTITIONS, + // Following attributes are applicable only in case of H.264. + // Value is bitmask collection from the flags defined in PP_H264Profile. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PROFILE, + // Value is type of PP_H264Level. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_LEVEL, + // Value is type of PP_H264PayloadFormat_Dev. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PAYLOADFORMAT, + // Subset for H.264 features, attribute value 0 signifies unsupported. + // This is needed in case decoder has partial support for certain profile. + // Default for features are enabled if they're part of supported profile. + // H264 tool called Flexible Macroblock Ordering. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_FMO, + // H264 tool called Arbitrary Slice Ordering. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_ASO, + // H264 tool called Interlacing. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_INTERLACE, + // H264 tool called Context-Adaptive Binary Arithmetic Coding. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_CABAC, + // H264 tool called Weighted Prediction. + PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_WEIGHTEDPREDICTION, + + PP_VIDEOATTR_DICTIONARY_COLOR_CORMAT_BASE = 0x1000, + // Keys for definining attributes of a color buffer. Using these attributes + // users can define color spaces in terms of red, green, blue and alpha + // components as well as with combination of luma and chroma values with + // different subsampling schemes. Also planar, semiplanar and interleaved + // formats can be described by using the provided keys as instructed. + // + // Rules for describing the color planes (1 or more) that constitute the whole + // picture are: + // 1. Each plane starts with PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE + // attribute telling how many bits per pixel the plane contains. + // 2. PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE attribute must be + // followed either by + // a. Red, green and blue components followed optionally by alpha size + // attribute. + // OR + // b. Luma, blue difference chroma and red difference chroma components as + // well as three sampling reference factors that tell how the chroma may + // have been subsampled with respect to luma. + // 3. Description must be terminated with PP_VIDEOATTR_COLORFORMATKEY_NONE + // key with no value for attribute. + // + // For example, semiplanar YCbCr 4:2:2 (2 planes, one containing 8-bit luma, + // the other containing two interleaved chroma data components) may be + // described with the following attributes: + // { + // PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, 8, + // PP_VIDEOATTR_COLORFORMATKEY_LUMA_SIZE, 8, + // PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, 16, + // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_BLUE_SIZE, 8, + // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_RED_SIZE, 8, + // PP_VIDEOATTR_COLORFORMATKEY_HORIZONTAL_SAMPLING_FACTOR_REFERENCE, 4, + // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_HORIZONTAL_SUBSAMPLING_FACTOR, 2, + // PP_VIDEOATTR_COLORFORMATKEY_CHROMA_VERTICAL_SUBSAMPLING_FACTOR, 2 + // PP_VIDEOATTR_DICTIONARY_TERMINATOR + // } + // + // Another example, commonly known 16-bit RGB 565 color format may be + // specified as follows: + // { + // PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, 16, + // PP_VIDEOATTR_COLORFORMATKEY_RED_SIZE, 5, + // PP_VIDEOATTR_COLORFORMATKEY_GREEN_SIZE, 6, + // PP_VIDEOATTR_COLORFORMATKEY_BLUE_SIZE, 5, + // PP_VIDEOATTR_DICTIONARY_TERMINATOR + // } + // Total color component bits per pixel in the picture buffer. + PP_VIDEOATTR_COLORFORMATKEY_PLANE_PIXEL_SIZE, + // Bits of red per pixel in picture buffer. + PP_VIDEOATTR_COLORFORMATKEY_RED_SIZE, + // Bits of green per pixel in picture buffer. + PP_VIDEOATTR_COLORFORMATKEY_GREEN_SIZE, + // Bits of blue per pixel in picture buffer. + PP_VIDEOATTR_COLORFORMATKEY_BLUE_SIZE, + // Bits of alpha in color buffer. + PP_VIDEOATTR_COLORFORMATKEY_ALPHA_SIZE, + // Bits of luma per pixel in color buffer. + PP_VIDEOATTR_COLORFORMATKEY_LUMA_SIZE, + // Bits of blue difference chroma (Cb) data in color buffer. + PP_VIDEOATTR_COLORFORMATKEY_CHROMA_BLUE_SIZE, + // Bits of blue difference chroma (Cr) data in color buffer. + PP_VIDEOATTR_COLORFORMATKEY_CHROMA_RED_SIZE, + // Three keys to describe the subsampling of YCbCr sampled digital video + // signal. For example, 4:2:2 sampling could be defined by setting: + // PP_VIDEOATTR_COLORFORMATKEY_HORIZONTAL_SAMPLING_FACTOR_REFERENCE = 4 + // PP_VIDEOATTR_COLORFORMATKEY_CHROMINANCE_HORIZONTAL_SUBSAMPLING_FACTOR = 2 + // PP_VIDEOATTR_COLORFORMATKEY_CHROMINANCE_VERTICAL_SUBSAMPLING_FACTOR = 2 + PP_VIDEOATTR_COLORFORMATKEY_HORIZONTAL_SAMPLING_FACTOR_REFERENCE, + PP_VIDEOATTR_COLORFORMATKEY_CHROMA_HORIZONTAL_SUBSAMPLING_FACTOR, + PP_VIDEOATTR_COLORFORMATKEY_CHROMA_VERTICAL_SUBSAMPLING_FACTOR, + // Base for telling implementation specific information about the optimal + // number of picture buffers to be provided to the implementation. + PP_VIDEOATTR_DICTIONARY_PICTUREBUFFER_REQUIREMENTS_BASE = 0x10000, + // Following two keys are used to signal how many buffers are needed by the + // implementation as a function of the maximum number of reference frames set + // by the stream. Number of required buffers is + // MAX_REF_FRAMES * REFERENCE_PIC_MULTIPLIER + ADDITIONAL_BUFFERS + PP_VIDEOATTR_PICTUREBUFFER_REQUIREMENTS_ADDITIONAL_BUFFERS, + PP_VIDEOATTR_PICTUREBUFFER_REQUIREMENTS_REFERENCE_PIC_MULTIPLIER, + // If decoder does not support pixel accurate strides for picture buffer, this + // parameter tells the stride multiple that is needed by the decoder. Plugin + // must obey the given stride in its picture buffer allocations. + PP_VIDEOATTR_PICTUREBUFFER_REQUIREMENTS_STRIDE_MULTIPLE }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecoderEvent_Dev, 4); +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4); +typedef int32_t* PP_VideoConfigElement; -enum PP_VideoDecodeError_Dev { - PP_VIDEODECODEERROR_NONE = 0, - PP_VIDEODECODEERROR_NOTSUPPORTED, - PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, - PP_VIDEODECODEERROR_UNDEFINED, - PP_VIDEODECODEERROR_BADINPUT, - PP_VIDEODECODEERROR_HARDWARE +enum PP_VideoCodecFourcc { + PP_VIDEOCODECFOURCC_NONE = 0, + PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. + PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'. }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); - -enum PP_VideoCodecId_Dev { - PP_VIDEODECODECID_NONE = 0, - PP_VIDEODECODECID_H264, - PP_VIDEODECODECID_VC1, - PP_VIDEODECODECID_MPEG2, - PP_VIDEODECODECID_VP8 +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4); + +// VP8 specific information to be carried over the APIs. +// Enumeration for flags defining supported VP8 profiles. +enum PP_VP8Profile_Dev { + PP_VP8PROFILE_NONE = 0, + PP_VP8PROFILE_0 = 1, + PP_VP8PROFILE_1 = 1 << 1, + PP_VP8PROFILE_2 = 1 << 2, + PP_VP8PROFILE_3 = 1 << 3 }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecId_Dev, 4); - -enum PP_VideoOperation_Dev { - PP_VIDEOOPERATION_NONE = 0, - PP_VIDEOOPERATION_DECODE, - PP_VIDEOOPERATION_ENCODE +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VP8Profile_Dev, 4); + +// H.264 specific information to be carried over the APIs. +// Enumeration for flags defining supported H.264 profiles. +enum PP_H264Profile_Dev { + PP_H264PROFILE_NONE = 0, + PP_H264PROFILE_BASELINE = 1, + PP_H264PROFILE_MAIN = 1 << 2, + PP_H264PROFILE_EXTENDED = 1 << 3, + PP_H264PROFILE_HIGH = 1 << 4, + PP_H264PROFILE_HIGH10PROFILE = 1 << 5, + PP_H264PROFILE_HIGH422PROFILE = 1 << 6, + PP_H264PROFILE_HIGH444PREDICTIVEPROFILE = 1 << 7, + PP_H264PROFILE_SCALABLEBASELINE = 1 << 8, + PP_H264PROFILE_SCALABLEHIGH = 1 << 9, + PP_H264PROFILE_STEREOHIGH = 1 << 10, + PP_H264PROFILE_MULTIVIEWHIGH = 1 << 11 }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoOperation_Dev, 4); - -enum PP_VideoCodecProfile_Dev { - PP_VIDEOCODECPROFILE_NONE = 0, - PP_VIDEOCODECPROFILE_H264_BASELINE, - PP_VIDEOCODECPROFILE_H264_MAIN, - PP_VIDEOCODECPROFILE_H264_EXTENDED, - PP_VIDEOCODECPROFILE_H264_HIGH, - PP_VIDEOCODECPROFILE_H264_SCALABLEBASELINE, - PP_VIDEOCODECPROFILE_H264_SCALABLEHIGH, - PP_VIDEOCODECPROFILE_H264_STEREOHIGH, - PP_VIDEOCODECPROFILE_H264_MULTIVIEWHIGH, - - PP_VIDEOCODECPROFILE_VC1_SIMPLE = 0x40, - PP_VIDEOCODECPROFILE_VC1_MAIN, - PP_VIDEOCODECPROFILE_VC1_ADVANCED, - - PP_VIDEOCODECPROFILE_MPEG2_SIMPLE = 0x80, - PP_VIDEOCODECPROFILE_MPEG2_MAIN, - PP_VIDEOCODECPROFILE_MPEG2_SNR, - PP_VIDEOCODECPROFILE_MPEG2_SPATIAL, - PP_VIDEOCODECPROFILE_MPEG2_HIGH +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Profile_Dev, 4); + +// Enumeration for defining H.264 level of decoder implementation. +enum PP_H264Level_Dev { + PP_H264LEVEL_NONE = 0, + PP_H264LEVEL_10 = 1, + PP_H264LEVEL_1B = PP_H264LEVEL_10 | 1 << 1, + PP_H264LEVEL_11 = PP_H264LEVEL_1B | 1 << 2, + PP_H264LEVEL_12 = PP_H264LEVEL_11 | 1 << 3, + PP_H264LEVEL_13 = PP_H264LEVEL_12 | 1 << 4, + PP_H264LEVEL_20 = PP_H264LEVEL_13 | 1 << 5, + PP_H264LEVEL_21 = PP_H264LEVEL_20 | 1 << 6, + PP_H264LEVEL_22 = PP_H264LEVEL_21 | 1 << 7, + PP_H264LEVEL_30 = PP_H264LEVEL_22 | 1 << 8, + PP_H264LEVEL_31 = PP_H264LEVEL_30 | 1 << 9, + PP_H264LEVEL_32 = PP_H264LEVEL_31 | 1 << 10, + PP_H264LEVEL_40 = PP_H264LEVEL_32 | 1 << 11, + PP_H264LEVEL_41 = PP_H264LEVEL_40 | 1 << 12, + PP_H264LEVEL_42 = PP_H264LEVEL_41 | 1 << 13, + PP_H264LEVEL_50 = PP_H264LEVEL_42 | 1 << 14, + PP_H264LEVEL_51 = PP_H264LEVEL_50 | 1 << 15 }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecProfile_Dev, 4); - -enum PP_VideoCodecLevel_Dev { - PP_VIDEOCODECLEVEL_NONE = 0, - PP_VIDEOCODECLEVEL_H264_10, - PP_VIDEOCODECLEVEL_H264_1B, - PP_VIDEOCODECLEVEL_H264_11, - PP_VIDEOCODECLEVEL_H264_12, - PP_VIDEOCODECLEVEL_H264_13, - PP_VIDEOCODECLEVEL_H264_20, - PP_VIDEOCODECLEVEL_H264_21, - PP_VIDEOCODECLEVEL_H264_22, - PP_VIDEOCODECLEVEL_H264_30, - PP_VIDEOCODECLEVEL_H264_31, - PP_VIDEOCODECLEVEL_H264_32, - PP_VIDEOCODECLEVEL_H264_40, - PP_VIDEOCODECLEVEL_H264_41, - PP_VIDEOCODECLEVEL_H264_42, - PP_VIDEOCODECLEVEL_H264_50, - PP_VIDEOCODECLEVEL_H264_51, - - PP_VIDEOCODECLEVEL_VC1_LOW = 0x40, - PP_VIDEOCODECLEVEL_VC1_MEDIUM, - PP_VIDEOCODECLEVEL_VC1_HIGH, - PP_VIDEOCODECLEVEL_VC1_L0, - PP_VIDEOCODECLEVEL_VC1_L1, - PP_VIDEOCODECLEVEL_VC1_L2, - PP_VIDEOCODECLEVEL_VC1_L3, - PP_VIDEOCODECLEVEL_VC1_L4, - - PP_VIDEOCODECLEVEL_MPEG2_LOW = 0x80, - PP_VIDEOCODECLEVEL_MPEG2_MAIN, - PP_VIDEOCODECLEVEL_MPEG2_HIGH1440, - PP_VIDEOCODECLEVEL_MPEG2_HIGH +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Level_Dev, 4); + +// Enumeration to describe which payload format is used within the exchanged +// bitstream buffers. +enum PP_H264PayloadFormat_Dev { + PP_H264PAYLOADFORMAT_NONE = 0, + // NALUs separated by Start Code. + PP_H264PAYLOADFORMAT_BYTESTREAM = 1, + // Exactly one raw NALU per buffer. + PP_H264PAYLOADFORMAT_ONE_NALU_PER_BUFFER = 1 << 1, + // NALU separated by 1-byte interleaved length field. + PP_H264PAYLOADFORMAT_ONE_BYTE_INTERLEAVED_LENGTH = 1 << 2, + // NALU separated by 2-byte interleaved length field. + PP_H264PAYLOADFORMAT_TWO_BYTE_INTERLEAVED_LENGTH = 1 << 3, + // NALU separated by 4-byte interleaved length field. + PP_H264PAYLOADFORMAT_FOUR_BYTE_INTERLEAVED_LENGTH = 1 << 4 }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecLevel_Dev, 4); - -enum PP_VideoPayloadFormat_Dev { - PP_VIDEOPAYLOADFORMAT_NONE = 0, - PP_VIDEOPAYLOADFORMAT_BYTESTREAM, - PP_VIDEOPAYLOADFORMAT_RTPPAYLOAD +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264PayloadFormat_Dev, 4); + +// Enumeration to determine which type of memory for buffer is used. +enum PP_PictureBufferType_Dev { + PP_PICTUREBUFFERTYPE_NONE = 0, + // System memory a.k.a. RAM. + PP_PICTUREBUFFERTYPE_SYSTEM = 1, + // GLES texture allocated using OpenGL ES APIs. + PP_PICTUREBUFFERTYPE_GLESTEXTURE = 1 << 1 }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoPayloadFormat_Dev, 4); +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_PictureBufferType_Dev, 4); -enum PP_VideoFrameColorType_Dev { - PP_VIDEOFRAMECOLORTYPE_NONE = 0, - PP_VIDEOFRAMECOLORTYPE_RGB565, - PP_VIDEOFRAMECOLORTYPE_ARGB8888, - PP_VIDEOFRAMECOLORTYPE_YUV, - PP_VIDEOFRAMECOLORTYPE_Monochrome, - PP_VIDEOFRAMECOLORTYPE_YUV420PLANAR, - PP_VIDEOFRAMECOLORTYPE_YUV422PLANAR, - PP_VIDEOFRAMECOLORTYPE_YUV444PLANAR -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoFrameColorType_Dev, 4); +// Structure to describe storage properties for a picture. +struct PP_PictureBufferProperties_Dev { + // Size of the storage (as per width & height in pixels). + struct PP_Size size; -enum PP_VideoFrameSurfaceType_Dev { - PP_VIDEOFRAMESURFACETYPE_NONE = 0, - PP_VIDEOFRAMESURFACETYPE_SYSTEMMEMORY, - PP_VIDEOFRAMESURFACETYPE_GLTEXTURE, - PP_VIDEOFRAMESURFACETYPE_PIXMAP -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoFrameSurfaceType_Dev, 4); + // Type of the picture buffer (GLES, system memory). + enum PP_PictureBufferType_Dev type; -enum PP_VideoFrameInfoFlag_Dev { - PP_VIDEOFRAMEINFOFLAG_NONE = 0, - // Indicate this is the end of stream. Used by both plugin and browser. - PP_VIDEOFRAMEINFOFLAG_EOS = 1 << 0, - // Decode the frame only, don't return decoded frame. Used by plugin. - PP_VIDEOFRAMEINFOFLAG_NOEMIT = 1 << 1, - // Indicate this is an anchor frame. Used by plugin. - PP_VIDEOFRAMEINFOFLAG_SYNCFRAME = 1 << 2, - // Indicate the decoded frame has data corruption. Used by browser. - PP_VIDEOFRAMEINFOFLAG_DATACORRUPT = 1 << 3 + // Key-attribute pairs defining color format for the buffer. + PP_VideoConfigElement color_format; }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoFrameInfoFlag_Dev, 4); - -enum PP_VideoFrameBufferConst_Dev { - // YUV formats - PP_VIDEOFRAMEBUFFER_YPLANE = 0, - PP_VIDEOFRAMEBUFFER_UPLANE = 1, - PP_VIDEOFRAMEBUFFER_VPLANE = 2, - PP_VIDEOFRAMEBUFFER_NUMBERYUVPLANES = 3, - - // RGBA formats - PP_VIDEOFRAMEBUFFER_RGBAPLANE = 0, - PP_VIDEOFRAMEBUFFER_NUMBERRGBAPLANES = 1, - PP_VIDEOFRAMEBUFFER_MAXNUMBERPLANES = 4 +// Requested decoder configuration and callback from plugin. +struct PP_VideoDecoderConfig_Dev { + // Input bitstream properties. + PP_VideoConfigElement bitstream_properties; + // Output picture properties. + struct PP_PictureBufferProperties_Dev picture_properties; }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoFrameBufferConst_Dev, 4); - -typedef int64_t PP_VideoDecodeData_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoDecodeData_Dev, 8); -// Array of key/value pairs describing video configuration. -// It could include any keys from PP_VideoKey. Its last element shall be -// PP_VIDEOKEY_NONE with no corresponding value. -// An example: -// { -// PP_VIDEOKEY_CODECID, PP_VIDEODECODECID_H264, -// PP_VIDEOKEY_OPERATION, PP_VIDEOOPERATION_DECODE, -// PP_VIDEOKEY_CODECPROFILE, PP_VIDEOCODECPROFILE_H264_HIGH, -// PP_VIDEOKEY_CODECLEVEL, PP_VIDEOCODECLEVEL_H264_41, -// PP_VIDEOKEY_ACCELERATION, 1 -// PP_VIDEOKEY_NONE, -// }; -typedef int32_t* PP_VideoConfig_Dev; -typedef int32_t PP_VideoConfigElement_Dev; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoConfigElement_Dev, 4); +// The data structure for video bitstream buffer. +struct PP_VideoBitstreamBuffer_Dev { + // Buffer to hold the bitstream data. Should be allocated using the PPB_Buffer + // interface for consistent interprocess behaviour. + PP_Resource bitstream; -// The data structure for compressed data buffer. -struct PP_VideoCompressedDataBuffer_Dev { - // The buffer is created through PPB_Buffer API. - // TODO(wjia): would uint8_t* be good, too? - PP_Resource buffer; + // Size of the bitstream contained in buffer (in bytes). + int32_t bitstream_size; - // number of bytes with real data in the buffer. - int32_t filled_size; + // Optional pointer for application to associate information with a sample. + // The pointer will be associated with the resulting decoded picture. + // Typically applications associate timestamps with buffers. + void* user_handle; - // Bit mask of PP_VideoFrameInfoFlag. - uint32_t flags; - - // Padding to ensure the PP_Resource is 8-byte aligned relative to the - // start of the struct. This helps ensure PP_VideoFrameBuffer_Dev has - // consistent size and alignment across compilers. - int32_t padding; - - // Time stamp of the frame in microsecond. - uint64_t time_stamp_us; + // TODO(vmr): Add information about access unit boundaries. }; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoCompressedDataBuffer_Dev, 24); - -struct PP_VideoFrameBuffer_Dev { - union { - struct { - struct { - int32_t width; - int32_t height; - int32_t stride; - - // TODO(wjia): uint8* would be better for some cases. - PP_Resource buffer; - } data_plane[PP_VIDEOFRAMEBUFFER_MAXNUMBERPLANES]; - - int32_t planes; - - // This padding makes sure the sys_mem struct's size is a multiple of 8 - // bytes, ensuring that handle is always 8-byte aligned relative to the - // start of the PP_VideoFrameBuffer_Dev struct. - int32_t padding; - } sys_mem; - // Handle for pixmap, gl texture, etc. - void* handle; - } buffer; - - // Storage for decoder to save some private data. It could be useful when - // plugin returns frame buffer to decoder. - void* private_handle; - - // In some 32-bit platforms (NaCl and Win32), this struct is 8-byte aligned - // due to the PP_Resource above. That causes the compiler to pad it an extra - // 4 bytes on the end. In other 32-bit platforms, there is no such pad. This - // padding ensures that the size is consistent on 32-bit platforms (and it - // is still consistent on 64-bit platforms, just bigger than it would be - // without the padding). - int32_t padding; +// Union for specifying picture data. +union PP_PictureData_Dev { + // Resource representing system memory from shared memory address space. + // Use PPB_Buffer_Dev interface to handle this resource. + PP_Resource sysmem; + // Structure to define explicitly a GLES2 context. + struct { + // Context allocated using. Use PPB_Context3D_Dev interface to handle this + // resource. + PP_Resource context; + // Texture ID in the given context where picture is stored. + GLuint textureId; + } gles2_texture; + // 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; }; -struct PP_VideoUncompressedDataBuffer_Dev { - PP_VideoConfig_Dev format; - - // Bit mask of PP_VideoFrameInfoFlag. - uint32_t flags; - - // Time stamp of the frame in microsecond. - uint64_t time_stamp_us; - - struct PP_VideoFrameBuffer_Dev buffer; - - // Output from decoder, indicating the decoded frame has error pixels. This - // could be resulted from corrupted input bit stream and error concealment - // in decoding. PP_TRUE indicates error. - // TODO(wjia): add more info about error pixels, such as error MB map, etc. - PP_Bool error; - - // In some 32-bit platforms (NaCl and Win32), this struct is 8-byte aligned - // due to the uint64_t and buffer above. That causes the compiler to pad it - // an extra 4 bytes on the end. In other 32-bit platforms, there is no such - // pad. This padding ensures that the size is consistent on 32-bit platforms - // (and it is still consistent on 64-bit platforms, just bigger than it would - // be without the padding). - int32_t padding; +// Structure to describe the decoded output picture for the plug-in along with +// optional metadata associated with the picture. +struct PP_Picture_Dev { + // Resource that represents the buffer where the picture data is stored. + // Actual implementation style of the picture buffer may be OpenGL ES texture + // (allocated using PPB_OpenGLES2_Dev) or system memory (allocated using + // PPB_Buffer_Dev). + union PP_PictureData_Dev picture_data; + + // Optional pointer to associated metadata with the picture. Typical + // information carried over metadata includes timestamps. If there is + // multiple NAL units each with their own respective metadata, only the + // metadata from the latest call to Decode will be carried over. + void* metadata; }; -// Plugin callback for decoder to deliver decoded frame buffers. -// |format| in |buffer| specifies the format of decoded frame, with -// PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required. -typedef void (*PP_VideoDecodeOutputCallback_Func_Dev)( - PP_Instance instance, - struct PP_VideoUncompressedDataBuffer_Dev* buffer); - -// Plugin callback for decoder to return input data buffers. -// Plugin can optionally provide this callback only when it wants to recycle -// input data buffers. -typedef void (*PP_VideoDecodeInputCallback_Func_Dev)( - PP_Instance instance, - struct PP_VideoCompressedDataBuffer_Dev* buffer); - -// Event handling Function for decoder to deliver events to plugin. -// The correspondence between event and data1, data2: -// When event == PP_VIDEODECODEREVENT_ERROR, -// data1 is type of PP_VideoDecodeError id and data2 is ignored; -// When event == PP_VIDEODECODEREVENT_NEWDIMENSION, -// data1 is type of PP_Size*, data2 is ignored; -// When event == PP_VIDEODECODEREVENT_NEWCROP, -// data1 is type of PP_Rect*, data2 is ignored; -typedef void (*PP_VideoDecodeEventHandler_Func_Dev)( - PP_Instance instance, - enum PP_VideoDecoderEvent_Dev event, - PP_VideoDecodeData_Dev data1, - PP_VideoDecodeData_Dev data2); - -// Requested decoder configuration and callback from plugin. -struct PP_VideoDecoderConfig_Dev { - PP_VideoConfig_Dev input_format; - PP_VideoConfig_Dev output_format; - PP_VideoDecodeOutputCallback_Func_Dev output_callback; - PP_VideoDecodeInputCallback_Func_Dev input_callback; - PP_VideoDecodeEventHandler_Func_Dev event_handler; +// Enumeration for error events that may be reported through +// PP_VideoDecodeErrorHandler_Func_Dev callback function to the plugin. Default +// error handling functionality expected from the plugin is to Flush and Destroy +// the decoder. +enum PP_VideoDecodeError_Dev { + PP_VIDEODECODEERROR_NONE = 0, + // Decoder has not been initialized and configured properly. + PP_VIDEODECODEERROR_UNINITIALIZED, + // Decoder does not support feature of configuration or bitstream. + PP_VIDEODECODEERROR_UNSUPPORTED, + // Decoder was given bitstream that would result in output pictures but it + // has not been provided buffers to do all this. + PP_VIDEODECODEERROR_INSUFFICIENT_BUFFERS, + // Decoder cannot continue operation due to insufficient resources for the + // current configuration. + PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, + // Decoder hardware has reported hardware error. + PP_VIDEODECODEERROR_HARDWARE }; +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); #endif /* PPAPI_C_DEV_PP_VIDEO_DEV_H_ */ - diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h index ceb4c80..9e9d239 100644 --- a/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -1,38 +1,78 @@ -/* Copyright (c) 2010 The Chromium Authors. All rights reserved. +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ -#include "ppapi/c/pp_bool.h" #include "ppapi/c/dev/pp_video_dev.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_var.h" -#define PPB_VIDEODECODER_DEV_INTERFACE "PPB_VideoDecoder(Dev);0.4" +#define PPB_VIDEODECODER_DEV_INTERFACE "PPB_VideoDecoder(Dev);0.5" +// Video decoder interface. +// +// Basic usage: +// 1. Use GetConfigs() to query potential configurations. Configuration +// information includes: +// a. Bitstream format. +// b. Output picture format. +// c. Output picture buffer storage type. +// 2. Select configuration that suits you and Create() the decoder with the +// chosen configuration. +// 3. Get the input bitstream data and Decode() it until streaming should +// stop or pause. +// +// Once decoder has processed a data from the bitstream buffer provided for +// decoding, it will call callback provided by the plug-in for letting the +// plug-in to know when it can release or recycle each buffer. +// +// Once decoder knows the output picture properties it needs, it will call +// callback provided by the plug-in for providing the needed buffers. Plug-in +// must provide there to the decoder. +// +// Errors are reported asynchronously to plug-in by calling the callback +// provided by the plug-in for error handling. +// +// Information to be conveyed over the API: +// 1. Bitstream format. +// 2. Output picture format. +// 3. Output picture buffer storage type. +// struct PPB_VideoDecoder_Dev { - // Queries capability of the decoder for |codec|. - // |codec| is the requested codec id. - // |configs| is a pointer to a buffer containing |config_size| elements. - // The number of configurations is returned in |num_config|. Element 0 through - // |num_config| - 1 of |configs| are filled in with valid PP_VideoConfig's. - // No more than |config_size| PP_VideoConfig's will be returned even if more - // are available on the device. - // When this function is called with |configs| = NULL, then no configurations - // are returned, but the total number of configurations available will be - // returned in |num_config|. + // Queries capability of the decoder implementation for a specific codec. + // + // Parameters: + // |instance| is the instance handle for the plugin. + // |proto_config| is a pointer to a prototype decoder configuration + // whose values are matched against supported configs. The intersection + // of prototype configuration and supported configs is stored in + // |matching_configs|. + // |matching_configs| is a pointer to a buffer where information about + // supported configuration elements that match the |proto_config| are + // stored. + // |matching_configs_size| tells for how many PP_VideoConfig_Dev elements + // the buffer pointed by |matching_configs| has space for. + // |num_of_matching_configs| is output parameter telling how many configs + // are filled with valid video config elements in the buffer pointed by + // |matching_configs| after successful call to the function. + // + // After the call |num_config| - 1 of PP_VideoConfig_Dev elements are filled + // with valid elements to the buffer pointed by |matching_configs|. No more + // than |config_size| PP_VideoConfig_Devs will be returned even if more would + // be available for the decoder device. + // + // When this function is called with |matching_configs| = NULL, then no + // configurations are returned, but the total number of PP_VideoConfig_Devs + // available will be returned in |num_of_matching_configs|. // // Returns PP_TRUE on success, PP_FALSE otherwise. - // NOTE: browser owns the memory of all PP_VideoConfig's. - PP_Bool (*GetConfig)(PP_Instance instance, - enum PP_VideoCodecId_Dev codec, - PP_VideoConfig_Dev* configs, - int32_t config_size, - int32_t* num_config); + PP_Bool (*GetConfigs)(PP_Instance instance, + struct PP_VideoDecoderConfig_Dev* proto_config, + struct PP_VideoDecoderConfig_Dev* matching_configs, + int32_t matching_configs_size, + int32_t* num_of_matching_configs); // Creates a video decoder with requested |decoder_config|. // |input_format| in |decoder_config| specifies the format of input access @@ -41,48 +81,121 @@ struct PPB_VideoDecoder_Dev { // information such as PP_VIDEOKEY_ACCELERATION, to let browser choose // the most appropriate decoder. // - // |output_format| in |decoder_config| specifies desired decoded frame buffer - // format, with PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required. - // - // |output_callback| in |decoder_config| specifies the callback function - // for decoder to deliver decoded frame buffers. Decoder shall retain it. - // - // |input_callback| in |decoder_config| specifies the callback function - // for decoder to return compressed data buffers to plugin. Decoder shall - // retain it. When plugin doesn't expect buffer recycling, it shall set - // |input_callback| to NULL. In this case, plugin shall allocate buffer via - // |MemAlloc| in PPB_Core interface, and decoder will free buffer via - // |MemFree| in the same API. - // - // |event_handler| in |decoder_config| specifies the function for decoder - // to deliver events to plugin. Decoder shall retain it. + // Parameters: + // |instance| pointer to the plugin instance. + // |dec_config| the configuration which to use to initialize the decoder. // // The created decoder is returned as PP_Resource. NULL means failure. PP_Resource (*Create)(PP_Instance instance, - const struct PP_VideoDecoderConfig_Dev* decoder_config); + struct PP_VideoDecoderConfig_Dev* dec_config); + + // 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); - // Sends bit stream in |input_buffer| to the decoder. - // This is a non-blocking call. - // The decoded frame will be returned by decoder calling |output_callback| - // provided by plugin during creation of decoder. - // The input data buffer is returned to plugin by decoder only when plugin - // provides |input_callback|. + // Dispatches bitstream buffer to the decoder. This is asynchronous and + // non-blocking function. + // + // Parameters: + // |video_decoder| is the previously created handle to the decoder instance. + // |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 PP_TRUE on decoder successfully accepting buffer, PP_FALSE // otherwise. + PP_Bool (*Decode)(PP_Resource video_decoder, + struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, + struct PP_CompletionCallback callback); + + // Provides the decoder with picture buffers for video decoding. This + // function should be called when decoder has issued ProvidePictureBuffers + // callback to the plugin with buffer requirements. + // + // If the plugin is can determine how many and what kind of buffers are + // needed by the decoder it can provide them in advance. For this purpose + // the configuration map can provide how many extra buffers the decoder + // implementation requires for seamless operation. + // + // The decoder will pause if AssignPictureBuffer hasn't been called with + // sufficient buffers. // - PP_Bool (*Decode)(PP_Resource decoder, - struct PP_VideoCompressedDataBuffer_Dev* input_buffer); + // If the decoder rejects the buffers it will return the buffers and issue + // ProvidePictureBuffers again. + // + // If AssignPictureBuffer is called multiple times the decoder will add them + // to its pool of output pictures. + // + // TODO(vmr): this API feels too flexible... should we make it more strict + // where the decoder errors on bad buffers/duplicate buffers? Perhaps + // AssignPictureBuffer should only get called in response to + // ProvidePictureBuffer? + // + // Parameters: + // |video_decoder| is the previously created handle to the decoder instance. + // |no_of_buffers| how many buffers are behind picture buffer pointer. + // |picture_buffer| contains the reference to the picture buffer that was + // processed. + void (*AssignPictureBuffer)(PP_Resource video_decoder, + uint32_t no_of_buffers, + union PP_PictureData_Dev* picture_buffer); - // Requests the decoder to flush its input and output buffers. Once done with - // flushing, the decode will call the |callback|. - int32_t (*Flush)(PP_Resource decoder, struct PP_CompletionCallback callback); + // Tells the decoder to reuse 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. + // + // The decoder will ignore any picture buffer not previously provided via + // AssignPictureBuffer. + // + // TODO(vmr): figure out how the sync will be handled with command buffer as + // there will be possibly lag due to command buffer implementation + // to actual GL swap. At that moment decoder may have already taken + // the GL textures for writing output again. + // + // Parameters: + // |video_decoder| is the previously created handle to the decoder instance. + // |picture_buffer| contains the reference to the picture buffer that was + // processed. + void (*ReusePictureBuffer)(PP_Resource video_decoder, + union PP_PictureData_Dev* picture_buffer); - // Plugin sends uncompressed data buffers to the decoder. - // Returns PP_TRUE on decoder successfully accepting the buffer, PP_FALSE - // otherwise. - PP_Bool (*ReturnUncompressedDataBuffer)(PP_Resource decoder, - struct PP_VideoUncompressedDataBuffer_Dev* buffer); + // Dispatches flushing request to the decoder to flush both input and output + // buffers. Successful flushing will result in output of the pictures and + // buffers held inside the decoder and returning of bitstream buffers using + // the callbacks implemented by the plug-in. Once done with flushing, the + // decode will call the |callback|. + // + // Parameters: + // |video_decoder| is the previously created handle to the decoder instance. + // |callback| is one-time callback that will be called once the flushing + // request has been completed. + // + // Returns PP_TRUE on acceptance of flush request and PP_FALSE if request to + // flush is rejected by the decoder. + PP_Bool (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + + // Dispatches abortion request to the decoder to abort decoding as soon as + // possible and will not output anything or generate new callbacks. |callback| + // will be called as soon as abortion has been finished. After abortion all + // buffers can be considered dismissed even when there has not been callbacks + // to dismiss them. + // + // Parameters: + // |video_decoder| is the previously created handle to the decoder instance. + // |callback| is one-time callback that will be called once the abortion + // request has been completed. + // + // Returns PP_TRUE on acceptance of abort request and PP_FALSE if request to + // abort is rejected by the decoder. + PP_Bool (*Abort)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); }; #endif /* PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ */ - diff --git a/ppapi/c/dev/ppp_video_decoder_dev.h b/ppapi/c/dev/ppp_video_decoder_dev.h new file mode 100644 index 0000000..3fb265c --- /dev/null +++ b/ppapi/c/dev/ppp_video_decoder_dev.h @@ -0,0 +1,70 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#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" + +#define PPP_VIDEODECODER_DEV_INTERFACE "PPP_VideoDecoder(Dev);0.1" + +// PPP_VideoDecoder_Dev structure contains the function pointers that the +// plugin MUST implement to provide services needed by the video decoder +// implementation. +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 |props| cannot be allocated decoder should be destroyed. + // + // Decoding will not proceed until buffers have been provided. + // + // Parameters: + // |decoder| is pointer to the Pepper Video Decoder instance. + // |req_num_of_bufs| tells how many buffers are needed by the decoder. + // |props| tells the properties that are required from the textures. + void (*ProvidePictureBuffers)( + PP_Resource decoder, + uint32_t req_num_of_bufs, + const struct PP_PictureBufferProperties_Dev* props); + + // Callback function for decoder to deliver unneeded picture buffers back to + // the plugin. + // + // Parameters: + // |decoder| is pointer to the Pepper Video Decoder instance. + // |picture_buffer| points to the picture buffer that is no longer needed. + void (*DismissPictureBuffer)(PP_Resource decoder, + union PP_PictureData_Dev* picture_buffer); + + // 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: + // |decoder| is pointer to the Pepper Video Decoder instance. + // |picture| is the picture that is ready. + void (*PictureReady)(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: + // |decoder| is pointer to the Pepper Video Decoder instance. + void (*EndOfStream)(PP_Resource decoder); + + // Error handler callback for decoder to deliver information about detected + // errors to the plugin. + // + // TODO(vmr): Fill out error result codes and corresponding actions. + // + // Parameters: + // |decoder| is pointer to the Pepper Video Decoder instance. + // |error| error is the enumeration specifying the error. + void (*NotifyError)(PP_Resource decoder, enum PP_VideoDecodeError_Dev error); +}; + +#endif /* PPAPI_C_DEV_PPP_VIDEO_DECODER_DEV_H_ */ |