1 /* 2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_AUGMENTED_VIDEO_FRAME_BUFFER_H_ 12 #define MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_AUGMENTED_VIDEO_FRAME_BUFFER_H_ 13 14 #include <cstdint> 15 #include <memory> 16 17 #include "api/scoped_refptr.h" 18 #include "api/video/video_frame_buffer.h" 19 20 namespace webrtc { 21 class AugmentedVideoFrameBuffer : public VideoFrameBuffer { 22 public: 23 AugmentedVideoFrameBuffer( 24 const rtc::scoped_refptr<VideoFrameBuffer>& video_frame_buffer, 25 std::unique_ptr<uint8_t[]> augmenting_data, 26 uint16_t augmenting_data_size); 27 28 // Retrieves the underlying VideoFrameBuffer without the augmented data 29 rtc::scoped_refptr<VideoFrameBuffer> GetVideoFrameBuffer() const; 30 31 // Gets a pointer to the augmenting data and moves ownership to the caller 32 uint8_t* GetAugmentingData() const; 33 34 // Get the size of the augmenting data 35 uint16_t GetAugmentingDataSize() const; 36 37 // Returns the type of the underlying VideoFrameBuffer 38 Type type() const final; 39 40 // Returns the width of the underlying VideoFrameBuffer 41 int width() const final; 42 43 // Returns the height of the underlying VideoFrameBuffer 44 int height() const final; 45 46 // Get the I140 Buffer from the underlying frame buffer 47 rtc::scoped_refptr<I420BufferInterface> ToI420() final; 48 // Returns GetI420() of the underlying VideoFrameBuffer. 49 // TODO(hbos): AugmentedVideoFrameBuffer should not return a type (such as 50 // kI420) without also implementing that type's interface (i.e. 51 // I420BufferInterface). Either implement all possible Type's interfaces or 52 // return kNative. 53 const I420BufferInterface* GetI420() const final; 54 55 private: 56 uint16_t augmenting_data_size_; 57 std::unique_ptr<uint8_t[]> augmenting_data_; 58 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; 59 }; 60 } // namespace webrtc 61 62 #endif // MODULES_VIDEO_CODING_CODECS_MULTIPLEX_INCLUDE_AUGMENTED_VIDEO_FRAME_BUFFER_H_ 63