[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 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 | */ | ||||
5 | |||||
[email protected] | 4fb752b | 2014-03-29 00:07:30 | [diff] [blame] | 6 | /* From ppb_video_frame.idl modified Tue Mar 25 18:28:57 2014. */ |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 7 | |
8 | #ifndef PPAPI_C_PPB_VIDEO_FRAME_H_ | ||||
9 | #define PPAPI_C_PPB_VIDEO_FRAME_H_ | ||||
10 | |||||
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" | ||||
17 | |||||
[email protected] | 4fb752b | 2014-03-29 00:07:30 | [diff] [blame] | 18 | #define PPB_VIDEOFRAME_INTERFACE_0_1 "PPB_VideoFrame;0.1" |
19 | #define PPB_VIDEOFRAME_INTERFACE PPB_VIDEOFRAME_INTERFACE_0_1 | ||||
20 | |||||
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 21 | /** |
22 | * @file | ||||
23 | * Defines the <code>PPB_VideoFrame</code> interface. | ||||
24 | */ | ||||
25 | |||||
26 | |||||
27 | /** | ||||
28 | * @addtogroup Enums | ||||
29 | * @{ | ||||
30 | */ | ||||
31 | typedef enum { | ||||
32 | /** | ||||
33 | * Unknown format value. | ||||
34 | */ | ||||
35 | PP_VIDEOFRAME_FORMAT_UNKNOWN = 0, | ||||
36 | /** | ||||
37 | * 12bpp YVU planar 1x1 Y, 2x2 VU samples. | ||||
38 | */ | ||||
39 | PP_VIDEOFRAME_FORMAT_YV12 = 1, | ||||
40 | /** | ||||
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 41 | * 12bpp YUV planar 1x1 Y, 2x2 UV samples. |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 42 | */ |
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 43 | PP_VIDEOFRAME_FORMAT_I420 = 2, |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 44 | /** |
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 45 | * 32bpp BGRA. |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 46 | */ |
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 47 | PP_VIDEOFRAME_FORMAT_BGRA = 3, |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 48 | /** |
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 49 | * The last format. |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 50 | */ |
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 51 | PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 52 | } PP_VideoFrame_Format; |
53 | /** | ||||
54 | * @} | ||||
55 | */ | ||||
56 | |||||
57 | /** | ||||
58 | * @addtogroup Interfaces | ||||
59 | * @{ | ||||
60 | */ | ||||
[email protected] | 4fb752b | 2014-03-29 00:07:30 | [diff] [blame] | 61 | struct PPB_VideoFrame_0_1 { |
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 62 | /** |
63 | * Determines if a resource is a VideoFrame resource. | ||||
64 | * | ||||
65 | * @param[in] resource The <code>PP_Resource</code> to test. | ||||
66 | * | ||||
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. | ||||
69 | */ | ||||
70 | PP_Bool (*IsVideoFrame)(PP_Resource resource); | ||||
71 | /** | ||||
72 | * Gets the timestamp of the video frame. | ||||
73 | * | ||||
74 | * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | ||||
75 | * resource. | ||||
76 | * | ||||
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. | ||||
79 | */ | ||||
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. | ||||
84 | * | ||||
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. | ||||
90 | */ | ||||
91 | void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp); | ||||
92 | /** | ||||
93 | * Gets the format of the video frame. | ||||
94 | * | ||||
95 | * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | ||||
96 | * resource. | ||||
97 | * | ||||
98 | * @return A <code>PP_VideoFrame_Format</code> containing the format of the | ||||
99 | * video frame. | ||||
100 | */ | ||||
101 | PP_VideoFrame_Format (*GetFormat)(PP_Resource frame); | ||||
102 | /** | ||||
103 | * Gets the size of the video frame. | ||||
104 | * | ||||
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>. | ||||
108 | * | ||||
109 | * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or | ||||
110 | * <code>PP_FALSE</code> on failure. | ||||
111 | */ | ||||
112 | PP_Bool (*GetSize)(PP_Resource frame, struct PP_Size* size); | ||||
113 | /** | ||||
114 | * Gets the data buffer for video frame pixels. | ||||
115 | * | ||||
116 | * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | ||||
117 | * resource. | ||||
118 | * | ||||
119 | * @return A pointer to the beginning of the data buffer. | ||||
120 | */ | ||||
121 | void* (*GetDataBuffer)(PP_Resource frame); | ||||
122 | /** | ||||
123 | * Gets the size of data buffer. | ||||
124 | * | ||||
125 | * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | ||||
126 | * resource. | ||||
127 | * | ||||
128 | * @return The size of the data buffer. | ||||
129 | */ | ||||
130 | uint32_t (*GetDataBufferSize)(PP_Resource frame); | ||||
131 | }; | ||||
[email protected] | 4fb752b | 2014-03-29 00:07:30 | [diff] [blame] | 132 | |
133 | typedef struct PPB_VideoFrame_0_1 PPB_VideoFrame; | ||||
[email protected] | 9134a8c | 2014-01-06 16:38:47 | [diff] [blame] | 134 | /** |
135 | * @} | ||||
136 | */ | ||||
137 | |||||
138 | #endif /* PPAPI_C_PPB_VIDEO_FRAME_H_ */ | ||||
139 |