Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / api / private / ppb_video_destination_private.idl
bloba37cbd56ac878ed6c72b4c26a78ede579a18b63e
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 */
6 /**
7 * This file defines the <code>PPB_VideoDestination_Private</code> interface
8 * for a video destination resource, which sends video frames to a MediaStream
9 * video track in the browser.
12 label Chrome {
13 M28 = 0.1
16 /**
17 * The <code>PPB_VideoDestination_Private</code> interface contains pointers to
18 * several functions for creating video destination resources and using them to
19 * send video frames to a MediaStream video track in the browser.
21 interface PPB_VideoDestination_Private {
22 /**
23 * Creates a video destination resource.
25 * @param[in] instance A <code>PP_Instance</code> identifying an instance of
26 * a module.
28 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
29 * failure. Failure means the instance was invalid.
31 PP_Resource Create([in] PP_Instance instance);
33 /**
34 * Determines if a resource is a video destination resource.
36 * @param[in] resource The <code>PP_Resource</code> to test.
38 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
39 * resource is a video destination resource or <code>PP_FALSE</code>
40 * otherwise.
42 PP_Bool IsVideoDestination([in] PP_Resource resource);
44 /**
45 * Opens a video destination for putting frames.
47 * @param[in] destination A <code>PP_Resource</code> corresponding to a video
48 * destination resource.
49 * @param[in] stream_url A <code>PP_Var</code> string holding a URL
50 * identifying a MediaStream.
51 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
52 * completion of Open().
54 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
55 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
56 * destination.
57 * Returns PP_ERROR_INPROGRESS if destination is already open.
58 * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
59 * some other browser error.
61 int32_t Open([in] PP_Resource destination,
62 [in] PP_Var stream_url,
63 [in] PP_CompletionCallback callback);
65 /**
66 * Puts a frame to the video destination.
68 * After this call, you should take care to release your references to the
69 * image embedded in the video frame. If you paint to the image after
70 * PutFame(), there is the possibility of artifacts because the browser may
71 * still be copying the frame to the stream.
73 * @param[in] destination A <code>PP_Resource</code> corresponding to a video
74 * destination resource.
75 * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video
76 * frame to send to the destination.
78 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
79 * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
80 * destination.
81 * Returns PP_ERROR_FAILED if destination is not open, if the video frame has
82 * an invalid image data resource, or if some other browser error occurs.
84 int32_t PutFrame([in] PP_Resource destination,
85 [in] PP_VideoFrame_Private frame);
87 /**
88 * Closes the video destination.
90 * @param[in] destination A <code>PP_Resource</code> corresponding to a video
91 * destination.
93 void Close([in] PP_Resource destination);