Do not assume that the orientation is PORTRAIT by default.
[chromium-blink-merge.git] / ppapi / c / ppb_video_frame.h
blob6dafc0cadd9840559cb97314ab97e1168c32dd58
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 Feb 11 14:41:52 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" /* dev */
19 /**
20 * @file
21 * Defines the <code>PPB_VideoFrame</code> interface.
25 /**
26 * @addtogroup Enums
27 * @{
29 typedef enum {
30 /**
31 * Unknown format value.
33 PP_VIDEOFRAME_FORMAT_UNKNOWN = 0,
34 /**
35 * 12bpp YVU planar 1x1 Y, 2x2 VU samples.
37 PP_VIDEOFRAME_FORMAT_YV12 = 1,
38 /**
39 * 12bpp YUV planar 1x1 Y, 2x2 UV samples.
41 PP_VIDEOFRAME_FORMAT_I420 = 2,
42 /**
43 * 32bpp BGRA.
45 PP_VIDEOFRAME_FORMAT_BGRA = 3,
46 /**
47 * The last format.
49 PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA
50 } PP_VideoFrame_Format;
51 /**
52 * @}
55 /**
56 * @addtogroup Interfaces
57 * @{
59 struct PPB_VideoFrame_0_1 { /* dev */
60 /**
61 * Determines if a resource is a VideoFrame resource.
63 * @param[in] resource The <code>PP_Resource</code> to test.
65 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
66 * resource is a VideoFrame resource or <code>PP_FALSE</code> otherwise.
68 PP_Bool (*IsVideoFrame)(PP_Resource resource);
69 /**
70 * Gets the timestamp of the video frame.
72 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
73 * resource.
75 * @return A <code>PP_TimeDelta</code> containing the timestamp of the video
76 * frame. Given in seconds since the start of the containing video stream.
78 PP_TimeDelta (*GetTimestamp)(PP_Resource frame);
79 /**
80 * Sets the timestamp of the video frame. Given in seconds since the
81 * start of the containing video stream.
83 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
84 * resource.
85 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
86 * of the video frame. Given in seconds since the start of the containing
87 * video stream.
89 void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp);
90 /**
91 * Gets the format of the video frame.
93 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
94 * resource.
96 * @return A <code>PP_VideoFrame_Format</code> containing the format of the
97 * video frame.
99 PP_VideoFrame_Format (*GetFormat)(PP_Resource frame);
101 * Gets the size of the video frame.
103 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
104 * resource.
105 * @param[out] size A <code>PP_Size</code>.
107 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or
108 * <code>PP_FALSE</code> on failure.
110 PP_Bool (*GetSize)(PP_Resource frame, struct PP_Size* size);
112 * Gets the data buffer for video frame pixels.
114 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
115 * resource.
117 * @return A pointer to the beginning of the data buffer.
119 void* (*GetDataBuffer)(PP_Resource frame);
121 * Gets the size of data buffer.
123 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
124 * resource.
126 * @return The size of the data buffer.
128 uint32_t (*GetDataBufferSize)(PP_Resource frame);
131 * @}
134 #endif /* PPAPI_C_PPB_VIDEO_FRAME_H_ */