Android NTP: Most visited tile clicks should have PageTransition.AUTO_BOOKMARK
[chromium-blink-merge.git] / ppapi / cpp / private / video_destination_private.h
bloba936485090184e28e9938fed5b99f5dc337c657d
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_DESTINATION_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_
8 #include <string>
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"
15 /// @file
16 /// This file defines the <code>PPB_VideoDestination_Private</code> interface
17 /// for a video destination resource, which sends video frames to a MediaStream
18 /// video track in the browser.
20 namespace pp {
22 class InstanceHandle;
23 class VideoFrame_Private;
25 /// The <code>VideoDestination_Private</code> class contains methods for
26 /// creating video destination resources and using them to send video frames to
27 /// a MediaStream video track in the browser.
28 class VideoDestination_Private : public Resource {
29 public:
30 /// Default constructor for creating a <code>VideoDestination_Private</code>
31 /// object.
32 VideoDestination_Private();
34 /// Constructor for creating a <code>VideoDestination_Private</code> for an
35 /// instance.
36 explicit VideoDestination_Private(const InstanceHandle& instance);
38 /// The copy constructor for <code>VideoDestination_Private</code>.
39 ///
40 /// @param[in] other A reference to a <code>VideoDestination_Private</code>.
41 VideoDestination_Private(const VideoDestination_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.
45 ///
46 /// @param[in] resource A PP_Resource corresponding to a video destination.
47 VideoDestination_Private(PassRef, PP_Resource resource);
49 /// Opens a video destination for putting frames.
50 ///
51 /// @param[in] stream_url A <code>Var</code> string holding a URL identifying
52 /// a MediaStream.
53 /// @param[in] callback A <code>CompletionCallback</code> to be
54 /// called upon completion of Open().
55 ///
56 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
57 /// Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
58 /// destination.
59 /// Returns PP_ERROR_INPROGRESS if destination is already open.
60 /// Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is
61 /// some other browser error.
62 int32_t Open(const Var& stream_url, const CompletionCallback& cc);
64 /// Puts a frame to the video destination.
65 ///
66 /// After this call, you should take care to release your references to the
67 /// image embedded in the video frame. If you paint to the image after
68 /// PutFrame(), there is the possibility of artifacts because the browser may
69 /// still be copying the frame to the stream.
70 ///
71 /// @param[in] frame A <code>VideoFrame_Private</code> holding the video
72 /// frame to send to the destination.
73 ///
74 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
75 /// Returns PP_ERROR_BADRESOURCE if destination isn't a valid video
76 /// destination.
77 /// Returns PP_ERROR_FAILED if destination is not open, if the video frame has
78 /// an invalid image data resource, or if some other browser error occurs.
79 int32_t PutFrame(const VideoFrame_Private& frame);
81 /// Closes the video destination.
82 void Close();
85 } // namespace pp
87 #endif // PPAPI_CPP_PRIVATE_VIDEO_DESTINATION_PRIVATE_H_