Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_ |
| 12 | #define MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_ |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "api/video/video_frame.h" |
| 17 | #include "api/video_codecs/video_decoder.h" |
| 18 | #include "api/video_codecs/video_encoder.h" |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame] | 19 | #include "common_types.h" // NOLINT(build/include) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 20 | #include "modules/include/module_common_types.h" |
| 21 | #include "modules/video_coding/include/video_error_codes.h" |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 22 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 23 | namespace webrtc { |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 24 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 25 | class RTPFragmentationHeader; // forward declaration |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 26 | |
| 27 | // Note: if any pointers are added to this struct, it must be fitted |
| 28 | // with a copy-constructor. See below. |
| 29 | struct CodecSpecificInfoVP8 { |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 30 | bool nonReference; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 31 | uint8_t temporalIdx; |
| 32 | bool layerSync; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 33 | int8_t keyIdx; // Negative value to skip keyIdx. |
| 34 | }; |
| 35 | |
| 36 | struct CodecSpecificInfoVP9 { |
Niels Möller | bb894ff | 2018-03-15 12:28:53 +0100 | [diff] [blame] | 37 | bool first_frame_in_picture; // First frame, increment picture_id. |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 38 | bool inter_pic_predicted; // This layer frame is dependent on previously |
| 39 | // coded frame(s). |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 40 | bool flexible_mode; |
| 41 | bool ss_data_available; |
Sergey Silkin | c5a131a | 2018-04-24 20:13:49 +0200 | [diff] [blame] | 42 | bool non_ref_for_inter_layer_pred; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 43 | |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 44 | uint8_t temporal_idx; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 45 | bool temporal_up_switch; |
| 46 | bool inter_layer_predicted; // Frame is dependent on directly lower spatial |
| 47 | // layer frame. |
| 48 | uint8_t gof_idx; |
| 49 | |
| 50 | // SS data. |
| 51 | size_t num_spatial_layers; // Always populated. |
| 52 | bool spatial_layer_resolution_present; |
| 53 | uint16_t width[kMaxVp9NumberOfSpatialLayers]; |
| 54 | uint16_t height[kMaxVp9NumberOfSpatialLayers]; |
| 55 | GofInfoVP9 gof; |
| 56 | |
| 57 | // Frame reference data. |
| 58 | uint8_t num_ref_pics; |
| 59 | uint8_t p_diff[kMaxVp9RefPics]; |
Sergey Silkin | 2a1f183 | 2018-04-04 11:45:41 +0200 | [diff] [blame] | 60 | |
Sergey Silkin | bc0f0d3 | 2018-04-24 21:29:14 +0200 | [diff] [blame] | 61 | bool end_of_picture; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 62 | }; |
| 63 | |
hta | 9aa9688 | 2016-12-06 05:36:03 -0800 | [diff] [blame] | 64 | struct CodecSpecificInfoH264 { |
| 65 | H264PacketizationMode packetization_mode; |
| 66 | }; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 67 | |
| 68 | union CodecSpecificInfoUnion { |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 69 | CodecSpecificInfoVP8 VP8; |
| 70 | CodecSpecificInfoVP9 VP9; |
| 71 | CodecSpecificInfoH264 H264; |
| 72 | }; |
| 73 | |
| 74 | // Note: if any pointers are added to this struct or its sub-structs, it |
| 75 | // must be fitted with a copy-constructor. This is because it is copied |
| 76 | // in the copy-constructor of VCMEncodedFrame. |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 77 | struct CodecSpecificInfo { |
Kári Tristan Helgason | 84ccb2d | 2018-08-16 14:35:26 +0200 | [diff] [blame] | 78 | CodecSpecificInfo() : codecType(kVideoCodecGeneric), codec_name(nullptr) { |
Sergio Garcia Murillo | 43800f9 | 2018-06-21 16:16:38 +0200 | [diff] [blame] | 79 | memset(&codecSpecific, 0, sizeof(codecSpecific)); |
| 80 | } |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 81 | VideoCodecType codecType; |
Erik Språng | e2fd86a | 2018-10-24 11:32:39 +0200 | [diff] [blame] | 82 | // |codec_name| is deprecated, use name provided by VideoEncoder instead. |
perkj | 275afc5 | 2016-09-01 00:21:16 -0700 | [diff] [blame] | 83 | const char* codec_name; |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 84 | CodecSpecificInfoUnion codecSpecific; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | } // namespace webrtc |
| 88 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 89 | #endif // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_ |