// 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()
/// VideoFrame
object.
VideoFrame();
/// The copy constructor for VideoFrame
.
///
/// @param[in] other A reference to a VideoFrame
.
VideoFrame(const VideoFrame& other);
/// Constructs a VideoFrame
from a Resource
.
///
/// @param[in] resource A PPB_VideoFrame
resource.
explicit VideoFrame(const Resource& resource);
/// A constructor used when you have received a PP_Resource
as a
/// return value that has had 1 ref added for you.
///
/// @param[in] resource A PPB_VideoFrame
resource.
VideoFrame(PassRef, PP_Resource resource);
virtual ~VideoFrame();
/// Gets the timestamp of the video frame.
///
/// @return A PP_TimeDelta
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.
///
/// @param[in] timestamp A PP_TimeDelta
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 PP_VideoFrame_Format
containing the format of the
/// video frame.
PP_VideoFrame_Format GetFormat() const;
/// Gets the size of the video frame.
///
/// @param[out] size A Size
.
///
/// @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 in bytes.
///
/// @return The size of the data buffer in bytes.
uint32_t GetDataBufferSize() const;
};
} // namespace pp
#endif // PPAPI_CPP_VIDEO_FRAME_H_