Upload upstream chromium 108.0.5359.1
[platform/framework/web/chromium-efl.git] / ppapi / cpp / video_frame.h
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.
4
5 #ifndef PPAPI_CPP_VIDEO_FRAME_H_
6 #define PPAPI_CPP_VIDEO_FRAME_H_
7
8 #include <stdint.h>
9
10 #include "ppapi/c/ppb_video_frame.h"
11 #include "ppapi/cpp/resource.h"
12 #include "ppapi/cpp/size.h"
13
14 namespace pp {
15
16 class VideoFrame : public Resource {
17  public:
18   /// Default constructor for creating an is_null()
19   /// <code>VideoFrame</code> object.
20   VideoFrame();
21
22   /// The copy constructor for <code>VideoFrame</code>.
23   ///
24   /// @param[in] other A reference to a <code>VideoFrame</code>.
25   VideoFrame(const VideoFrame& other);
26
27   /// Constructs a <code>VideoFrame</code> from a <code>Resource</code>.
28   ///
29   /// @param[in] resource A <code>PPB_VideoFrame</code> resource.
30   explicit VideoFrame(const Resource& resource);
31
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.
34   ///
35   /// @param[in] resource A <code>PPB_VideoFrame</code> resource.
36   VideoFrame(PassRef, PP_Resource resource);
37
38   virtual ~VideoFrame();
39
40   /// Gets the timestamp of the video frame.
41   ///
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;
45
46   /// Sets the timestamp of the video frame.
47   ///
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
50   /// video stream.
51   void SetTimestamp(PP_TimeDelta timestamp);
52
53   /// Gets the format of the video frame.
54   ///
55   /// @return A <code>PP_VideoFrame_Format</code> containing the format of the
56   /// video frame.
57   PP_VideoFrame_Format GetFormat() const;
58
59   /// Gets the size of the video frame.
60   ///
61   /// @param[out] size A <code>Size</code>.
62   ///
63   /// @return True on success or false on failure.
64   bool GetSize(Size* size) const;
65
66   /// Gets the data buffer for video frame pixels.
67   ///
68   /// @return A pointer to the beginning of the data buffer.
69   void* GetDataBuffer();
70
71   /// Gets the size of data buffer in bytes.
72   ///
73   /// @return The size of the data buffer in bytes.
74   uint32_t GetDataBufferSize() const;
75 };
76
77 }  // namespace pp
78
79 #endif  // PPAPI_CPP_VIDEO_FRAME_H_