Index: c/pp_video.h |
=================================================================== |
--- c/pp_video.h (revision 0) |
+++ c/pp_video.h (revision 0) |
@@ -0,0 +1,286 @@ |
+// Copyright (c) 2010 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_PP_VIDEO_H_ |
+#define PPAPI_C_PP_VIDEO_H_ |
+ |
+#include "ppapi/c/pp_instance.h" |
+#include "ppapi/c/pp_resource.h" |
+#include "ppapi/c/pp_stdint.h" |
+ |
+enum PP_VideoKey { |
+ 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, |
+}; |
+ |
+enum PP_VideoDecoderEvent { |
+ 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, |
+}; |
+ |
+enum PP_VideoDecodeError { |
+ PP_VIDEODECODEERROR_NONE = 0, |
+ PP_VIDEODECODEERROR_NOTSUPPORTED, |
+ PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, |
+ PP_VIDEODECODEERROR_UNDEFINED, |
+ PP_VIDEODECODEERROR_BADINPUT, |
+ PP_VIDEODECODEERROR_HARDWARE, |
+}; |
+ |
+enum PP_VideoCodecId { |
+ PP_VIDEODECODECID_NONE = 0, |
+ PP_VIDEODECODECID_H264, |
+ PP_VIDEODECODECID_VC1, |
+ PP_VIDEODECODECID_MPEG2, |
+ PP_VIDEODECODECID_VP8, |
+}; |
+ |
+enum PP_VideoOperation { |
+ PP_VIDEOOPERATION_NONE = 0, |
+ PP_VIDEOOPERATION_DECODE, |
+ PP_VIDEOOPERATION_ENCODE, |
+}; |
+ |
+enum PP_VideoCodecProfile { |
+ 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, |
+}; |
+ |
+enum PP_VideoCodecLevel { |
+ 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, |
+}; |
+ |
+enum PP_VideoPayloadFormat { |
+ PP_VIDEOPAYLOADFORMAT_NONE = 0, |
+ PP_VIDEOPAYLOADFORMAT_BYTESTREAM, |
+ PP_VIDEOPAYLOADFORMAT_RTPPAYLOAD, |
+}; |
+ |
+enum PP_VideoFrameColorType { |
+ 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, |
+}; |
+ |
+enum PP_VideoFrameSurfaceType { |
+ PP_VIDEOFRAMESURFACETYPE_NONE = 0, |
+ PP_VIDEOFRAMESURFACETYPE_SYSTEMMEMORY, |
+ PP_VIDEOFRAMESURFACETYPE_GLTEXTURE, |
+ PP_VIDEOFRAMESURFACETYPE_PIXMAP, |
+}; |
+ |
+enum PP_VideoFrameInfoFlag { |
+ 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, |
+}; |
+ |
+enum PP_VideoFrameBufferConst { |
+ // 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, |
+}; |
+ |
+typedef int64_t PP_VideoDecodeData; |
+ |
+// 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; |
+typedef int32_t PP_VideoConfigElement; |
+ |
+// The data structure for compressed data buffer. |
+typedef struct _pp_VideoCompressedDataBuffer { |
+ // The buffer is created through PPB_Buffer API. |
+ // TODO(wjia): would uint8_t* be good, too? |
+ PP_Resource buffer; |
+ // number of bytes with real data in the buffer. |
+ int32_t filled_size; |
+} PP_VideoCompressedDataBuffer; |
+ |
+typedef struct _pp_VideoFrameInfo { |
+ // Time stamp of the frame in microsecond. |
+ uint64_t time_stamp_us; |
+ |
+ // Bit mask of PP_VideoFrameInfoFlag. |
+ uint32_t flags; |
+ |
+ // Output from decoder, indicating the decoded frame has error pixels. This |
+ // could be resulted from corrupted input bit stream and error concealment |
+ // in decoding. |
+ // TODO(wjia): add more info about error pixels, such as error MB map, etc. |
+ bool has_error; |
+} PP_VideoFrameInfo; |
+ |
+typedef struct _pp_VideoFrameBuffer { |
+ union { |
+ struct { |
+ int32_t planes; |
+ 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]; |
+ } 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; |
+} PP_VideoFrameBuffer; |
+ |
+typedef struct _pp_VideoUncompressedDataBuffer { |
+ PP_VideoConfig format; |
+ PP_VideoFrameBuffer buffer; |
+} PP_VideoUncompressedDataBuffer; |
+ |
+// 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)(PP_Instance instance, |
+ PP_VideoUncompressedDataBuffer* buffer, |
+ PP_VideoFrameInfo* frame_info); |
+ |
+// 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)( |
+ PP_Instance instance, |
+ PP_VideoCompressedDataBuffer* 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)( |
+ PP_Instance instance, |
+ PP_VideoDecoderEvent event, |
+ PP_VideoDecodeData data1, |
+ PP_VideoDecodeData data2); |
+ |
+// Requested decoder configuration and callback from plugin. |
+typedef struct _pp_VideoDecoderConfig { |
+ PP_VideoConfig input_format; |
+ PP_VideoConfig output_format; |
+ PP_VideoDecodeOutputCallback_Func output_callback; |
+ PP_VideoDecodeInputCallback_Func input_callback; |
+ PP_VideoDecodeEventHandler_Func event_handler; |
+} PP_VideoDecoderConfig; |
+ |
+#endif // PPAPI_C_PP_VIDEO_H_ |
Property changes on: c/pp_video.h |
___________________________________________________________________ |
Name: svn:eol-style |
+ LF |