blob: 3efe39249272be1ebf21690d5145b09100a40dcf [file] [log] [blame]
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +00001/* 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
Ben Murdocheffb81e2014-03-31 11:51:25 +01006/* From ppb_video_frame.idl modified Tue Mar 25 18:28:57 2014. */
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +00007
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
Ben Murdocheffb81e2014-03-31 11:51:25 +010018#define PPB_VIDEOFRAME_INTERFACE_0_1 "PPB_VideoFrame;0.1"
19#define PPB_VIDEOFRAME_INTERFACE PPB_VIDEOFRAME_INTERFACE_0_1
20
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000021/**
22 * @file
23 * Defines the <code>PPB_VideoFrame</code> interface.
24 */
25
26
27/**
28 * @addtogroup Enums
29 * @{
30 */
31typedef 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 /**
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000041 * 12bpp YUV planar 1x1 Y, 2x2 UV samples.
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000042 */
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000043 PP_VIDEOFRAME_FORMAT_I420 = 2,
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000044 /**
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000045 * 32bpp BGRA.
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000046 */
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000047 PP_VIDEOFRAME_FORMAT_BGRA = 3,
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000048 /**
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000049 * The last format.
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000050 */
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000051 PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000052} PP_VideoFrame_Format;
53/**
54 * @}
55 */
56
57/**
58 * @addtogroup Interfaces
59 * @{
60 */
Ben Murdocheffb81e2014-03-31 11:51:25 +010061struct PPB_VideoFrame_0_1 {
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000062 /**
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};
Ben Murdocheffb81e2014-03-31 11:51:25 +0100132
133typedef struct PPB_VideoFrame_0_1 PPB_VideoFrame;
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000134/**
135 * @}
136 */
137
138#endif /* PPAPI_C_PPB_VIDEO_FRAME_H_ */
139