Home | History | Annotate | Download | only in private
      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_source_private.idl,
      7  *   modified Thu Apr 25 11:51:30 2013.
      8  */
      9 
     10 #ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_
     11 #define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_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_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 "PPB_VideoSource_Private;0.1"
     24 #define PPB_VIDEOSOURCE_PRIVATE_INTERFACE PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1
     25 
     26 /**
     27  * @file
     28  * This file defines the <code>PPB_VideoSource_Private</code> interface for a
     29  * video source resource, which receives video frames from a MediaStream video
     30  * track in the browser.
     31  */
     32 
     33 
     34 /**
     35  * @addtogroup Interfaces
     36  * @{
     37  */
     38 /**
     39  * The <code>PPB_VideoSource_Private</code> interface contains pointers to
     40  * several functions for creating video source resources and using them to
     41  * receive video frames from a MediaStream video track in the browser.
     42  */
     43 struct PPB_VideoSource_Private_0_1 {
     44   /**
     45    * Creates a video source resource.
     46    *
     47    * @param[in] instance A <code>PP_Instance</code> identifying an instance of
     48    * a module.
     49    *
     50    * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
     51    * failure. Failure means the instance was invalid.
     52    */
     53   PP_Resource (*Create)(PP_Instance instance);
     54   /**
     55    * Determines if a resource is a video source resource.
     56    *
     57    * @param[in] resource The <code>PP_Resource</code> to test.
     58    *
     59    * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
     60    * resource is a video source resource or <code>PP_FALSE</code> otherwise.
     61    */
     62   PP_Bool (*IsVideoSource)(PP_Resource resource);
     63   /**
     64    * Opens a video source for getting frames.
     65    *
     66    * @param[in] source A <code>PP_Resource</code> corresponding to a video
     67    * source resource.
     68    * @param[in] stream_url A <code>PP_Var</code> string holding a URL
     69    * identifying a MediaStream.
     70    * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
     71    * completion of Open().
     72    *
     73    * @return An int32_t containing a result code from <code>pp_errors.h</code>.
     74    * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
     75    * Returns PP_ERROR_INPROGRESS if source is already open.
     76    * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
     77    * some other browser error.
     78    */
     79   int32_t (*Open)(PP_Resource source,
     80                   struct PP_Var stream_url,
     81                   struct PP_CompletionCallback callback);
     82   /**
     83    * Gets a frame from the video source.
     84    * The image data resource inside the returned frame will have its reference
     85    * count incremented by one and must be managed by the plugin.
     86    *
     87    * @param[in] source A <code>PP_Resource</code> corresponding to a video
     88    * source resource.
     89    * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video
     90    * frame from the source.
     91    * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
     92    * completion of GetNextFrame().
     93    *
     94    * @return An int32_t containing a result code from <code>pp_errors.h</code>.
     95    * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
     96    * Returns PP_ERROR_FAILED if the source is not open, or if some other
     97    * browser error occurs.
     98    */
     99   int32_t (*GetFrame)(PP_Resource source,
    100                       struct PP_VideoFrame_Private* frame,
    101                       struct PP_CompletionCallback callback);
    102   /**
    103    * Closes the video source.
    104    *
    105    * @param[in] source A <code>PP_Resource</code> corresponding to a video
    106    * source resource.
    107    */
    108   void (*Close)(PP_Resource source);
    109 };
    110 
    111 typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private;
    112 /**
    113  * @}
    114  */
    115 
    116 #endif  /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */
    117 
    118