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 /* From ppb_video_writer.idl modified Fri Apr 5 15:46:57 2013. */ | 6 /* From private/ppb_video_destination_private.idl, |
| 7 * modified Thu Apr 25 11:51:30 2013. |
| 8 */ |
7 | 9 |
8 #ifndef PPAPI_C_PPB_VIDEO_WRITER_H_ | 10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ |
9 #define PPAPI_C_PPB_VIDEO_WRITER_H_ | 11 #define PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ |
10 | 12 |
11 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 14 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_macros.h" | 16 #include "ppapi/c/pp_macros.h" |
15 #include "ppapi/c/pp_resource.h" | 17 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_stdint.h" | 18 #include "ppapi/c/pp_stdint.h" |
17 #include "ppapi/c/pp_time.h" | 19 #include "ppapi/c/pp_time.h" |
18 #include "ppapi/c/pp_var.h" | 20 #include "ppapi/c/pp_var.h" |
19 #include "ppapi/c/pp_video_frame.h" | 21 #include "ppapi/c/private/pp_video_frame_private.h" |
20 | 22 |
21 #define PPB_VIDEOWRITER_INTERFACE_0_1 "PPB_VideoWriter;0.1" | 23 #define PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 \ |
22 #define PPB_VIDEOWRITER_INTERFACE PPB_VIDEOWRITER_INTERFACE_0_1 | 24 "PPB_VideoDestination_Private;0.1" |
| 25 #define PPB_VIDEODESTINATION_PRIVATE_INTERFACE \ |
| 26 PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 |
23 | 27 |
24 /** | 28 /** |
25 * @file | 29 * @file |
26 * This file defines the <code>PPB_VideoWriter</code> struct for a video writer | 30 * This file defines the <code>PPB_VideoDestination_Private</code> interface |
27 * resource. | 31 * for a video destination resource, which sends video frames to a MediaStream |
| 32 * video track in the browser. |
28 */ | 33 */ |
29 | 34 |
30 | 35 |
31 /** | 36 /** |
32 * @addtogroup Interfaces | 37 * @addtogroup Interfaces |
33 * @{ | 38 * @{ |
34 */ | 39 */ |
35 /** | 40 /** |
36 * The <code>PPB_VideoWriter</code> interface contains pointers to several | 41 * The <code>PPB_VideoDestination_Private</code> interface contains pointers to |
37 * functions for creating video writer resources and using them to generate | 42 * several functions for creating video destination resources and using them to |
38 * streams of video frames. | 43 * send video frames to a MediaStream video track in the browser. |
39 */ | 44 */ |
40 struct PPB_VideoWriter_0_1 { | 45 struct PPB_VideoDestination_Private_0_1 { |
41 /** | 46 /** |
42 * Creates a video writer resource. | 47 * Creates a video destination resource. |
43 * | 48 * |
44 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 49 * @param[in] instance A <code>PP_Instance</code> identifying an instance of |
45 * of a module. | 50 * a module. |
46 * | 51 * |
47 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on | 52 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on |
48 * failure. Failure means the instance was invalid. | 53 * failure. Failure means the instance was invalid. |
49 */ | 54 */ |
50 PP_Resource (*Create)(PP_Instance instance); | 55 PP_Resource (*Create)(PP_Instance instance); |
51 /** | 56 /** |
52 * Determines if a given resource is a video writer. | 57 * Determines if a resource is a video destination resource. |
53 * | 58 * |
54 * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. | 59 * @param[in] resource The <code>PP_Resource</code> to test. |
55 * | 60 * |
56 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 61 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
57 * resource is a video writer or <code>PP_FALSE</code> otherwise. | 62 * resource is a video destination resource or <code>PP_FALSE</code> |
| 63 * otherwise. |
58 */ | 64 */ |
59 PP_Bool (*IsVideoWriter)(PP_Resource resource); | 65 PP_Bool (*IsVideoDestination)(PP_Resource resource); |
60 /** | 66 /** |
61 * Opens a video stream with the given id for writing. | 67 * Opens a video destination for putting frames. |
62 * | 68 * |
63 * @param[in] writer A <code>PP_Resource</code> corresponding to a video | 69 * @param[in] destination A <code>PP_Resource</code> corresponding to a video |
64 * writer resource. | 70 * destination resource. |
65 * @param[out] stream_id A <code>PP_Var</code> holding a string uniquely | 71 * @param[in] stream_url A <code>PP_Var</code> string holding a URL |
66 * identifying the stream. This string is generated by the host. | 72 * identifying a MediaStream. |
67 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 73 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
68 * completion of Open(). | 74 * completion of Open(). |
69 * | 75 * |
70 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 76 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
71 * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. | 77 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video |
72 * Returns PP_ERROR_INPROGRESS if the writer has already opened a stream. | 78 * destination. |
| 79 * Returns PP_ERROR_INPROGRESS if destination is already open. |
| 80 * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is |
| 81 * some other browser error. |
73 */ | 82 */ |
74 int32_t (*Open)(PP_Resource writer, | 83 int32_t (*Open)(PP_Resource destination, |
75 struct PP_Var* stream_id, | 84 struct PP_Var stream_url, |
76 struct PP_CompletionCallback callback); | 85 struct PP_CompletionCallback callback); |
77 /** | 86 /** |
78 * Puts a frame of video to the writer's open stream. | 87 * Puts a frame to the video destination. |
79 * | 88 * |
80 * After this call, you should take care to release your references to the | 89 * After this call, you should take care to release your references to the |
81 * image embedded in the video frame. If you paint to the image after | 90 * image embedded in the video frame. If you paint to the image after |
82 * PutFrame(), there is the possibility of artifacts because the browser may | 91 * PutFame(), there is the possibility of artifacts because the browser may |
83 * still be copying the frame to the stream. | 92 * still be copying the frame to the stream. |
84 * | 93 * |
85 * @param[in] writer A <code>PP_Resource</code> corresponding to a video | 94 * @param[in] destination A <code>PP_Resource</code> corresponding to a video |
86 * writer resource. | 95 * destination resource. |
87 * @param[in] frame A <code>PP_VideoFrame</code> holding a video frame to | 96 * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video |
88 * write to the open stream. | 97 * frame to send to the destination. |
89 * | 98 * |
90 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 99 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
91 * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. | 100 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video |
92 * Returns PP_ERROR_FAILED if the writer has not opened a stream, if the video | 101 * destination. |
93 * frame has an invalid image data resource, or if some other error occurs. | 102 * Returns PP_ERROR_FAILED if destination is not open, if the video frame has |
| 103 * an invalid image data resource, or if some other browser error occurs. |
94 */ | 104 */ |
95 int32_t (*PutFrame)(PP_Resource writer, const struct PP_VideoFrame* frame); | 105 int32_t (*PutFrame)(PP_Resource destination, |
| 106 const struct PP_VideoFrame_Private* frame); |
96 /** | 107 /** |
97 * Closes the writer's video stream. | 108 * Closes the video destination. |
98 * | 109 * |
99 * @param[in] writer A <code>PP_Resource</code> corresponding to a video | 110 * @param[in] destination A <code>PP_Resource</code> corresponding to a video |
100 * writer resource. | 111 * destination. |
101 */ | 112 */ |
102 void (*Close)(PP_Resource writer); | 113 void (*Close)(PP_Resource destination); |
103 }; | 114 }; |
104 | 115 |
105 typedef struct PPB_VideoWriter_0_1 PPB_VideoWriter; | 116 typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private; |
106 /** | 117 /** |
107 * @} | 118 * @} |
108 */ | 119 */ |
109 | 120 |
110 #endif /* PPAPI_C_PPB_VIDEO_WRITER_H_ */ | 121 #endif /* PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ */ |
111 | 122 |
OLD | NEW |