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" |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 22 | #include "typedefs.h" // NOLINT(build/include) |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 23 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 24 | namespace webrtc { |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 25 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 26 | class RTPFragmentationHeader; // forward declaration |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 27 | |
| 28 | // Note: if any pointers are added to this struct, it must be fitted |
| 29 | // with a copy-constructor. See below. |
| 30 | struct CodecSpecificInfoVP8 { |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 31 | int16_t pictureId; // Negative value to skip pictureId. |
| 32 | bool nonReference; |
| 33 | uint8_t simulcastIdx; |
| 34 | uint8_t temporalIdx; |
| 35 | bool layerSync; |
| 36 | int tl0PicIdx; // Negative value to skip tl0PicIdx. |
| 37 | int8_t keyIdx; // Negative value to skip keyIdx. |
| 38 | }; |
| 39 | |
| 40 | struct CodecSpecificInfoVP9 { |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 41 | int16_t picture_id; // Negative value to skip pictureId. |
| 42 | |
| 43 | bool inter_pic_predicted; // This layer frame is dependent on previously |
| 44 | // coded frame(s). |
| 45 | bool flexible_mode; |
| 46 | bool ss_data_available; |
| 47 | |
| 48 | int tl0_pic_idx; // Negative value to skip tl0PicIdx. |
| 49 | uint8_t temporal_idx; |
| 50 | uint8_t spatial_idx; |
| 51 | bool temporal_up_switch; |
| 52 | bool inter_layer_predicted; // Frame is dependent on directly lower spatial |
| 53 | // layer frame. |
| 54 | uint8_t gof_idx; |
| 55 | |
| 56 | // SS data. |
| 57 | size_t num_spatial_layers; // Always populated. |
| 58 | bool spatial_layer_resolution_present; |
| 59 | uint16_t width[kMaxVp9NumberOfSpatialLayers]; |
| 60 | uint16_t height[kMaxVp9NumberOfSpatialLayers]; |
| 61 | GofInfoVP9 gof; |
| 62 | |
| 63 | // Frame reference data. |
| 64 | uint8_t num_ref_pics; |
| 65 | uint8_t p_diff[kMaxVp9RefPics]; |
| 66 | }; |
| 67 | |
| 68 | struct CodecSpecificInfoGeneric { |
| 69 | uint8_t simulcast_idx; |
| 70 | }; |
| 71 | |
hta | 9aa9688 | 2016-12-06 05:36:03 -0800 | [diff] [blame] | 72 | struct CodecSpecificInfoH264 { |
| 73 | H264PacketizationMode packetization_mode; |
| 74 | }; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 75 | |
| 76 | union CodecSpecificInfoUnion { |
| 77 | CodecSpecificInfoGeneric generic; |
| 78 | CodecSpecificInfoVP8 VP8; |
| 79 | CodecSpecificInfoVP9 VP9; |
| 80 | CodecSpecificInfoH264 H264; |
| 81 | }; |
| 82 | |
| 83 | // Note: if any pointers are added to this struct or its sub-structs, it |
| 84 | // must be fitted with a copy-constructor. This is because it is copied |
| 85 | // in the copy-constructor of VCMEncodedFrame. |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 86 | struct CodecSpecificInfo { |
perkj | 275afc5 | 2016-09-01 00:21:16 -0700 | [diff] [blame] | 87 | CodecSpecificInfo() : codecType(kVideoCodecUnknown), codec_name(nullptr) {} |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 88 | VideoCodecType codecType; |
perkj | 275afc5 | 2016-09-01 00:21:16 -0700 | [diff] [blame] | 89 | const char* codec_name; |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 90 | CodecSpecificInfoUnion codecSpecific; |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | } // namespace webrtc |
| 94 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 95 | #endif // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INTERFACE_H_ |