#ifndef VDR_LIVE_LIVE_H
#define VDR_LIVE_LIVE_H

#include <memory>
#include <string>
#include <vdr/plugin.h>
#include "thread.h"

namespace vdrlive {

class Setup;
class TimerManager;

class PluginBase : public cPlugin 
{
public:
	virtual Setup& GetLiveSetup() = 0;
	virtual TimerManager& GetLiveTimerManager() = 0;
};

inline PluginBase& LivePlugin()
{
	static PluginBase& plugin = *static_cast< PluginBase* >( cPluginManager::GetPlugin( PLUGIN_NAME_I18N ) );
	return plugin;
}

class Plugin : public PluginBase {
public:
	Plugin(void);
	virtual const char *Version(void) { return VERSION; }
	virtual const char *Description(void) { return DESCRIPTION; }
	virtual const char *CommandLineHelp(void);
	virtual bool ProcessArgs(int argc, char *argv[]);
	virtual bool Start(void);
	virtual void Stop(void);
	virtual void MainThreadHook(void);
	virtual cString Active(void);
	virtual cMenuSetupPage *SetupMenu(void);
	virtual bool SetupParse(const char *Name, const char *Value);

	virtual Setup& GetLiveSetup();
	virtual TimerManager& GetLiveTimerManager();

	static std::string const& GetConfigDirectory() { return m_configDirectory; }

private:
	static const char *VERSION;
	static const char *DESCRIPTION;

	static std::string m_configDirectory;

	std::auto_ptr< ServerThread > m_thread;
};

} // namespace vdrlive

#endif // VDR_LIVE_LIVE_H
