35 virtual ~
Driver() =
default;
50 virtual std::string_view
GetName()
const = 0;
68 typedef std::map<std::string, DriverFactoryBase *>
Drivers;
86 static Driver *s_driver[3] = {
nullptr,
nullptr,
nullptr };
87 return &s_driver[type];
97 static const std::string_view driver_type_name[] = {
"music",
"sound",
"video" };
98 return driver_type_name[type];
101 static bool SelectDriverImpl(
const std::string &name,
Driver::Type type);
103 static void MarkVideoDriverOperational();
126 Driver *driver = *GetActiveDriver(dt);
127 if (driver !=
nullptr) driver->
Stop();
131 static void SelectDriver(
const std::string &name,
Driver::Type type);
132 static void GetDriversInfo(std::back_insert_iterator<std::string> &output_iterator);
140 return this->description;
Base for all driver factories.
std::string_view name
The name of the drivers of this factory.
std::string_view GetDescription() const
Get a nice description of the driver-class.
std::map< std::string, DriverFactoryBase * > Drivers
Type for a map of drivers.
virtual bool UsesHardwareAcceleration() const
Does the driver use hardware acceleration (video-drivers only).
static void ShutdownDrivers()
Shuts down all active drivers.
virtual Driver * CreateInstance() const =0
Create an instance of this driver-class.
static std::string_view GetDriverTypeName(Driver::Type type)
Get the driver type name.
static Drivers & GetDrivers()
Get the map with drivers.
Driver::Type type
The type of driver.
static Driver ** GetActiveDriver(Driver::Type type)
Get the active driver for the given type.
int priority
The priority of this factory.
std::string_view description
The description of this driver.
A driver for communicating with the user.
virtual std::string_view GetName() const =0
Get the name of this driver.
virtual void Stop()=0
Stop this driver.
virtual std::optional< std::string_view > Start(const StringList &parm)=0
Start this driver.
@ DT_END
Helper for iteration.
@ DT_VIDEO
A video driver.
@ DT_SOUND
A sound driver.
@ DT_BEGIN
Helper for iteration.
@ DT_MUSIC
A music driver, needs to be before sound to properly shut down extmidi forked music players.
Driver for all music playback.
Base for all sound drivers.
The base of all video drivers.
const char * GetDriverParam(const StringList &parm, const char *name)
Get a string parameter the list of parameters.
int GetDriverParamInt(const StringList &parm, const char *name, int def)
Get an integer parameter the list of parameters.
bool GetDriverParamBool(const StringList &parm, const char *name)
Get a boolean parameter the list of parameters.
Type (helpers) for enums.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
std::vector< std::string > StringList
Type for a list of strings.