diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 02:35:54 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-05 02:35:54 +0000 |
commit | d1a46611c61734c7c37cded23a2b7fa8fbc70e0d (patch) | |
tree | 978a39693a15cc394286c7a9956debecfc9212e8 /ppapi/api | |
parent | aea9952a3f3f35b4fa7f53797e971d15f1a96a38 (diff) | |
download | chromium_src-d1a46611c61734c7c37cded23a2b7fa8fbc70e0d.zip chromium_src-d1a46611c61734c7c37cded23a2b7fa8fbc70e0d.tar.gz chromium_src-d1a46611c61734c7c37cded23a2b7fa8fbc70e0d.tar.bz2 |
Add PP_VideoFrame, PPB_VideoReader, and PPB_VideoWriter APIs to Pepper.
Defines a PP_VideoFrame struct, and 2 new APIs,PPB_ VideoReader to consume a video stream, and
PPB_VideoWriter to generate a video stream.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/13461010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api')
-rw-r--r-- | ppapi/api/pp_video_frame.idl | 34 | ||||
-rw-r--r-- | ppapi/api/ppb_video_reader.idl | 89 | ||||
-rw-r--r-- | ppapi/api/ppb_video_writer.idl | 89 |
3 files changed, 212 insertions, 0 deletions
diff --git a/ppapi/api/pp_video_frame.idl b/ppapi/api/pp_video_frame.idl new file mode 100644 index 0000000..d2f6dafb --- /dev/null +++ b/ppapi/api/pp_video_frame.idl @@ -0,0 +1,34 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the struct used to hold a video frame. + */ + +/** + * The <code>PP_Video_Frame</code> struct represents a video frame. + */ +[assert_size(16)] +struct PP_VideoFrame { + /** + * A timestamp placing the frame in a video stream. + */ + PP_TimeTicks timestamp; + + /** + * An image data resource to hold the video frame. + */ + PP_Resource image_data; + + /** + * Ensure that this struct is 16-bytes wide by padding the end. In some + * compilers, PP_TimeTicks is 8-byte aligned, so those compilers align this + * struct on 8-byte boundaries as well and pad it to 8 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; + diff --git a/ppapi/api/ppb_video_reader.idl b/ppapi/api/ppb_video_reader.idl new file mode 100644 index 0000000..1c98584 --- /dev/null +++ b/ppapi/api/ppb_video_reader.idl @@ -0,0 +1,89 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the <code>PPB_VideoReader</code> struct for a video reader + * resource. + */ + + label Chrome { + M28 = 0.1 + }; + +/** + * The <code>PPB_VideoReader</code> interface contains pointers to several + * functions for creating video reader resources and using them to consume + * streams of video frames. + */ +interface PPB_VideoReader { + /** + * Creates a video reader resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a video reader. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video reader or <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsVideoReader([in] PP_Resource resource); + + /** + * Opens a video stream with the given id for reading. + * + * @param[in] reader A <code>PP_Resource</code> corresponding to a video + * reader resource. + * @param[in] stream_id A <code>PP_Var</code> holding a string uniquely + * identifying the stream. This string is application defined. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader. + * Returns PP_ERROR_INPROGRESS if the reader has already opened a stream. + */ + int32_t Open([in] PP_Resource reader, + [in] PP_Var stream_id, + [in] PP_CompletionCallback callback); + + /** + * Gets the next frame of video from the reader's open stream. The image data + * resource returned in the frame will have its reference count incremented by + * one and must be managed by the plugin. + * + * @param[in] reader A <code>PP_Resource</code> corresponding to a video + * reader resource. + * @param[out] frame A <code>PP_VideoFrame</code> to hold a video frame to + * read from the open stream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetNextFrame(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader. + * Returns PP_ERROR_FAILED if the reader has not opened a stream, if the video + * frame has an invalid image data resource, or if some other error occurs. + */ + int32_t GetFrame([in] PP_Resource reader, + [out] PP_VideoFrame frame, + [in] PP_CompletionCallback callback); + + /** + * Closes the reader's video stream. + * + * @param[in] reader A <code>PP_Resource</code> corresponding to a video + * reader resource. + */ + void Close([in] PP_Resource reader); +}; + diff --git a/ppapi/api/ppb_video_writer.idl b/ppapi/api/ppb_video_writer.idl new file mode 100644 index 0000000..e1a7757 --- /dev/null +++ b/ppapi/api/ppb_video_writer.idl @@ -0,0 +1,89 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the <code>PPB_VideoWriter</code> struct for a video writer + * resource. + */ + + label Chrome { + M28 = 0.1 + }; + +/** + * The <code>PPB_VideoWriter</code> interface contains pointers to several + * functions for creating video writer resources and using them to generate + * streams of video frames. + */ +interface PPB_VideoWriter { + /** + * Creates a video writer resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a video writer. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video writer or <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsVideoWriter([in] PP_Resource resource); + + /** + * Opens a video stream with the given id for writing. + * + * @param[in] writer A <code>PP_Resource</code> corresponding to a video + * writer resource. + * @param[in] stream_id A <code>PP_Var</code> holding a string uniquely + * identifying the stream. This string is application defined. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. + * Returns PP_ERROR_INPROGRESS if the writer has already opened a stream. + */ + int32_t Open([in] PP_Resource writer, + [in] PP_Var stream_id, + [in] PP_CompletionCallback callback); + + /** + * Puts a frame of video to the writer's open stream. + * + * After this call, you should take care to release your references to the + * image embedded in the video frame. If you paint to the image after + * PutFrame(), there is the possibility of artifacts because the browser may + * still be copying the frame to the stream. + * + * @param[in] writer A <code>PP_Resource</code> corresponding to a video + * writer resource. + * @param[in] frame A <code>PP_VideoFrame</code> holding a video frame to + * write to the open stream. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if writer isn't a valid video writer. + * Returns PP_ERROR_FAILED if the writer has not opened a stream, if the video + * frame has an invalid image data resource, or if some other error occurs. + */ + int32_t PutFrame([in] PP_Resource writer, + [in] PP_VideoFrame frame); + + /** + * Closes the writer's video stream. + * + * @param[in] writer A <code>PP_Resource</code> corresponding to a video + * writer resource. + */ + void Close([in] PP_Resource writer); +}; + |