Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* Copyright (c) 2013 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_MediaStreamVideoTrack</code> interface. Used for | |
| 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. | |
| 10 */ | |
| 11 label Chrome { | |
| 12 [channel=dev] M34 = 0.1 | |
| 13 }; | |
| 14 | |
| 15 /** | |
| 16 */ | |
| 17 interface PPB_MediaStreamVideoTrack { | |
| 18 /** | |
| 19 * Determines if a resource is a MediaStream video track resource. | |
| 20 * | |
| 21 * @param[in] resource The <code>PP_Resource</code> to test. | |
| 22 * | |
| 23 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | |
| 24 * resource is a Mediastream video track resource or <code>PP_FALSE</code> | |
| 25 * otherwise. | |
| 26 */ | |
| 27 PP_Bool IsMediaStreamVideoTrack([in] PP_Resource resource); | |
| 28 | |
| 29 /** | |
| 30 * Configures underlaying frame buffers for incoming frames. | |
| 31 * If the application doesn't want to drop frames, then the | |
| 32 * <code>max_buffered_frames</code> should be chosen such that inter-frame | |
| 33 * processing time variability won't overrun the input buffer. If the buffer | |
| 34 * is overfilled, then frames will be dropped. The application can detect | |
| 35 * this by examining the timestamp on returned frames. | |
| 36 * If <code>Configure()</code> is not used, default settings will be used. | |
| 37 * | |
| 38 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | |
| 39 * resource. | |
| 40 * @param[in] max_buffered_frames The maximum number of video frames to | |
| 41 * hold in input buffer. | |
| 42 * | |
| 43 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
| 44 */ | |
| 45 int32_t Configure([in] PP_Resource video_track, | |
| 46 [in] uint32_t max_buffered_frames); | |
| 47 | |
| 48 /** | |
| 49 * Returns the track ID of the underlying MediaStream video track. | |
| 50 * | |
| 51 * @param[in] video_track The <code>PP_Resource</code> to check. | |
| 52 * | |
| 53 * @return A <code>PP_Var</code> containing the MediaStream track ID as | |
| 54 * a string. | |
| 55 */ | |
| 56 PP_Var GetId([in] PP_Resource video_track); | |
| 57 | |
| 58 /** | |
| 59 * Checks whether the underlying MediaStream track has ended. | |
| 60 * Calls to GetFrame while the track has ended are safe to make and will | |
| 61 * complete, but will fail. | |
| 62 * | |
| 63 * @param[in] video_track The <code>PP_Resource</code> to check. | |
| 64 * | |
| 65 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | |
| 66 * MediaStream track has ended or <code>PP_FALSE</code> otherwise. | |
| 67 */ | |
| 68 PP_Bool HasEnded([in] PP_Resource video_track); | |
| 69 | |
| 70 /** | |
| 71 * Gets the next video frame from the MediaStream track. | |
| 72 * If internal processing is slower than the incoming frame rate, new frames | |
| 73 * will be dropped from the incoming stream. Once the input buffer is full, | |
| 74 * frames will be dropped until <code>RecycleFrame()</code> is called to free | |
| 75 * a spot for another frame to be buffered. | |
| 76 * If there is no frames in the input buffer, | |
| 77 * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediatelly. And the | |
|
yzshen1
2013/12/27 17:40:08
nit: immediate*l*y.
Peng
2013/12/27 21:21:43
Done.
| |
| 78 * <code>callback</code> will be called, when a new frame is recieved or some | |
| 79 * error happens. | |
| 80 * If the caller holds a frame returned by the previous call of | |
| 81 * <code>GetFrame()</code>, <code>PP_ERROR_INGROGRESS</code> will be returned. | |
| 82 * The caller should recycle the previous frame, before getting the next | |
| 83 * frame. | |
| 84 * | |
| 85 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | |
| 86 * resource. | |
| 87 * @param[out] frame A <code>PP_Resource</code> corresponding to a VideoFrame | |
| 88 * resource. | |
| 89 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
| 90 * completion of GetFrame(). | |
| 91 * | |
| 92 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
| 93 * Returns PP_ERROR_NOMEMORY if <code>max_buffered_frames</code> frames buffer | |
| 94 * was not allocated successfully. | |
| 95 */ | |
| 96 int32_t GetFrame([in] PP_Resource video_track, | |
| 97 [out] PP_Resource frame, | |
| 98 [in] PP_CompletionCallback callback); | |
| 99 | |
| 100 /** | |
| 101 * Recycles a frame returned by <code>GetFrame()</code>, so the track can | |
| 102 * reuse the underlaying buffer of this frame. And the frame will become | |
| 103 * invalid. The caller should release all references it holds to | |
| 104 * <code>frame</code>, and not use it anymore. | |
| 105 * | |
| 106 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | |
| 107 * resource. | |
| 108 * @param[in] frame A <code>PP_Resource</code> corresponding to a VideoFrame | |
| 109 * resource returned by <code>GetFrame()</code>. | |
| 110 * | |
| 111 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
| 112 */ | |
| 113 int32_t RecycleFrame([in] PP_Resource video_track, | |
| 114 [in] PP_Resource frame); | |
| 115 | |
| 116 /** | |
| 117 * Closes the MediaStream video track, and disconnects it from video source. | |
| 118 * After calling <code>Close()</code>, no new frames will be received. | |
| 119 * | |
| 120 * @param[in] video_track A <code>PP_Resource</code> corresponding to a | |
| 121 * MediaStream video track resource. | |
| 122 */ | |
| 123 void Close([in] PP_Resource video_track); | |
| 124 }; | |
| 125 | |
| OLD | NEW |