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.
5 #ifndef PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_
10 #include "ppapi/c/pp_time.h"
11 #include "ppapi/cpp/completion_callback.h"
12 #include "ppapi/cpp/pass_ref.h"
13 #include "ppapi/cpp/resource.h"
16 /// This file defines the <code>PPB_VideoSource_Private</code> interface for a
17 /// video source resource, which receives video frames from a MediaStream video
18 /// track in the browser.
23 class VideoFrame_Private
;
25 /// The <code>VideoSource_Private</code> class contains methods for creating
26 /// video source resources and using them to receive video frames from a
27 /// MediaStream video track in the browser.
28 class VideoSource_Private
: public Resource
{
30 /// Default constructor for creating a <code>VideoSource_Private</code>
32 VideoSource_Private();
34 /// Constructor for creating a <code>VideoSource_Private</code> for an
36 explicit VideoSource_Private(const InstanceHandle
& instance
);
38 /// The copy constructor for <code>VideoSource_Private</code>.
40 /// @param[in] other A reference to a <code>VideoSource_Private</code>.
41 VideoSource_Private(const VideoSource_Private
& other
);
43 /// A constructor used when you have received a PP_Resource as a return
44 /// value that has had its reference count incremented for you.
46 /// @param[in] resource A PP_Resource corresponding to a video source.
47 VideoSource_Private(PassRef
, PP_Resource resource
);
49 /// Opens a video source for getting frames.
51 /// @param[in] stream_url A <code>Var</code> string holding a URL identifying
53 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
54 /// completion of Open().
56 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
57 /// Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
58 /// Returns PP_ERROR_INPROGRESS if source is already open.
59 /// Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
60 /// some other browser error.
61 int32_t Open(const Var
& stream_url
,
62 const CompletionCallback
& cc
);
64 /// Gets a frame from the video source. The returned frame is only valid
65 /// until the next call to GetFrame.
67 /// @param[out] frame A <code>VideoFrame_Private</code> to hold a video
68 /// frame from the source.
69 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
70 /// called upon completion of ReceiveFrame().
72 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
73 /// Returns PP_ERROR_BADRESOURCE if source isn't a valid video source.
74 /// Returns PP_ERROR_FAILED if the source is not open, or if some other
75 /// browser error occurs.
77 const CompletionCallbackWithOutput
<VideoFrame_Private
>& cc
);
79 /// Closes the video source.
85 #endif // PPAPI_CPP_PRIVATE_VIDEO_SOURCE_PRIVATE_H_