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_destination_private.idl,
7 * modified Thu Apr 25 11:51:30 2013.
10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_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_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 \
24 "PPB_VideoDestination_Private;0.1"
25 #define PPB_VIDEODESTINATION_PRIVATE_INTERFACE \
26 PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1
30 * This file defines the <code>PPB_VideoDestination_Private</code> interface
31 * for a video destination resource, which sends video frames to a MediaStream
32 * video track in the browser.
37 * @addtogroup Interfaces
41 * The <code>PPB_VideoDestination_Private</code> interface contains pointers to
42 * several functions for creating video destination resources and using them to
43 * send video frames to a MediaStream video track in the browser.
45 struct PPB_VideoDestination_Private_0_1
{
47 * Creates a video destination resource.
49 * @param[in] instance A <code>PP_Instance</code> identifying an instance of
52 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
53 * failure. Failure means the instance was invalid.
55 PP_Resource (*Create
)(PP_Instance instance
);
57 * Determines if a resource is a video destination resource.
59 * @param[in] resource The <code>PP_Resource</code> to test.
61 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
62 * resource is a video destination resource or <code>PP_FALSE</code>
65 PP_Bool (*IsVideoDestination
)(PP_Resource resource
);
67 * Opens a video destination for putting frames.
69 * @param[in] destination A <code>PP_Resource</code> corresponding to a video
70 * destination resource.
71 * @param[in] stream_url A <code>PP_Var</code> string holding a URL
72 * identifying a MediaStream.
73 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
74 * completion of Open().
76 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
77 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
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.
83 int32_t (*Open
)(PP_Resource destination
,
84 struct PP_Var stream_url
,
85 struct PP_CompletionCallback callback
);
87 * Puts a frame to the video destination.
89 * After this call, you should take care to release your references to the
90 * image embedded in the video frame. If you paint to the image after
91 * PutFame(), there is the possibility of artifacts because the browser may
92 * still be copying the frame to the stream.
94 * @param[in] destination A <code>PP_Resource</code> corresponding to a video
95 * destination resource.
96 * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video
97 * frame to send to the destination.
99 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
100 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
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.
105 int32_t (*PutFrame
)(PP_Resource destination
,
106 const struct PP_VideoFrame_Private
* frame
);
108 * Closes the video destination.
110 * @param[in] destination A <code>PP_Resource</code> corresponding to a video
113 void (*Close
)(PP_Resource destination
);
116 typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private
;
121 #endif /* PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ */