driver/record.cpp: try to not stop timeshift, if not needed

This commit is contained in:
[CST] Focus
2012-08-06 15:08:34 +04:00
parent 693ae8d9ff
commit e245f581ca
2 changed files with 11 additions and 4 deletions

View File

@@ -790,8 +790,10 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
printf("%s channel_id %llx epg: %llx, apidmode 0x%X\n", __FUNCTION__, printf("%s channel_id %llx epg: %llx, apidmode 0x%X\n", __FUNCTION__,
eventinfo->channel_id, eventinfo->epgID, eventinfo->apids); eventinfo->channel_id, eventinfo->epgID, eventinfo->apids);
#if 0
if(!CheckRecording(eventinfo)) if(!CheckRecording(eventinfo))
return false; return false;
#endif
#if 1 // FIXME test #if 1 // FIXME test
StopSectionsd = false; StopSectionsd = false;
@@ -896,7 +898,7 @@ bool CRecordManager::StartAutoRecord()
return Record(live_channel_id, TimeshiftDirectory.c_str(), true); return Record(live_channel_id, TimeshiftDirectory.c_str(), true);
} }
bool CRecordManager::StopAutoRecord() bool CRecordManager::StopAutoRecord(bool lock)
{ {
printf("%s: autoshift %d\n", __FUNCTION__, autoshift); printf("%s: autoshift %d\n", __FUNCTION__, autoshift);
@@ -905,7 +907,8 @@ bool CRecordManager::StopAutoRecord()
if(!autoshift) if(!autoshift)
return false; return false;
mutex.lock(); if (lock)
mutex.lock();
CRecordInstance * inst = NULL; CRecordInstance * inst = NULL;
for (recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) { for (recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
if (it->second->Timeshift()) { if (it->second->Timeshift()) {
@@ -916,11 +919,13 @@ bool CRecordManager::StopAutoRecord()
if (inst) if (inst)
StopInstance(inst); StopInstance(inst);
mutex.unlock(); if (lock)
mutex.unlock();
return (inst != NULL); return (inst != NULL);
} }
#if 0
bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo) bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo)
{ {
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
@@ -930,6 +935,7 @@ bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventin
return true; return true;
} }
#endif
void CRecordManager::StartNextRecording() void CRecordManager::StartNextRecording()
{ {
@@ -1477,6 +1483,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
} }
else { else {
printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode()); printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode());
StopAutoRecord(false);
if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap );
mode_changed = true; mode_changed = true;

View File

@@ -187,7 +187,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
bool AskToStop(const t_channel_id channel_id, const int recid = 0); bool AskToStop(const t_channel_id channel_id, const int recid = 0);
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
bool StartAutoRecord(); bool StartAutoRecord();
bool StopAutoRecord(); bool StopAutoRecord(bool lock = true);
MI_MOVIE_INFO * GetMovieInfo(const t_channel_id channel_id); MI_MOVIE_INFO * GetMovieInfo(const t_channel_id channel_id);
const std::string GetFileName(const t_channel_id channel_id); const std::string GetFileName(const t_channel_id channel_id);