123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- /*
- * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
- #include "api/video_codecs/builtin_video_encoder_factory.h"
- #include <memory>
- #include <vector>
- #include "absl/strings/match.h"
- #include "api/video_codecs/sdp_video_format.h"
- #include "api/video_codecs/video_encoder.h"
- #include "media/base/codec.h"
- #include "media/base/media_constants.h"
- #include "media/engine/encoder_simulcast_proxy.h"
- #include "media/engine/internal_encoder_factory.h"
- #include "rtc_base/checks.h"
- #include "sri_build_encoder_factory.h"
- #include "absl/memory/memory.h"
- #include "media/engine/internal_decoder_factory.h"
- #include "rtc_base/logging.h"
- #include "modules/video_coding/codecs/h264/include/h264.h"
- #include "modules/video_coding/codecs/vp8/include/vp8.h"
- #include "modules/video_coding/codecs/vp9/include/vp9.h"
- #include "api/video_codecs/video_encoder_factory.h"
- #include "rtc_base/checks.h"
- namespace webrtc {
- class ExternalEncoderFactory : public webrtc::VideoEncoderFactory {
- public:
- std::vector<webrtc::SdpVideoFormat> GetSupportedFormats()
- const override {
- std::vector<webrtc::SdpVideoFormat> video_formats;
- for (const webrtc::SdpVideoFormat& h264_format : webrtc::SupportedH264Codecs())
- video_formats.push_back(h264_format);
- return video_formats;
- }
- ExternalEncoderFactory::CodecInfo QueryVideoEncoder(
- const webrtc::SdpVideoFormat& format) const override {
- CodecInfo codec_info = { false };
- // codec_info.is_hardware_accelerated = true;
- codec_info.has_internal_source = false;
- return codec_info;
- }
- std::unique_ptr<webrtc::VideoEncoder> CreateVideoEncoder(
- const webrtc::SdpVideoFormat& format) override {
- if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) {
- if (webrtc::H264Encoder::IsSupported()) {
- printf("进入h264 encode \n");
-
- return absl::make_unique<webrtc::JetsonVideoEncoder>(cricket::VideoCodec(format));
-
-
- }
- }
- return nullptr;
- }
- };
- std::unique_ptr<webrtc::VideoEncoderFactory> CreateExternalVideoEncoderFactory() {
- return std::make_unique<ExternalEncoderFactory>();
- }
- }
- // /*
- // * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
- // *
- // * Use of this source code is governed by a BSD-style license
- // * that can be found in the LICENSE file in the root of the source
- // * tree. An additional intellectual property rights grant can be found
- // * in the file PATENTS. All contributing project authors may
- // * be found in the AUTHORS file in the root of the source tree.
- // */
- // #include "api/video_codecs/builtin_video_encoder_factory.h"
- // #include <memory>
- // #include <vector>
- // #include "absl/strings/match.h"
- // #include "api/video_codecs/sdp_video_format.h"
- // #include "api/video_codecs/video_encoder.h"
- // #include "media/base/codec.h"
- // #include "media/base/media_constants.h"
- // #include "media/engine/encoder_simulcast_proxy.h"
- // #include "media/engine/internal_encoder_factory.h"
- // #include "rtc_base/checks.h"
- // #include "sri_build_encoder_factory.h"
- // #include "absl/memory/memory.h"
- // #include "media/engine/internal_decoder_factory.h"
- // #include "rtc_base/logging.h"
- // #include "modules/video_coding/codecs/h264/include/h264.h"
- // #include "modules/video_coding/codecs/vp8/include/vp8.h"
- // #include "modules/video_coding/codecs/vp9/include/vp9.h"
- // #include "api/video_codecs/video_encoder_factory.h"
- // #include "rtc_base/checks.h"
- // namespace webrtc {
- // class ExternalEncoderFactory : public webrtc::VideoEncoderFactory {
- // public:
- // std::vector<webrtc::SdpVideoFormat> GetSupportedFormats()
- // const override {
- // std::vector<webrtc::SdpVideoFormat> video_formats;
- // for (const webrtc::SdpVideoFormat& vp9_format : webrtc::SupportedVP9Codecs())
- // video_formats.push_back(vp9_format);
- // return video_formats;
- // }
- // ExternalEncoderFactory::CodecInfo QueryVideoEncoder(
- // const webrtc::SdpVideoFormat& format) const override {
- // CodecInfo codec_info = { false };
- // // codec_info.is_hardware_accelerated = true;
- // codec_info.has_internal_source = false;
- // return codec_info;
- // }
- // std::unique_ptr<webrtc::VideoEncoder> CreateVideoEncoder(
- // const webrtc::SdpVideoFormat& format) override {
- // if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) {
- // // if (webrtc::VP9Encoder::IsSupported()) {
- // // printf("VP9 encode \n");
-
- // return absl::make_unique<webrtc::VP9EncoderImpl_>(cricket::VideoCodec(format));
- // // return absl::make_unique<webrtc::H264EncoderImpl_>(cricket::VideoCodec(format));
-
-
-
- // // }
- // }
- // return nullptr;
- // }
- // };
- // std::unique_ptr<webrtc::VideoEncoderFactory> CreateExternalVideoEncoderFactory() {
- // return std::make_unique<ExternalEncoderFactory>();
- // }
- // }
|