mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
driver/record.cpp: always use configured hours to record for temporary timeshift;
cleanup unused code
This commit is contained in:
@@ -97,7 +97,6 @@ CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo,
|
|||||||
cMovieInfo = new CMovieInfo();
|
cMovieInfo = new CMovieInfo();
|
||||||
recMovieInfo = new MI_MOVIE_INFO();
|
recMovieInfo = new MI_MOVIE_INFO();
|
||||||
record = NULL;
|
record = NULL;
|
||||||
tshift_mode = TSHIFT_MODE_OFF;
|
|
||||||
rec_stop_msg = g_Locale->getText(LOCALE_RECORDING_STOP);
|
rec_stop_msg = g_Locale->getText(LOCALE_RECORDING_STOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +259,7 @@ bool CRecordInstance::Stop(bool remove_event)
|
|||||||
hintBox.paint();
|
hintBox.paint();
|
||||||
|
|
||||||
printf("%s: channel %" PRIx64 " recording_id %d\n", __func__, channel_id, recording_id);
|
printf("%s: channel %" PRIx64 " recording_id %d\n", __func__, channel_id, recording_id);
|
||||||
|
printf("%s: file %s.ts\n", __FUNCTION__, filename);
|
||||||
SaveXml();
|
SaveXml();
|
||||||
/* Stop do close fd - if started */
|
/* Stop do close fd - if started */
|
||||||
record->Stop();
|
record->Stop();
|
||||||
@@ -450,15 +450,19 @@ record_error_msg_t CRecordInstance::Record()
|
|||||||
//FIXME recording_id (timerd eventID) is 0 means its user recording, in this case timer always added ?
|
//FIXME recording_id (timerd eventID) is 0 means its user recording, in this case timer always added ?
|
||||||
if(ret == RECORD_OK && recording_id == 0) {
|
if(ret == RECORD_OK && recording_id == 0) {
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
int record_end = now+g_settings.record_hours*60*60;
|
int record_end;
|
||||||
if (g_settings.recording_epg_for_end)
|
if (autoshift) {
|
||||||
{
|
record_end = now+g_settings.timeshift_hours*60*60;
|
||||||
int pre=0, post=0;
|
} else {
|
||||||
CEPGData epgData;
|
record_end = now+g_settings.record_hours*60*60;
|
||||||
if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) {
|
if (g_settings.recording_epg_for_end) {
|
||||||
g_Timerd->getRecordingSafety(pre, post);
|
int pre=0, post=0;
|
||||||
if (epgData.epg_times.startzeit > 0)
|
CEPGData epgData;
|
||||||
record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post;
|
if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) {
|
||||||
|
g_Timerd->getRecordingSafety(pre, post);
|
||||||
|
if (epgData.epg_times.startzeit > 0)
|
||||||
|
record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recording_id = g_Timerd->addImmediateRecordTimerEvent(channel_id, now, record_end, epgid, epg_time, apidmode);
|
recording_id = g_Timerd->addImmediateRecordTimerEvent(channel_id, now, record_end, epgid, epg_time, apidmode);
|
||||||
@@ -832,28 +836,6 @@ const std::string CRecordManager::GetFileName(t_channel_id channel_id, bool time
|
|||||||
/* return record mode mask, for channel_id not 0, or global */
|
/* return record mode mask, for channel_id not 0, or global */
|
||||||
int CRecordManager::GetRecordMode(const t_channel_id channel_id)
|
int CRecordManager::GetRecordMode(const t_channel_id channel_id)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (RecordingStatus(channel_id) || IsTimeshift(channel_id))
|
|
||||||
{
|
|
||||||
if (RecordingStatus(channel_id) && !IsTimeshift(channel_id))
|
|
||||||
return RECMODE_REC;
|
|
||||||
if (channel_id == 0)
|
|
||||||
{
|
|
||||||
int records = GetRecordCount();
|
|
||||||
if (IsTimeshift(channel_id) && (records == 1))
|
|
||||||
return RECMODE_TSHIFT;
|
|
||||||
else if (IsTimeshift(channel_id) && (records > 1))
|
|
||||||
return RECMODE_REC_TSHIFT;
|
|
||||||
else
|
|
||||||
return RECMODE_OFF;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if (IsTimeshift(channel_id))
|
|
||||||
return RECMODE_TSHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RECMODE_OFF;
|
|
||||||
#endif
|
|
||||||
int recmode = RECMODE_OFF;
|
int recmode = RECMODE_OFF;
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (channel_id == 0) {
|
if (channel_id == 0) {
|
||||||
@@ -913,10 +895,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
|||||||
|
|
||||||
if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF)
|
if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF)
|
||||||
return false;
|
return false;
|
||||||
#if 0
|
|
||||||
if(!CheckRecording(eventinfo))
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1 // FIXME test
|
#if 1 // FIXME test
|
||||||
StopSectionsd = false;
|
StopSectionsd = false;
|
||||||
@@ -926,18 +904,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons
|
|||||||
RunStartScript();
|
RunStartScript();
|
||||||
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
#if 0
|
|
||||||
inst = FindInstance(eventinfo->channel_id);
|
|
||||||
if(inst) {
|
|
||||||
if(direct_record) {
|
|
||||||
error_msg = RECORD_BUSY;
|
|
||||||
} else {
|
|
||||||
CTimerd::RecordingInfo * evt = new CTimerd::RecordingInfo(*eventinfo);
|
|
||||||
printf("%s add %llx : %s to pending\n", __FUNCTION__, evt->channel_id, evt->epgTitle);
|
|
||||||
nextmap.push_back((CTimerd::RecordingInfo *)evt);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
if(recmap.size() < RECORD_MAX_COUNT) {
|
if(recmap.size() < RECORD_MAX_COUNT) {
|
||||||
CFrontend * frontend = NULL;
|
CFrontend * frontend = NULL;
|
||||||
if(CutBackNeutrino(eventinfo->channel_id, frontend)) {
|
if(CutBackNeutrino(eventinfo->channel_id, frontend)) {
|
||||||
@@ -1034,18 +1000,6 @@ bool CRecordManager::StopAutoRecord(bool lock)
|
|||||||
return (inst != NULL);
|
return (inst != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo)
|
|
||||||
{
|
|
||||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
|
||||||
/* FIXME check if frontend used for timeshift the same and will zap ?? */
|
|
||||||
if(/*(eventinfo->channel_id == live_channel_id) ||*/ !SAME_TRANSPONDER(eventinfo->channel_id, live_channel_id))
|
|
||||||
StopAutoRecord();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CRecordManager::StartNextRecording()
|
void CRecordManager::StartNextRecording()
|
||||||
{
|
{
|
||||||
CTimerd::RecordingInfo * eventinfo = NULL;
|
CTimerd::RecordingInfo * eventinfo = NULL;
|
||||||
@@ -1053,25 +1007,6 @@ void CRecordManager::StartNextRecording()
|
|||||||
|
|
||||||
for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) {
|
for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) {
|
||||||
eventinfo = *it;
|
eventinfo = *it;
|
||||||
#if 0
|
|
||||||
bool tested = true;
|
|
||||||
if( !recmap.empty() ) {
|
|
||||||
CRecordInstance * inst = FindInstance(eventinfo->channel_id);
|
|
||||||
/* same channel recording and not auto - skip */
|
|
||||||
if(inst && !inst->Timeshift())
|
|
||||||
tested = false;
|
|
||||||
/* there is only auto-record which can be stopped */
|
|
||||||
else if(recmap.size() == 1 && autoshift)
|
|
||||||
tested = true;
|
|
||||||
else {
|
|
||||||
/* there are some recordings, test any (first) for now */
|
|
||||||
recmap_iterator_t fit = recmap.begin();
|
|
||||||
t_channel_id channel_id = fit->second->GetChannelId();
|
|
||||||
tested = (SAME_TRANSPONDER(channel_id, eventinfo->channel_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tested)
|
|
||||||
#endif
|
|
||||||
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id);
|
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id);
|
||||||
if (channel && CFEManager::getInstance()->canTune(channel))
|
if (channel && CFEManager::getInstance()->canTune(channel))
|
||||||
{
|
{
|
||||||
@@ -1140,11 +1075,6 @@ void CRecordManager::StopInstance(CRecordInstance * inst, bool remove_event)
|
|||||||
if(inst->Timeshift())
|
if(inst->Timeshift())
|
||||||
autoshift = false;
|
autoshift = false;
|
||||||
|
|
||||||
#if 0
|
|
||||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
|
||||||
if(inst->GetChannelId() == live_channel_id)
|
|
||||||
recordingstatus = 0;
|
|
||||||
#endif
|
|
||||||
delete inst;
|
delete inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1278,47 +1208,6 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
|
|||||||
return messages_return::unhandled;
|
return messages_return::unhandled;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
bool CRecordManager::IsTimeshift(t_channel_id channel_id)
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
CRecordInstance * inst;
|
|
||||||
mutex.lock();
|
|
||||||
if (channel_id != 0)
|
|
||||||
{
|
|
||||||
inst = FindInstance(channel_id);
|
|
||||||
if(inst && inst->tshift_mode)
|
|
||||||
ret = true;
|
|
||||||
else
|
|
||||||
ret = false;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++)
|
|
||||||
{
|
|
||||||
if(it->second->tshift_mode)
|
|
||||||
{
|
|
||||||
mutex.unlock();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mutex.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRecordManager::SetTimeshiftMode(CRecordInstance * inst, int mode)
|
|
||||||
{
|
|
||||||
mutex.lock();
|
|
||||||
/* reset all instances mode ? */
|
|
||||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++)
|
|
||||||
it->second->tshift_mode = TSHIFT_MODE_OFF;
|
|
||||||
|
|
||||||
mutex.unlock();
|
|
||||||
if (inst)
|
|
||||||
inst->tshift_mode = mode;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CRecordManager::StartTimeshift()
|
void CRecordManager::StartTimeshift()
|
||||||
{
|
{
|
||||||
if(g_RemoteControl->is_video_started)
|
if(g_RemoteControl->is_video_started)
|
||||||
@@ -1326,26 +1215,6 @@ void CRecordManager::StartTimeshift()
|
|||||||
std::string tmode = "ptimeshift"; // already recording, pause
|
std::string tmode = "ptimeshift"; // already recording, pause
|
||||||
bool res = true;
|
bool res = true;
|
||||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||||
#if 0
|
|
||||||
if(RecordingStatus(live_channel_id))
|
|
||||||
{
|
|
||||||
tmode = "ptimeshift"; // already recording, pause
|
|
||||||
if(GetRecordMode(live_channel_id) == RECMODE_TSHIFT)
|
|
||||||
SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PAUSE);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if(g_settings.temp_timeshift)
|
|
||||||
{
|
|
||||||
res = StartAutoRecord();
|
|
||||||
SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_TEMPORAER);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
res = Record(live_channel_id);
|
|
||||||
SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PERMANET);
|
|
||||||
}
|
|
||||||
tmode = "timeshift"; // record just started
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* start temporary timeshift if enabled and not running, but dont start second record */
|
/* start temporary timeshift if enabled and not running, but dont start second record */
|
||||||
if (g_settings.temp_timeshift) {
|
if (g_settings.temp_timeshift) {
|
||||||
if (!FindTimeshift()) {
|
if (!FindTimeshift()) {
|
||||||
@@ -1427,10 +1296,6 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
|||||||
|
|
||||||
return menu_return::RETURN_EXIT_ALL;
|
return menu_return::RETURN_EXIT_ALL;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDING_IS_RUNNING));
|
|
||||||
#endif
|
|
||||||
} else if(actionKey == "Timeshift")
|
} else if(actionKey == "Timeshift")
|
||||||
{
|
{
|
||||||
StartTimeshift();
|
StartTimeshift();
|
||||||
@@ -1497,7 +1362,6 @@ bool CRecordManager::ShowMenu(void)
|
|||||||
durations.push_back(duration);
|
durations.push_back(duration);
|
||||||
|
|
||||||
const char* mode_icon = NEUTRINO_ICON_REC;
|
const char* mode_icon = NEUTRINO_ICON_REC;
|
||||||
//if (inst->tshift_mode)
|
|
||||||
if (inst->Timeshift())
|
if (inst->Timeshift())
|
||||||
mode_icon = NEUTRINO_ICON_AUTO_SHIFT;
|
mode_icon = NEUTRINO_ICON_AUTO_SHIFT;
|
||||||
|
|
||||||
@@ -1551,7 +1415,6 @@ bool CRecordManager::ShowMenu(void)
|
|||||||
|
|
||||||
bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
||||||
{
|
{
|
||||||
//int recording_id = 0;
|
|
||||||
std::string title, duration;
|
std::string title, duration;
|
||||||
CRecordInstance * inst;
|
CRecordInstance * inst;
|
||||||
|
|
||||||
@@ -1562,7 +1425,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
|||||||
inst = FindInstance(channel_id);
|
inst = FindInstance(channel_id);
|
||||||
|
|
||||||
if(inst) {
|
if(inst) {
|
||||||
//recording_id = inst->GetRecordingId();
|
|
||||||
inst->GetRecordString(title, duration);
|
inst->GetRecordString(title, duration);
|
||||||
title += duration;
|
title += duration;
|
||||||
}
|
}
|
||||||
@@ -1572,9 +1434,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid)
|
|||||||
|
|
||||||
if(ShowMsg(LOCALE_SHUTDOWN_RECODING_QUERY, title.c_str(),
|
if(ShowMsg(LOCALE_SHUTDOWN_RECODING_QUERY, title.c_str(),
|
||||||
CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes) {
|
CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes) {
|
||||||
#if 0
|
|
||||||
g_Timerd->stopTimerEvent(recording_id);
|
|
||||||
#endif
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (recid)
|
if (recid)
|
||||||
inst = FindInstanceID(recid);
|
inst = FindInstanceID(recid);
|
||||||
|
@@ -163,14 +163,12 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
|
|||||||
|
|
||||||
bool CutBackNeutrino(const t_channel_id channel_id, CFrontend * &frontend);
|
bool CutBackNeutrino(const t_channel_id channel_id, CFrontend * &frontend);
|
||||||
void RestoreNeutrino(void);
|
void RestoreNeutrino(void);
|
||||||
bool CheckRecording(const CTimerd::RecordingInfo * const eventinfo);
|
|
||||||
void StartNextRecording();
|
void StartNextRecording();
|
||||||
void StopPostProcess();
|
void StopPostProcess();
|
||||||
void StopInstance(CRecordInstance * inst, bool remove_event = true);
|
void StopInstance(CRecordInstance * inst, bool remove_event = true);
|
||||||
CRecordInstance * FindInstance(t_channel_id);
|
CRecordInstance * FindInstance(t_channel_id);
|
||||||
CRecordInstance * FindInstanceID(int recid);
|
CRecordInstance * FindInstanceID(int recid);
|
||||||
CRecordInstance * FindTimeshift();
|
CRecordInstance * FindTimeshift();
|
||||||
//void SetTimeshiftMode(CRecordInstance * inst=NULL, int mode=TSHIFT_MODE_OFF);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum record_modes_t
|
enum record_modes_t
|
||||||
@@ -225,7 +223,6 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
|
|||||||
CRecordInstance* getRecordInstance(std::string file);
|
CRecordInstance* getRecordInstance(std::string file);
|
||||||
// old code
|
// old code
|
||||||
#if 0
|
#if 0
|
||||||
bool IsTimeshift(t_channel_id channel_id=0);
|
|
||||||
bool MountDirectory(const char *recordingDir);
|
bool MountDirectory(const char *recordingDir);
|
||||||
bool ChooseRecDir(std::string &dir);
|
bool ChooseRecDir(std::string &dir);
|
||||||
int recordingstatus;
|
int recordingstatus;
|
||||||
|
Reference in New Issue
Block a user