1 // Copyright 2014 The Chromium Authors
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_
10 #include "ppapi/c/ppb_video_frame.h"
11 #include "ppapi/cpp/resource.h"
12 #include "ppapi/cpp/size.h"
16 class VideoFrame : public Resource {
18 /// Default constructor for creating an is_null()
19 /// <code>VideoFrame</code> object.
22 /// The copy constructor for <code>VideoFrame</code>.
24 /// @param[in] other A reference to a <code>VideoFrame</code>.
25 VideoFrame(const VideoFrame& other);
27 /// Constructs a <code>VideoFrame</code> from a <code>Resource</code>.
29 /// @param[in] resource A <code>PPB_VideoFrame</code> resource.
30 explicit VideoFrame(const Resource& resource);
32 /// A constructor used when you have received a <code>PP_Resource</code> as a
33 /// return value that has had 1 ref added for you.
35 /// @param[in] resource A <code>PPB_VideoFrame</code> resource.
36 VideoFrame(PassRef, PP_Resource resource);
38 virtual ~VideoFrame();
40 /// Gets the timestamp of the video frame.
42 /// @return A <code>PP_TimeDelta</code> containing the timestamp of the video
43 /// frame. Given in seconds since the start of the containing video stream.
44 PP_TimeDelta GetTimestamp() const;
46 /// Sets the timestamp of the video frame.
48 /// @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
49 /// of the video frame. Given in seconds since the start of the containing
51 void SetTimestamp(PP_TimeDelta timestamp);
53 /// Gets the format of the video frame.
55 /// @return A <code>PP_VideoFrame_Format</code> containing the format of the
57 PP_VideoFrame_Format GetFormat() const;
59 /// Gets the size of the video frame.
61 /// @param[out] size A <code>Size</code>.
63 /// @return True on success or false on failure.
64 bool GetSize(Size* size) const;
66 /// Gets the data buffer for video frame pixels.
68 /// @return A pointer to the beginning of the data buffer.
69 void* GetDataBuffer();
71 /// Gets the size of data buffer in bytes.
73 /// @return The size of the data buffer in bytes.
74 uint32_t GetDataBufferSize() const;
79 #endif // PPAPI_CPP_VIDEO_FRAME_H_