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/** 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. 10 */ 11 12 label Chrome { 13 M28 = 0.1 14 }; 15 16/** 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. 20 */ 21interface PPB_VideoSource_Private { 22 /** 23 * Creates a video source resource. 24 * 25 * @param[in] instance A <code>PP_Instance</code> identifying an instance of 26 * a module. 27 * 28 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on 29 * failure. Failure means the instance was invalid. 30 */ 31 PP_Resource Create([in] PP_Instance instance); 32 33 /** 34 * Determines if a resource is a video source resource. 35 * 36 * @param[in] resource The <code>PP_Resource</code> to test. 37 * 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. 40 */ 41 PP_Bool IsVideoSource([in] PP_Resource resource); 42 43 /** 44 * Opens a video source for getting frames. 45 * 46 * @param[in] source A <code>PP_Resource</code> corresponding to a video 47 * source resource. 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(). 52 * 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. 58 */ 59 int32_t Open([in] PP_Resource source, 60 [in] PP_Var stream_url, 61 [in] PP_CompletionCallback callback); 62 63 /** 64 * Gets a frame from the video source. The returned image data is only valid 65 * until the next call to GetFrame. 66 * The image data resource inside the returned frame will have its reference 67 * count incremented by one and must be managed by the plugin. 68 * 69 * @param[in] source A <code>PP_Resource</code> corresponding to a video 70 * source resource. 71 * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video 72 * frame from the source. 73 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 74 * completion of GetNextFrame(). 75 * 76 * @return An int32_t containing a result code from <code>pp_errors.h</code>. 77 * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. 78 * Returns PP_ERROR_FAILED if the source is not open, or if some other 79 * browser error occurs. 80 */ 81 int32_t GetFrame([in] PP_Resource source, 82 [out] PP_VideoFrame_Private frame, 83 [in] PP_CompletionCallback callback); 84 85 /** 86 * Closes the video source. 87 * 88 * @param[in] source A <code>PP_Resource</code> corresponding to a video 89 * source resource. 90 */ 91 void Close([in] PP_Resource source); 92}; 93 94