OXYGENHUB
◆ main openmsx / src / laserdisc / LaserdiscPlayerCLI.cc
1.3 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "LaserdiscPlayerCLI.hh"
2
3
#include "CommandLineParser.hh"
4
#include "Interpreter.hh"
5
#include "MSXException.hh"
6
#include "TclObject.hh"
7
8
namespace openmsx {
9
10
LaserdiscPlayerCLI::LaserdiscPlayerCLI(CommandLineParser& parser_)
11
	: parser(parser_)
12
{
13
	parser.registerOption("-laserdisc", *this);
14
	parser.registerFileType(std::array<std::string_view, 1>{"ogv"}, *this);
15
}
16
17
void LaserdiscPlayerCLI::parseOption(const std::string& option, std::span<std::string>& cmdLine)
18
{
19
	parseFileType(getArgument(option, cmdLine), cmdLine);
20
}
21
22
std::string_view LaserdiscPlayerCLI::optionHelp() const
23
{
24
	return "Put LaserDisc image specified in argument in "
25
	       "virtual LaserDisc player";
26
}
27
28
void LaserdiscPlayerCLI::parseFileType(const std::string& filename,
29
                                       std::span<std::string>& /*cmdLine*/)
30
{
31
	if (!parser.getInterpreter().hasCommand("laserdiscplayer")) {
32
		throw MSXException("No LaserDisc player present.");
33
	}
34
	TclObject command = makeTclList("laserdiscplayer", "insert", filename);
35
	command.executeCommand(parser.getInterpreter());
36
}
37
38
std::string_view LaserdiscPlayerCLI::fileTypeHelp() const
39
{
40
	return "LaserDisc image, Ogg Vorbis/Theora";
41
}
42
43
std::string_view LaserdiscPlayerCLI::fileTypeCategoryName() const
44
{
45
	return "laserdisc";
46
}
47
48
} // namespace openmsx