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_reader.idl modified Thu Apr 4 13:47:30 2013. */ | 6 /* From private/ppb_video_source_private.idl, |
| 7 * modified Thu Apr 25 11:51:30 2013. |
| 8 */ |
7 | 9 |
8 #ifndef PPAPI_C_PPB_VIDEO_READER_H_ | 10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ |
9 #define PPAPI_C_PPB_VIDEO_READER_H_ | 11 #define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_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_VIDEOREADER_INTERFACE_0_1 "PPB_VideoReader;0.1" | 23 #define PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 "PPB_VideoSource_Private;0.1" |
22 #define PPB_VIDEOREADER_INTERFACE PPB_VIDEOREADER_INTERFACE_0_1 | 24 #define PPB_VIDEOSOURCE_PRIVATE_INTERFACE PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 |
23 | 25 |
24 /** | 26 /** |
25 * @file | 27 * @file |
26 * This file defines the <code>PPB_VideoReader</code> struct for a video reader | 28 * This file defines the <code>PPB_VideoSource_Private</code> interface for a |
27 * resource. | 29 * video source resource, which receives video frames from a MediaStream video |
| 30 * track in the browser. |
28 */ | 31 */ |
29 | 32 |
30 | 33 |
31 /** | 34 /** |
32 * @addtogroup Interfaces | 35 * @addtogroup Interfaces |
33 * @{ | 36 * @{ |
34 */ | 37 */ |
35 /** | 38 /** |
36 * The <code>PPB_VideoReader</code> interface contains pointers to several | 39 * The <code>PPB_VideoSource_Private</code> interface contains pointers to |
37 * functions for creating video reader resources and using them to consume | 40 * several functions for creating video source resources and using them to |
38 * streams of video frames. | 41 * receive video frames from a MediaStream video track in the browser. |
39 */ | 42 */ |
40 struct PPB_VideoReader_0_1 { | 43 struct PPB_VideoSource_Private_0_1 { |
41 /** | 44 /** |
42 * Creates a video reader resource. | 45 * Creates a video source resource. |
43 * | 46 * |
44 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 47 * @param[in] instance A <code>PP_Instance</code> identifying an instance of |
45 * of a module. | 48 * a module. |
46 * | 49 * |
47 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on | 50 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on |
48 * failure. Failure means the instance was invalid. | 51 * failure. Failure means the instance was invalid. |
49 */ | 52 */ |
50 PP_Resource (*Create)(PP_Instance instance); | 53 PP_Resource (*Create)(PP_Instance instance); |
51 /** | 54 /** |
52 * Determines if a given resource is a video reader. | 55 * Determines if a resource is a video source resource. |
53 * | 56 * |
54 * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. | 57 * @param[in] resource The <code>PP_Resource</code> to test. |
55 * | 58 * |
56 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 59 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
57 * resource is a video reader or <code>PP_FALSE</code> otherwise. | 60 * resource is a video source resource or <code>PP_FALSE</code> otherwise. |
58 */ | 61 */ |
59 PP_Bool (*IsVideoReader)(PP_Resource resource); | 62 PP_Bool (*IsVideoSource)(PP_Resource resource); |
60 /** | 63 /** |
61 * Opens a video stream with the given id for reading. | 64 * Opens a video source for getting frames. |
62 * | 65 * |
63 * @param[in] reader A <code>PP_Resource</code> corresponding to a video | 66 * @param[in] source A <code>PP_Resource</code> corresponding to a video |
64 * reader resource. | 67 * source resource. |
65 * @param[in] stream_id A <code>PP_Var</code> holding a string uniquely | 68 * @param[in] stream_url A <code>PP_Var</code> string holding a URL |
66 * identifying the stream. This string is application defined. | 69 * identifying a MediaStream. |
67 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 70 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
68 * completion of Open(). | 71 * completion of Open(). |
69 * | 72 * |
70 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 73 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
71 * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader. | 74 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. |
72 * Returns PP_ERROR_INPROGRESS if the reader has already opened a stream. | 75 * Returns PP_ERROR_INPROGRESS if source is already open. |
| 76 * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is |
| 77 * some other browser error. |
73 */ | 78 */ |
74 int32_t (*Open)(PP_Resource reader, | 79 int32_t (*Open)(PP_Resource source, |
75 struct PP_Var stream_id, | 80 struct PP_Var stream_url, |
76 struct PP_CompletionCallback callback); | 81 struct PP_CompletionCallback callback); |
77 /** | 82 /** |
78 * Gets the next frame of video from the reader's open stream. The image data | 83 * Gets a frame from the video source. |
79 * resource returned in the frame will have its reference count incremented by | 84 * The image data resource inside the returned frame will have its reference |
80 * one and must be managed by the plugin. | 85 * count incremented by one and must be managed by the plugin. |
81 * | 86 * |
82 * @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 |
83 * reader resource. | 88 * source resource. |
84 * @param[out] frame A <code>PP_VideoFrame</code> to hold a video frame to | 89 * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video |
85 * read from the open stream. | 90 * frame from the source. |
86 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 91 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
87 * completion of GetNextFrame(). | 92 * completion of GetNextFrame(). |
88 * | 93 * |
89 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 94 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
90 * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader. | 95 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. |
91 * Returns PP_ERROR_FAILED if the reader has not opened a stream, if the video | 96 * Returns PP_ERROR_FAILED if the source is not open, or if some other |
92 * frame has an invalid image data resource, or if some other error occurs. | 97 * browser error occurs. |
93 */ | 98 */ |
94 int32_t (*GetFrame)(PP_Resource reader, | 99 int32_t (*GetFrame)(PP_Resource source, |
95 struct PP_VideoFrame* frame, | 100 struct PP_VideoFrame_Private* frame, |
96 struct PP_CompletionCallback callback); | 101 struct PP_CompletionCallback callback); |
97 /** | 102 /** |
98 * Closes the reader's video stream. | 103 * Closes the video source. |
99 * | 104 * |
100 * @param[in] reader A <code>PP_Resource</code> corresponding to a video | 105 * @param[in] source A <code>PP_Resource</code> corresponding to a video |
101 * reader resource. | 106 * source resource. |
102 */ | 107 */ |
103 void (*Close)(PP_Resource reader); | 108 void (*Close)(PP_Resource source); |
104 }; | 109 }; |
105 | 110 |
106 typedef struct PPB_VideoReader_0_1 PPB_VideoReader; | 111 typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private; |
107 /** | 112 /** |
108 * @} | 113 * @} |
109 */ | 114 */ |
110 | 115 |
111 #endif /* PPAPI_C_PPB_VIDEO_READER_H_ */ | 116 #endif /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */ |
112 | 117 |
OLD | NEW |