diff options
Diffstat (limited to 'p2pvr/lib/tuner.cpp')
-rw-r--r-- | p2pvr/lib/tuner.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/p2pvr/lib/tuner.cpp b/p2pvr/lib/tuner.cpp index e508152..3cfb8a4 100644 --- a/p2pvr/lib/tuner.cpp +++ b/p2pvr/lib/tuner.cpp @@ -89,8 +89,7 @@ Tuner::ScanAndSendNetworkInformation(const P2PVR::RawDataClientPrx & client, con { frontend->FrequencyScan([this, &client, &ice](long) { try { - SendNetworkInformation(client, ice); - return true; + return (SendPID(0x10, client, ice) > 0); } catch (...) { return false; @@ -117,12 +116,24 @@ Tuner::SendServiceDescriptions(const P2PVR::RawDataClientPrx & client, const Ice } void +Tuner::SendProgramMap(Ice::Int pid, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) +{ + SendPID(pid, client, ice); +} + +void +Tuner::SendProgramAssociationTable(const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) +{ + SendPID(0x00, client, ice); +} + +void Tuner::SendEventInformation(const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) { SendPID(0x12, client, ice); } -void +uint64_t Tuner::SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) const { Logger()->messagebf(LOG_DEBUG, "%s: pid = 0x%x", __PRETTY_FUNCTION__, pid); @@ -138,15 +149,16 @@ Tuner::SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Curre throw P2PVR::DeviceError("demux", strerror(errno), errno); } - ReadDemuxAndSend(demux, client); + return ReadDemuxAndSend(demux, client); } -void +uint64_t Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & client) const { Logger()->messagebf(LOG_DEBUG, "%s: begin", __PRETTY_FUNCTION__); std::vector<Ice::AsyncResultPtr> asyncs; struct pollfd ufd; + uint64_t packetsSent = 0; bool exitFlag = false; do { // Wait for data to appear @@ -155,7 +167,7 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & client) const ufd.events = POLLIN; if (poll(&ufd, 1, timeout) < 1) { Logger()->messagebf(LOG_DEBUG, "%s: Timed out waiting for data", __PRETTY_FUNCTION__); - throw P2PVR::DeviceError("demux", "Timed out. Tuned to a multiplex?", 0); + break; } // Read it @@ -187,6 +199,7 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & client) const } asyncs.push_back(client->begin_NewData(buf)); + packetsSent += 1; asyncs.erase(std::remove_if(asyncs.begin(), asyncs.end(), [&exitFlag, &client](const Ice::AsyncResultPtr & a) { if (a->isCompleted()) { @@ -200,6 +213,7 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & client) const client->end_NewData(a); } Logger()->messagebf(LOG_DEBUG, "%s: end", __PRETTY_FUNCTION__); + return packetsSent; } int |