blob: e8bb4811e6ecd7dd319f707852f4276df553f065 [file] [log] [blame]
philipelc707ab72016-04-01 02:01:54 -07001/*
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
philipel02447bc2016-05-13 06:01:03 -070014#include "webrtc/common_types.h"
15#include "webrtc/modules/include/module_common_types.h"
philipelc707ab72016-04-01 02:01:54 -070016
17namespace webrtc {
18namespace video_coding {
19
20class FrameObject {
21 public:
philipelf4139332016-04-20 10:26:34 +020022 static const uint8_t kMaxFrameReferences = 5;
23
philipela1059872016-05-09 11:41:48 +020024 FrameObject();
25
philipelc707ab72016-04-01 02:01:54 -070026 virtual bool GetBitstream(uint8_t* destination) const = 0;
27 virtual ~FrameObject() {}
philipelf4139332016-04-20 10:26:34 +020028
philipela1059872016-05-09 11:41:48 +020029 // The tuple (|picture_id|, |spatial_layer|) uniquely identifies a frame
30 // object. For codec types that don't necessarily have picture ids they
31 // have to be constructed from the header data relevant to that codec.
philipelf4139332016-04-20 10:26:34 +020032 uint16_t picture_id;
philipela1059872016-05-09 11:41:48 +020033 uint8_t spatial_layer;
philipelbe7a9e52016-05-19 12:19:35 +020034 uint32_t timestamp;
philipela1059872016-05-09 11:41:48 +020035
philipelf4139332016-04-20 10:26:34 +020036 size_t num_references;
philipelf4139332016-04-20 10:26:34 +020037 uint16_t references[kMaxFrameReferences];
philipela1059872016-05-09 11:41:48 +020038 bool inter_layer_predicted;
philipelc707ab72016-04-01 02:01:54 -070039};
40
41class PacketBuffer;
42
43class RtpFrameObject : public FrameObject {
44 public:
45 RtpFrameObject(PacketBuffer* packet_buffer,
philipel02447bc2016-05-13 06:01:03 -070046 uint16_t first_seq_num,
47 uint16_t last_seq_num);
philipelf4139332016-04-20 10:26:34 +020048
philipelc707ab72016-04-01 02:01:54 -070049 ~RtpFrameObject();
philipelf4139332016-04-20 10:26:34 +020050 uint16_t first_seq_num() const;
51 uint16_t last_seq_num() const;
philipel02447bc2016-05-13 06:01:03 -070052 FrameType frame_type() const;
53 VideoCodecType codec_type() const;
philipelc707ab72016-04-01 02:01:54 -070054 bool GetBitstream(uint8_t* destination) const override;
philipel02447bc2016-05-13 06:01:03 -070055 RTPVideoTypeHeader* GetCodecHeader() const;
philipelc707ab72016-04-01 02:01:54 -070056
57 private:
58 PacketBuffer* packet_buffer_;
philipel02447bc2016-05-13 06:01:03 -070059 FrameType frame_type_;
60 VideoCodecType codec_type_;
61 uint16_t first_seq_num_;
62 uint16_t last_seq_num_;
philipelc707ab72016-04-01 02:01:54 -070063};
64
65} // namespace video_coding
66} // namespace webrtc
67
68#endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_OBJECT_H_