diff options
author | randomdan <randomdan@localhost> | 2013-12-14 04:14:30 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-12-14 04:14:30 +0000 |
commit | fc90e9a0964b6d75134d10c23d6648811437920c (patch) | |
tree | b36e8ebbe097fc61367353765fdb0d1637d29761 | |
parent | Extend interface for currently held recordings (diff) | |
download | p2pvr-fc90e9a0964b6d75134d10c23d6648811437920c.tar.bz2 p2pvr-fc90e9a0964b6d75134d10c23d6648811437920c.tar.xz p2pvr-fc90e9a0964b6d75134d10c23d6648811437920c.zip |
Allow FileSink to take a file handle as well as a path
Pass a target to ServiceStreamer instead of it generating a hard coded one
-rw-r--r-- | p2pvr/lib/fileSink.cpp | 5 | ||||
-rw-r--r-- | p2pvr/lib/fileSink.h | 1 | ||||
-rw-r--r-- | p2pvr/lib/serviceStreamer.cpp | 4 | ||||
-rw-r--r-- | p2pvr/lib/serviceStreamer.h | 4 |
4 files changed, 10 insertions, 4 deletions
diff --git a/p2pvr/lib/fileSink.cpp b/p2pvr/lib/fileSink.cpp index 94379ea..dade921 100644 --- a/p2pvr/lib/fileSink.cpp +++ b/p2pvr/lib/fileSink.cpp @@ -6,6 +6,11 @@ FileSink::FileSink(const boost::filesystem::path & path) : { } +FileSink::FileSink(int fd) : + file(fdopen(fd, "w")) +{ +} + FileSink::~FileSink() { if (file) { diff --git a/p2pvr/lib/fileSink.h b/p2pvr/lib/fileSink.h index a89016c..40644cd 100644 --- a/p2pvr/lib/fileSink.h +++ b/p2pvr/lib/fileSink.h @@ -8,6 +8,7 @@ class FileSink : public P2PVR::RawDataClient { public: FileSink(const boost::filesystem::path & path); + FileSink(int fd); ~FileSink(); bool NewData(const P2PVR::Data & data, const Ice::Current &); diff --git a/p2pvr/lib/serviceStreamer.cpp b/p2pvr/lib/serviceStreamer.cpp index d1bab4f..a26d157 100644 --- a/p2pvr/lib/serviceStreamer.cpp +++ b/p2pvr/lib/serviceStreamer.cpp @@ -4,11 +4,11 @@ #include "fileSink.h" #include "bindSiParserHandler.h" -ServiceStreamer::ServiceStreamer(int sid, const Ice::CommunicatorPtr & ic, const Ice::ObjectAdapterPtr & a) : +ServiceStreamer::ServiceStreamer(int sid, P2PVR::RawDataClientPrx t, const Ice::CommunicatorPtr & ic, const Ice::ObjectAdapterPtr & a) : adapter(a), devs(P2PVR::DevicesPrx::checkedCast(adapter->createProxy(ic->stringToIdentity("GlobalDevices")))), si(P2PVR::SIPrx::checkedCast(adapter->createProxy(ic->stringToIdentity("SI")))), - target(adapter, new FileSink("/tmp/out.ts")), + target(t), patParser(adapter, new BindSiParserHandler<ProgramAssociationMapPtr, SiProgramAssociationParser>(boost::bind(&ServiceStreamer::HandlePAT, this, _1))), pmtParser(adapter, new BindSiParserHandler<DVBSI::ProgramMapPtr, SiProgramMapParser>(boost::bind(&ServiceStreamer::HandlePMT, this, _1))), serviceId(sid), diff --git a/p2pvr/lib/serviceStreamer.h b/p2pvr/lib/serviceStreamer.h index 3ea0c5c..f140050 100644 --- a/p2pvr/lib/serviceStreamer.h +++ b/p2pvr/lib/serviceStreamer.h @@ -11,7 +11,7 @@ class ServiceStreamer { public: - ServiceStreamer(int sid, const Ice::CommunicatorPtr & ic, const Ice::ObjectAdapterPtr & a); + ServiceStreamer(int sid, P2PVR::RawDataClientPrx, const Ice::CommunicatorPtr & ic, const Ice::ObjectAdapterPtr & a); ~ServiceStreamer(); bool HandlePAT(ProgramAssociationMapPtr pam); @@ -25,7 +25,7 @@ class ServiceStreamer { P2PVR::DevicesPrx devs; P2PVR::SIPrx si; P2PVR::TunerPrx tuner; - TemporarayIceAdapterObject<P2PVR::RawDataClient> target; + P2PVR::RawDataClientPrx target; TemporarayIceAdapterObject<P2PVR::RawDataClient> patParser; TemporarayIceAdapterObject<P2PVR::RawDataClient> pmtParser; |