diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-05-21 15:33:16 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-05-21 15:33:16 +0100 |
commit | 6568a332b34685bfd63c37805677a9294765bd95 (patch) | |
tree | d2e0091da2ba4e6a9250b54e0b4e289cb13d606e | |
parent | Update with recent test from mock api (diff) | |
download | p2pvr-6568a332b34685bfd63c37805677a9294765bd95.tar.bz2 p2pvr-6568a332b34685bfd63c37805677a9294765bd95.tar.xz p2pvr-6568a332b34685bfd63c37805677a9294765bd95.zip |
Remove Project2 components
-rw-r--r-- | p2pvr/Jamfile.jam | 4 | ||||
-rw-r--r-- | p2pvr/daemon/unittests/Jamfile.jam | 17 | ||||
-rw-r--r-- | p2pvr/daemon/unittests/testp2ice.cpp | 60 | ||||
-rw-r--r-- | p2pvr/p2comp/Jamfile.jam | 11 | ||||
-rw-r--r-- | p2pvr/p2comp/recordingStream.cpp | 79 | ||||
-rw-r--r-- | p2pvr/p2comp/serviceStream.cpp | 57 | ||||
-rw-r--r-- | p2pvr/p2comp/streamBase.cpp | 50 | ||||
-rw-r--r-- | p2pvr/p2comp/streamBase.h | 26 | ||||
-rw-r--r-- | p2pvr/p2comp/streamSinkWrapper.cpp | 28 | ||||
-rw-r--r-- | p2pvr/p2comp/streamSinkWrapper.h | 23 |
10 files changed, 1 insertions, 354 deletions
diff --git a/p2pvr/Jamfile.jam b/p2pvr/Jamfile.jam index d380de0..0e61105 100644 --- a/p2pvr/Jamfile.jam +++ b/p2pvr/Jamfile.jam @@ -50,12 +50,10 @@ alias p2daemonlib : glibmm : : : ; build-project daemon ; build-project carddaemon ; -build-project p2comp ; explicit debuginstall ; -install debuginstall : p2comp//p2pvrp2comp dvb//p2pvrdvb devices//p2pvrdevices lib//p2pvrlib carddaemon//p2pvrcarddaemon daemonbase//p2pvrdaemonbase daemon//p2pvrdaemon ice//p2pvrice ../libtmdb//tmdb : <location>./testing ; +install debuginstall : dvb//p2pvrdvb devices//p2pvrdevices lib//p2pvrlib carddaemon//p2pvrcarddaemon daemonbase//p2pvrdaemonbase daemon//p2pvrdaemon ice//p2pvrice ../libtmdb//tmdb : <location>./testing ; alias finallib : - p2comp//p2pvrp2comp carddaemon//p2pvrcarddaemon daemon//p2pvrdaemon ; diff --git a/p2pvr/daemon/unittests/Jamfile.jam b/p2pvr/daemon/unittests/Jamfile.jam index 6f0f0dd..252dd89 100644 --- a/p2pvr/daemon/unittests/Jamfile.jam +++ b/p2pvr/daemon/unittests/Jamfile.jam @@ -46,23 +46,6 @@ run : testEmbedding ; run - testp2ice.cpp - : : : - <define>BOOST_TEST_DYN_LINK - <library>../..//p2common - <library>../..//p2basics - <library>../..//p2ice - <library>../..//p2ut - <dependency>../../ice//p2pvrice - <dependency>../../lib//p2pvrlib - <dependency>../../p2comp//p2pvrp2comp - <library>boost_system - <library>boost_filesystem - <library>../..//boost_utf - <define>ROOT=\"$(me)\" - : testp2ice ; - -run testMaint.cpp mockDevices.cpp mockScheduler.cpp : : ../../datasources/schema.sql diff --git a/p2pvr/daemon/unittests/testp2ice.cpp b/p2pvr/daemon/unittests/testp2ice.cpp deleted file mode 100644 index 6eece19..0000000 --- a/p2pvr/daemon/unittests/testp2ice.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#define BOOST_TEST_MODULE ClientCompile -#include <boost/test/unit_test.hpp> -#include <boost/filesystem/operations.hpp> -#include <testOptionsSource.h> -#include <definedDirs.h> -#include <sourceObject.h> -#include <testAppInstance.h> -#include <stream.h> -#include <rowSet.h> - -const boost::filesystem::path variant = binDir.leaf(); -const boost::filesystem::path compiler = binDir.parent_path().leaf(); -const boost::filesystem::path root = rootDir.parent_path().parent_path(); -const boost::filesystem::path iceroot = root / "ice"; - -static -void -commonTests() -{ - BOOST_REQUIRE(StreamFactory::get("p2pvrrecordingstream")); - BOOST_REQUIRE(StreamFactory::get("p2pvrservicestream")); - BOOST_REQUIRE(RowSetFactory::get("P2PVR-SI-GetEvent")); -} - -static -void -unloadTests() -{ - BOOST_REQUIRE_THROW(RowSetFactory::get("P2PVR-SI-GetEvent"), AdHoc::NoSuchPluginException); - BOOST_REQUIRE_THROW(StreamFactory::get("p2pvrrecordingstream"), AdHoc::NoSuchPluginException); - BOOST_REQUIRE_THROW(StreamFactory::get("p2pvrservicestream"), AdHoc::NoSuchPluginException); -} - -BOOST_GLOBAL_FIXTURE( TestAppInstance ); - -BOOST_AUTO_TEST_CASE( compile_client_clientOnly ) -{ - TestOptionsSource::LoadTestOptions({ }); - - const std::string tmpdir = "/tmp/ut/p2pvr.slice"; - BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); - - BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); - TestOptionsSource::LoadTestOptions({ - { "ice.compile.tmpdir", tmpdir }, - { "ice.client.slicerclient", (iceroot / "common.ice").string() }, - { "library", (root / "ice" / "bin" / compiler / variant / "slicer-yes" / "libp2pvrice.so").string() }, - { "library", (root / "dvb" / "bin" / compiler / variant / "libp2pvrdvb.so").string() }, - { "library", (root / "lib" / "bin" / compiler / variant / "libp2pvrlib.so").string() }, - { "library", (root / "p2comp" / "bin" / compiler / variant / "libp2pvrp2comp.so").string() }, - { "ice.client.slicerclient", (iceroot / "dvbsi.ice").string() }, - { "ice.client.slicerclient", (iceroot / "dvb.ice").string() }, - { "ice.client.slicerclient", (iceroot / "p2pvr.ice").string() }, - }); - commonTests(); - - TestOptionsSource::LoadTestOptions({ }); - unloadTests(); -} diff --git a/p2pvr/p2comp/Jamfile.jam b/p2pvr/p2comp/Jamfile.jam deleted file mode 100644 index a62751f..0000000 --- a/p2pvr/p2comp/Jamfile.jam +++ /dev/null @@ -1,11 +0,0 @@ -lib p2pvrp2comp : - [ glob-tree *.cpp ] - : - <library>../ice//p2pvrice - <library>../lib//p2pvrlib - <library>..//p2streams - <library>..//p2ice - <library>..//p2cgi - <library>..//adhocutil - <implicit-dependency>../ice//p2pvrice - ; diff --git a/p2pvr/p2comp/recordingStream.cpp b/p2pvr/p2comp/recordingStream.cpp deleted file mode 100644 index 56f3e69..0000000 --- a/p2pvr/p2comp/recordingStream.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include <p2pvr.h> -#include <options.h> -#include <temporaryIceAdapterObject.h> -#include "streamSinkWrapper.h" -#include "streamBase.h" -#include <limits> -#include <cgiRequestContext.h> - -class RecordingStream : public StreamBase { - public: - RecordingStream(ScriptNodePtr p) : - StreamBase(p), - recording(p, "recording") - { - } - - void runStream(const Sink & sink, ExecContext * ec) const override - { - auto storage = ice->GetProxy<P2PVR::StoragePrx>("Storage", ec); - assert(storage); - - std::promise<int> prom; - { - TemporaryIceAdapterObject<P2PVR::RawDataClient> output(adapter, new StreamSinkWrapper(sink, prom)); - - try { - auto range = getRange(ec); - if (!range) { - range = RangeResponse({ std::string(), 0, (unsigned long long)(storage->FileSize(recording(ec)) - 1) }); - } - storage->Send(recording(ec), output, range->Start, range->End - range->Start + 1); - } - catch (const std::ios_base::failure &) { - } - } - } - - boost::optional<unsigned long long> getSizeInBytes(ExecContext * ec) const override - { - auto storage = ice->GetProxy<P2PVR::StoragePrx>("Storage", ec); - assert(storage); - return storage->FileSize(recording(ec)); - } - - bool isSeekable() const override - { - return true; - } - - boost::optional<RangeResponse> getRange(ExecContext * ec) const override - { - auto crc = dynamic_cast<CgiRequestContext *>(ec); - if (crc) { - auto range = crc->getRequestRange(); - if (range && range->Unit == "bytes") { - auto storage = ice->GetProxy<P2PVR::StoragePrx>("Storage", ec); - assert(storage); - auto size = storage->FileSize(recording(ec)); - if (!range->Start) { - range->Start = 0; - } - if (!range->End) { - range->End = size - 1; - } - else { - range->End = std::min<RangePos>(*range->End, size - 1); - } - return (RangeResponse){ std::string("bytes"), *range->Start, *range->End }; - } - } - return boost::optional<RangeResponse>(); - } - - private: - Variable recording; -}; - -NAMEDFACTORY("p2pvrrecordingstream", RecordingStream, StreamFactory); - diff --git a/p2pvr/p2comp/serviceStream.cpp b/p2pvr/p2comp/serviceStream.cpp deleted file mode 100644 index 3702787..0000000 --- a/p2pvr/p2comp/serviceStream.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#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); - diff --git a/p2pvr/p2comp/streamBase.cpp b/p2pvr/p2comp/streamBase.cpp deleted file mode 100644 index 2ed4954..0000000 --- a/p2pvr/p2comp/streamBase.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "streamBase.h" -#include <logger.h> -#include <Ice/ObjectAdapter.h> -#include <commonObjects.h> -#include <exception> - -StreamBase::StreamBase(ScriptNodePtr p) : - Stream(p), - dataSource(p, "datasource") -{ -} - -StreamBase::~StreamBase() -{ - adapter->deactivate(); - adapter->destroy(); -} - -void -StreamBase::loadComplete(const CommonObjects * co) -{ - ice = co->dataSource<IceDataSource>(dataSource(NULL)); - - Ice::CommunicatorPtr ic(ice->GetCommunicator()); - for (int port = startPort; !adapter && port <= endPort; ++port) { - try { - adapter = ic->createObjectAdapterWithEndpoints(std::string(), stringbf("default -p %d", port)); - adapter->activate(); - Logger()->messagebf(LOG_INFO, "%s: adapter activated on port %d", __PRETTY_FUNCTION__, port); - } - catch (...) { - adapter = NULL; - } - } - if (!adapter) { - Logger()->messagebf(LOG_ERR, "%s: Failed to bind to a free port in the configured range (%d - %d)", - __PRETTY_FUNCTION__, startPort, endPort); - throw std::runtime_error("Failed to bind to a free port"); - } -} - -DECLARE_OPTIONS(StreamBase, "P2PVR Stream Client options") -("p2pvr.stream.startport", Options::value(&startPort, 10001), - "Start of port range for ICE adapter when receiving streams") -("p2pvr.stream.endport", Options::value(&endPort, 11000), - "End of port range for ICE adapter when receiving streams") -END_OPTIONS(StreamBase); - -int StreamBase::startPort; -int StreamBase::endPort; diff --git a/p2pvr/p2comp/streamBase.h b/p2pvr/p2comp/streamBase.h deleted file mode 100644 index 279625b..0000000 --- a/p2pvr/p2comp/streamBase.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef STREAMBASE_H -#define STREAMBASE_H - -#include <iceDataSource.h> -#include <stream.h> -#include <options.h> - -class StreamBase : public Stream { - public: - StreamBase(ScriptNodePtr p); - ~StreamBase(); - - void loadComplete(const CommonObjects * co) override; - - INITOPTIONS; - protected: - Variable dataSource; - const IceDataSource * ice; - Ice::ObjectAdapterPtr adapter; - - static int startPort; - static int endPort; -}; - -#endif - diff --git a/p2pvr/p2comp/streamSinkWrapper.cpp b/p2pvr/p2comp/streamSinkWrapper.cpp deleted file mode 100644 index 3dd3d2b..0000000 --- a/p2pvr/p2comp/streamSinkWrapper.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "streamSinkWrapper.h" - -#define LOCK(lock) std::lock_guard<std::mutex> _lock##__LINE_NO__##lock(lock); - -StreamSinkWrapper::StreamSinkWrapper(const Stream::Sink & s, std::promise<int> & p) : - sink(s), - promise(p), - completed(false) -{ -} - -bool -StreamSinkWrapper::NewData(const P2PVR::Data & data, const Ice::Current &) -{ - try { - sink(reinterpret_cast<const char *>(&data.front()), data.size()); - return false; - } - catch (const std::ios_base::failure &) { - LOCK(lock) { - if (completed) return true; - completed = true; - promise.set_value(0); - return true; - } - } -} - diff --git a/p2pvr/p2comp/streamSinkWrapper.h b/p2pvr/p2comp/streamSinkWrapper.h deleted file mode 100644 index 0cbf915..0000000 --- a/p2pvr/p2comp/streamSinkWrapper.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef STREAMSINKWRAPPER -#define STREAMSINKWRAPPER - -#include <stream.h> -#include <dvb.h> -#include <future> -#include <mutex> - -class StreamSinkWrapper : public P2PVR::RawDataClient { - public: - StreamSinkWrapper(const Stream::Sink & s, std::promise<int> & p); - - bool NewData(const P2PVR::Data & data, const Ice::Current &) override; - - private: - const Stream::Sink & sink; - std::promise<int> & promise; - bool completed; - std::mutex lock; -}; - -#endif - |