diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 03:54:05 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 03:54:05 +0000 |
commit | b48e52e676662a0e3bcdceea36799b03d701c064 (patch) | |
tree | d57fc3301bd4eff19593a86ab41a4ea254600800 /ppapi | |
parent | ddeb6f98440724a735fe743be2560aae56d1631d (diff) | |
download | chromium_src-b48e52e676662a0e3bcdceea36799b03d701c064.zip chromium_src-b48e52e676662a0e3bcdceea36799b03d701c064.tar.gz chromium_src-b48e52e676662a0e3bcdceea36799b03d701c064.tar.bz2 |
Rename PPAPI Video Stream APIs.
PP_VideoFrame -> PP_VideoFrame_Private
PPB_VideoReader -> PPB_VideoSource_Private
PPB_VideoWriter -> PPB_VideoDestination_Private
IDL, .h and C++ wrapper files are now in /private subdirectories.
Renamed some methods to fit the API names better.
Changed the Source Open method's stream_id param to [in].
BUG=230980
TEST=none
Review URL: https://chromiumcodereview.appspot.com/14192054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
25 files changed, 981 insertions, 909 deletions
diff --git a/ppapi/api/ppb_video_reader.idl b/ppapi/api/ppb_video_reader.idl deleted file mode 100644 index 1c98584..0000000 --- a/ppapi/api/ppb_video_reader.idl +++ /dev/null @@ -1,89 +0,0 @@ -/* 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 deleted file mode 100644 index cf92f3e..0000000 --- a/ppapi/api/ppb_video_writer.idl +++ /dev/null @@ -1,89 +0,0 @@ -/* 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[out] stream_id A <code>PP_Var</code> holding a string uniquely - * identifying the stream. This string is generated by the host. - * @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, - [out] 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); -}; - diff --git a/ppapi/api/pp_video_frame.idl b/ppapi/api/private/pp_video_frame_private.idl index d2f6dafb..593f363 100644 --- a/ppapi/api/pp_video_frame.idl +++ b/ppapi/api/private/pp_video_frame_private.idl @@ -8,10 +8,12 @@ */ /** - * The <code>PP_Video_Frame</code> struct represents a video frame. + * The <code>PP_VideoFrame_Private</code> struct represents a video frame. + * Video sources and destinations use frames to transfer video to and from + * the browser. */ [assert_size(16)] -struct PP_VideoFrame { +struct PP_VideoFrame_Private { /** * A timestamp placing the frame in a video stream. */ diff --git a/ppapi/api/private/ppb_video_destination_private.idl b/ppapi/api/private/ppb_video_destination_private.idl new file mode 100644 index 0000000..a37cbd5 --- /dev/null +++ b/ppapi/api/private/ppb_video_destination_private.idl @@ -0,0 +1,95 @@ +/* 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_VideoDestination_Private</code> interface + * for a video destination resource, which sends video frames to a MediaStream + * video track in the browser. + */ + + label Chrome { + M28 = 0.1 + }; + +/** + * The <code>PPB_VideoDestination_Private</code> interface contains pointers to + * several functions for creating video destination resources and using them to + * send video frames to a MediaStream video track in the browser. + */ +interface PPB_VideoDestination_Private { + /** + * Creates a video destination resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying an 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 resource is a video destination resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video destination resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool IsVideoDestination([in] PP_Resource resource); + + /** + * Opens a video destination for putting frames. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination resource. + * @param[in] stream_url A <code>PP_Var</code> string holding a URL + * identifying a MediaStream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_INPROGRESS if destination is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t Open([in] PP_Resource destination, + [in] PP_Var stream_url, + [in] PP_CompletionCallback callback); + + /** + * Puts a frame to the video destination. + * + * 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 + * PutFame(), there is the possibility of artifacts because the browser may + * still be copying the frame to the stream. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination resource. + * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video + * frame to send to the destination. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_FAILED if destination is not open, if the video frame has + * an invalid image data resource, or if some other browser error occurs. + */ + int32_t PutFrame([in] PP_Resource destination, + [in] PP_VideoFrame_Private frame); + + /** + * Closes the video destination. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination. + */ + void Close([in] PP_Resource destination); +}; + diff --git a/ppapi/api/private/ppb_video_source_private.idl b/ppapi/api/private/ppb_video_source_private.idl new file mode 100644 index 0000000..3fc5872 --- /dev/null +++ b/ppapi/api/private/ppb_video_source_private.idl @@ -0,0 +1,92 @@ +/* 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_VideoSource_Private</code> interface for a + * video source resource, which receives video frames from a MediaStream video + * track in the browser. + */ + + label Chrome { + M28 = 0.1 + }; + +/** + * The <code>PPB_VideoSource_Private</code> interface contains pointers to + * several functions for creating video source resources and using them to + * receive video frames from a MediaStream video track in the browser. + */ +interface PPB_VideoSource_Private { + /** + * Creates a video source resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying an 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 resource is a video source resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video source resource or <code>PP_FALSE</code> otherwise. + */ + PP_Bool IsVideoSource([in] PP_Resource resource); + + /** + * Opens a video source for getting frames. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + * @param[in] stream_url A <code>PP_Var</code> string holding a URL + * identifying a MediaStream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_INPROGRESS if source is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t Open([in] PP_Resource source, + [in] PP_Var stream_url, + [in] PP_CompletionCallback callback); + + /** + * Gets a frame from the video source. + * The image data resource inside the returned frame will have its reference + * count incremented by one and must be managed by the plugin. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video + * frame from the source. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetNextFrame(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_FAILED if the source is not open, or if some other + * browser error occurs. + */ + int32_t GetFrame([in] PP_Resource source, + [out] PP_VideoFrame_Private frame, + [in] PP_CompletionCallback callback); + + /** + * Closes the video source. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + */ + void Close([in] PP_Resource source); +}; + diff --git a/ppapi/c/ppb_video_reader.h b/ppapi/c/ppb_video_reader.h deleted file mode 100644 index 0f38c6d..0000000 --- a/ppapi/c/ppb_video_reader.h +++ /dev/null @@ -1,112 +0,0 @@ -/* 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. - */ - -/* From ppb_video_reader.idl modified Thu Apr 4 13:47:30 2013. */ - -#ifndef PPAPI_C_PPB_VIDEO_READER_H_ -#define PPAPI_C_PPB_VIDEO_READER_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" -#include "ppapi/c/pp_var.h" -#include "ppapi/c/pp_video_frame.h" - -#define PPB_VIDEOREADER_INTERFACE_0_1 "PPB_VideoReader;0.1" -#define PPB_VIDEOREADER_INTERFACE PPB_VIDEOREADER_INTERFACE_0_1 - -/** - * @file - * This file defines the <code>PPB_VideoReader</code> struct for a video reader - * resource. - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * 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. - */ -struct PPB_VideoReader_0_1 { - /** - * 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)(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)(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)(PP_Resource reader, - struct PP_Var stream_id, - struct 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)(PP_Resource reader, - struct PP_VideoFrame* frame, - struct 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)(PP_Resource reader); -}; - -typedef struct PPB_VideoReader_0_1 PPB_VideoReader; -/** - * @} - */ - -#endif /* PPAPI_C_PPB_VIDEO_READER_H_ */ - diff --git a/ppapi/c/ppb_video_writer.h b/ppapi/c/ppb_video_writer.h deleted file mode 100644 index 1aaa3ac..0000000 --- a/ppapi/c/ppb_video_writer.h +++ /dev/null @@ -1,111 +0,0 @@ -/* 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. - */ - -/* From ppb_video_writer.idl modified Fri Apr 5 15:46:57 2013. */ - -#ifndef PPAPI_C_PPB_VIDEO_WRITER_H_ -#define PPAPI_C_PPB_VIDEO_WRITER_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" -#include "ppapi/c/pp_var.h" -#include "ppapi/c/pp_video_frame.h" - -#define PPB_VIDEOWRITER_INTERFACE_0_1 "PPB_VideoWriter;0.1" -#define PPB_VIDEOWRITER_INTERFACE PPB_VIDEOWRITER_INTERFACE_0_1 - -/** - * @file - * This file defines the <code>PPB_VideoWriter</code> struct for a video writer - * resource. - */ - - -/** - * @addtogroup Interfaces - * @{ - */ -/** - * 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. - */ -struct PPB_VideoWriter_0_1 { - /** - * 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)(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)(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[out] stream_id A <code>PP_Var</code> holding a string uniquely - * identifying the stream. This string is generated by the host. - * @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)(PP_Resource writer, - struct PP_Var* stream_id, - struct 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)(PP_Resource writer, const struct 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)(PP_Resource writer); -}; - -typedef struct PPB_VideoWriter_0_1 PPB_VideoWriter; -/** - * @} - */ - -#endif /* PPAPI_C_PPB_VIDEO_WRITER_H_ */ - diff --git a/ppapi/c/pp_video_frame.h b/ppapi/c/private/pp_video_frame_private.h index ad5f893..8c64476 100644 --- a/ppapi/c/pp_video_frame.h +++ b/ppapi/c/private/pp_video_frame_private.h @@ -3,10 +3,10 @@ * found in the LICENSE file. */ -/* From pp_video_frame.idl modified Tue Apr 2 10:07:49 2013. */ +/* From private/pp_video_frame_private.idl modified Wed Apr 24 11:49:01 2013. */ -#ifndef PPAPI_C_PP_VIDEO_FRAME_H_ -#define PPAPI_C_PP_VIDEO_FRAME_H_ +#ifndef PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" @@ -24,9 +24,11 @@ * @{ */ /** - * The <code>PP_Video_Frame</code> struct represents a video frame. + * The <code>PP_VideoFrame_Private</code> struct represents a video frame. + * Video sources and destinations use frames to transfer video to and from + * the browser. */ -struct PP_VideoFrame { +struct PP_VideoFrame_Private { /** * A timestamp placing the frame in a video stream. */ @@ -44,10 +46,10 @@ struct PP_VideoFrame { */ int32_t padding; }; -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoFrame, 16); +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoFrame_Private, 16); /** * @} */ -#endif /* PPAPI_C_PP_VIDEO_FRAME_H_ */ +#endif /* PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ */ diff --git a/ppapi/c/private/ppb_video_destination_private.h b/ppapi/c/private/ppb_video_destination_private.h new file mode 100644 index 0000000..775ec96 --- /dev/null +++ b/ppapi/c/private/ppb_video_destination_private.h @@ -0,0 +1,122 @@ +/* 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. + */ + +/* From private/ppb_video_destination_private.idl, + * modified Thu Apr 25 11:51:30 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_video_frame_private.h" + +#define PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 \ + "PPB_VideoDestination_Private;0.1" +#define PPB_VIDEODESTINATION_PRIVATE_INTERFACE \ + PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VideoDestination_Private</code> interface + * for a video destination resource, which sends video frames to a MediaStream + * video track in the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_VideoDestination_Private</code> interface contains pointers to + * several functions for creating video destination resources and using them to + * send video frames to a MediaStream video track in the browser. + */ +struct PPB_VideoDestination_Private_0_1 { + /** + * Creates a video destination resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying an 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)(PP_Instance instance); + /** + * Determines if a resource is a video destination resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video destination resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsVideoDestination)(PP_Resource resource); + /** + * Opens a video destination for putting frames. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination resource. + * @param[in] stream_url A <code>PP_Var</code> string holding a URL + * identifying a MediaStream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_INPROGRESS if destination is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t (*Open)(PP_Resource destination, + struct PP_Var stream_url, + struct PP_CompletionCallback callback); + /** + * Puts a frame to the video destination. + * + * 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 + * PutFame(), there is the possibility of artifacts because the browser may + * still be copying the frame to the stream. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination resource. + * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video + * frame to send to the destination. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_FAILED if destination is not open, if the video frame has + * an invalid image data resource, or if some other browser error occurs. + */ + int32_t (*PutFrame)(PP_Resource destination, + const struct PP_VideoFrame_Private* frame); + /** + * Closes the video destination. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination. + */ + void (*Close)(PP_Resource destination); +}; + +typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ */ + diff --git a/ppapi/c/private/ppb_video_source_private.h b/ppapi/c/private/ppb_video_source_private.h new file mode 100644 index 0000000..a3ba071 --- /dev/null +++ b/ppapi/c/private/ppb_video_source_private.h @@ -0,0 +1,117 @@ +/* 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. + */ + +/* From private/ppb_video_source_private.idl, + * modified Thu Apr 25 11:51:30 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_video_frame_private.h" + +#define PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 "PPB_VideoSource_Private;0.1" +#define PPB_VIDEOSOURCE_PRIVATE_INTERFACE PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VideoSource_Private</code> interface for a + * video source resource, which receives video frames from a MediaStream video + * track in the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_VideoSource_Private</code> interface contains pointers to + * several functions for creating video source resources and using them to + * receive video frames from a MediaStream video track in the browser. + */ +struct PPB_VideoSource_Private_0_1 { + /** + * Creates a video source resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying an 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)(PP_Instance instance); + /** + * Determines if a resource is a video source resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video source resource or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsVideoSource)(PP_Resource resource); + /** + * Opens a video source for getting frames. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + * @param[in] stream_url A <code>PP_Var</code> string holding a URL + * identifying a MediaStream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_INPROGRESS if source is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t (*Open)(PP_Resource source, + struct PP_Var stream_url, + struct PP_CompletionCallback callback); + /** + * Gets a frame from the video source. + * The image data resource inside the returned frame will have its reference + * count incremented by one and must be managed by the plugin. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video + * frame from the source. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetNextFrame(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_FAILED if the source is not open, or if some other + * browser error occurs. + */ + int32_t (*GetFrame)(PP_Resource source, + struct PP_VideoFrame_Private* frame, + struct PP_CompletionCallback callback); + /** + * Closes the video source. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + */ + void (*Close)(PP_Resource source); +}; + +typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */ + diff --git a/ppapi/cpp/private/video_destination_private.cc b/ppapi/cpp/private/video_destination_private.cc new file mode 100644 index 0000000..5233b5f --- /dev/null +++ b/ppapi/cpp/private/video_destination_private.cc @@ -0,0 +1,76 @@ +// 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. + +#include "ppapi/cpp/private/video_destination_private.h" + +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/private/ppb_video_destination_private.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/private/video_frame_private.h" +#include "ppapi/cpp/var.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VideoDestination_Private_0_1>() { + return PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1; +} + +} // namespace + +VideoDestination_Private::VideoDestination_Private() { +} + +VideoDestination_Private::VideoDestination_Private( + const InstanceHandle& instance) { + if (!has_interface<PPB_VideoDestination_Private_0_1>()) + return; + PassRefFromConstructor( + get_interface<PPB_VideoDestination_Private_0_1>()->Create( + instance.pp_instance())); +} + +VideoDestination_Private::VideoDestination_Private( + const VideoDestination_Private& other) + : Resource(other) { +} + +VideoDestination_Private::VideoDestination_Private(PassRef, + PP_Resource resource) + : Resource(PASS_REF, resource) { +} + +int32_t VideoDestination_Private::Open(const Var& stream_url, + const CompletionCallback& cc) { + if (has_interface<PPB_VideoDestination_Private_0_1>()) { + int32_t result = + get_interface<PPB_VideoDestination_Private_0_1>()->Open( + pp_resource(), + stream_url.pp_var(), + cc.pp_completion_callback()); + return result; + } + return cc.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t VideoDestination_Private::PutFrame( + const VideoFrame_Private& frame) { + if (has_interface<PPB_VideoDestination_Private_0_1>()) { + return get_interface<PPB_VideoDestination_Private_0_1>()->PutFrame( + pp_resource(), + &frame.pp_video_frame()); + } + return PP_ERROR_NOINTERFACE; +} + +void VideoDestination_Private::Close() { + if (has_interface<PPB_VideoDestination_Private_0_1>()) { + get_interface<PPB_VideoDestination_Private_0_1>()->Close(pp_resource()); + } +} + +} // namespace pp diff --git a/ppapi/cpp/private/video_destination_private.h b/ppapi/cpp/private/video_destination_private.h new file mode 100644 index 0000000..a936485 --- /dev/null +++ b/ppapi/cpp/private/video_destination_private.h @@ -0,0 +1,87 @@ +// 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. + +#ifndef PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_ +#define PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_ + +#include <string> + +#include "ppapi/c/pp_time.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/pass_ref.h" +#include "ppapi/cpp/resource.h" + +/// @file +/// This file defines the <code>PPB_VideoDestination_Private</code> interface +/// for a video destination resource, which sends video frames to a MediaStream +/// video track in the browser. + +namespace pp { + +class InstanceHandle; +class VideoFrame_Private; + +/// The <code>VideoDestination_Private</code> class contains methods for +/// creating video destination resources and using them to send video frames to +/// a MediaStream video track in the browser. +class VideoDestination_Private : public Resource { + public: + /// Default constructor for creating a <code>VideoDestination_Private</code> + /// object. + VideoDestination_Private(); + + /// Constructor for creating a <code>VideoDestination_Private</code> for an + /// instance. + explicit VideoDestination_Private(const InstanceHandle& instance); + + /// The copy constructor for <code>VideoDestination_Private</code>. + /// + /// @param[in] other A reference to a <code>VideoDestination_Private</code>. + VideoDestination_Private(const VideoDestination_Private& other); + + /// A constructor used when you have received a PP_Resource as a return + /// value that has had its reference count incremented for you. + /// + /// @param[in] resource A PP_Resource corresponding to a video destination. + VideoDestination_Private(PassRef, PP_Resource resource); + + /// Opens a video destination for putting frames. + /// + /// @param[in] stream_url A <code>Var</code> string holding a URL identifying + /// a MediaStream. + /// @param[in] callback A <code>CompletionCallback</code> to be + /// called upon completion of Open(). + /// + /// @return An int32_t containing a result code from <code>pp_errors.h</code>. + /// Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + /// destination. + /// Returns PP_ERROR_INPROGRESS if destination is already open. + /// Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + /// some other browser error. + int32_t Open(const Var& stream_url, const CompletionCallback& cc); + + /// Puts a frame to the video destination. + /// + /// 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] frame A <code>VideoFrame_Private</code> holding the video + /// frame to send to the destination. + /// + /// @return An int32_t containing a result code from <code>pp_errors.h</code>. + /// Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + /// destination. + /// Returns PP_ERROR_FAILED if destination is not open, if the video frame has + /// an invalid image data resource, or if some other browser error occurs. + int32_t PutFrame(const VideoFrame_Private& frame); + + /// Closes the video destination. + void Close(); +}; + +} // namespace pp + +#endif // PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_ diff --git a/ppapi/cpp/video_frame.cc b/ppapi/cpp/private/video_frame_private.cc index 5092c5a..9976647 100644 --- a/ppapi/cpp/video_frame.cc +++ b/ppapi/cpp/private/video_frame_private.cc @@ -2,39 +2,41 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/cpp/video_frame.h" +#include "ppapi/cpp/private/video_frame_private.h" namespace pp { -// VideoFrame ------------------------------------------------------------------ - -VideoFrame::VideoFrame() +VideoFrame_Private::VideoFrame_Private() : video_frame_() { video_frame_.image_data = image_data_.pp_resource(); } -VideoFrame::VideoFrame(const ImageData& image_data, PP_TimeTicks timestamp) +VideoFrame_Private::VideoFrame_Private(const ImageData& image_data, + PP_TimeTicks timestamp) : image_data_(image_data), video_frame_() { video_frame_.timestamp = timestamp; video_frame_.image_data = image_data_.pp_resource(); } -VideoFrame::VideoFrame(PassRef, const PP_VideoFrame& pp_video_frame) +VideoFrame_Private::VideoFrame_Private( + PassRef, + const PP_VideoFrame_Private& pp_video_frame) : video_frame_(pp_video_frame) { // Take over the image_data resource in the frame. image_data_ = ImageData(PASS_REF, video_frame_.image_data); } -VideoFrame::VideoFrame(const VideoFrame& other) +VideoFrame_Private::VideoFrame_Private(const VideoFrame_Private& other) : video_frame_() { set_image_data(other.image_data()); set_timestamp(other.timestamp()); } -VideoFrame::~VideoFrame() { +VideoFrame_Private::~VideoFrame_Private() { } -VideoFrame& VideoFrame::operator=(const VideoFrame& other) { +VideoFrame_Private& VideoFrame_Private::operator=( + const VideoFrame_Private& other) { if (this == &other) return *this; diff --git a/ppapi/cpp/private/video_frame_private.h b/ppapi/cpp/private/video_frame_private.h new file mode 100644 index 0000000..fed9d1d --- /dev/null +++ b/ppapi/cpp/private/video_frame_private.h @@ -0,0 +1,96 @@ +// 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. + +#ifndef PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_ +#define PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_ + +#include "ppapi/c/pp_time.h" +#include "ppapi/c/private/pp_video_frame_private.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/image_data.h" +#include "ppapi/cpp/pass_ref.h" + +/// @file +/// This file defines the struct used to hold a video frame. + +namespace pp { + +/// The <code>PP_VideoFrame_Private</code> struct represents a video frame. +/// Video sources and destinations use frames to transfer video to and from +/// the browser. +class VideoFrame_Private { + public: + /// Default constructor for creating a <code>VideoFrame_Private</code> object. + VideoFrame_Private(); + + /// Constructor that takes an existing <code>PP_VideoFrame_Private</code> + /// structure. The 'image_data' PP_Resource field in the structure will be + /// managed by this instance. + VideoFrame_Private(PassRef, const PP_VideoFrame_Private& pp_video_frame); + + /// Constructor that takes an existing <code>ImageData</code> instance and + /// a timestamp. + VideoFrame_Private(const ImageData& image_data, PP_TimeTicks timestamp); + + /// The copy constructor for <code>VideoFrame_Private</code>. + /// + /// @param[in] other A reference to a <code>VideoFrame_Private</code>. + VideoFrame_Private(const VideoFrame_Private& other); + + ~VideoFrame_Private(); + + /// The assignment operator for <code>VideoFrame_Private</code>. + /// + /// @param[in] other A reference to a <code>VideoFrame_Private</code>. + VideoFrame_Private& operator=(const VideoFrame_Private& other); + + const PP_VideoFrame_Private& pp_video_frame() const { + return video_frame_; + } + + ImageData image_data() const { + return image_data_; + } + void set_image_data(const ImageData& image_data) { + image_data_ = image_data; + // The assignment above manages the underlying PP_Resources. Copy the new + // one into our internal video frame struct. + video_frame_.image_data = image_data_.pp_resource(); + } + + PP_TimeTicks timestamp() const { return video_frame_.timestamp; } + void set_timestamp(PP_TimeTicks timestamp) { + video_frame_.timestamp = timestamp; + } + + private: + ImageData image_data_; // This manages the PP_Resource in video_frame_. + PP_VideoFrame_Private video_frame_; +}; + +namespace internal { + +// A specialization of CallbackOutputTraits to provide the callback system the +// information on how to handle pp::VideoFrame_Private. This converts +// PP_VideoFrame_Private to pp::VideoFrame_Private when passing to the plugin, +// and specifically manages the PP_Resource embedded in the video_frame_ field. +template<> +struct CallbackOutputTraits<pp::VideoFrame_Private> { + typedef PP_VideoFrame_Private* APIArgType; + typedef PP_VideoFrame_Private StorageType; + + static inline APIArgType StorageToAPIArg(StorageType& t) { + return &t; + } + + static inline pp::VideoFrame_Private StorageToPluginArg(StorageType& t) { + return pp::VideoFrame_Private(PASS_REF, t); + } +}; + +} // namespace internal + +} // namespace pp + +#endif // PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_ diff --git a/ppapi/cpp/private/video_source_private.cc b/ppapi/cpp/private/video_source_private.cc new file mode 100644 index 0000000..264c001 --- /dev/null +++ b/ppapi/cpp/private/video_source_private.cc @@ -0,0 +1,71 @@ +// 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. + +#include "ppapi/cpp/private/video_source_private.h" + +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/private/ppb_video_source_private.h" +#include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/private/video_frame_private.h" +#include "ppapi/cpp/var.h" + +namespace pp { + +namespace { + +template <> const char* interface_name<PPB_VideoSource_Private_0_1>() { + return PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1; +} + +} // namespace + +VideoSource_Private::VideoSource_Private() { +} + +VideoSource_Private::VideoSource_Private(const InstanceHandle& instance) { + if (!has_interface<PPB_VideoSource_Private_0_1>()) + return; + PassRefFromConstructor(get_interface<PPB_VideoSource_Private_0_1>()->Create( + instance.pp_instance())); +} + +VideoSource_Private::VideoSource_Private(const VideoSource_Private& other) + : Resource(other) { +} + +VideoSource_Private::VideoSource_Private(PassRef, PP_Resource resource) + : Resource(PASS_REF, resource) { +} + +int32_t VideoSource_Private::Open(const Var& stream_url, + const CompletionCallback& cc) { + if (has_interface<PPB_VideoSource_Private_0_1>()) { + int32_t result = + get_interface<PPB_VideoSource_Private_0_1>()->Open( + pp_resource(), + stream_url.pp_var(), cc.pp_completion_callback()); + return result; + } + return cc.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t VideoSource_Private::GetFrame( + const CompletionCallbackWithOutput<VideoFrame_Private>& cc) { + if (has_interface<PPB_VideoSource_Private_0_1>()) { + return get_interface<PPB_VideoSource_Private_0_1>()->GetFrame( + pp_resource(), + cc.output(), cc.pp_completion_callback()); + } + return cc.MayForce(PP_ERROR_NOINTERFACE); +} + +void VideoSource_Private::Close() { + if (has_interface<PPB_VideoSource_Private_0_1>()) { + get_interface<PPB_VideoSource_Private_0_1>()->Close(pp_resource()); + } +} + +} // namespace pp diff --git a/ppapi/cpp/private/video_source_private.h b/ppapi/cpp/private/video_source_private.h new file mode 100644 index 0000000..3d919bf --- /dev/null +++ b/ppapi/cpp/private/video_source_private.h @@ -0,0 +1,84 @@ +// 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. + +#ifndef PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_ +#define PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_ + +#include <string> + +#include "ppapi/c/pp_time.h" +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/pass_ref.h" +#include "ppapi/cpp/resource.h" + +/// @file +/// This file defines the <code>PPB_VideoSource_Private</code> interface for a +/// video source resource, which receives video frames from a MediaStream video +/// track in the browser. + +namespace pp { + +class InstanceHandle; +class VideoFrame_Private; + +/// The <code>VideoSource_Private</code> class contains methods for creating +/// video source resources and using them to receive video frames from a +/// MediaStream video track in the browser. +class VideoSource_Private : public Resource { + public: + /// Default constructor for creating a <code>VideoSource_Private</code> + /// object. + VideoSource_Private(); + + /// Constructor for creating a <code>VideoSource_Private</code> for an + /// instance. + explicit VideoSource_Private(const InstanceHandle& instance); + + /// The copy constructor for <code>VideoSource_Private</code>. + /// + /// @param[in] other A reference to a <code>VideoSource_Private</code>. + VideoSource_Private(const VideoSource_Private& other); + + /// A constructor used when you have received a PP_Resource as a return + /// value that has had its reference count incremented for you. + /// + /// @param[in] resource A PP_Resource corresponding to a video source. + VideoSource_Private(PassRef, PP_Resource resource); + + /// Opens a video source for getting frames. + /// + /// @param[in] stream_url A <code>Var</code> string holding a URL identifying + /// a MediaStream. + /// @param[in] callback A <code>CompletionCallback</code> to be called upon + /// completion of Open(). + /// + /// @return An int32_t containing a result code from <code>pp_errors.h</code>. + /// Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + /// Returns PP_ERROR_INPROGRESS if source is already open. + /// Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + /// some other browser error. + int32_t Open(const Var& stream_url, + const CompletionCallback& cc); + + /// Gets a frame from the video source. + /// + /// @param[out] frame A <code>VideoFrame_Private</code> to hold a video + /// frame from the source. + /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be + /// called upon completion of ReceiveFrame(). + /// + /// @return An int32_t containing a result code from <code>pp_errors.h</code>. + /// Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + /// Returns PP_ERROR_FAILED if the source is not open, or if some other + /// browser error occurs. + int32_t GetFrame( + const CompletionCallbackWithOutput<VideoFrame_Private>& cc); + + /// Closes the video source. + void Close(); +}; + +} // namespace pp + +#endif // PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_ diff --git a/ppapi/cpp/video_frame.h b/ppapi/cpp/video_frame.h deleted file mode 100644 index cb69596..0000000 --- a/ppapi/cpp/video_frame.h +++ /dev/null @@ -1,93 +0,0 @@ -// 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. - -#ifndef PPAPI_CPP_VIDEO_FRAME_H_ -#define PPAPI_CPP_VIDEO_FRAME_H_ - -#include "ppapi/c/pp_time.h" -#include "ppapi/c/pp_video_frame.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/image_data.h" -#include "ppapi/cpp/pass_ref.h" - -/// @file -/// This file defines the video frame struct used by video readers and writers. - -namespace pp { - -// VideoFrame ------------------------------------------------------------------ - -/// The <code>VideoFrame</code> class represents a frame of video in a stream. -class VideoFrame { - public: - /// Default constructor for creating a <code>VideoFrame</code> object. - VideoFrame(); - - /// Constructor that takes an existing <code>PP_VideoFrame</code> structure. - /// The 'image_data' PP_Resource field in the structure will be managed by - /// this instance. - VideoFrame(PassRef, const PP_VideoFrame& pp_video_frame); - - /// Constructor that takes an existing <code>ImageData</code> instance and - /// a timestamp. - VideoFrame(const ImageData& image_data, PP_TimeTicks timestamp); - - /// The copy constructor for <code>VideoFrame</code>. - /// - /// @param[in] other A reference to a <code>VideoFrame</code>. - VideoFrame(const VideoFrame& other); - - ~VideoFrame(); - - VideoFrame& operator=(const VideoFrame& other); - - const PP_VideoFrame& pp_video_frame() const { - return video_frame_; - } - - ImageData image_data() const { - return image_data_; - } - void set_image_data(const ImageData& image_data) { - image_data_ = image_data; - // The assignment above manages the underlying PP_Resources. Copy the new - // one into our internal video frame struct. - video_frame_.image_data = image_data_.pp_resource(); - } - - PP_TimeTicks timestamp() const { return video_frame_.timestamp; } - void set_timestamp(PP_TimeTicks timestamp) { - video_frame_.timestamp = timestamp; - } - - private: - ImageData image_data_; // This manages the PP_Resource in video_frame_. - PP_VideoFrame video_frame_; -}; - -namespace internal { - -// A specialization of CallbackOutputTraits to provide the callback system the -// information on how to handle pp::VideoFrame. This converts PP_VideoFrame to -// pp::VideoFrame when passing to the plugin, and specifically manages the -// PP_Resource embedded in the video_frame_ field. -template<> -struct CallbackOutputTraits<pp::VideoFrame> { - typedef PP_VideoFrame* APIArgType; - typedef PP_VideoFrame StorageType; - - static inline APIArgType StorageToAPIArg(StorageType& t) { - return &t; - } - - static inline pp::VideoFrame StorageToPluginArg(StorageType& t) { - return pp::VideoFrame(PASS_REF, t); - } -}; - -} // namespace internal - -} // namespace pp - -#endif // PPAPI_CPP_VIDEO_FRAME_H_ diff --git a/ppapi/cpp/video_reader.cc b/ppapi/cpp/video_reader.cc deleted file mode 100644 index 9ae83bb..0000000 --- a/ppapi/cpp/video_reader.cc +++ /dev/null @@ -1,73 +0,0 @@ -// 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. - -#include "ppapi/cpp/video_reader.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/ppb_video_reader.h" -#include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/module_impl.h" -#include "ppapi/cpp/var.h" -#include "ppapi/cpp/video_frame.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_VideoReader_0_1>() { - return PPB_VIDEOREADER_INTERFACE_0_1; -} - -} // namespace - -// VideoReader ----------------------------------------------------------------- - -VideoReader::VideoReader() { -} - -VideoReader::VideoReader(const InstanceHandle& instance) { - if (!has_interface<PPB_VideoReader_0_1>()) - return; - PassRefFromConstructor(get_interface<PPB_VideoReader_0_1>()->Create( - instance.pp_instance())); -} - -VideoReader::VideoReader(const VideoReader& other) - : Resource(other) { -} - -VideoReader::VideoReader(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -int32_t VideoReader::Open(const Var& stream_id, - const CompletionCallback& cc) { - if (has_interface<PPB_VideoReader_0_1>()) { - int32_t result = - get_interface<PPB_VideoReader_0_1>()->Open( - pp_resource(), - stream_id.pp_var(), cc.pp_completion_callback()); - return result; - } - return cc.MayForce(PP_ERROR_NOINTERFACE); -} - -int32_t VideoReader::GetFrame( - const CompletionCallbackWithOutput<VideoFrame>& cc) { - if (has_interface<PPB_VideoReader_0_1>()) { - return get_interface<PPB_VideoReader_0_1>()->GetFrame( - pp_resource(), - cc.output(), cc.pp_completion_callback()); - } - return cc.MayForce(PP_ERROR_NOINTERFACE); -} - -void VideoReader::Close() { - if (has_interface<PPB_VideoReader_0_1>()) { - get_interface<PPB_VideoReader_0_1>()->Close(pp_resource()); - } -} - -} // namespace pp diff --git a/ppapi/cpp/video_reader.h b/ppapi/cpp/video_reader.h deleted file mode 100644 index 57e85a5c..0000000 --- a/ppapi/cpp/video_reader.h +++ /dev/null @@ -1,70 +0,0 @@ -// 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. - -#ifndef PPAPI_CPP_VIDEO_READER_H_ -#define PPAPI_CPP_VIDEO_READER_H_ - -#include <string> - -#include "ppapi/c/pp_time.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" - -/// @file -/// This file defines the API to create and use video stream readers. - -namespace pp { - -class InstanceHandle; -class VideoFrame; - -// VideoReader ----------------------------------------------------------------- - -/// The <code>VideoReader</code> class represents a video reader resource. -class VideoReader : public Resource { - public: - /// Default constructor for creating a <code>VideoReader</code> object. - VideoReader(); - - /// Constructor for creating a <code>VideoReader</code> for an instance. - explicit VideoReader(const InstanceHandle& instance); - - /// The copy constructor for <code>VideoReader</code>. - /// - /// @param[in] other A reference to a <code>VideoReader</code>. - VideoReader(const VideoReader& other); - - /// A constructor used when you have received a PP_Resource as a return - /// value that has had its reference count incremented for you. - /// - /// @param[in] resource A PP_Resource corresponding to a video reader. - VideoReader(PassRef, PP_Resource resource); - - /// Opens a stream for reading video and associates it with the given id. - /// - /// @param[in] stream_id A <code>Var</code> uniquely identifying the stream - /// to read from. - /// @param[in] callback A <code>CompletionCallback</code> to be called upon - /// completion of Open. - /// - /// @return A return code from <code>pp_errors.h</code>. - int32_t Open(const Var& stream_id, - const CompletionCallback& cc); - - /// Gets the next frame of video from the reader's stream. - /// - /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be - /// called upon completion of GetNextFrame. - /// - /// @return A return code from <code>pp_errors.h</code>. - int32_t GetFrame(const CompletionCallbackWithOutput<VideoFrame>& cc); - - /// Closes the reader's current stream. - void Close(); -}; - -} // namespace pp - -#endif // PPAPI_CPP_VIDEO_READER_H_ diff --git a/ppapi/cpp/video_writer.cc b/ppapi/cpp/video_writer.cc deleted file mode 100644 index 372bfad..0000000 --- a/ppapi/cpp/video_writer.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 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. - -#include "ppapi/cpp/video_writer.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/ppb_video_writer.h" -#include "ppapi/cpp/instance_handle.h" -#include "ppapi/cpp/module.h" -#include "ppapi/cpp/module_impl.h" -#include "ppapi/cpp/var.h" -#include "ppapi/cpp/video_frame.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_VideoWriter_0_1>() { - return PPB_VIDEOWRITER_INTERFACE_0_1; -} - -} // namespace - -// VideoWriter ----------------------------------------------------------------- - -VideoWriter::VideoWriter() { -} - -VideoWriter::VideoWriter(const InstanceHandle& instance) { - if (!has_interface<PPB_VideoWriter_0_1>()) - return; - PassRefFromConstructor(get_interface<PPB_VideoWriter_0_1>()->Create( - instance.pp_instance())); -} - -VideoWriter::VideoWriter(const VideoWriter& other) - : Resource(other) { -} - -VideoWriter::VideoWriter(PassRef, PP_Resource resource) - : Resource(PASS_REF, resource) { -} - -int32_t VideoWriter::Open(const CompletionCallbackWithOutput<Var>& cc) { - if (has_interface<PPB_VideoWriter_0_1>()) { - int32_t result = - get_interface<PPB_VideoWriter_0_1>()->Open( - pp_resource(), - cc.output(), cc.pp_completion_callback()); - return result; - } - return cc.MayForce(PP_ERROR_NOINTERFACE); -} - -int32_t VideoWriter::PutFrame(const VideoFrame& frame) { - if (has_interface<PPB_VideoWriter_0_1>()) { - return get_interface<PPB_VideoWriter_0_1>()->PutFrame( - pp_resource(), - &frame.pp_video_frame()); - } - return PP_ERROR_NOINTERFACE; -} - -void VideoWriter::Close() { - if (has_interface<PPB_VideoWriter_0_1>()) { - get_interface<PPB_VideoWriter_0_1>()->Close(pp_resource()); - } -} - -} // namespace pp diff --git a/ppapi/cpp/video_writer.h b/ppapi/cpp/video_writer.h deleted file mode 100644 index 0b878c4..0000000 --- a/ppapi/cpp/video_writer.h +++ /dev/null @@ -1,69 +0,0 @@ -// 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. - -#ifndef PPAPI_CPP_VIDEO_WRITER_H_ -#define PPAPI_CPP_VIDEO_WRITER_H_ - -#include <string> - -#include "ppapi/c/pp_time.h" -#include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/pass_ref.h" -#include "ppapi/cpp/resource.h" - -/// @file -/// This file defines the API to create and use video stream readers and -/// writers. - -namespace pp { - -class InstanceHandle; -class VideoFrame; - -// VideoWriter ----------------------------------------------------------------- - -/// The <code>VideoWriter</code> class represents a video writer resource. -class VideoWriter : public Resource { - public: - /// Default constructor for creating a <code>VideoWriter</code> object. - VideoWriter(); - - /// Constructor for creating a <code>VideoWriter</code> for an instance. - explicit VideoWriter(const InstanceHandle& instance); - - /// The copy constructor for <code>VideoWriter</code>. - /// - /// @param[in] other A reference to a <code>VideoWriter</code>. - VideoWriter(const VideoWriter& other); - - /// A constructor used when you have received a PP_Resource as a return - /// value that has had its reference count incremented for you. - /// - /// @param[in] resource A PP_Resource corresponding to a video writer. - VideoWriter(PassRef, PP_Resource resource); - - /// Opens a stream for writing video and associates it with the given id. - /// - /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be - /// called upon completion of Open which writes the stream id generated by - /// the host. - /// - /// @return A return code from <code>pp_errors.h</code>. - int32_t Open(const CompletionCallbackWithOutput<Var>& cc); - - /// Puts the next frame of video to the writer's stream. - /// - /// @param[in] frame A <code>VideoFrame</code> containing the frame to write - /// to the open stream. - /// - /// @return A return code from <code>pp_errors.h</code>. - int32_t PutFrame(const VideoFrame& frame); - - /// Closes the writer's current stream. - void Close(); -}; - -} // namespace pp - -#endif // PPAPI_CPP_VIDEO_WRITER_H_ diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index e3f33a5..6d5e608 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -70,8 +70,6 @@ #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" #include "ppapi/c/ppb_var_array_buffer.h" -#include "ppapi/c/ppb_video_reader.h" -#include "ppapi/c/ppb_video_writer.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp_graphics_3d.h" @@ -102,6 +100,8 @@ #include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/c/private/ppb_uma_private.h" +#include "ppapi/c/private/ppb_video_destination_private.h" +#include "ppapi/c/private/ppb_video_source_private.h" #include "ppapi/c/private/ppb_x509_certificate_private.h" #include "ppapi/c/private/ppp_content_decryptor_private.h" #include "ppapi/c/private/ppp_flash_browser_operations.h" @@ -168,8 +168,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_URLResponseInfo_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Var_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoReader_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoWriter_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0; @@ -275,6 +273,8 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_0; @@ -1264,74 +1264,6 @@ void Pnacl_M18_PPB_VarArrayBuffer_Unmap(struct PP_Var array) { /* End wrapper methods for PPB_VarArrayBuffer_1_0 */ -/* Begin wrapper methods for PPB_VideoReader_0_1 */ - -static __attribute__((pnaclcall)) -PP_Resource Pnacl_M28_PPB_VideoReader_Create(PP_Instance instance) { - const struct PPB_VideoReader_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoReader_0_1.real_iface; - return iface->Create(instance); -} - -static __attribute__((pnaclcall)) -PP_Bool Pnacl_M28_PPB_VideoReader_IsVideoReader(PP_Resource resource) { - const struct PPB_VideoReader_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoReader_0_1.real_iface; - return iface->IsVideoReader(resource); -} - -static __attribute__((pnaclcall)) -int32_t Pnacl_M28_PPB_VideoReader_Open(PP_Resource reader, struct PP_Var stream_id, struct PP_CompletionCallback callback) { - const struct PPB_VideoReader_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoReader_0_1.real_iface; - return iface->Open(reader, stream_id, callback); -} - -static __attribute__((pnaclcall)) -int32_t Pnacl_M28_PPB_VideoReader_GetFrame(PP_Resource reader, struct PP_VideoFrame* frame, struct PP_CompletionCallback callback) { - const struct PPB_VideoReader_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoReader_0_1.real_iface; - return iface->GetFrame(reader, frame, callback); -} - -static __attribute__((pnaclcall)) -void Pnacl_M28_PPB_VideoReader_Close(PP_Resource reader) { - const struct PPB_VideoReader_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoReader_0_1.real_iface; - iface->Close(reader); -} - -/* End wrapper methods for PPB_VideoReader_0_1 */ - -/* Begin wrapper methods for PPB_VideoWriter_0_1 */ - -static __attribute__((pnaclcall)) -PP_Resource Pnacl_M28_PPB_VideoWriter_Create(PP_Instance instance) { - const struct PPB_VideoWriter_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoWriter_0_1.real_iface; - return iface->Create(instance); -} - -static __attribute__((pnaclcall)) -PP_Bool Pnacl_M28_PPB_VideoWriter_IsVideoWriter(PP_Resource resource) { - const struct PPB_VideoWriter_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoWriter_0_1.real_iface; - return iface->IsVideoWriter(resource); -} - -static __attribute__((pnaclcall)) -int32_t Pnacl_M28_PPB_VideoWriter_Open(PP_Resource writer, struct PP_Var* stream_id, struct PP_CompletionCallback callback) { - const struct PPB_VideoWriter_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoWriter_0_1.real_iface; - return iface->Open(writer, stream_id, callback); -} - -static __attribute__((pnaclcall)) -int32_t Pnacl_M28_PPB_VideoWriter_PutFrame(PP_Resource writer, const struct PP_VideoFrame* frame) { - const struct PPB_VideoWriter_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoWriter_0_1.real_iface; - return iface->PutFrame(writer, frame); -} - -static __attribute__((pnaclcall)) -void Pnacl_M28_PPB_VideoWriter_Close(PP_Resource writer) { - const struct PPB_VideoWriter_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoWriter_0_1.real_iface; - iface->Close(writer); -} - -/* End wrapper methods for PPB_VideoWriter_0_1 */ - /* Not generating wrapper methods for PPB_View_1_0 */ /* Not generating wrapper methods for PPB_View_1_1 */ @@ -3920,6 +3852,74 @@ void Pnacl_M18_PPB_UMA_Private_HistogramEnumeration(struct PP_Var name, int32_t /* End wrapper methods for PPB_UMA_Private_0_1 */ +/* Begin wrapper methods for PPB_VideoDestination_Private_0_1 */ + +static __attribute__((pnaclcall)) +PP_Resource Pnacl_M28_PPB_VideoDestination_Private_Create(PP_Instance instance) { + const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface; + return iface->Create(instance); +} + +static __attribute__((pnaclcall)) +PP_Bool Pnacl_M28_PPB_VideoDestination_Private_IsVideoDestination(PP_Resource resource) { + const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface; + return iface->IsVideoDestination(resource); +} + +static __attribute__((pnaclcall)) +int32_t Pnacl_M28_PPB_VideoDestination_Private_Open(PP_Resource destination, struct PP_Var stream_url, struct PP_CompletionCallback callback) { + const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface; + return iface->Open(destination, stream_url, callback); +} + +static __attribute__((pnaclcall)) +int32_t Pnacl_M28_PPB_VideoDestination_Private_PutFrame(PP_Resource destination, const struct PP_VideoFrame_Private* frame) { + const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface; + return iface->PutFrame(destination, frame); +} + +static __attribute__((pnaclcall)) +void Pnacl_M28_PPB_VideoDestination_Private_Close(PP_Resource destination) { + const struct PPB_VideoDestination_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1.real_iface; + iface->Close(destination); +} + +/* End wrapper methods for PPB_VideoDestination_Private_0_1 */ + +/* Begin wrapper methods for PPB_VideoSource_Private_0_1 */ + +static __attribute__((pnaclcall)) +PP_Resource Pnacl_M28_PPB_VideoSource_Private_Create(PP_Instance instance) { + const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface; + return iface->Create(instance); +} + +static __attribute__((pnaclcall)) +PP_Bool Pnacl_M28_PPB_VideoSource_Private_IsVideoSource(PP_Resource resource) { + const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface; + return iface->IsVideoSource(resource); +} + +static __attribute__((pnaclcall)) +int32_t Pnacl_M28_PPB_VideoSource_Private_Open(PP_Resource source, struct PP_Var stream_url, struct PP_CompletionCallback callback) { + const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface; + return iface->Open(source, stream_url, callback); +} + +static __attribute__((pnaclcall)) +int32_t Pnacl_M28_PPB_VideoSource_Private_GetFrame(PP_Resource source, struct PP_VideoFrame_Private* frame, struct PP_CompletionCallback callback) { + const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface; + return iface->GetFrame(source, frame, callback); +} + +static __attribute__((pnaclcall)) +void Pnacl_M28_PPB_VideoSource_Private_Close(PP_Resource source) { + const struct PPB_VideoSource_Private_0_1 *iface = Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1.real_iface; + iface->Close(source); +} + +/* End wrapper methods for PPB_VideoSource_Private_0_1 */ + /* Begin wrapper methods for PPB_X509Certificate_Private_0_1 */ static __attribute__((pnaclcall)) @@ -4400,22 +4400,6 @@ struct PPB_VarArrayBuffer_1_0 Pnacl_Wrappers_PPB_VarArrayBuffer_1_0 = { .Unmap = (void (*)(struct PP_Var array))&Pnacl_M18_PPB_VarArrayBuffer_Unmap }; -struct PPB_VideoReader_0_1 Pnacl_Wrappers_PPB_VideoReader_0_1 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M28_PPB_VideoReader_Create, - .IsVideoReader = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_VideoReader_IsVideoReader, - .Open = (int32_t (*)(PP_Resource reader, struct PP_Var stream_id, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoReader_Open, - .GetFrame = (int32_t (*)(PP_Resource reader, struct PP_VideoFrame* frame, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoReader_GetFrame, - .Close = (void (*)(PP_Resource reader))&Pnacl_M28_PPB_VideoReader_Close -}; - -struct PPB_VideoWriter_0_1 Pnacl_Wrappers_PPB_VideoWriter_0_1 = { - .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M28_PPB_VideoWriter_Create, - .IsVideoWriter = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_VideoWriter_IsVideoWriter, - .Open = (int32_t (*)(PP_Resource writer, struct PP_Var* stream_id, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoWriter_Open, - .PutFrame = (int32_t (*)(PP_Resource writer, const struct PP_VideoFrame* frame))&Pnacl_M28_PPB_VideoWriter_PutFrame, - .Close = (void (*)(PP_Resource writer))&Pnacl_M28_PPB_VideoWriter_Close -}; - /* Not generating wrapper interface for PPB_View_1_0 */ /* Not generating wrapper interface for PPB_View_1_1 */ @@ -5061,6 +5045,22 @@ struct PPB_UMA_Private_0_1 Pnacl_Wrappers_PPB_UMA_Private_0_1 = { .HistogramEnumeration = (void (*)(struct PP_Var name, int32_t sample, int32_t boundary_value))&Pnacl_M18_PPB_UMA_Private_HistogramEnumeration }; +struct PPB_VideoDestination_Private_0_1 Pnacl_Wrappers_PPB_VideoDestination_Private_0_1 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M28_PPB_VideoDestination_Private_Create, + .IsVideoDestination = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_VideoDestination_Private_IsVideoDestination, + .Open = (int32_t (*)(PP_Resource destination, struct PP_Var stream_url, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoDestination_Private_Open, + .PutFrame = (int32_t (*)(PP_Resource destination, const struct PP_VideoFrame_Private* frame))&Pnacl_M28_PPB_VideoDestination_Private_PutFrame, + .Close = (void (*)(PP_Resource destination))&Pnacl_M28_PPB_VideoDestination_Private_Close +}; + +struct PPB_VideoSource_Private_0_1 Pnacl_Wrappers_PPB_VideoSource_Private_0_1 = { + .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M28_PPB_VideoSource_Private_Create, + .IsVideoSource = (PP_Bool (*)(PP_Resource resource))&Pnacl_M28_PPB_VideoSource_Private_IsVideoSource, + .Open = (int32_t (*)(PP_Resource source, struct PP_Var stream_url, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoSource_Private_Open, + .GetFrame = (int32_t (*)(PP_Resource source, struct PP_VideoFrame_Private* frame, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_VideoSource_Private_GetFrame, + .Close = (void (*)(PP_Resource source))&Pnacl_M28_PPB_VideoSource_Private_Close +}; + struct PPB_X509Certificate_Private_0_1 Pnacl_Wrappers_PPB_X509Certificate_Private_0_1 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_X509Certificate_Private_Create, .IsX509CertificatePrivate = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_X509Certificate_Private_IsX509CertificatePrivate, @@ -5319,18 +5319,6 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoReader_0_1 = { - .iface_macro = PPB_VIDEOREADER_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoReader_0_1, - .real_iface = NULL -}; - -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoWriter_0_1 = { - .iface_macro = PPB_VIDEOWRITER_INTERFACE_0_1, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoWriter_0_1, - .real_iface = NULL -}; - static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_View_1_0 = { .iface_macro = PPB_VIEW_INTERFACE_1_0, .wrapped_iface = NULL /* Still need slot for real_iface */, @@ -5961,6 +5949,18 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1 = { + .iface_macro = PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoDestination_Private_0_1, + .real_iface = NULL +}; + +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1 = { + .iface_macro = PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_VideoSource_Private_0_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1 = { .iface_macro = PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_X509Certificate_Private_0_1, @@ -6049,8 +6049,6 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_Var_1_0, &Pnacl_WrapperInfo_PPB_Var_1_1, &Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0, - &Pnacl_WrapperInfo_PPB_VideoReader_0_1, - &Pnacl_WrapperInfo_PPB_VideoWriter_0_1, &Pnacl_WrapperInfo_PPB_View_1_0, &Pnacl_WrapperInfo_PPB_View_1_1, &Pnacl_WrapperInfo_PPB_WebSocket_1_0, @@ -6138,6 +6136,8 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3, &Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4, &Pnacl_WrapperInfo_PPB_UMA_Private_0_1, + &Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1, + &Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1, &Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1, &Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1, &Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1, diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index dcfc385..97821a4 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -94,6 +94,7 @@ # Private interfaces. 'c/private/pp_file_handle.h', 'c/private/pp_private_font_charset.h', + 'c/private/pp_video_frame_private.h', 'c/private/ppb_content_decryptor_private.h', 'c/private/ppb_flash.h', 'c/private/ppb_flash_clipboard.h', @@ -115,6 +116,8 @@ 'c/private/ppb_tcp_server_socket_private.h', 'c/private/ppb_tcp_socket_private.h', 'c/private/ppb_udp_socket_private.h', + 'c/private/ppb_video_destination_private.h', + 'c/private/ppb_video_source_private.h', 'c/private/ppb_x509_certificate_private.h', 'c/private/ppp_content_decryptor_private.h', @@ -200,12 +203,6 @@ 'cpp/var.h', 'cpp/var_array_buffer.cc', 'cpp/var_array_buffer.h', - 'cpp/video_frame.cc', - 'cpp/video_frame.h', - 'cpp/video_reader.cc', - 'cpp/video_reader.h', - 'cpp/video_writer.cc', - 'cpp/video_writer.h', 'cpp/view.cc', 'cpp/view.h', 'cpp/websocket.cc', @@ -320,6 +317,12 @@ 'cpp/private/udp_socket_private.h', 'cpp/private/var_private.cc', 'cpp/private/var_private.h', + 'cpp/private/video_destination_private.cc', + 'cpp/private/video_destination_private.h', + 'cpp/private/video_frame_private.cc', + 'cpp/private/video_frame_private.h', + 'cpp/private/video_source_private.cc', + 'cpp/private/video_source_private.h', 'cpp/private/x509_certificate_private.cc', 'cpp/private/x509_certificate_private.h', diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index 9f9757e..5cf7f40 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -67,7 +67,6 @@ #include "ppapi/c/pp_time.h" #include "ppapi/c/pp_touch_point.h" #include "ppapi/c/pp_var.h" -#include "ppapi/c/pp_video_frame.h" #include "ppapi/c/ppb.h" #include "ppapi/c/ppb_audio.h" #include "ppapi/c/ppb_audio_config.h" @@ -90,8 +89,6 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var_array_buffer.h" -#include "ppapi/c/ppb_video_reader.h" -#include "ppapi/c/ppb_video_writer.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_graphics_3d.h" @@ -100,6 +97,7 @@ #include "ppapi/c/ppp_messaging.h" #include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/pp_private_font_charset.h" +#include "ppapi/c/private/pp_video_frame_private.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" #include "ppapi/c/private/ppb_file_io_private.h" #include "ppapi/c/private/ppb_flash.h" @@ -119,6 +117,8 @@ #include "ppapi/c/private/ppb_tcp_socket_private.h" #include "ppapi/c/private/ppb_udp_socket_private.h" #include "ppapi/c/private/ppb_uma_private.h" +#include "ppapi/c/private/ppb_video_destination_private.h" +#include "ppapi/c/private/ppb_video_source_private.h" #include "ppapi/c/private/ppb_x509_certificate_private.h" #include "ppapi/c/private/ppp_content_decryptor_private.h" #include "ppapi/c/private/ppp_instance_private.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index c9e0a6b..4e3ced4 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -61,6 +61,9 @@ #include "ppapi/cpp/private/tcp_socket_private.h" #include "ppapi/cpp/private/udp_socket_private.h" #include "ppapi/cpp/private/var_private.h" +#include "ppapi/cpp/private/video_destination_private.h" +#include "ppapi/cpp/private/video_frame_private.h" +#include "ppapi/cpp/private/video_source_private.h" #include "ppapi/cpp/rect.h" #include "ppapi/cpp/resource.h" #include "ppapi/cpp/size.h" @@ -70,9 +73,6 @@ #include "ppapi/cpp/url_response_info.h" #include "ppapi/cpp/var.h" #include "ppapi/cpp/var_array_buffer.h" -#include "ppapi/cpp/video_frame.h" -#include "ppapi/cpp/video_reader.h" -#include "ppapi/cpp/video_writer.h" #include "ppapi/cpp/websocket.h" #include "ppapi/utility/completion_callback_factory.h" #include "ppapi/utility/completion_callback_factory_thread_traits.h" |