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