blob: 7524631f998d3dd4a50a94bb193a9cd0da1e53c1 [file] [log] [blame]
Henrik Kjellander2557b862015-11-18 22:00:21 +01001/*
2 * Copyright (c) 2012 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_
12#define MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_
Henrik Kjellander2557b862015-11-18 22:00:21 +010013
14#include <vector>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "api/video/video_frame.h"
17#include "api/video_codecs/video_decoder.h"
18#include "api/video_codecs/video_encoder.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020019#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "modules/include/module_common_types.h"
21#include "modules/video_coding/include/video_error_codes.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020022#include "typedefs.h" // NOLINT(build/include)
Henrik Kjellander2557b862015-11-18 22:00:21 +010023
philipel9d3ab612015-12-21 04:12:39 -080024namespace webrtc {
Henrik Kjellander2557b862015-11-18 22:00:21 +010025
philipel9d3ab612015-12-21 04:12:39 -080026class RTPFragmentationHeader; // forward declaration
Henrik Kjellander2557b862015-11-18 22:00:21 +010027
28// Note: if any pointers are added to this struct, it must be fitted
29// with a copy-constructor. See below.
30struct CodecSpecificInfoVP8 {
Niels Möllerbb894ff2018-03-15 12:28:53 +010031 // TODO(nisse): Delete, set by PayloadRouter.
Henrik Kjellander2557b862015-11-18 22:00:21 +010032 int16_t pictureId; // Negative value to skip pictureId.
33 bool nonReference;
34 uint8_t simulcastIdx;
35 uint8_t temporalIdx;
36 bool layerSync;
Niels Möllerbb894ff2018-03-15 12:28:53 +010037 // TODO(nisse): Delete, set by PayloadRouter.
Henrik Kjellander2557b862015-11-18 22:00:21 +010038 int tl0PicIdx; // Negative value to skip tl0PicIdx.
39 int8_t keyIdx; // Negative value to skip keyIdx.
40};
41
42struct CodecSpecificInfoVP9 {
Niels Möllerbb894ff2018-03-15 12:28:53 +010043 // TODO(nisse): Delete, set by PayloadRouter.
Henrik Kjellander2557b862015-11-18 22:00:21 +010044 int16_t picture_id; // Negative value to skip pictureId.
45
Niels Möllerbb894ff2018-03-15 12:28:53 +010046 bool first_frame_in_picture; // First frame, increment picture_id.
Henrik Kjellander2557b862015-11-18 22:00:21 +010047 bool inter_pic_predicted; // This layer frame is dependent on previously
48 // coded frame(s).
49 bool flexible_mode;
50 bool ss_data_available;
51
Niels Möllerbb894ff2018-03-15 12:28:53 +010052 // TODO(nisse): Delete, set by PayloadRouter.
Henrik Kjellander2557b862015-11-18 22:00:21 +010053 int tl0_pic_idx; // Negative value to skip tl0PicIdx.
54 uint8_t temporal_idx;
55 uint8_t spatial_idx;
56 bool temporal_up_switch;
57 bool inter_layer_predicted; // Frame is dependent on directly lower spatial
58 // layer frame.
59 uint8_t gof_idx;
60
61 // SS data.
62 size_t num_spatial_layers; // Always populated.
63 bool spatial_layer_resolution_present;
64 uint16_t width[kMaxVp9NumberOfSpatialLayers];
65 uint16_t height[kMaxVp9NumberOfSpatialLayers];
66 GofInfoVP9 gof;
67
68 // Frame reference data.
69 uint8_t num_ref_pics;
70 uint8_t p_diff[kMaxVp9RefPics];
71};
72
73struct CodecSpecificInfoGeneric {
74 uint8_t simulcast_idx;
75};
76
hta9aa96882016-12-06 05:36:03 -080077struct CodecSpecificInfoH264 {
78 H264PacketizationMode packetization_mode;
79};
Henrik Kjellander2557b862015-11-18 22:00:21 +010080
81union CodecSpecificInfoUnion {
82 CodecSpecificInfoGeneric generic;
83 CodecSpecificInfoVP8 VP8;
84 CodecSpecificInfoVP9 VP9;
85 CodecSpecificInfoH264 H264;
86};
87
88// Note: if any pointers are added to this struct or its sub-structs, it
89// must be fitted with a copy-constructor. This is because it is copied
90// in the copy-constructor of VCMEncodedFrame.
philipel9d3ab612015-12-21 04:12:39 -080091struct CodecSpecificInfo {
perkj275afc52016-09-01 00:21:16 -070092 CodecSpecificInfo() : codecType(kVideoCodecUnknown), codec_name(nullptr) {}
philipel9d3ab612015-12-21 04:12:39 -080093 VideoCodecType codecType;
perkj275afc52016-09-01 00:21:16 -070094 const char* codec_name;
philipel9d3ab612015-12-21 04:12:39 -080095 CodecSpecificInfoUnion codecSpecific;
Henrik Kjellander2557b862015-11-18 22:00:21 +010096};
97
98} // namespace webrtc
99
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200100#endif // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_