1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <vector>
20 
21 #include "host/frontend/webrtc/lib/video_frame_buffer.h"
22 
23 namespace cuttlefish {
24 
25 class CvdVideoFrameBuffer : public webrtc_streaming::VideoFrameBuffer {
26  public:
27   CvdVideoFrameBuffer(int width, int height);
28   ~CvdVideoFrameBuffer() override = default;
29 
30   int width() const override;
31   int height() const override;
32 
33   int StrideY() const override;
34   int StrideU() const override;
35   int StrideV() const override;
36 
37   const uint8_t *DataY() const override;
38   const uint8_t *DataU() const override;
39   const uint8_t *DataV() const override;
40 
DataY()41   uint8_t *DataY() { return y_.data(); }
DataU()42   uint8_t *DataU() { return u_.data(); }
DataV()43   uint8_t *DataV() { return v_.data(); }
44 
45  private:
46   const int width_;
47   const int height_;
48   std::vector<std::uint8_t> y_;
49   std::vector<std::uint8_t> u_;
50   std::vector<std::uint8_t> v_;
51 };
52 
53 }
54