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 "media/base/codec.h"
20 #include "media/base/h264_profile_level_id.h"
21 #include "modules/video_coding/include/video_codec_interface.h"
22 #include "rtc_base/system/rtc_export.h"
23 
24 namespace webrtc {
25 
26 struct SdpVideoFormat;
27 
28 // Creates an H264 SdpVideoFormat entry with specified paramters.
29 RTC_EXPORT SdpVideoFormat
30 CreateH264Format(H264::Profile profile,
31                  H264::Level level,
32                  const std::string& packetization_mode);
33 
34 // Set to disable the H.264 encoder/decoder implementations that are provided if
35 // |rtc_use_h264| build flag is true (if false, this function does nothing).
36 // This function should only be called before or during WebRTC initialization
37 // and is not thread-safe.
38 RTC_EXPORT void DisableRtcUseH264();
39 
40 // Returns a vector with all supported internal H264 profiles that we can
41 // negotiate in SDP, in order of preference.
42 std::vector<SdpVideoFormat> SupportedH264Codecs();
43 
44 class RTC_EXPORT H264Encoder : public VideoEncoder {
45  public:
46   static std::unique_ptr<H264Encoder> Create(const cricket::VideoCodec& codec);
47   // If H.264 is supported (any implementation).
48   static bool IsSupported();
49 
~H264Encoder()50   ~H264Encoder() override {}
51 };
52 
53 class RTC_EXPORT H264Decoder : public VideoDecoder {
54  public:
55   static std::unique_ptr<H264Decoder> Create();
56   static bool IsSupported();
57 
~H264Decoder()58   ~H264Decoder() override {}
59 };
60 
61 }  // namespace webrtc
62 
63 #endif  // MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
64