mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
driver/record.cpp: split record and timeshift,
return record mask in GetRecordMode(), comment almost unused tshift_mode - for menu enough to check is this timeshift or not
This commit is contained in:
@@ -709,13 +709,26 @@ CRecordInstance * CRecordManager::FindInstanceID(int recid)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MI_MOVIE_INFO * CRecordManager::GetMovieInfo(t_channel_id channel_id)
|
CRecordInstance * CRecordManager::FindTimeshift()
|
||||||
|
{
|
||||||
|
for (recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
||||||
|
if (it->second->Timeshift())
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MI_MOVIE_INFO * CRecordManager::GetMovieInfo(t_channel_id channel_id, bool timeshift)
|
||||||
{
|
{
|
||||||
//FIXME copy MI_MOVIE_INFO ?
|
//FIXME copy MI_MOVIE_INFO ?
|
||||||
MI_MOVIE_INFO * mi = NULL;
|
MI_MOVIE_INFO * mi = NULL;
|
||||||
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
CRecordInstance * inst = FindInstance(channel_id);
|
CRecordInstance * inst = NULL;
|
||||||
|
if (timeshift)
|
||||||
|
inst = FindTimeshift();
|
||||||
|
if (inst == NULL)
|
||||||
|
inst = FindInstance(channel_id);
|
||||||
if (inst)
|
if (inst)
|
||||||
mi = inst->GetMovieInfo();
|
mi = inst->GetMovieInfo();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
@@ -731,8 +744,10 @@ const std::string CRecordManager::GetFileName(t_channel_id channel_id)
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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))
|
||||||
{
|
{
|
||||||
if (RecordingStatus(channel_id) && !IsTimeshift(channel_id))
|
if (RecordingStatus(channel_id) && !IsTimeshift(channel_id))
|
||||||
@@ -753,6 +768,27 @@ int CRecordManager::GetRecordMode(const t_channel_id channel_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RECMODE_OFF;
|
return RECMODE_OFF;
|
||||||
|
#endif
|
||||||
|
int recmode = RECMODE_OFF;
|
||||||
|
mutex.lock();
|
||||||
|
if (channel_id == 0) {
|
||||||
|
/* we can have only one timeshift instance, if there are more - some is record */
|
||||||
|
if ((!autoshift && !recmap.empty()) || recmap.size() > 1)
|
||||||
|
recmode |= RECMODE_REC;
|
||||||
|
if (autoshift)
|
||||||
|
recmode |= RECMODE_TSHIFT;
|
||||||
|
} else {
|
||||||
|
for (recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
||||||
|
if (it->second->GetChannelId() == channel_id) {
|
||||||
|
if (it->second->Timeshift())
|
||||||
|
recmode |= RECMODE_TSHIFT;
|
||||||
|
else
|
||||||
|
recmode |= RECMODE_REC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex.unlock();
|
||||||
|
return recmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRecordManager::Record(const t_channel_id channel_id, const char * dir, bool timeshift)
|
bool CRecordManager::Record(const t_channel_id channel_id, const char * dir, bool timeshift)
|
||||||
@@ -909,13 +945,8 @@ bool CRecordManager::StopAutoRecord(bool lock)
|
|||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
CRecordInstance * inst = NULL;
|
|
||||||
for (recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
CRecordInstance * inst = FindTimeshift();
|
||||||
if (it->second->Timeshift()) {
|
|
||||||
inst = it->second;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inst)
|
if (inst)
|
||||||
StopInstance(inst);
|
StopInstance(inst);
|
||||||
|
|
||||||
@@ -978,6 +1009,7 @@ void CRecordManager::StartNextRecording()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return true, if there are any recording running for this channel id, or global if id is 0 */
|
||||||
bool CRecordManager::RecordingStatus(const t_channel_id channel_id)
|
bool CRecordManager::RecordingStatus(const t_channel_id channel_id)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
@@ -1176,9 +1208,10 @@ void CRecordManager::StartTimeshift()
|
|||||||
{
|
{
|
||||||
if(g_RemoteControl->is_video_started)
|
if(g_RemoteControl->is_video_started)
|
||||||
{
|
{
|
||||||
std::string tmode;
|
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))
|
if(RecordingStatus(live_channel_id))
|
||||||
{
|
{
|
||||||
tmode = "ptimeshift"; // already recording, pause
|
tmode = "ptimeshift"; // already recording, pause
|
||||||
@@ -1197,6 +1230,19 @@ void CRecordManager::StartTimeshift()
|
|||||||
}
|
}
|
||||||
tmode = "timeshift"; // record just started
|
tmode = "timeshift"; // record just started
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
/* start temporary timeshift if enabled and not running, but dont start second record */
|
||||||
|
if (g_settings.temp_timeshift) {
|
||||||
|
if (!FindTimeshift()) {
|
||||||
|
res = StartAutoRecord();
|
||||||
|
tmode = "timeshift"; // record just started
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!RecordingStatus(live_channel_id)) {
|
||||||
|
res = Record(live_channel_id);
|
||||||
|
tmode = "timeshift"; // record just started
|
||||||
|
}
|
||||||
|
|
||||||
if(res)
|
if(res)
|
||||||
{
|
{
|
||||||
CMoviePlayerGui::getInstance().exec(NULL, tmode);
|
CMoviePlayerGui::getInstance().exec(NULL, tmode);
|
||||||
@@ -1328,7 +1374,8 @@ bool CRecordManager::ShowMenu(void)
|
|||||||
inst->GetRecordString(title);
|
inst->GetRecordString(title);
|
||||||
|
|
||||||
const char* mode_icon = NULL;
|
const char* mode_icon = NULL;
|
||||||
if (inst->tshift_mode)
|
//if (inst->tshift_mode)
|
||||||
|
if (inst->Timeshift())
|
||||||
mode_icon = NEUTRINO_ICON_AUTO_SHIFT;
|
mode_icon = NEUTRINO_ICON_AUTO_SHIFT;
|
||||||
|
|
||||||
sprintf(cnt, "%d", i);
|
sprintf(cnt, "%d", i);
|
||||||
|
@@ -162,6 +162,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
|
|||||||
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();
|
||||||
void SetTimeshiftMode(CRecordInstance * inst=NULL, int mode=TSHIFT_MODE_OFF);
|
void SetTimeshiftMode(CRecordInstance * inst=NULL, int mode=TSHIFT_MODE_OFF);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -189,7 +190,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/
|
|||||||
bool StartAutoRecord();
|
bool StartAutoRecord();
|
||||||
bool StopAutoRecord(bool lock = true);
|
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, bool timeshift = true);
|
||||||
const std::string GetFileName(const t_channel_id channel_id);
|
const std::string GetFileName(const t_channel_id channel_id);
|
||||||
|
|
||||||
bool RunStartScript(void);
|
bool RunStartScript(void);
|
||||||
|
Reference in New Issue
Block a user