• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6/**
7 * This file defines the <code>PPB_VideoSource_Private</code> interface for a
8 * video source resource, which receives video frames from a MediaStream video
9 * track in the browser.
10 */
11
12 label Chrome {
13   M28 = 0.1
14 };
15
16/**
17 * The <code>PPB_VideoSource_Private</code> interface contains pointers to
18 * several functions for creating video source resources and using them to
19 * receive video frames from a MediaStream video track in the browser.
20 */
21interface PPB_VideoSource_Private {
22  /**
23   * Creates a video source resource.
24   *
25   * @param[in] instance A <code>PP_Instance</code> identifying an instance of
26   * a module.
27   *
28   * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
29   * failure. Failure means the instance was invalid.
30   */
31  PP_Resource Create([in] PP_Instance instance);
32
33  /**
34   * Determines if a resource is a video source resource.
35   *
36   * @param[in] resource The <code>PP_Resource</code> to test.
37   *
38   * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
39   * resource is a video source resource or <code>PP_FALSE</code> otherwise.
40   */
41  PP_Bool IsVideoSource([in] PP_Resource resource);
42
43  /**
44   * Opens a video source for getting frames.
45   *
46   * @param[in] source A <code>PP_Resource</code> corresponding to a video
47   * source resource.
48   * @param[in] stream_url A <code>PP_Var</code> string holding a URL
49   * identifying a MediaStream.
50   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
51   * completion of Open().
52   *
53   * @return An int32_t containing a result code from <code>pp_errors.h</code>.
54   * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
55   * Returns PP_ERROR_INPROGRESS if source is already open.
56   * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
57   * some other browser error.
58   */
59  int32_t Open([in] PP_Resource source,
60               [in] PP_Var stream_url,
61               [in] PP_CompletionCallback callback);
62
63  /**
64   * Gets a frame from the video source.
65   * The image data resource inside the returned frame will have its reference
66   * count incremented by one and must be managed by the plugin.
67   *
68   * @param[in] source A <code>PP_Resource</code> corresponding to a video
69   * source resource.
70   * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video
71   * frame from the source.
72   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
73   * completion of GetNextFrame().
74   *
75   * @return An int32_t containing a result code from <code>pp_errors.h</code>.
76   * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
77   * Returns PP_ERROR_FAILED if the source is not open, or if some other
78   * browser error occurs.
79   */
80  int32_t GetFrame([in] PP_Resource source,
81                   [out] PP_VideoFrame_Private frame,
82                   [in] PP_CompletionCallback callback);
83
84  /**
85   * Closes the video source.
86   *
87   * @param[in] source A <code>PP_Resource</code> corresponding to a video
88   * source resource.
89   */
90  void Close([in] PP_Resource source);
91};
92
93