OLD | NEW |
1 /* Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * Defines the <code>PPB_MediaStreamVideoTrack</code> interface. Used for | 7 * Defines the <code>PPB_MediaStreamVideoTrack</code> interface. Used for |
8 * receiving video frames from a MediaStream video track in the browser. | 8 * receiving video frames from a MediaStream video track in the browser. |
9 * This interface is still in development (Dev API status) and may change. | 9 * This interface is still in development (Dev API status) and may change. |
10 */ | 10 */ |
(...skipping 14 matching lines...) Expand all Loading... |
25 */ | 25 */ |
26 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, | 26 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, |
27 | 27 |
28 /** | 28 /** |
29 * The maximum number of frames to hold in the input buffer. | 29 * The maximum number of frames to hold in the input buffer. |
30 * Note: this is only used as advisory; the browser may allocate more or fewer | 30 * Note: this is only used as advisory; the browser may allocate more or fewer |
31 * based on available resources. How many frames to buffer depends on usage - | 31 * based on available resources. How many frames to buffer depends on usage - |
32 * request at least 2 to make sure latency doesn't cause lost frames. If | 32 * request at least 2 to make sure latency doesn't cause lost frames. If |
33 * the plugin expects to hold on to more than one frame at a time (e.g. to do | 33 * the plugin expects to hold on to more than one frame at a time (e.g. to do |
34 * multi-frame processing), it should request that many more. | 34 * multi-frame processing), it should request that many more. |
| 35 * If this attribute is not specified or value 0 is specified for this |
| 36 * attribute, the default value will be used. |
35 */ | 37 */ |
36 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, | 38 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, |
37 | 39 |
38 /** | 40 /** |
39 * The width of video frames in pixels. It should be a multiple of 4. | 41 * The width of video frames in pixels. It should be a multiple of 4. |
| 42 * If the specified size is different from the video source (webcam), |
| 43 * frames will be scaled to specified size. |
| 44 * If this attribute is not specified or value 0 is specified, the original |
| 45 * frame size of the video track will be used. |
40 * | 46 * |
41 * Maximum value: 4096 (4K resolution). | 47 * Maximum value: 4096 (4K resolution). |
42 */ | 48 */ |
43 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, | 49 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, |
44 | 50 |
45 /** | 51 /** |
46 * The height of video frames in pixels. It should be a multiple of 4. | 52 * The height of video frames in pixels. It should be a multiple of 4. |
| 53 * If the specified size is different from the video source (webcam), |
| 54 * frames will be scaled to specified size. |
| 55 * If this attribute is not specified or value 0 is specified, the original |
| 56 * frame size of the video track will be used. |
47 * | 57 * |
48 * Maximum value: 4096 (4K resolution). | 58 * Maximum value: 4096 (4K resolution). |
49 */ | 59 */ |
50 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, | 60 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, |
51 | 61 |
52 /** | 62 /** |
53 * The format of video frames. The attribute value is | 63 * The format of video frames. The attribute value is |
54 * a <code>PP_VideoFrame_Format</code>. | 64 * a <code>PP_VideoFrame_Format</code>. If the specified format is different |
| 65 * from the video source (webcam), frames will be converted to specified |
| 66 * format. |
| 67 * If this attribute is not specified or value |
| 68 * <code>PP_VIDEOFRAME_FORMAT_UNKNOWN</code> is specified, the orignal frame |
| 69 * format of the video track will be used. |
55 */ | 70 */ |
56 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 | 71 PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 |
57 }; | 72 }; |
58 | 73 |
59 interface PPB_MediaStreamVideoTrack { | 74 interface PPB_MediaStreamVideoTrack { |
60 /** | 75 /** |
61 * Determines if a resource is a MediaStream video track resource. | 76 * Determines if a resource is a MediaStream video track resource. |
62 * | 77 * |
63 * @param[in] resource The <code>PP_Resource</code> to test. | 78 * @param[in] resource The <code>PP_Resource</code> to test. |
64 * | 79 * |
65 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 80 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
66 * resource is a Mediastream video track resource or <code>PP_FALSE</code> | 81 * resource is a Mediastream video track resource or <code>PP_FALSE</code> |
67 * otherwise. | 82 * otherwise. |
68 */ | 83 */ |
69 PP_Bool IsMediaStreamVideoTrack([in] PP_Resource resource); | 84 PP_Bool IsMediaStreamVideoTrack([in] PP_Resource resource); |
70 | 85 |
71 /** | 86 /** |
72 * Configures underlying frame buffers for incoming frames. | 87 * Configures underlying frame buffers for incoming frames. |
73 * If the application doesn't want to drop frames, then the | 88 * If the application doesn't want to drop frames, then the |
74 * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be | 89 * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be |
75 * chosen such that inter-frame processing time variability won't overrun the | 90 * chosen such that inter-frame processing time variability won't overrun the |
76 * input buffer. If the buffer is overfilled, then frames will be dropped. | 91 * input buffer. If the buffer is overfilled, then frames will be dropped. |
77 * The application can detect this by examining the timestamp on returned | 92 * The application can detect this by examining the timestamp on returned |
78 * frames. If <code>Configure()</code> is not called, default settings will be | 93 * frames. If some attributes are not specified, default values will be used |
79 * used. | 94 * for those unspecified attributes. If <code>Configure()</code> is not |
| 95 * called, default settings will be used. |
80 * Example usage from plugin code: | 96 * Example usage from plugin code: |
81 * @code | 97 * @code |
82 * int32_t attribs[] = { | 98 * int32_t attribs[] = { |
83 * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, | 99 * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, |
84 * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; | 100 * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; |
85 * track_if->Configure(track, attribs, callback); | 101 * track_if->Configure(track, attribs, callback); |
86 * @endcode | 102 * @endcode |
87 * | 103 * |
88 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | 104 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
89 * resource. | 105 * resource. |
90 * @param[in] attrib_list A list of attribute name-value pairs in which each | 106 * @param[in] attrib_list A list of attribute name-value pairs in which each |
91 * attribute is immediately followed by the corresponding desired value. | 107 * attribute is immediately followed by the corresponding desired value. |
92 * The list is terminated by | 108 * The list is terminated by |
93 * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE</code>. | 109 * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE</code>. |
94 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon | 110 * @param[in] callback <code>PP_CompletionCallback</code> to be called upon |
95 * completion of <code>Configure()</code>. | 111 * completion of <code>Configure()</code>. |
96 * | 112 * |
97 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | 113 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 114 * Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of |
| 115 * <code>Configure()</code> or <code>GetFrame()</code>, or the plugin |
| 116 * holds some frames which are not recycled with <code>RecycleFrame()</code>. |
| 117 * If an error is returned, all attributes and the underlying buffer will not |
| 118 * be changed. |
98 */ | 119 */ |
99 int32_t Configure([in] PP_Resource video_track, | 120 int32_t Configure([in] PP_Resource video_track, |
100 [in] int32_t[] attrib_list, | 121 [in] int32_t[] attrib_list, |
101 [in] PP_CompletionCallback callback); | 122 [in] PP_CompletionCallback callback); |
102 | 123 |
103 /** | 124 /** |
104 * Gets attribute value for a given attribute name. | 125 * Gets attribute value for a given attribute name. |
105 * | 126 * |
106 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | 127 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
107 * resource. | 128 * resource. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 /** | 205 /** |
185 * Closes the MediaStream video track and disconnects it from video source. | 206 * Closes the MediaStream video track and disconnects it from video source. |
186 * After calling <code>Close()</code>, no new frames will be received. | 207 * After calling <code>Close()</code>, no new frames will be received. |
187 * | 208 * |
188 * @param[in] video_track A <code>PP_Resource</code> corresponding to a | 209 * @param[in] video_track A <code>PP_Resource</code> corresponding to a |
189 * MediaStream video track resource. | 210 * MediaStream video track resource. |
190 */ | 211 */ |
191 void Close([in] PP_Resource video_track); | 212 void Close([in] PP_Resource video_track); |
192 }; | 213 }; |
193 | 214 |
OLD | NEW |