• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019 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 API_VIDEO_RECORDABLE_ENCODED_FRAME_H_
12 #define API_VIDEO_RECORDABLE_ENCODED_FRAME_H_
13 
14 #include "api/array_view.h"
15 #include "api/scoped_refptr.h"
16 #include "api/units/timestamp.h"
17 #include "api/video/color_space.h"
18 #include "api/video/encoded_image.h"
19 #include "api/video/video_codec_type.h"
20 #include "rtc_base/ref_count.h"
21 
22 namespace webrtc {
23 
24 // Interface for accessing recordable elements of an encoded frame.
25 class RecordableEncodedFrame {
26  public:
27   // Encoded resolution in pixels
28   struct EncodedResolution {
29     unsigned width;
30     unsigned height;
31   };
32 
33   virtual ~RecordableEncodedFrame() = default;
34 
35   // Provides access to encoded data
36   virtual rtc::scoped_refptr<const EncodedImageBufferInterface> encoded_buffer()
37       const = 0;
38 
39   // Optionally returns the colorspace of the encoded frame. This can differ
40   // from the eventually decoded frame's colorspace.
41   virtual absl::optional<webrtc::ColorSpace> color_space() const = 0;
42 
43   // Returns the codec of the encoded frame
44   virtual VideoCodecType codec() const = 0;
45 
46   // Returns whether the encoded frame is a key frame
47   virtual bool is_key_frame() const = 0;
48 
49   // Returns the frame's encoded resolution. May be 0x0 if the frame
50   // doesn't contain resolution information
51   virtual EncodedResolution resolution() const = 0;
52 
53   // Returns the computed render time
54   virtual Timestamp render_time() const = 0;
55 };
56 
57 }  // namespace webrtc
58 
59 #endif  // API_VIDEO_RECORDABLE_ENCODED_FRAME_H_
60