mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
- recording: add timer logic to ensure recording messages are readable for all users
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1750 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -98,6 +98,7 @@ CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo,
|
|||||||
recMovieInfo = new MI_MOVIE_INFO();
|
recMovieInfo = new MI_MOVIE_INFO();
|
||||||
record = NULL;
|
record = NULL;
|
||||||
tshift_mode = TSHIFT_MODE_OFF;
|
tshift_mode = TSHIFT_MODE_OFF;
|
||||||
|
rec_stop_msg = g_Locale->getText(LOCALE_RECORDING_STOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRecordInstance::~CRecordInstance()
|
CRecordInstance::~CRecordInstance()
|
||||||
@@ -126,11 +127,18 @@ bool CRecordInstance::SaveXml()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRecordInstance::WaitRecMsg(time_t StartTime, time_t WaitTime)
|
||||||
|
{
|
||||||
|
while (time(0) < StartTime + WaitTime)
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
|
||||||
record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList &apid_list*/)
|
record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList &apid_list*/)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
std::string tsfile;
|
std::string tsfile;
|
||||||
|
|
||||||
|
time_t msg_start_time = time(0);
|
||||||
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_RECORDING_START));
|
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_RECORDING_START));
|
||||||
hintBox.paint();
|
hintBox.paint();
|
||||||
|
|
||||||
@@ -187,6 +195,7 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel /*, APIDList &
|
|||||||
ca->SendPMT(DEMUX_SOURCE_2, pmt, len);
|
ca->SendPMT(DEMUX_SOURCE_2, pmt, len);
|
||||||
|
|
||||||
//CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true);
|
//CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true);
|
||||||
|
WaitRecMsg(msg_start_time, 2);
|
||||||
hintBox.hide();
|
hintBox.hide();
|
||||||
return RECORD_OK;
|
return RECORD_OK;
|
||||||
}
|
}
|
||||||
@@ -198,7 +207,7 @@ bool CRecordInstance::Stop(bool remove_event)
|
|||||||
time_t end_time = time(0);
|
time_t end_time = time(0);
|
||||||
recMovieInfo->length = (int) round((double) (end_time - start_time) / (double) 60);
|
recMovieInfo->length = (int) round((double) (end_time - start_time) / (double) 60);
|
||||||
|
|
||||||
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_RECORDING_STOP));
|
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, rec_stop_msg.c_str());
|
||||||
hintBox.paint();
|
hintBox.paint();
|
||||||
|
|
||||||
printf("%s: channel %llx recording_id %d\n", __FUNCTION__, channel_id, recording_id);
|
printf("%s: channel %llx recording_id %d\n", __FUNCTION__, channel_id, recording_id);
|
||||||
@@ -219,6 +228,7 @@ bool CRecordInstance::Stop(bool remove_event)
|
|||||||
recording_id = 0;
|
recording_id = 0;
|
||||||
}
|
}
|
||||||
//CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, false);
|
//CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, false);
|
||||||
|
WaitRecMsg(end_time, 2);
|
||||||
hintBox.hide();
|
hintBox.hide();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1151,19 +1161,20 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
|||||||
{
|
{
|
||||||
snprintf(rec_msg1, sizeof(rec_msg1)-1, "%s", g_Locale->getText(LOCALE_RECORDINGMENU_MULTIMENU_INFO_STOP_ALL));
|
snprintf(rec_msg1, sizeof(rec_msg1)-1, "%s", g_Locale->getText(LOCALE_RECORDINGMENU_MULTIMENU_INFO_STOP_ALL));
|
||||||
snprintf(rec_msg, sizeof(rec_msg)-1, rec_msg1, records);
|
snprintf(rec_msg, sizeof(rec_msg)-1, rec_msg1, records);
|
||||||
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, rec_msg);
|
|
||||||
hintBox->paint();
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int recording_ids[RECORD_MAX_COUNT];
|
int recording_ids[RECORD_MAX_COUNT];
|
||||||
t_channel_id channel_ids[RECORD_MAX_COUNT];
|
t_channel_id channel_ids[RECORD_MAX_COUNT];
|
||||||
t_channel_id channel_id;
|
t_channel_id channel_id;
|
||||||
recmap_iterator_t it;
|
recmap_iterator_t it;
|
||||||
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
for(it = recmap.begin(); it != recmap.end(); it++)
|
for(it = recmap.begin(); it != recmap.end(); it++)
|
||||||
{
|
{
|
||||||
recording_ids[i] = 0;
|
recording_ids[i] = 0;
|
||||||
channel_id = it->first;
|
channel_id = it->first;
|
||||||
CRecordInstance * inst = it->second;
|
CRecordInstance * inst = it->second;
|
||||||
|
inst-> SetStopMessage(rec_msg);
|
||||||
if(inst)
|
if(inst)
|
||||||
{
|
{
|
||||||
channel_ids[i] = channel_id;
|
channel_ids[i] = channel_id;
|
||||||
@@ -1179,6 +1190,7 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
|||||||
{
|
{
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
CRecordInstance * inst = FindInstance(channel_ids[i2]);
|
CRecordInstance * inst = FindInstance(channel_ids[i2]);
|
||||||
|
inst-> SetStopMessage(rec_msg);
|
||||||
if(inst == NULL || recording_ids[i2] != inst->GetRecordingId())
|
if(inst == NULL || recording_ids[i2] != inst->GetRecordingId())
|
||||||
{
|
{
|
||||||
printf("CRecordManager::exec(ExitAll) channel %llx event id %d not found\n", channel_ids[i2], recording_ids[i2]);
|
printf("CRecordManager::exec(ExitAll) channel %llx event id %d not found\n", channel_ids[i2], recording_ids[i2]);
|
||||||
@@ -1190,8 +1202,6 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
|||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hintBox->hide();
|
|
||||||
delete hintBox;
|
|
||||||
}
|
}
|
||||||
return menu_return::RETURN_EXIT_ALL;
|
return menu_return::RETURN_EXIT_ALL;
|
||||||
}else if(actionKey == "Record")
|
}else if(actionKey == "Record")
|
||||||
|
@@ -92,6 +92,7 @@ class CRecordInstance
|
|||||||
|
|
||||||
std::string Directory;
|
std::string Directory;
|
||||||
char filename[FILENAMEBUFFERSIZE];
|
char filename[FILENAMEBUFFERSIZE];
|
||||||
|
std::string rec_stop_msg;
|
||||||
|
|
||||||
CMovieInfo * cMovieInfo;
|
CMovieInfo * cMovieInfo;
|
||||||
MI_MOVIE_INFO * recMovieInfo;
|
MI_MOVIE_INFO * recMovieInfo;
|
||||||
@@ -104,6 +105,7 @@ class CRecordInstance
|
|||||||
record_error_msg_t MakeFileName(CZapitChannel * channel);
|
record_error_msg_t MakeFileName(CZapitChannel * channel);
|
||||||
bool SaveXml();
|
bool SaveXml();
|
||||||
record_error_msg_t Start(CZapitChannel * channel /*, APIDList &apid_list*/);
|
record_error_msg_t Start(CZapitChannel * channel /*, APIDList &apid_list*/);
|
||||||
|
void WaitRecMsg(time_t StartTime, time_t WaitTime);
|
||||||
public:
|
public:
|
||||||
CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false);
|
CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false);
|
||||||
~CRecordInstance();
|
~CRecordInstance();
|
||||||
@@ -120,6 +122,7 @@ class CRecordInstance
|
|||||||
const char * GetFileName() { return filename; };
|
const char * GetFileName() { return filename; };
|
||||||
bool Timeshift() { return autoshift; };
|
bool Timeshift() { return autoshift; };
|
||||||
int tshift_mode;
|
int tshift_mode;
|
||||||
|
void SetStopMessage(const char* text) {rec_stop_msg = text;} ;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<t_channel_id, CRecordInstance*> recmap_t;
|
typedef std::map<t_channel_id, CRecordInstance*> recmap_t;
|
||||||
|
Reference in New Issue
Block a user