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.
7 * This file defines the <code>PPB_VideoSource_Private</code> interface for a
8 * video source resource, which receives video frames from a MediaStream video
9 * track in the browser.
17 * The <code>PPB_VideoSource_Private</code> interface contains pointers to
18 * several functions for creating video source resources and using them to
19 * receive video frames from a MediaStream video track in the browser.
21 interface PPB_VideoSource_Private
{
23 * Creates a video source resource.
25 * @param[in] instance A <code>PP_Instance</code> identifying an instance of
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
);
34 * Determines if a resource is a video source 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 source resource or <code>PP_FALSE</code> otherwise.
41 PP_Bool IsVideoSource
([in] PP_Resource resource
);
44 * Opens a video source for getting frames.
46 * @param[in] source A <code>PP_Resource</code> corresponding to a video
48 * @param[in] stream_url A <code>PP_Var</code> string holding a URL
49 * identifying a MediaStream.
50 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
51 * completion of Open().
53 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
54 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
55 * Returns PP_ERROR_INPROGRESS if source is already open.
56 * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
57 * some other browser error.
59 int32_t Open
([in] PP_Resource
source,
60 [in] PP_Var stream_url
,
61 [in] PP_CompletionCallback
callback);
64 * Gets a frame from the video source.
65 * The image data resource inside the returned frame will have its reference
66 * count incremented by one and must be managed by the plugin.
68 * @param[in] source A <code>PP_Resource</code> corresponding to a video
70 * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video
71 * frame from the source.
72 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
73 * completion of GetNextFrame().
75 * @return An int32_t containing a result code from <code>pp_errors.h</code>.
76 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
77 * Returns PP_ERROR_FAILED if the source is not open, or if some other
78 * browser error occurs.
80 int32_t GetFrame
([in] PP_Resource
source,
81 [out] PP_VideoFrame_Private frame
,
82 [in] PP_CompletionCallback
callback);
85 * Closes the video source.
87 * @param[in] source A <code>PP_Resource</code> corresponding to a video
90 void Close
([in] PP_Resource
source);