OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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 #include "media/cdm/cdm_video_frame.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "media/base/video_frame.h" | |
9 | |
10 namespace media { | |
11 | |
12 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).
| |
13 : format_(cdm::kUnknownVideoFormat), frame_buffer_(nullptr), timestamp_(0) { | |
14 for (uint32_t i = 0; i < kMaxPlanes; ++i) { | |
15 plane_offsets_[i] = 0; | |
16 strides_[i] = 0; | |
17 } | |
18 } | |
19 | |
20 CdmVideoFrame::~CdmVideoFrame() { | |
21 if (frame_buffer_) | |
22 frame_buffer_->Destroy(); | |
23 } | |
24 | |
25 void CdmVideoFrame::SetFormat(cdm::VideoFormat format) { | |
26 format_ = format; | |
27 } | |
28 | |
29 cdm::VideoFormat CdmVideoFrame::Format() const { | |
30 return format_; | |
31 } | |
32 | |
33 void CdmVideoFrame::SetSize(cdm::Size size) { | |
34 size_ = size; | |
35 } | |
36 | |
37 cdm::Size CdmVideoFrame::Size() const { | |
38 return size_; | |
39 } | |
40 | |
41 void CdmVideoFrame::SetFrameBuffer(cdm::Buffer* frame_buffer) { | |
42 frame_buffer_ = frame_buffer; | |
43 } | |
44 | |
45 cdm::Buffer* CdmVideoFrame::FrameBuffer() { | |
46 return frame_buffer_; | |
47 } | |
48 | |
49 void CdmVideoFrame::SetPlaneOffset(cdm::VideoFrame::VideoPlane plane, | |
50 uint32_t offset) { | |
51 DCHECK(plane < kMaxPlanes); | |
52 plane_offsets_[plane] = offset; | |
53 } | |
54 | |
55 uint32_t CdmVideoFrame::PlaneOffset(VideoPlane plane) { | |
56 DCHECK(plane < kMaxPlanes); | |
57 return plane_offsets_[plane]; | |
58 } | |
59 | |
60 void CdmVideoFrame::SetStride(VideoPlane plane, uint32_t stride) { | |
61 DCHECK(plane < kMaxPlanes); | |
62 strides_[plane] = stride; | |
63 } | |
64 | |
65 uint32_t CdmVideoFrame::Stride(VideoPlane plane) { | |
66 DCHECK(plane < kMaxPlanes); | |
67 return strides_[plane]; | |
68 } | |
69 | |
70 void CdmVideoFrame::SetTimestamp(int64_t timestamp) { | |
71 timestamp_ = timestamp; | |
72 } | |
73 | |
74 int64_t CdmVideoFrame::Timestamp() const { | |
75 return timestamp_; | |
76 } | |
77 | |
78 } // namespace media | |
OLD | NEW |