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
6/**
7 * Defines the <code>PPB_VideoFrame</code> interface.
8 */
9
10[generate_thunk]
11
12label Chrome {
13  [channel=dev] M34 = 0.1,
14  M35 = 0.1
15};
16
17enum PP_VideoFrame_Format {
18  /**
19   * Unknown format value.
20   */
21  PP_VIDEOFRAME_FORMAT_UNKNOWN = 0,
22
23  /**
24   * 12bpp YVU planar 1x1 Y, 2x2 VU samples.
25   */
26  PP_VIDEOFRAME_FORMAT_YV12 = 1,
27
28  /**
29   * 12bpp YUV planar 1x1 Y, 2x2 UV samples.
30   */
31  PP_VIDEOFRAME_FORMAT_I420 = 2,
32
33  /**
34   * 32bpp BGRA.
35   */
36  PP_VIDEOFRAME_FORMAT_BGRA = 3,
37
38  /**
39   * The last format.
40   */
41  PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA
42};
43
44[version=0.1]
45interface PPB_VideoFrame {
46  /**
47   * Determines if a resource is a VideoFrame resource.
48   *
49   * @param[in] resource The <code>PP_Resource</code> to test.
50   *
51   * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
52   * resource is a VideoFrame resource or <code>PP_FALSE</code> otherwise.
53   */
54  PP_Bool IsVideoFrame([in] PP_Resource resource);
55
56  /**
57   * Gets the timestamp of the video frame.
58   *
59   * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
60   * resource.
61   *
62   * @return A <code>PP_TimeDelta</code> containing the timestamp of the video
63   * frame. Given in seconds since the start of the containing video stream.
64   */
65  [on_failure=0.0]
66  PP_TimeDelta GetTimestamp([in] PP_Resource frame);
67
68  /**
69   * Sets the timestamp of the video frame. Given in seconds since the
70   * start of the containing video stream.
71   *
72   * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
73   * resource.
74   * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
75   * of the video frame. Given in seconds since the start of the containing
76   * video stream.
77   */
78  void SetTimestamp([in] PP_Resource frame, [in] PP_TimeDelta timestamp);
79
80  /**
81   * Gets the format of the video frame.
82   *
83   * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
84   * resource.
85   *
86   * @return A <code>PP_VideoFrame_Format</code> containing the format of the
87   * video frame.
88   */
89  [on_failure=PP_VIDEOFRAME_FORMAT_UNKNOWN]
90  PP_VideoFrame_Format GetFormat([in] PP_Resource frame);
91
92  /**
93   * Gets the size of the video frame.
94   *
95   * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
96   * resource.
97   * @param[out] size A <code>PP_Size</code>.
98   *
99   * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or
100   * <code>PP_FALSE</code> on failure.
101   */
102  PP_Bool GetSize([in] PP_Resource frame, [out] PP_Size size);
103
104  /**
105   * Gets the data buffer for video frame pixels.
106   *
107   * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
108   * resource.
109   *
110   * @return A pointer to the beginning of the data buffer.
111   */
112  mem_t GetDataBuffer([in] PP_Resource frame);
113
114  /**
115   * Gets the size of data buffer.
116   *
117   * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame
118   * resource.
119   *
120   * @return The size of the data buffer.
121   */
122  uint32_t GetDataBufferSize([in] PP_Resource frame);
123};
124