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