X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fdvb.cpp;h=f07a986789372a277978f4588ad649e8f97f9e52;hp=ce096039c1c61477ffc028ab6bb24868bed67c89;hb=dba8122997839f5084ebb20594f28ac9ceff207a;hpb=377c2adbf11ed3b293bced1a4195cefd8aa6110f diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp old mode 100644 new mode 100755 index ce09603..f07a986 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -824,17 +824,17 @@ int eDVBResourceManager::canAllocateFrontend(ePtr &fepar return bestval; } -int tuner_type_channel_default(ePtr &channellist, const eDVBChannelID &chid) +int tuner_type_channel_default(ePtr &channellist, const eDVBChannelID &chid, int &system) { + system = iDVBFrontend::feSatellite; if (channellist) { ePtr feparm; if (!channellist->getChannelFrontendData(chid, feparm)) { - int system; if (!feparm->getSystem(system)) { - switch(system) + switch (system) { case iDVBFrontend::feSatellite: return 50000; @@ -851,15 +851,16 @@ int tuner_type_channel_default(ePtr &channellist, const eDVBCha return 0; } -int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore, bool simulate) +int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore, int &system, bool simulate) { std::list &active_channels = simulate ? m_active_simulate_channels : m_active_channels; - int ret=0; + int ret = 0; + system = iDVBFrontend::feSatellite; if (!simulate && m_cached_channel) { eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel); if(channelid==cache_chan->getChannelID()) - return tuner_type_channel_default(m_list, channelid); + return tuner_type_channel_default(m_list, channelid, system); } /* first, check if a channel is already existing. */ @@ -870,7 +871,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons if (i->m_channel_id == channelid) { // eDebug("found shared channel.."); - return tuner_type_channel_default(m_list, channelid); + return tuner_type_channel_default(m_list, channelid, system); } } @@ -950,6 +951,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons eDebug("channel not found!"); goto error; } + feparm->getSystem(system); ret = canAllocateFrontend(feparm, simulate); @@ -1352,8 +1354,9 @@ static inline long long align_with_len(long long x, int align, size_t &len) if (sign) x = -x; - x -= x % align; - len += x % align; + int r = x % align; + x -= r; + len += r; if (sign) x = -x; @@ -1382,13 +1385,13 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off max = align(m_skipmode_n, blocksize); } - eDebug("getNextSourceSpan, current offset is %08llx, m_skipmode_m = %d!", current_offset, m_skipmode_m); + eDebug("getNextSourceSpan, current offset is %08lld, m_skipmode_m = %d!", current_offset, m_skipmode_m); int frame_skip_success = 0; if (m_skipmode_m) { int frames_to_skip = m_skipmode_frames + m_skipmode_frames_remainder; - eDebug("we are at %llx, and we try to skip %d+%d frames from here", current_offset, m_skipmode_frames, m_skipmode_frames_remainder); + eDebug("we are at %lld, and we try to skip %d+%d frames from here", current_offset, m_skipmode_frames, m_skipmode_frames_remainder); size_t iframe_len; off_t iframe_start = current_offset; int frames_skipped = frames_to_skip; @@ -1409,20 +1412,24 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off if (!frame_skip_success) { current_offset += align(m_skipmode_m, blocksize); - - if (m_skipmode_m) + if(current_offset < 0) + current_offset = 0; + else { - eDebug("we are at %llx, and we try to find the iframe here:", current_offset); - size_t iframe_len; - off_t iframe_start = current_offset; - - int direction = (m_skipmode_m < 0) ? -1 : +1; - if (m_tstools.findFrame(iframe_start, iframe_len, direction)) - eDebug("failed"); - else + if (m_skipmode_m) { - current_offset = align_with_len(iframe_start, blocksize, iframe_len); - max = align(iframe_len, blocksize); + eDebug("we are at %lld, and we try to find the iframe here:", current_offset); + size_t iframe_len; + off_t start_offset = current_offset; + off_t new_offset = start_offset; + int direction = (m_skipmode_m < 0) ? -1 : +1; + if (m_tstools.findFrame(start_offset, new_offset, iframe_len, direction)) + eDebug("failed"); + else + { + current_offset = align_with_len(new_offset, blocksize, iframe_len); + max = align(iframe_len, blocksize); + } } } } @@ -1580,18 +1587,19 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off } } + if(current_offset <0) + current_offset =0; if ((current_offset < -m_skipmode_m) && (m_skipmode_m < 0)) { eDebug("reached SOF"); m_skipmode_m = 0; m_pvr_thread->sendEvent(eFilePushThread::evtUser); } - if (m_source_span.empty()) { start = current_offset; size = max; - eDebug("NO CUESHEET. (%08llx, %zd)", start, size); + eDebug("NO CUESHEET. (%08lld, %zd)", start, size); } else { start = current_offset;