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 // This file contains codec dependent definitions that are needed in
12 // order to compile the WebRTC codebase, even if this codec is not used.
13 
14 #ifndef MODULES_VIDEO_CODING_CODECS_H265_INCLUDE_H265_GLOBALS_H_
15 #define MODULES_VIDEO_CODING_CODECS_H265_INCLUDE_H265_GLOBALS_H_
16 
17 #ifndef DISABLE_H265
18 
19 #include "modules/video_coding/codecs/h264/include/h264_globals.h"
20 
21 namespace webrtc {
22 
23 // The packetization types that we support: single, aggregated, and fragmented.
24 enum H265PacketizationTypes {
25   kH265SingleNalu,  // This packet contains a single NAL unit.
26   kH265AP,          // This packet contains aggregation Packet.
27                     // If this packet has an associated NAL unit type,
28                     // it'll be for the first such aggregated packet.
29   kH265FU,          // This packet contains a FU (fragmentation
30                     // unit) packet, meaning it is a part of a frame
31                     // that was too large to fit into a single packet.
32 };
33 
34 struct H265NaluInfo {
35   uint8_t type;
36   int vps_id;
37   int sps_id;
38   int pps_id;
39 };
40 
41 enum class H265PacketizationMode {
42   NonInterleaved = 0,  // Mode 1 - STAP-A, FU-A is allowed
43   SingleNalUnit        // Mode 0 - only single NALU allowed
44 };
45 
46 struct RTPVideoHeaderH265 {
47   // The NAL unit type. If this is a header for a fragmented packet, it's the
48   // NAL unit type of the original data. If this is the header for an aggregated
49   // packet, it's the NAL unit type of the first NAL unit in the packet.
50   uint8_t nalu_type;
51   H265PacketizationTypes packetization_type;
52   H265NaluInfo nalus[kMaxNalusPerPacket];
53   size_t nalus_length;
54   // The packetization type of this buffer - single, aggregated or fragmented.
55   H265PacketizationMode packetization_mode;
56 };
57 
58 }  // namespace webrtc
59 
60 #endif
61 
62 #endif  // MODULES_VIDEO_CODING_CODECS_H265_INCLUDE_H265_GLOBALS_H_
63