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_destination_private.idl, 7 * modified Thu Apr 25 11:51:30 2013. 8 */ 9 10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ 11 #define PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ 12 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" 22 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 27 28 /** 29 * @file 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. 33 */ 34 35 36 /** 37 * @addtogroup Interfaces 38 * @{ 39 */ 40 /** 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. 44 */ 45 struct PPB_VideoDestination_Private_0_1 { 46 /** 47 * Creates a video destination resource. 48 * 49 * @param[in] instance A <code>PP_Instance</code> identifying an instance of 50 * a module. 51 * 52 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on 53 * failure. Failure means the instance was invalid. 54 */ 55 PP_Resource (*Create)(PP_Instance instance); 56 /** 57 * Determines if a resource is a video destination resource. 58 * 59 * @param[in] resource The <code>PP_Resource</code> to test. 60 * 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> 63 * otherwise. 64 */ 65 PP_Bool (*IsVideoDestination)(PP_Resource resource); 66 /** 67 * Opens a video destination for putting frames. 68 * 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(). 75 * 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 78 * destination. 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. 82 */ 83 int32_t (*Open)(PP_Resource destination, 84 struct PP_Var stream_url, 85 struct PP_CompletionCallback callback); 86 /** 87 * Puts a frame to the video destination. 88 * 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. 93 * 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. 98 * 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 101 * destination. 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. 104 */ 105 int32_t (*PutFrame)(PP_Resource destination, 106 const struct PP_VideoFrame_Private* frame); 107 /** 108 * Closes the video destination. 109 * 110 * @param[in] destination A <code>PP_Resource</code> corresponding to a video 111 * destination. 112 */ 113 void (*Close)(PP_Resource destination); 114 }; 115 116 typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private; 117 /** 118 * @} 119 */ 120 121 #endif /* PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ */ 122 123