Pepper_47_C_interfaces
ppb_video_source_private.h
Go to the documentation of this file.
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 private/ppb_video_source_private.idl,
7  * modified Thu Oct 20 13:57:04 2016.
8  */
9 
10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_
12 
13 #include "ppapi/c/pp_bool.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"
22 
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
25 
26 /**
27  * @file
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.
31  */
32 
33 
34 /**
35  * @addtogroup Interfaces
36  * @{
37  */
38 /**
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.
42  */
44  /**
45  * Creates a video source resource.
46  *
47  * @param[in] instance A <code>PP_Instance</code> identifying an instance of
48  * a module.
49  *
50  * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
51  * failure. Failure means the instance was invalid.
52  */
54  /**
55  * Determines if a resource is a video source resource.
56  *
57  * @param[in] resource The <code>PP_Resource</code> to test.
58  *
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.
61  */
63  /**
64  * Opens a video source for getting frames.
65  *
66  * @param[in] source A <code>PP_Resource</code> corresponding to a video
67  * source resource.
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().
72  *
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.
78  */
79  int32_t (*Open)(PP_Resource source,
80  struct PP_Var stream_url,
81  struct PP_CompletionCallback callback);
82  /**
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.
87  *
88  * @param[in] source A <code>PP_Resource</code> corresponding to a video
89  * source resource.
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().
94  *
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.
99  */
100  int32_t (*GetFrame)(PP_Resource source,
101  struct PP_VideoFrame_Private* frame,
102  struct PP_CompletionCallback callback);
103  /**
104  * Closes the video source.
105  *
106  * @param[in] source A <code>PP_Resource</code> corresponding to a video
107  * source resource.
108  */
109  void (*Close)(PP_Resource source);
110 };
111 
113 /**
114  * @}
115  */
116 
117 #endif /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */
118 
int32_t(* Open)(PP_Resource source, struct PP_Var stream_url, struct PP_CompletionCallback callback)
PP_Bool(* IsVideoSource)(PP_Resource resource)
void(* Close)(PP_Resource source)
int32_t(* GetFrame)(PP_Resource source, struct PP_VideoFrame_Private *frame, struct PP_CompletionCallback callback)
int32_t PP_Resource
Definition: pp_resource.h:40
Definition: pp_var.h:166
int32_t PP_Instance
Definition: pp_instance.h:34
PP_Bool
Definition: pp_bool.h:30
PP_Resource(* Create)(PP_Instance instance)