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 /* From ppb_media_stream_video_track.idl modified Fri Dec 27 17:28:11 2013. */ |
| 7 |
| 8 #ifndef PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ |
| 9 #define PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ |
| 10 |
| 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/pp_macros.h" |
| 14 #include "ppapi/c/pp_resource.h" |
| 15 #include "ppapi/c/pp_stdint.h" |
| 16 #include "ppapi/c/pp_var.h" |
| 17 |
| 18 #define PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1 \ |
| 19 "PPB_MediaStreamVideoTrack;0.1" /* dev */ |
| 20 /** |
| 21 * @file |
| 22 * Defines the <code>PPB_MediaStreamVideoTrack</code> interface. Used for |
| 23 * receiving video frames from a MediaStream video track in the browser. |
| 24 * This interface is still in development (Dev API status) and may change. |
| 25 */ |
| 26 |
| 27 |
| 28 /** |
| 29 * @addtogroup Interfaces |
| 30 * @{ |
| 31 */ |
| 32 /** |
| 33 */ |
| 34 struct PPB_MediaStreamVideoTrack_0_1 { /* dev */ |
| 35 /** |
| 36 * Determines if a resource is a MediaStream video track resource. |
| 37 * |
| 38 * @param[in] resource The <code>PP_Resource</code> to test. |
| 39 * |
| 40 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 41 * resource is a Mediastream video track resource or <code>PP_FALSE</code> |
| 42 * otherwise. |
| 43 */ |
| 44 PP_Bool (*IsMediaStreamVideoTrack)(PP_Resource resource); |
| 45 /** |
| 46 * Configures underlying frame buffers for incoming frames. |
| 47 * If the application doesn't want to drop frames, then the |
| 48 * <code>max_buffered_frames</code> should be chosen such that inter-frame |
| 49 * processing time variability won't overrun the input buffer. If the buffer |
| 50 * is overfilled, then frames will be dropped. The application can detect |
| 51 * this by examining the timestamp on returned frames. |
| 52 * If <code>Configure()</code> is not used, default settings will be used. |
| 53 * |
| 54 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
| 55 * resource. |
| 56 * @param[in] max_buffered_frames The maximum number of video frames to |
| 57 * hold in the input buffer. |
| 58 * |
| 59 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 60 */ |
| 61 int32_t (*Configure)(PP_Resource video_track, uint32_t max_buffered_frames); |
| 62 /** |
| 63 * Returns the track ID of the underlying MediaStream video track. |
| 64 * |
| 65 * @param[in] video_track The <code>PP_Resource</code> to check. |
| 66 * |
| 67 * @return A <code>PP_Var</code> containing the MediaStream track ID as |
| 68 * a string. |
| 69 */ |
| 70 struct PP_Var (*GetId)(PP_Resource video_track); |
| 71 /** |
| 72 * Checks whether the underlying MediaStream track has ended. |
| 73 * Calls to GetFrame while the track has ended are safe to make and will |
| 74 * complete, but will fail. |
| 75 * |
| 76 * @param[in] video_track The <code>PP_Resource</code> to check. |
| 77 * |
| 78 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 79 * MediaStream track has ended or <code>PP_FALSE</code> otherwise. |
| 80 */ |
| 81 PP_Bool (*HasEnded)(PP_Resource video_track); |
| 82 /** |
| 83 * Gets the next video frame from the MediaStream track. |
| 84 * If internal processing is slower than the incoming frame rate, new frames |
| 85 * will be dropped from the incoming stream. Once the input buffer is full, |
| 86 * frames will be dropped until <code>RecycleFrame()</code> is called to free |
| 87 * a spot for another frame to be buffered. |
| 88 * If there are no frames in the input buffer, |
| 89 * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the |
| 90 * <code>callback</code> will be called, when a new frame is received or an |
| 91 * error happens. |
| 92 * If the caller holds a frame returned by the previous call of |
| 93 * <code>GetFrame()</code>, <code>PP_ERROR_INPROGRESS</code> will be returned. |
| 94 * The caller should recycle the previous frame before getting the next frame. |
| 95 * |
| 96 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
| 97 * resource. |
| 98 * @param[out] frame A <code>PP_Resource</code> corresponding to a VideoFrame |
| 99 * resource. |
| 100 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 101 * completion of GetFrame(). |
| 102 * |
| 103 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 104 * Returns PP_ERROR_NOMEMORY if <code>max_buffered_frames</code> frames buffer |
| 105 * was not allocated successfully. |
| 106 */ |
| 107 int32_t (*GetFrame)(PP_Resource video_track, |
| 108 PP_Resource* frame, |
| 109 struct PP_CompletionCallback callback); |
| 110 /** |
| 111 * Recycles a frame returned by <code>GetFrame()</code>, so the track can |
| 112 * reuse the underlying buffer of this frame. And the frame will become |
| 113 * invalid. The caller should release all references it holds to |
| 114 * <code>frame</code> and not use it anymore. |
| 115 * |
| 116 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video |
| 117 * resource. |
| 118 * @param[in] frame A <code>PP_Resource</code> corresponding to a VideoFrame |
| 119 * resource returned by <code>GetFrame()</code>. |
| 120 * |
| 121 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 122 */ |
| 123 int32_t (*RecycleFrame)(PP_Resource video_track, PP_Resource frame); |
| 124 /** |
| 125 * Closes the MediaStream video track and disconnects it from video source. |
| 126 * After calling <code>Close()</code>, no new frames will be received. |
| 127 * |
| 128 * @param[in] video_track A <code>PP_Resource</code> corresponding to a |
| 129 * MediaStream video track resource. |
| 130 */ |
| 131 void (*Close)(PP_Resource video_track); |
| 132 }; |
| 133 /** |
| 134 * @} |
| 135 */ |
| 136 |
| 137 #endif /* PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ */ |
| 138 |
OLD | NEW |