2017-09-14 10:24:54 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_
|
|
|
|
|
#define API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_
|
2017-09-14 10:24:54 +02:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2024-01-22 13:17:05 +01:00
|
|
|
#include "api/environment/environment.h"
|
2021-04-26 22:18:57 +02:00
|
|
|
#include "api/video_codecs/sdp_video_format.h"
|
2024-01-22 13:17:05 +01:00
|
|
|
#include "api/video_codecs/video_decoder.h"
|
2019-04-02 11:33:59 +02:00
|
|
|
#include "rtc_base/system/rtc_export.h"
|
|
|
|
|
|
2017-09-14 10:24:54 +02:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// A factory that creates VideoDecoders.
|
|
|
|
|
// NOTE: This class is still under development and may change without notice.
|
2019-04-02 11:33:59 +02:00
|
|
|
class RTC_EXPORT VideoDecoderFactory {
|
2017-09-14 10:24:54 +02:00
|
|
|
public:
|
2021-04-26 22:18:57 +02:00
|
|
|
struct CodecSupport {
|
|
|
|
|
bool is_supported = false;
|
|
|
|
|
bool is_power_efficient = false;
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-22 13:17:05 +01:00
|
|
|
virtual ~VideoDecoderFactory() = default;
|
|
|
|
|
|
2017-09-14 10:24:54 +02:00
|
|
|
// Returns a list of supported video formats in order of preference, to use
|
|
|
|
|
// for signaling etc.
|
|
|
|
|
virtual std::vector<SdpVideoFormat> GetSupportedFormats() const = 0;
|
|
|
|
|
|
2021-04-26 22:18:57 +02:00
|
|
|
// Query whether the specifed format is supported or not and if it will be
|
|
|
|
|
// power efficient, which is currently interpreted as if there is support for
|
|
|
|
|
// hardware acceleration.
|
2021-08-19 10:34:32 +02:00
|
|
|
// The parameter `reference_scaling` is used to query support for prediction
|
|
|
|
|
// across spatial layers. An example where support for reference scaling is
|
|
|
|
|
// needed is if the video stream is produced with a scalability mode that has
|
|
|
|
|
// a dependency between the spatial layers. See
|
|
|
|
|
// https://w3c.github.io/webrtc-svc/#scalabilitymodes* for a specification of
|
|
|
|
|
// different scalabilty modes. NOTE: QueryCodecSupport is currently an
|
|
|
|
|
// experimental feature that is subject to change without notice.
|
|
|
|
|
virtual CodecSupport QueryCodecSupport(const SdpVideoFormat& format,
|
2024-01-22 13:17:05 +01:00
|
|
|
bool reference_scaling) const;
|
2021-08-19 10:34:32 +02:00
|
|
|
|
2024-01-22 13:17:05 +01:00
|
|
|
// Creates a VideoDecoder for the specified `format`.
|
|
|
|
|
// TODO: bugs.webrtc.org/15791 - Make pure virtual when implemented in all
|
|
|
|
|
// derived classes.
|
|
|
|
|
virtual std::unique_ptr<VideoDecoder> Create(const Environment& env,
|
|
|
|
|
const SdpVideoFormat& format);
|
2017-09-14 10:24:54 +02:00
|
|
|
|
2024-02-15 18:11:13 +01:00
|
|
|
private:
|
|
|
|
|
// TODO: bugs.webrtc.org/15791 - Delete when all derived classes implement
|
|
|
|
|
// `Create`.
|
2024-01-22 13:17:05 +01:00
|
|
|
virtual std::unique_ptr<VideoDecoder> CreateVideoDecoder(
|
|
|
|
|
const SdpVideoFormat& format);
|
2017-09-14 10:24:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_
|