mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Eventually we want to get to a point where we can remove OpenCV from the internals of cscore. The start to doing that is converting the existing CvSource and CvSink methods to RawFrame. For CvSource, this is 100% a free operation. We can do everything the existing code could have done (with one small exception we can fairly easily fix). For CvSink, by defaut this change would incur one extra copy, but no extra allocations. A set of direct methods were added to CvSink to add a method to avoid this extra copy.
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
#ifndef CSCORE_CONFIGURABLESOURCEIMPL_H_
|
|
#define CSCORE_CONFIGURABLESOURCEIMPL_H_
|
|
|
|
#include <atomic>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <span>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
#include "SourceImpl.h"
|
|
|
|
namespace cs {
|
|
|
|
class ConfigurableSourceImpl : public SourceImpl {
|
|
protected:
|
|
ConfigurableSourceImpl(std::string_view name, wpi::Logger& logger,
|
|
Notifier& notifier, Telemetry& telemetry,
|
|
const VideoMode& mode);
|
|
|
|
public:
|
|
~ConfigurableSourceImpl() override;
|
|
|
|
void Start() override;
|
|
|
|
bool SetVideoMode(const VideoMode& mode, CS_Status* status) override;
|
|
|
|
void NumSinksChanged() override;
|
|
void NumSinksEnabledChanged() override;
|
|
|
|
// Frame based specific functions
|
|
void NotifyError(std::string_view msg);
|
|
int CreateProperty(std::string_view name, CS_PropertyKind kind, int minimum,
|
|
int maximum, int step, int defaultValue, int value);
|
|
int CreateProperty(std::string_view name, CS_PropertyKind kind, int minimum,
|
|
int maximum, int step, int defaultValue, int value,
|
|
std::function<void(CS_Property property)> onChange);
|
|
void SetEnumPropertyChoices(int property,
|
|
std::span<const std::string> choices,
|
|
CS_Status* status);
|
|
|
|
private:
|
|
std::atomic_bool m_connected{true};
|
|
};
|
|
|
|
} // namespace cs
|
|
|
|
#endif // CSCORE_CONFIGURABLESOURCEIMPL_H_
|