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.
7 * This file defines the <code>PPB_VideoReader</code> struct for a video reader
16 * The <code>PPB_VideoReader</code> interface contains pointers to several
17 * functions for creating video reader resources and using them to consume
18 * streams of video frames.
20 interface PPB_VideoReader
{
22 * Creates a video reader resource.
24 * @param[in] instance A <code>PP_Instance</code> identifying one instance
27 * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
28 * failure. Failure means the instance was invalid.
30 PP_Resource Create
([in] PP_Instance instance
);
33 * Determines if a given resource is a video reader.
35 * @param[in] resource A <code>PP_Resource</code> corresponding to a resource.
37 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
38 * resource is a video reader or <code>PP_FALSE</code> otherwise.
40 PP_Bool IsVideoReader
([in] PP_Resource resource
);
43 * Opens a video stream with the given id for reading.
45 * @param[in] reader A <code>PP_Resource</code> corresponding to a video
47 * @param[in] stream_id A <code>PP_Var</code> holding a string uniquely
48 * identifying the stream. This string is application defined.
49 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
50 * completion of Open().
52 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
53 * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader.
54 * Returns PP_ERROR_INPROGRESS if the reader has already opened a stream.
56 int32_t Open
([in] PP_Resource reader
,
57 [in] PP_Var stream_id
,
58 [in] PP_CompletionCallback
callback);
61 * Gets the next frame of video from the reader's open stream. The image data
62 * resource returned in the frame will have its reference count incremented by
63 * one and must be managed by the plugin.
65 * @param[in] reader A <code>PP_Resource</code> corresponding to a video
67 * @param[out] frame A <code>PP_VideoFrame</code> to hold a video frame to
68 * read from the open stream.
69 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
70 * completion of GetNextFrame().
72 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
73 * Returns PP_ERROR_BADRESOURCE if reader isn't a valid video reader.
74 * Returns PP_ERROR_FAILED if the reader has not opened a stream, if the video
75 * frame has an invalid image data resource, or if some other error occurs.
77 int32_t GetFrame
([in] PP_Resource reader
,
78 [out] PP_VideoFrame frame
,
79 [in] PP_CompletionCallback
callback);
82 * Closes the reader's video stream.
84 * @param[in] reader A <code>PP_Resource</code> corresponding to a video
87 void Close
([in] PP_Resource reader
);