Chromium Code Reviews| Index: media/cdm/cdm_video_frame.cc |
| diff --git a/media/cdm/cdm_video_frame.cc b/media/cdm/cdm_video_frame.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..47072bd6b06a733730088b488da854270bd1e1ac |
| --- /dev/null |
| +++ b/media/cdm/cdm_video_frame.cc |
| @@ -0,0 +1,78 @@ |
| +// Copyright 2016 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. |
| + |
| +#include "media/cdm/cdm_video_frame.h" |
| + |
| +#include "base/logging.h" |
| +#include "media/base/video_frame.h" |
| + |
| +namespace media { |
| + |
| +CdmVideoFrame::CdmVideoFrame() |
|
xhwang
2016/02/11 19:24:13
Are these implementations exactly the same as Vide
jrummell
2016/02/11 22:08:16
Done (conditionally).
|
| + : format_(cdm::kUnknownVideoFormat), frame_buffer_(nullptr), timestamp_(0) { |
| + for (uint32_t i = 0; i < kMaxPlanes; ++i) { |
| + plane_offsets_[i] = 0; |
| + strides_[i] = 0; |
| + } |
| +} |
| + |
| +CdmVideoFrame::~CdmVideoFrame() { |
| + if (frame_buffer_) |
| + frame_buffer_->Destroy(); |
| +} |
| + |
| +void CdmVideoFrame::SetFormat(cdm::VideoFormat format) { |
| + format_ = format; |
| +} |
| + |
| +cdm::VideoFormat CdmVideoFrame::Format() const { |
| + return format_; |
| +} |
| + |
| +void CdmVideoFrame::SetSize(cdm::Size size) { |
| + size_ = size; |
| +} |
| + |
| +cdm::Size CdmVideoFrame::Size() const { |
| + return size_; |
| +} |
| + |
| +void CdmVideoFrame::SetFrameBuffer(cdm::Buffer* frame_buffer) { |
| + frame_buffer_ = frame_buffer; |
| +} |
| + |
| +cdm::Buffer* CdmVideoFrame::FrameBuffer() { |
| + return frame_buffer_; |
| +} |
| + |
| +void CdmVideoFrame::SetPlaneOffset(cdm::VideoFrame::VideoPlane plane, |
| + uint32_t offset) { |
| + DCHECK(plane < kMaxPlanes); |
| + plane_offsets_[plane] = offset; |
| +} |
| + |
| +uint32_t CdmVideoFrame::PlaneOffset(VideoPlane plane) { |
| + DCHECK(plane < kMaxPlanes); |
| + return plane_offsets_[plane]; |
| +} |
| + |
| +void CdmVideoFrame::SetStride(VideoPlane plane, uint32_t stride) { |
| + DCHECK(plane < kMaxPlanes); |
| + strides_[plane] = stride; |
| +} |
| + |
| +uint32_t CdmVideoFrame::Stride(VideoPlane plane) { |
| + DCHECK(plane < kMaxPlanes); |
| + return strides_[plane]; |
| +} |
| + |
| +void CdmVideoFrame::SetTimestamp(int64_t timestamp) { |
| + timestamp_ = timestamp; |
| +} |
| + |
| +int64_t CdmVideoFrame::Timestamp() const { |
| + return timestamp_; |
| +} |
| + |
| +} // namespace media |