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.
6 /* From private/ppb_video_source_private.idl,
7 * modified Mon Oct 27 16:13:24 2014.
10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h"
19 #include "ppapi/c/pp_time.h"
20 #include "ppapi/c/pp_var.h"
21 #include "ppapi/c/private/pp_video_frame_private.h"
23 #define PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 "PPB_VideoSource_Private;0.1"
24 #define PPB_VIDEOSOURCE_PRIVATE_INTERFACE PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1
28 * This file defines the <code>PPB_VideoSource_Private</code> interface for a
29 * video source resource, which receives video frames from a MediaStream video
30 * track in the browser.
35 * @addtogroup Interfaces
39 * The <code>PPB_VideoSource_Private</code> interface contains pointers to
40 * several functions for creating video source resources and using them to
41 * receive video frames from a MediaStream video track in the browser.
43 struct PPB_VideoSource_Private_0_1
{
45 * Creates a video source resource.
47 * @param[in] instance A <code>PP_Instance</code> identifying an instance of
50 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
51 * failure. Failure means the instance was invalid.
53 PP_Resource (*Create
)(PP_Instance instance
);
55 * Determines if a resource is a video source resource.
57 * @param[in] resource The <code>PP_Resource</code> to test.
59 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
60 * resource is a video source resource or <code>PP_FALSE</code> otherwise.
62 PP_Bool (*IsVideoSource
)(PP_Resource resource
);
64 * Opens a video source for getting frames.
66 * @param[in] source A <code>PP_Resource</code> corresponding to a video
68 * @param[in] stream_url A <code>PP_Var</code> string holding a URL
69 * identifying a MediaStream.
70 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
71 * completion of Open().
73 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
74 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
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.
79 int32_t (*Open
)(PP_Resource source
,
80 struct PP_Var stream_url
,
81 struct PP_CompletionCallback callback
);
83 * Gets a frame from the video source. The returned image data is only valid
84 * until the next call to GetFrame.
85 * The image data resource inside the returned frame will have its reference
86 * count incremented by one and must be managed by the plugin.
88 * @param[in] source A <code>PP_Resource</code> corresponding to a video
90 * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video
91 * frame from the source.
92 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
93 * completion of GetNextFrame().
95 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
96 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
97 * Returns PP_ERROR_FAILED if the source is not open, or if some other
98 * browser error occurs.
100 int32_t (*GetFrame
)(PP_Resource source
,
101 struct PP_VideoFrame_Private
* frame
,
102 struct PP_CompletionCallback callback
);
104 * Closes the video source.
106 * @param[in] source A <code>PP_Resource</code> corresponding to a video
109 void (*Close
)(PP_Resource source
);
112 typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private
;
117 #endif /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */