]> git.tdb.fi Git - xinema.git/blob - source/xinema.cpp
Refactor the libxine interface into classes
[xinema.git] / source / xinema.cpp
1 #include <sigc++/bind.h>
2 #include <msp/core/getopt.h>
3 #include "xineengine.h"
4 #include "xinema.h"
5 #include "xinestream.h"
6
7 using namespace std;
8 using namespace Msp;
9
10 Xinema::Xinema(int argc, char **argv):
11         window(display, 1920, 1080)
12 {
13         GetOpt getopt;
14         getopt.add_argument("filename", filename, GetOpt::REQUIRED_ARG);
15         getopt(argc, argv);
16
17         window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Xinema::exit), 0));
18 }
19
20 int Xinema::main()
21 {
22         window.show();
23         display.tick();
24
25         engine = new XineEngine(window, &display_mutex);
26         stream = new XineStream(*engine, filename);
27         stream->play();
28
29         Application::main();
30
31         delete stream;
32         delete engine;
33
34         return exit_code;
35 }
36
37 void Xinema::tick()
38 {
39         {
40                 MutexLock lock(display_mutex);
41                 display.tick();
42         }
43
44         stream->tick();
45 }