1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#include <commonObjects.h>
#include <iceDataSource.h>
#include <serviceStreamer.h>
#include <options.h>
#include <muxer.h>
#include <future>
#include <temporaryIceAdapterObject.h>
#include "streamSinkWrapper.h"
#include "streamBase.h"
class ServiceStream : public StreamBase {
public:
ServiceStream(ScriptNodePtr p) :
StreamBase(p),
serviceId(p, "serviceId")
{
}
void runStream(const Sink & sink, ExecContext * ec) const
{
auto devices = ice->GetProxy<P2PVR::DevicesPrx>("Devices", ec);
assert(devices);
auto si = ice->GetProxy<P2PVR::SIPrx>("SI", ec);
assert(si);
std::promise<int> prom;
{
TemporaryIceAdapterObject<P2PVR::RawDataClient> output(adapter, new StreamSinkWrapper(sink, prom));
{
TemporaryIceAdapterObject<P2PVR::RawDataClient> muxer(adapter, new Muxer(output, muxerCommand));
ServiceStreamerPtr ss(new ServiceStreamer(serviceId(ec), muxer, devices, si, adapter));
ss->Start();
prom.get_future().get();
ss->Stop();
}
}
}
INITOPTIONS;
private:
Variable serviceId;
static std::string muxerCommand;
};
DECLARE_OPTIONS(ServiceStream, "P2PVR Live Stream options")
("p2pvr.livestream.muxercommand", Options::value(&muxerCommand, "/usr/bin/ffmpeg -f mpegts -i - -f dvd -codec copy -"),
"Command to perform TS->PS muxing (default: '/usr/bin/ffmpeg -f mpegts -i - -f webm -')")
END_OPTIONS(ServiceStream);
std::string ServiceStream::muxerCommand;
NAMEDFACTORY("p2pvrservicestream", ServiceStream, StreamFactory);
|