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_VideoWriter</code> struct for a video writer | 7 * This file defines the <code>PPB_VideoDestination_Private</code> interface |
8 * resource. | 8 * for a video destination resource, which sends video frames to a MediaStream |
| 9 * video track in the browser. |
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_VideoWriter</code> interface contains pointers to several | 17 * The <code>PPB_VideoDestination_Private</code> interface contains pointers to |
17 * functions for creating video writer resources and using them to generate | 18 * several functions for creating video destination resources and using them to |
18 * streams of video frames. | 19 * send video frames to a MediaStream video track in the browser. |
19 */ | 20 */ |
20 interface PPB_VideoWriter { | 21 interface PPB_VideoDestination_Private { |
21 /** | 22 /** |
22 * Creates a video writer resource. | 23 * Creates a video destination 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 writer. | 34 * Determines if a resource is a video destination 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 writer or <code>PP_FALSE</code> otherwise. | 39 * resource is a video destination resource or <code>PP_FALSE</code> |
| 40 * otherwise. |
39 */ | 41 */ |
40 PP_Bool IsVideoWriter([in] PP_Resource resource); | 42 PP_Bool IsVideoDestination([in] PP_Resource resource); |
41 | 43 |
42 /** | 44 /** |
43 * Opens a video stream with the given id for writing. | 45 * Opens a video destination for putting frames. |
44 * | 46 * |
45 * @param[in] writer A <code>PP_Resource</code> corresponding to a video | 47 * @param[in] destination A <code>PP_Resource</code> corresponding to a video |
46 * writer resource. | 48 * destination resource. |
47 * @param[out] stream_id A <code>PP_Var</code> holding a string uniquely | 49 * @param[in] stream_url A <code>PP_Var</code> string holding a URL |
48 * identifying the stream. This string is generated by the host. | 50 * identifying a MediaStream. |
49 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 51 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
50 * completion of Open(). | 52 * completion of Open(). |
51 * | 53 * |
52 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 54 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
53 * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. | 55 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video |
54 * Returns PP_ERROR_INPROGRESS if the writer has already opened a stream. | 56 * destination. |
| 57 * Returns PP_ERROR_INPROGRESS if destination is already open. |
| 58 * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is |
| 59 * some other browser error. |
55 */ | 60 */ |
56 int32_t Open([in] PP_Resource writer, | 61 int32_t Open([in] PP_Resource destination, |
57 [out] PP_Var stream_id, | 62 [in] PP_Var stream_url, |
58 [in] PP_CompletionCallback callback); | 63 [in] PP_CompletionCallback callback); |
59 | 64 |
60 /** | 65 /** |
61 * Puts a frame of video to the writer's open stream. | 66 * Puts a frame to the video destination. |
62 * | 67 * |
63 * After this call, you should take care to release your references to the | 68 * After this call, you should take care to release your references to the |
64 * image embedded in the video frame. If you paint to the image after | 69 * image embedded in the video frame. If you paint to the image after |
65 * PutFrame(), there is the possibility of artifacts because the browser may | 70 * PutFame(), there is the possibility of artifacts because the browser may |
66 * still be copying the frame to the stream. | 71 * still be copying the frame to the stream. |
67 * | 72 * |
68 * @param[in] writer A <code>PP_Resource</code> corresponding to a video | 73 * @param[in] destination A <code>PP_Resource</code> corresponding to a video |
69 * writer resource. | 74 * destination resource. |
70 * @param[in] frame A <code>PP_VideoFrame</code> holding a video frame to | 75 * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video |
71 * write to the open stream. | 76 * frame to send to the destination. |
72 * | 77 * |
73 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 78 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
74 * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. | 79 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video |
75 * Returns PP_ERROR_FAILED if the writer has not opened a stream, if the video | 80 * destination. |
76 * frame has an invalid image data resource, or if some other error occurs. | 81 * Returns PP_ERROR_FAILED if destination is not open, if the video frame has |
| 82 * an invalid image data resource, or if some other browser error occurs. |
77 */ | 83 */ |
78 int32_t PutFrame([in] PP_Resource writer, | 84 int32_t PutFrame([in] PP_Resource destination, |
79 [in] PP_VideoFrame frame); | 85 [in] PP_VideoFrame_Private frame); |
80 | 86 |
81 /** | 87 /** |
82 * Closes the writer's video stream. | 88 * Closes the video destination. |
83 * | 89 * |
84 * @param[in] writer A <code>PP_Resource</code> corresponding to a video | 90 * @param[in] destination A <code>PP_Resource</code> corresponding to a video |
85 * writer resource. | 91 * destination. |
86 */ | 92 */ |
87 void Close([in] PP_Resource writer); | 93 void Close([in] PP_Resource destination); |
88 }; | 94 }; |
89 | 95 |
OLD | NEW |