8 int main(
int argc,
char** argv)
11 size_t streamIndex = 0;
17 help +=
"\tavplayer filename [streamIndex] [--width width] [--height height] [--help]\n";
18 help +=
"Command line options\n";
19 help +=
"\tstreamIndex: specify the index of the stream to read (by default 0)\n";
20 help +=
"\t--width: specify the output width (by default the same as input)\n";
21 help +=
"\t--height: specify the output height (by default the same as input)\n";
22 help +=
"\t--help: display this help\n";
25 std::vector<std::string> arguments;
26 for(
int argument = 1; argument < argc; ++argument)
28 arguments.push_back(argv[argument]);
30 for(
size_t argument = 0; argument < arguments.size(); ++argument)
32 if(arguments.at(argument) ==
"--help")
34 std::cout << help << std::endl;
37 else if(arguments.at(argument) ==
"--width")
41 width = atoi(arguments.at(++argument).c_str());
45 std::cout << help << std::endl;
49 else if(arguments.at(argument) ==
"--height")
53 height = atoi(arguments.at(++argument).c_str());
57 std::cout << help << std::endl;
64 filename = arguments.at(argument);
66 else if(argument == 1)
68 streamIndex = atoi(arguments.at(argument).c_str());
75 std::cout <<
"avplay can play the given video media file." << std::endl;
76 std::cout <<
"Use option --help to display help" << std::endl;
int main(int argc, char **argv)
void preloadCodecsAndFormats()
Register all the codecs and formats which are enabled at configuration time.
size_t getOutputHeight() const
void updateOutput(const size_t width, const size_t height, const std::string &pixelFormat)
Update width, height and pixelFormat of the output.
static void setLogLevel(const int level)
Set the log level of ffmpeg/libav.
size_t getOutputWidth() const