video_decoder_factory.h (2322B)
1 /* 2 * Copyright (c) 2017 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 #ifndef API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_ 12 #define API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_ 13 14 #include <memory> 15 #include <vector> 16 17 #include "api/environment/environment.h" 18 #include "api/video_codecs/sdp_video_format.h" 19 #include "api/video_codecs/video_decoder.h" 20 #include "rtc_base/system/rtc_export.h" 21 22 namespace webrtc { 23 24 // A factory that creates VideoDecoders. 25 // NOTE: This class is still under development and may change without notice. 26 class RTC_EXPORT VideoDecoderFactory { 27 public: 28 struct CodecSupport { 29 bool is_supported = false; 30 bool is_power_efficient = false; 31 }; 32 33 virtual ~VideoDecoderFactory() = default; 34 35 // Returns a list of supported video formats in order of preference, to use 36 // for signaling etc. 37 virtual std::vector<SdpVideoFormat> GetSupportedFormats() const = 0; 38 39 // Query whether the specifed format is supported or not and if it will be 40 // power efficient, which is currently interpreted as if there is support for 41 // hardware acceleration. 42 // The parameter `reference_scaling` is used to query support for prediction 43 // across spatial layers. An example where support for reference scaling is 44 // needed is if the video stream is produced with a scalability mode that has 45 // a dependency between the spatial layers. See 46 // https://w3c.github.io/webrtc-svc/#scalabilitymodes* for a specification of 47 // different scalabilty modes. NOTE: QueryCodecSupport is currently an 48 // experimental feature that is subject to change without notice. 49 virtual CodecSupport QueryCodecSupport(const SdpVideoFormat& format, 50 bool reference_scaling) const; 51 52 // Creates a VideoDecoder for the specified `format`. 53 virtual std::unique_ptr<VideoDecoder> Create( 54 const Environment& env, 55 const SdpVideoFormat& format) = 0; 56 }; 57 58 } // namespace webrtc 59 60 #endif // API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_