4 |
|
// |
5 |
|
// $Id$ |
6 |
|
|
7 |
+ |
#include <menes-api/console.hpp> |
8 |
+ |
#include <menes-api/process.hpp> |
9 |
+ |
#include <menes-api/threads.hpp> |
10 |
|
#include <menes-app/simple.hpp> |
11 |
+ |
#include <menes-etl/fnbind.hpp> |
12 |
+ |
#include <menes-ios/helpers.hpp> |
13 |
|
|
14 |
|
#include "BeepRemote.hpp" |
15 |
|
|
16 |
< |
int Main(const app::Options& options) |
16 |
> |
class DecentralizedMedia |
17 |
|
{ |
18 |
+ |
public: |
19 |
|
BeepRemote bmp; |
20 |
+ |
private: |
21 |
+ |
_H<api::Process> process; |
22 |
+ |
int Destroy() { return process->Join(); } |
23 |
+ |
public: |
24 |
+ |
DecentralizedMedia() : process(bmp.IsRunning() ? NULL : new api::Process("/usr/X11R6/bin/beep-media-player")) {} |
25 |
+ |
~DecentralizedMedia() |
26 |
+ |
{ |
27 |
+ |
if (!process.IsEmpty()) |
28 |
+ |
{ |
29 |
+ |
_H<api::Thread> thread(new api::Thread(etl::BindAll(&DecentralizedMedia::Destroy, this))); |
30 |
+ |
|
31 |
+ |
bmp.Quit(); |
32 |
+ |
|
33 |
+ |
thread->Join(); |
34 |
+ |
} |
35 |
+ |
} |
36 |
+ |
}; |
37 |
+ |
|
38 |
+ |
int Main(const app::Options& options) |
39 |
+ |
{ |
40 |
+ |
DecentralizedMedia media; |
41 |
+ |
ext::String command; |
42 |
+ |
|
43 |
+ |
while (ios::ReadLine(api::Cin, command)) |
44 |
+ |
{ |
45 |
+ |
} |
46 |
|
|
47 |
|
return 0; |
48 |
|
} |