Roll src/third_party/WebKit ef7cfd7:80927b2 (svn 194570:194575)
[chromium-blink-merge.git] / ppapi / c / ppb_video_frame.h
blob3efe39249272be1ebf21690d5145b09100a40dcf
1 /* Copyright 2014 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
6 /* From ppb_video_frame.idl modified Tue Mar 25 18:28:57 2014. */
8 #ifndef PPAPI_C_PPB_VIDEO_FRAME_H_
9 #define PPAPI_C_PPB_VIDEO_FRAME_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_size.h"
15 #include "ppapi/c/pp_stdint.h"
16 #include "ppapi/c/pp_time.h"
18 #define PPB_VIDEOFRAME_INTERFACE_0_1 "PPB_VideoFrame;0.1"
19 #define PPB_VIDEOFRAME_INTERFACE PPB_VIDEOFRAME_INTERFACE_0_1
21 /**
22 * @file
23 * Defines the <code>PPB_VideoFrame</code> interface.
27 /**
28 * @addtogroup Enums
29 * @{
31 typedef enum {
32 /**
33 * Unknown format value.
35 PP_VIDEOFRAME_FORMAT_UNKNOWN = 0,
36 /**
37 * 12bpp YVU planar 1x1 Y, 2x2 VU samples.
39 PP_VIDEOFRAME_FORMAT_YV12 = 1,
40 /**
41 * 12bpp YUV planar 1x1 Y, 2x2 UV samples.
43 PP_VIDEOFRAME_FORMAT_I420 = 2,
44 /**
45 * 32bpp BGRA.
47 PP_VIDEOFRAME_FORMAT_BGRA = 3,
48 /**
49 * The last format.
51 PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA
52 } PP_VideoFrame_Format;
53 /**
54 * @}
57 /**
58 * @addtogroup Interfaces
59 * @{
61 struct PPB_VideoFrame_0_1 {
62 /**
63 * Determines if a resource is a VideoFrame resource.
65 * @param[in] resource The <code>PP_Resource</code> to test.
67 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
68 * resource is a VideoFrame resource or <code>PP_FALSE</code> otherwise.
70 PP_Bool (*IsVideoFrame)(PP_Resource resource);
71 /**
72 * Gets the timestamp of the video frame.
74 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
75 * resource.
77 * @return A <code>PP_TimeDelta</code> containing the timestamp of the video
78 * frame. Given in seconds since the start of the containing video stream.
80 PP_TimeDelta (*GetTimestamp)(PP_Resource frame);
81 /**
82 * Sets the timestamp of the video frame. Given in seconds since the
83 * start of the containing video stream.
85 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
86 * resource.
87 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
88 * of the video frame. Given in seconds since the start of the containing
89 * video stream.
91 void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp);
92 /**
93 * Gets the format of the video frame.
95 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
96 * resource.
98 * @return A <code>PP_VideoFrame_Format</code> containing the format of the
99 * video frame.
101 PP_VideoFrame_Format (*GetFormat)(PP_Resource frame);
103 * Gets the size of the video frame.
105 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
106 * resource.
107 * @param[out] size A <code>PP_Size</code>.
109 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or
110 * <code>PP_FALSE</code> on failure.
112 PP_Bool (*GetSize)(PP_Resource frame, struct PP_Size* size);
114 * Gets the data buffer for video frame pixels.
116 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
117 * resource.
119 * @return A pointer to the beginning of the data buffer.
121 void* (*GetDataBuffer)(PP_Resource frame);
123 * Gets the size of data buffer.
125 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
126 * resource.
128 * @return The size of the data buffer.
130 uint32_t (*GetDataBufferSize)(PP_Resource frame);
133 typedef struct PPB_VideoFrame_0_1 PPB_VideoFrame;
135 * @}
138 #endif /* PPAPI_C_PPB_VIDEO_FRAME_H_ */