1 // Copyright 2014 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_VIDEO_FRAME_H_
6 #define PPAPI_CPP_VIDEO_FRAME_H_
8 #include "ppapi/c/ppb_video_frame.h"
9 #include "ppapi/cpp/resource.h"
10 #include "ppapi/cpp/size.h"
14 class VideoFrame
: public Resource
{
16 /// Default constructor for creating an is_null()
17 /// <code>VideoFrame</code> object.
20 /// The copy constructor for <code>VideoFrame</code>.
22 /// @param[in] other A reference to a <code>VideoFrame</code>.
23 VideoFrame(const VideoFrame
& other
);
25 /// Constructs a <code>VideoFrame</code> from a <code>Resource</code>.
27 /// @param[in] resource A <code>PPB_VideoFrame</code> resource.
28 explicit VideoFrame(const Resource
& resource
);
30 /// A constructor used when you have received a <code>PP_Resource</code> as a
31 /// return value that has had 1 ref added for you.
33 /// @param[in] resource A <code>PPB_VideoFrame</code> resource.
34 VideoFrame(PassRef
, PP_Resource resource
);
36 virtual ~VideoFrame();
38 /// Gets the timestamp of the video frame.
40 /// @return A <code>PP_TimeDelta</code> containing the timestamp of the video
41 /// frame. Given in seconds since the start of the containing video stream.
42 PP_TimeDelta
GetTimestamp() const;
44 /// Sets the timestamp of the video frame.
46 /// @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
47 /// of the video frame. Given in seconds since the start of the containing
49 void SetTimestamp(PP_TimeDelta timestamp
);
51 /// Gets the format of the video frame.
53 /// @return A <code>PP_VideoFrame_Format</code> containing the format of the
55 PP_VideoFrame_Format
GetFormat() const;
57 /// Gets the size of the video frame.
59 /// @param[out] size A <code>Size</code>.
61 /// @return True on success or false on failure.
62 bool GetSize(Size
* size
) const;
64 /// Gets the data buffer for video frame pixels.
66 /// @return A pointer to the beginning of the data buffer.
67 void* GetDataBuffer();
69 /// Gets the size of data buffer in bytes.
71 /// @return The size of the data buffer in bytes.
72 uint32_t GetDataBufferSize() const;
77 #endif // PPAPI_CPP_VIDEO_FRAME_H_