blob: e164189b61e248d3d32844550f6439329e56ea68 [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"
Henrik Kjellander2557b862015-11-18 22:00:21 +010022
philipel9d3ab612015-12-21 04:12:39 -080023namespace webrtc {
Henrik Kjellander2557b862015-11-18 22:00:21 +010024
philipel9d3ab612015-12-21 04:12:39 -080025class RTPFragmentationHeader; // forward declaration
Henrik Kjellander2557b862015-11-18 22:00:21 +010026
27// Note: if any pointers are added to this struct, it must be fitted
28// with a copy-constructor. See below.
29struct CodecSpecificInfoVP8 {
Henrik Kjellander2557b862015-11-18 22:00:21 +010030 bool nonReference;
31 uint8_t simulcastIdx;
32 uint8_t temporalIdx;
33 bool layerSync;
Henrik Kjellander2557b862015-11-18 22:00:21 +010034 int8_t keyIdx; // Negative value to skip keyIdx.
35};
36
37struct CodecSpecificInfoVP9 {
Niels Möllerbb894ff2018-03-15 12:28:53 +010038 bool first_frame_in_picture; // First frame, increment picture_id.
Yves Gerey665174f2018-06-19 15:03:05 +020039 bool inter_pic_predicted; // This layer frame is dependent on previously
40 // coded frame(s).
Henrik Kjellander2557b862015-11-18 22:00:21 +010041 bool flexible_mode;
42 bool ss_data_available;
Sergey Silkinc5a131a2018-04-24 20:13:49 +020043 bool non_ref_for_inter_layer_pred;
Henrik Kjellander2557b862015-11-18 22:00:21 +010044
Henrik Kjellander2557b862015-11-18 22:00:21 +010045 uint8_t temporal_idx;
46 uint8_t spatial_idx;
47 bool temporal_up_switch;
48 bool inter_layer_predicted; // Frame is dependent on directly lower spatial
49 // layer frame.
50 uint8_t gof_idx;
51
52 // SS data.
53 size_t num_spatial_layers; // Always populated.
54 bool spatial_layer_resolution_present;
55 uint16_t width[kMaxVp9NumberOfSpatialLayers];
56 uint16_t height[kMaxVp9NumberOfSpatialLayers];
57 GofInfoVP9 gof;
58
59 // Frame reference data.
60 uint8_t num_ref_pics;
61 uint8_t p_diff[kMaxVp9RefPics];
Sergey Silkin2a1f1832018-04-04 11:45:41 +020062
Sergey Silkinbc0f0d32018-04-24 21:29:14 +020063 bool end_of_picture;
Henrik Kjellander2557b862015-11-18 22:00:21 +010064};
65
66struct CodecSpecificInfoGeneric {
67 uint8_t simulcast_idx;
68};
69
hta9aa96882016-12-06 05:36:03 -080070struct CodecSpecificInfoH264 {
71 H264PacketizationMode packetization_mode;
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020072 uint8_t simulcast_idx;
hta9aa96882016-12-06 05:36:03 -080073};
Henrik Kjellander2557b862015-11-18 22:00:21 +010074
75union CodecSpecificInfoUnion {
76 CodecSpecificInfoGeneric generic;
77 CodecSpecificInfoVP8 VP8;
78 CodecSpecificInfoVP9 VP9;
79 CodecSpecificInfoH264 H264;
80};
81
82// Note: if any pointers are added to this struct or its sub-structs, it
83// must be fitted with a copy-constructor. This is because it is copied
84// in the copy-constructor of VCMEncodedFrame.
philipel9d3ab612015-12-21 04:12:39 -080085struct CodecSpecificInfo {
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020086 CodecSpecificInfo() : codecType(kVideoCodecUnknown), codec_name(nullptr) {
87 memset(&codecSpecific, 0, sizeof(codecSpecific));
88 }
philipel9d3ab612015-12-21 04:12:39 -080089 VideoCodecType codecType;
perkj275afc52016-09-01 00:21:16 -070090 const char* codec_name;
philipel9d3ab612015-12-21 04:12:39 -080091 CodecSpecificInfoUnion codecSpecific;
Henrik Kjellander2557b862015-11-18 22:00:21 +010092};
93
94} // namespace webrtc
95
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020096#endif // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_