Index: ppapi/api/ppb_media_stream_video_track.idl |
diff --git a/ppapi/api/ppb_media_stream_video_track.idl b/ppapi/api/ppb_media_stream_video_track.idl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7bd1d7345665ec2430e96b29bfe293760102e9e6 |
--- /dev/null |
+++ b/ppapi/api/ppb_media_stream_video_track.idl |
@@ -0,0 +1,122 @@ |
+/* Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+/** |
+ * Defines the <code>PPB_MediaStreamVideoTrack</code> interface. Used for |
+ * receiving video frames from a MediaStream video track in the browser. |
+ * This interface is still in development (Dev API status) and may change. |
+ */ |
+label Chrome { |
+ [channel=dev] M33 = 0.1 |
yzshen1
2013/12/20 23:37:43
M34? :) Time flies.
Peng
2013/12/23 02:41:49
Done.
|
+}; |
+ |
+/** |
+ */ |
+interface PPB_MediaStreamVideoTrack { |
+ /** |
+ * Determines if a resource is a MediaStream video track resource. |
+ * |
+ * @param[in] resource The <code>PP_Resource</code> to test. |
+ * |
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
+ * resource is a Mediastream video track resource or <code>PP_FALSE</code> |
+ * otherwise. |
+ */ |
+ PP_Bool IsMediaStreamVideoTrack([in] PP_Resource resource); |
+ |
+ /** |
+ * Configures underlaying frame buffers for incoming frames. |
+ * If the application doesn't want to drop frames, then the |
+ * |frame_buffer_size| should be chosen such that inter-frame processing time |
+ * variability won't overrun the input buffer. If the buffer is overfilled, |
yzshen1
2013/12/20 23:37:43
nit: extra space before 'input'.
Peng
2013/12/23 02:41:49
Done.
|
+ * then frames will be dropped. The application can detect this by examining |
+ * the timestamp on returned frames. If |Configure()| is not used, default |
+ * settings will be used. |
bbudge
2013/12/20 23:58:13
Could you make it clearer that this is the number
Peng
2013/12/23 02:41:49
Done.
|
+ * |
+ * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
+ * resource. |
+ * @param[in] frame_buffer_size The maximum number of video frames to hold in |
+ * input buffer. |
+ * |
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
+ */ |
+ int32_t Configure([in] PP_Resource video_track, |
+ [in] uint32_t frame_buffer_size); |
+ |
+ /** |
+ * Returns the track ID of the underlying MediaStream video track. |
+ * |
+ * @param[in] video_track The <code>PP_Resource</code> to check. |
+ * |
+ * @return A <code>PP_Var</code> containing the MediaStream track ID as |
+ * a string. |
+ */ |
+ PP_Var GetId([in] PP_Resource video_track); |
+ |
+ /** |
+ * Checks whether the underlying MediaStream track has ended. |
+ * Calls to GetFrame while the track has ended are safe to make and will |
+ * complete, but will fail. |
+ * |
+ * @param[in] video_track The <code>PP_Resource</code> to check. |
+ * |
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
+ * MediaStream track has ended or <code>PP_FALSE</code> otherwise. |
+ */ |
+ PP_Bool HasEnded([in] PP_Resource video_track); |
+ |
+ /** |
+ * Gets the next video frame from the MediaStream track. |
+ * If internal processing is slower than the incoming frame rate, new frames |
+ * will be dropped from the incoming stream. Once the input buffer is full, |
+ * frames will be dropped until |ReuseFrame()| is called to free a spot for |
+ * another frame to be buffered. If the caller holds a frame got from previous |
yzshen1
2013/12/20 23:37:43
*the* previous call
Peng
2013/12/23 02:41:49
Done.
|
+ * call of |GetFrame()|, an error will be returned. The caller should recycle |
yzshen1
2013/12/20 23:37:43
what error will be returned in this case?
Peng
2013/12/23 02:41:49
Done.
|
+ * previous frame, before getting next frame. |
yzshen1
2013/12/20 23:37:43
*the* previous frame. *the* next frame.
Peng
2013/12/23 02:41:49
Done.
|
+ * |
+ * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
+ * resource. |
+ * @param[out] frame A <code>PP_Resource</code> corresponding to a VideoFrame |
+ * resource. |
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
+ * completion of GetFrame(). |
+ * |
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
+ * Returns PP_ERROR_NOMEMORY if |frame_buffer_size| frames buffer was not |
+ * allocated successfully. |
+ */ |
+ int32_t GetFrame([in] PP_Resource video_track, |
+ [out] PP_Resource frame, |
+ [in] PP_CompletionCallback callback); |
+ |
+ /** |
+ * Recycles a frame got from |GetFrame()|, so the track can reuse |
bbudge
2013/12/20 23:58:13
s/got/gotten but really 'returned by' might be les
Peng
2013/12/23 02:41:49
Done.
|
+ * the underlaying buffer of this frame. And the frame will become invalidate. |
yzshen1
2013/12/20 23:37:43
invalidate -> invalid
Peng
2013/12/23 02:41:49
Done.
|
+ * The caller should release all references it holds to |frame|, and not use |
+ * it anymore. |
+ * |
+ * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
+ * resource. |
+ * @param[in] video_frame A <code>PP_Resource</code> corresponding to a |
yzshen1
2013/12/20 23:37:43
the parameter name is |frame|.
Peng
2013/12/23 02:41:49
Done.
|
+ * VideoFrame resource got from |GetFrame()| |
+ * |
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
+ * Retruns PP_ERROR_BADARGUMENT if frame isn't a vaild video frame got from |
bbudge
2013/12/20 23:58:13
see comment above.
Peng
2013/12/23 02:41:49
Done.
|
+ * |GetFrame()|. |
+ */ |
+ int32_t ReuseFrame([in] PP_Resource video_track, |
+ [in] PP_Resource frame); |
+ |
+ /** |
+ * Closes the MediaStream video track, and disconnects it from video source. |
+ * And then not new frames will be recevied. After calling |Close()|, the |
yzshen1
2013/12/20 23:37:43
not -> no.
Peng
2013/12/23 02:41:49
Done.
|
+ * video track should not be used anymore. |
bbudge
2013/12/20 23:58:13
How about this?
* Closes the MediaStream video tr
Peng
2013/12/23 02:41:49
Done.
|
+ * |
+ * @param[in] video_track A <code>PP_Resource</code> corresponding to a |
+ * MediaStream video track resource. |
+ */ |
+ void Close([in] PP_Resource video_track); |
+}; |
+ |