philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ |
| 12 | #define WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ |
| 13 | |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
| 16 | |
| 17 | #include <array> |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | namespace video_coding { |
| 21 | |
| 22 | class FrameObject { |
| 23 | public: |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 24 | static const uint8_t kMaxFrameReferences = 5; |
| 25 | |
philipel | a105987 | 2016-05-09 11:41:48 +0200 | [diff] [blame^] | 26 | FrameObject(); |
| 27 | |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 28 | virtual bool GetBitstream(uint8_t* destination) const = 0; |
| 29 | virtual ~FrameObject() {} |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 30 | |
philipel | a105987 | 2016-05-09 11:41:48 +0200 | [diff] [blame^] | 31 | // The tuple (|picture_id|, |spatial_layer|) uniquely identifies a frame |
| 32 | // object. For codec types that don't necessarily have picture ids they |
| 33 | // have to be constructed from the header data relevant to that codec. |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 34 | uint16_t picture_id; |
philipel | a105987 | 2016-05-09 11:41:48 +0200 | [diff] [blame^] | 35 | uint8_t spatial_layer; |
| 36 | |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 37 | size_t num_references; |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 38 | uint16_t references[kMaxFrameReferences]; |
philipel | a105987 | 2016-05-09 11:41:48 +0200 | [diff] [blame^] | 39 | bool inter_layer_predicted; |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | class PacketBuffer; |
| 43 | |
| 44 | class RtpFrameObject : public FrameObject { |
| 45 | public: |
| 46 | RtpFrameObject(PacketBuffer* packet_buffer, |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 47 | uint16_t first_packet, |
| 48 | uint16_t last_packet); |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 49 | |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 50 | ~RtpFrameObject(); |
philipel | f413933 | 2016-04-20 10:26:34 +0200 | [diff] [blame] | 51 | uint16_t first_seq_num() const; |
| 52 | uint16_t last_seq_num() const; |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 53 | bool GetBitstream(uint8_t* destination) const override; |
| 54 | |
| 55 | private: |
| 56 | PacketBuffer* packet_buffer_; |
philipel | c707ab7 | 2016-04-01 02:01:54 -0700 | [diff] [blame] | 57 | uint16_t first_packet_; |
| 58 | uint16_t last_packet_; |
| 59 | }; |
| 60 | |
| 61 | } // namespace video_coding |
| 62 | } // namespace webrtc |
| 63 | |
| 64 | #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_ |