Revision control

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFFMPEGCODECSTORAGE_P_H
#define QFFMPEGCODECSTORAGE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtFFmpegMediaPluginImpl/private/qffmpegdefs_p.h>
- #include "qtmultimediaglobal.h"
+ #include <QtFFmpegMediaPluginImpl/private/qffmpegcodec_p.h>
+ #include <QtMultimedia/qtmultimediaglobal.h>
+
+ #include <QtCore/qxpfunctional.h>
- #include <functional>
#include <optional>
QT_BEGIN_NAMESPACE
namespace QFFmpeg {
- class Codec;
enum class CodecRole : uint8_t {
Encoders,
Decoders,
};
- bool findAndOpenAVDecoder(AVCodecID codecId,
- const std::function<AVScore(const Codec &)> &scoresGetter,
- const std::function<bool(const Codec &)> &codecOpener);
+ struct CodecScoreRecord
+ {
+ Codec codec;
+ AVScore score;
+ };
- bool findAndOpenAVEncoder(AVCodecID codecId,
- const std::function<AVScore(const Codec &)> &scoresGetter,
- const std::function<bool(const Codec &)> &codecOpener);
+ std::vector<CodecScoreRecord>
+ findAndScoreCodecs(CodecRole, AVCodecID,
+ const qxp::function_ref<AVScore(const Codec &)> &scoreFunction);
+
+ // note: Sorted by score descending, so the first element is the best match.
+ inline std::vector<CodecScoreRecord>
+ findAndScoreEncoders(AVCodecID codecId,
+ const qxp::function_ref<AVScore(const Codec &)> &scoreFunction)
+ {
+ return findAndScoreCodecs(CodecRole::Encoders, codecId, scoreFunction);
+ }
std::optional<Codec> findAVDecoder(AVCodecID codecId,
const std::optional<PixelOrSampleFormat> &format = {});
std::optional<Codec> findAVEncoder(AVCodecID codecId,
const std::optional<PixelOrSampleFormat> &format = {});
} // namespace QFFmpeg
QT_END_NAMESPACE
#endif // QFFMPEGCODECSTORAGE_P_H