summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/video_frame.h
blob: 0c3b3ea28bed7aafe037b1b55ed762bbf37d7e1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PPAPI_CPP_VIDEO_FRAME_H_
#define PPAPI_CPP_VIDEO_FRAME_H_

#include "ppapi/c/ppb_video_frame.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/size.h"

namespace pp {

class VideoFrame : public Resource {
 public:
  /// Default constructor for creating an is_null()
  /// <code>VideoFrame</code> object.
  VideoFrame();

  /// The copy constructor for <code>VideoFrame</code>.
  ///
  /// @param[in] other A reference to a <code>VideoFrame</code>.
  VideoFrame(const VideoFrame& other);

  VideoFrame(const Resource& resource);

  /// A constructor used when you have received a <code>PP_Resource</code> as a
  /// return value that has had 1 ref added for you.
  ///
  /// @para[in] resource A <code>PPB_VideoFrame</code> resource.
  VideoFrame(PassRef, PP_Resource resource);

  virtual ~VideoFrame();

  /// Gets the timestamp of the video frame.
  ///
  /// @return A <code>PP_TimeDelta</code> containing the timestamp of the video
  /// frame. Given in seconds since the start of the containing video stream.
  PP_TimeDelta GetTimestamp() const;

  /// Sets the timestamp of the video frame. Given in seconds since the
  /// start of the containing video stream.
  ///
  /// @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
  /// of the video frame. Given in seconds since the start of the containing
  /// video stream.
  void SetTimestamp(PP_TimeDelta timestamp);

  /// Gets the format of the video frame.
  ///
  /// @return A <code>PP_VideoFrame_Format</code> containing the format of the
  /// video frame.
  PP_VideoFrame_Format GetFormat() const;

  /// Gets the size of the video frame.
  ///
  /// @param[out] size A <code>Size</code>.
  ///
  /// @return True on success or false on failure.
  bool GetSize(Size* size) const;

  /// Gets the data buffer for video frame pixels.
  ///
  /// @return A pointer to the beginning of the data buffer.
  void* GetDataBuffer();

  /// Gets the size of data buffer.
  ///
  /// @return The size of the data buffer.
  uint32_t GetDataBufferSize() const;
};

}  // namespace pp

#endif  // PPAPI_CPP_VIDEO_FRAME_H_