Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 * This file defines the <code>PPB_VideoReader</code> struct for a video reader | 7 * This file defines the <code>PPB_VideoSource_Private</code> interface for a |
| 8 * resource. | 8 * video source resource. A video source receives video frames from a |
| 9 * MediaStream video track. | |
| 9 */ | 10 */ |
| 10 | 11 |
| 11 label Chrome { | 12 label Chrome { |
| 12 M28 = 0.1 | 13 M28 = 0.1 |
| 13 }; | 14 }; |
| 14 | 15 |
| 15 /** | 16 /** |
| 16 * The <code>PPB_VideoReader</code> interface contains pointers to several | 17 * The <code>PPB_VideoSource_Private</code> interface contains pointers to |
| 17 * functions for creating video reader resources and using them to consume | 18 * several functions for creating video source resources and using them to |
| 18 * streams of video frames. | 19 * receive video frames from a MediaStream in the browser. |
| 19 */ | 20 */ |
| 20 interface PPB_VideoReader { | 21 interface PPB_VideoSource_Private { |
| 21 /** | 22 /** |
| 22 * Creates a video reader resource. | 23 * Creates a video source resource. |
| 23 * | 24 * |
| 24 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 25 * @param[in] instance A <code>PP_Instance</code> identifying an instance of |
| 25 * of a module. | 26 * a module. |
| 26 * | 27 * |
| 27 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on | 28 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on |
| 28 * failure. Failure means the instance was invalid. | 29 * failure. Failure means the instance was invalid. |
| 29 */ | 30 */ |
| 30 PP_Resource Create([in] PP_Instance instance); | 31 PP_Resource Create([in] PP_Instance instance); |
| 31 | 32 |
| 32 /** | 33 /** |
| 33 * Determines if a given resource is a video reader. | 34 * Determines if a resource is a video source resource. |
| 34 * | 35 * |
| 35 * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. | 36 * @param[in] resource The <code>PP_Resource</code> to test. |
| 36 * | 37 * |
| 37 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 38 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 38 * resource is a video reader or <code>PP_FALSE</code> otherwise. | 39 * resource is a video source resource or <code>PP_FALSE</code> otherwise. |
| 39 */ | 40 */ |
| 40 PP_Bool IsVideoReader([in] PP_Resource resource); | 41 PP_Bool IsVideoSource([in] PP_Resource resource); |
| 41 | 42 |
| 42 /** | 43 /** |
| 43 * Opens a video stream with the given id for reading. | 44 * Opens a video source to emit frames. |
| 44 * | 45 * |
| 45 * @param[in] reader A <code>PP_Resource</code> corresponding to a video | 46 * @param[in] source A <code>PP_Resource</code> corresponding to a video |
| 46 * reader resource. | 47 * source resource. |
| 47 * @param[in] stream_id A <code>PP_Var</code> holding a string uniquely | 48 * @param[in] stream_url A <code>PP_Var</code> string holding a URL |
| 48 * identifying the stream. This string is application defined. | 49 * identifying a MediaStream. |
| 49 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 50 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 50 * completion of Open(). | 51 * completion of Open(). |
| 51 * | 52 * |
| 52 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 53 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 53 * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader. | 54 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. |
| 54 * Returns PP_ERROR_INPROGRESS if the reader has already opened a stream. | 55 * Returns PP_ERROR_INPROGRESS if source is already open. |
| 56 * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is | |
| 57 * some other browser error. | |
| 55 */ | 58 */ |
| 56 int32_t Open([in] PP_Resource reader, | 59 int32_t Open([in] PP_Resource source, |
| 57 [in] PP_Var stream_id, | 60 [in] PP_Var stream_url, |
| 58 [in] PP_CompletionCallback callback); | 61 [in] PP_CompletionCallback callback); |
| 59 | 62 |
| 60 /** | 63 /** |
| 61 * Gets the next frame of video from the reader's open stream. The image data | 64 * Passes a frame from the video source to the plugin. |
| 62 * resource returned in the frame will have its reference count incremented by | 65 * The image data resource inside the returned frame will have its reference |
| 63 * one and must be managed by the plugin. | 66 * count incremented by one and must be managed by the plugin. |
| 64 * | 67 * |
| 65 * @param[in] reader A <code>PP_Resource</code> corresponding to a video | 68 * @param[in] source A <code>PP_Resource</code> corresponding to a video |
| 66 * reader resource. | 69 * source resource. |
| 67 * @param[out] frame A <code>PP_VideoFrame</code> to hold a video frame to | 70 * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video |
| 68 * read from the open stream. | 71 * frame from the source. |
| 69 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 72 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 70 * completion of GetNextFrame(). | 73 * completion of GetNextFrame(). |
| 71 * | 74 * |
| 72 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 75 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 73 * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader. | 76 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. |
| 74 * Returns PP_ERROR_FAILED if the reader has not opened a stream, if the video | 77 * Returns PP_ERROR_FAILED if the source is not open, or if some other |
| 75 * frame has an invalid image data resource, or if some other error occurs. | 78 * browser error occurs. |
| 76 */ | 79 */ |
| 77 int32_t GetFrame([in] PP_Resource reader, | 80 int32_t EmitFrame([in] PP_Resource source, |
|
Ronghua Wu (Left Chromium)
2013/04/25 18:22:48
Don't we get frame here instead of "emit"?
bbudge
2013/04/25 18:30:08
This does return a frame, but the VideoSource reso
| |
| 78 [out] PP_VideoFrame frame, | 81 [out] PP_VideoFrame_Private frame, |
| 79 [in] PP_CompletionCallback callback); | 82 [in] PP_CompletionCallback callback); |
| 80 | 83 |
| 81 /** | 84 /** |
| 82 * Closes the reader's video stream. | 85 * Closes the video source. |
| 83 * | 86 * |
| 84 * @param[in] reader A <code>PP_Resource</code> corresponding to a video | 87 * @param[in] source A <code>PP_Resource</code> corresponding to a video |
| 85 * reader resource. | 88 * source resource. |
| 86 */ | 89 */ |
| 87 void Close([in] PP_Resource reader); | 90 void Close([in] PP_Resource source); |
| 88 }; | 91 }; |
| 89 | 92 |
| OLD | NEW |