1 /* 2 * Copyright (c) 2015 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 12 #ifndef MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_ 13 #define MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_ 14 15 #include <memory> 16 #include <string> 17 #include <vector> 18 19 #include "api/video_codecs/h264_profile_level_id.h" 20 #include "api/video_codecs/scalability_mode.h" 21 #include "media/base/codec.h" 22 #include "modules/video_coding/include/video_codec_interface.h" 23 #include "rtc_base/system/rtc_export.h" 24 25 namespace webrtc { 26 27 struct SdpVideoFormat; 28 29 // Creates an H264 SdpVideoFormat entry with specified paramters. 30 RTC_EXPORT SdpVideoFormat 31 CreateH264Format(H264Profile profile, 32 H264Level level, 33 const std::string& packetization_mode, 34 bool add_scalability_modes = false); 35 36 // Set to disable the H.264 encoder/decoder implementations that are provided if 37 // `rtc_use_h264` build flag is true (if false, this function does nothing). 38 // This function should only be called before or during WebRTC initialization 39 // and is not thread-safe. 40 RTC_EXPORT void DisableRtcUseH264(); 41 42 // Returns a vector with all supported internal H264 encode profiles that we can 43 // negotiate in SDP, in order of preference. 44 std::vector<SdpVideoFormat> SupportedH264Codecs( 45 bool add_scalability_modes = false); 46 47 // Returns a vector with all supported internal H264 decode profiles that we can 48 // negotiate in SDP, in order of preference. This will be available for receive 49 // only connections. 50 std::vector<SdpVideoFormat> SupportedH264DecoderCodecs(); 51 52 class RTC_EXPORT H264Encoder : public VideoEncoder { 53 public: 54 static std::unique_ptr<H264Encoder> Create(const cricket::VideoCodec& codec); 55 // If H.264 is supported (any implementation). 56 static bool IsSupported(); 57 static bool SupportsScalabilityMode(ScalabilityMode scalability_mode); 58 ~H264Encoder()59 ~H264Encoder() override {} 60 }; 61 62 class RTC_EXPORT H264Decoder : public VideoDecoder { 63 public: 64 static std::unique_ptr<H264Decoder> Create(); 65 static bool IsSupported(); 66 ~H264Decoder()67 ~H264Decoder() override {} 68 }; 69 70 } // namespace webrtc 71 72 #endif // MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_ 73