OLD | NEW |
(Empty) | |
| 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 ppb_video_writer.idl modified Thu Apr 4 13:47:32 2013. */ |
| 7 |
| 8 #ifndef PPAPI_C_PPB_VIDEO_WRITER_H_ |
| 9 #define PPAPI_C_PPB_VIDEO_WRITER_H_ |
| 10 |
| 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_macros.h" |
| 15 #include "ppapi/c/pp_resource.h" |
| 16 #include "ppapi/c/pp_stdint.h" |
| 17 #include "ppapi/c/pp_time.h" |
| 18 #include "ppapi/c/pp_var.h" |
| 19 #include "ppapi/c/pp_video_frame.h" |
| 20 |
| 21 #define PPB_VIDEOWRITER_INTERFACE_0_1 "PPB_VideoWriter;0.1" |
| 22 #define PPB_VIDEOWRITER_INTERFACE PPB_VIDEOWRITER_INTERFACE_0_1 |
| 23 |
| 24 /** |
| 25 * @file |
| 26 * This file defines the <code>PPB_VideoWriter</code> struct for a video writer |
| 27 * resource. |
| 28 */ |
| 29 |
| 30 |
| 31 /** |
| 32 * @addtogroup Interfaces |
| 33 * @{ |
| 34 */ |
| 35 /** |
| 36 * The <code>PPB_VideoWriter</code> interface contains pointers to several |
| 37 * functions for creating video writer resources and using them to generate |
| 38 * streams of video frames. |
| 39 */ |
| 40 struct PPB_VideoWriter_0_1 { |
| 41 /** |
| 42 * Creates a video writer resource. |
| 43 * |
| 44 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
| 45 * of a module. |
| 46 * |
| 47 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on |
| 48 * failure. Failure means the instance was invalid. |
| 49 */ |
| 50 PP_Resource (*Create)(PP_Instance instance); |
| 51 /** |
| 52 * Determines if a given resource is a video writer. |
| 53 * |
| 54 * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. |
| 55 * |
| 56 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 57 * resource is a video writer or <code>PP_FALSE</code> otherwise. |
| 58 */ |
| 59 PP_Bool (*IsVideoWriter)(PP_Resource resource); |
| 60 /** |
| 61 * Opens a video stream with the given id for writing. |
| 62 * |
| 63 * @param[in] writer A <code>PP_Resource</code> corresponding to a video |
| 64 * writer resource. |
| 65 * @param[in] stream_id A <code>PP_Var</code> holding a string uniquely |
| 66 * identifying the stream. This string is application defined. |
| 67 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 68 * completion of Open(). |
| 69 * |
| 70 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 71 * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. |
| 72 * Returns PP_ERROR_INPROGRESS if the writer has already opened a stream. |
| 73 */ |
| 74 int32_t (*Open)(PP_Resource writer, |
| 75 struct PP_Var stream_id, |
| 76 struct PP_CompletionCallback callback); |
| 77 /** |
| 78 * Puts a frame of video to the writer's open stream. |
| 79 * |
| 80 * After this call, you should take care to release your references to the |
| 81 * image embedded in the video frame. If you paint to the image after |
| 82 * PutFrame(), there is the possibility of artifacts because the browser may |
| 83 * still be copying the frame to the stream. |
| 84 * |
| 85 * @param[in] writer A <code>PP_Resource</code> corresponding to a video |
| 86 * writer resource. |
| 87 * @param[in] frame A <code>PP_VideoFrame</code> holding a video frame to |
| 88 * write to the open stream. |
| 89 * |
| 90 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 91 * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. |
| 92 * Returns PP_ERROR_FAILED if the writer has not opened a stream, if the video |
| 93 * frame has an invalid image data resource, or if some other error occurs. |
| 94 */ |
| 95 int32_t (*PutFrame)(PP_Resource writer, const struct PP_VideoFrame* frame); |
| 96 /** |
| 97 * Closes the writer's video stream. |
| 98 * |
| 99 * @param[in] writer A <code>PP_Resource</code> corresponding to a video |
| 100 * writer resource. |
| 101 */ |
| 102 void (*Close)(PP_Resource writer); |
| 103 }; |
| 104 |
| 105 typedef struct PPB_VideoWriter_0_1 PPB_VideoWriter; |
| 106 /** |
| 107 * @} |
| 108 */ |
| 109 |
| 110 #endif /* PPAPI_C_PPB_VIDEO_WRITER_H_ */ |
| 111 |
OLD | NEW |