concrete-agent.hpp 1.39 KB
Newer Older
Frediano Ziglio's avatar
Frediano Ziglio committed
1 2 3 4 5 6 7 8 9
/* Agent implementation
 *
 * \copyright
 * Copyright 2017 Red Hat Inc. All rights reserved.
 */
#ifndef SPICE_STREAMING_AGENT_CONCRETE_AGENT_HPP
#define SPICE_STREAMING_AGENT_CONCRETE_AGENT_HPP

#include <vector>
10
#include <set>
Frediano Ziglio's avatar
Frediano Ziglio committed
11 12 13
#include <memory>
#include <spice-streaming-agent/plugin.hpp>

14 15
namespace spice {
namespace streaming_agent {
Frediano Ziglio's avatar
Frediano Ziglio committed
16

17 18
class FrameLog;

Frediano Ziglio's avatar
Frediano Ziglio committed
19 20 21 22 23 24 25 26 27 28 29 30
struct ConcreteConfigureOption: ConfigureOption
{
    ConcreteConfigureOption(const char *name, const char *value)
    {
        this->name = name;
        this->value = value;
    }
};

class ConcreteAgent final : public Agent
{
public:
31 32
    ConcreteAgent(const std::vector<ConcreteConfigureOption> &options,
                  FrameLog *logger=nullptr);
33
    void Register(const std::shared_ptr<Plugin>& plugin) override;
Frediano Ziglio's avatar
Frediano Ziglio committed
34
    const ConfigureOption* Options() const override;
35
    void LoadPlugins(const std::string &directory);
36
    FrameCapture *GetBestFrameCapture(const std::set<SpiceVideoCodecType>& codecs);
37 38
    __attribute__ ((format (printf, 2, 3)))
    void LogStat(const char* format, ...) override;
Frediano Ziglio's avatar
Frediano Ziglio committed
39
private:
40
    bool PluginVersionIsCompatible(unsigned pluginVersion) const;
41
    void LoadPlugin(const std::string &plugin_filename);
Frediano Ziglio's avatar
Frediano Ziglio committed
42 43
    std::vector<std::shared_ptr<Plugin>> plugins;
    std::vector<ConcreteConfigureOption> options;
44
    FrameLog *const logger = nullptr;
Frediano Ziglio's avatar
Frediano Ziglio committed
45 46
};

47
}} // namespace spice::streaming_agent
Frediano Ziglio's avatar
Frediano Ziglio committed
48 49

#endif // SPICE_STREAMING_AGENT_CONCRETE_AGENT_HPP