mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
driver/record.cpp: bug fixes for multi-record of the same channel, WIP
This commit is contained in:
@@ -883,8 +883,6 @@ bool CRecordManager::StartAutoRecord()
|
|||||||
|
|
||||||
bool CRecordManager::StopAutoRecord()
|
bool CRecordManager::StopAutoRecord()
|
||||||
{
|
{
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
printf("%s: autoshift %d\n", __FUNCTION__, autoshift);
|
printf("%s: autoshift %d\n", __FUNCTION__, autoshift);
|
||||||
|
|
||||||
g_RCInput->killTimer (shift_timer);
|
g_RCInput->killTimer (shift_timer);
|
||||||
@@ -893,24 +891,26 @@ bool CRecordManager::StopAutoRecord()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
CRecordInstance * inst = NULL;
|
||||||
CRecordInstance * inst = FindInstance(live_channel_id);
|
for (recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
||||||
if(inst && inst->Timeshift())
|
if (it->second->Timeshift()) {
|
||||||
found = true;
|
inst = it->second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inst)
|
||||||
|
StopInstance(inst);
|
||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
if(found) {
|
return (inst != NULL);
|
||||||
Stop(live_channel_id);
|
|
||||||
autoshift = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return found;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
if((eventinfo->channel_id == live_channel_id) || !SAME_TRANSPONDER(eventinfo->channel_id, live_channel_id))
|
/* 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();
|
StopAutoRecord();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -923,8 +923,9 @@ void CRecordManager::StartNextRecording()
|
|||||||
printf("%s: pending count %d\n", __FUNCTION__, nextmap.size());
|
printf("%s: pending count %d\n", __FUNCTION__, nextmap.size());
|
||||||
|
|
||||||
for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) {
|
for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) {
|
||||||
bool tested = true;
|
|
||||||
eventinfo = *it;
|
eventinfo = *it;
|
||||||
|
#if 0
|
||||||
|
bool tested = true;
|
||||||
if( !recmap.empty() ) {
|
if( !recmap.empty() ) {
|
||||||
CRecordInstance * inst = FindInstance(eventinfo->channel_id);
|
CRecordInstance * inst = FindInstance(eventinfo->channel_id);
|
||||||
/* same channel recording and not auto - skip */
|
/* same channel recording and not auto - skip */
|
||||||
@@ -936,16 +937,22 @@ void CRecordManager::StartNextRecording()
|
|||||||
else {
|
else {
|
||||||
/* there are some recordings, test any (first) for now */
|
/* there are some recordings, test any (first) for now */
|
||||||
recmap_iterator_t fit = recmap.begin();
|
recmap_iterator_t fit = recmap.begin();
|
||||||
t_channel_id channel_id = fit->first;
|
t_channel_id channel_id = fit->second->GetChannelId();
|
||||||
tested = (SAME_TRANSPONDER(channel_id, eventinfo->channel_id));
|
tested = (SAME_TRANSPONDER(channel_id, eventinfo->channel_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tested) {
|
if(tested)
|
||||||
|
#endif
|
||||||
|
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id);
|
||||||
|
if (channel && CFEManager::getInstance()->canTune(channel))
|
||||||
|
{
|
||||||
//MountDirectory(eventinfo->recordingDir);//FIXME in old neutrino startNextRecording commented
|
//MountDirectory(eventinfo->recordingDir);//FIXME in old neutrino startNextRecording commented
|
||||||
bool ret = Record(eventinfo);
|
bool ret = Record(eventinfo);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
it = nextmap.erase(it);
|
|
||||||
delete[] (unsigned char *) eventinfo;
|
delete[] (unsigned char *) eventinfo;
|
||||||
|
it = nextmap.erase(it++);
|
||||||
|
if (it == nextmap.end())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -986,7 +993,7 @@ bool CRecordManager::SameTransponder(const t_channel_id channel_id)
|
|||||||
same = true;
|
same = true;
|
||||||
else {
|
else {
|
||||||
recmap_iterator_t fit = recmap.begin();
|
recmap_iterator_t fit = recmap.begin();
|
||||||
t_channel_id id = fit->first;
|
t_channel_id id = fit->second->GetChannelId();
|
||||||
same = (SAME_TRANSPONDER(channel_id, id));
|
same = (SAME_TRANSPONDER(channel_id, id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -996,8 +1003,9 @@ bool CRecordManager::SameTransponder(const t_channel_id channel_id)
|
|||||||
|
|
||||||
void CRecordManager::StopInstance(CRecordInstance * inst, bool remove_event)
|
void CRecordManager::StopInstance(CRecordInstance * inst, bool remove_event)
|
||||||
{
|
{
|
||||||
inst->Stop(remove_event);
|
/* first erase - then stop, because Stop() reset recording_id to 0 */
|
||||||
recmap.erase(inst->GetRecordingId());
|
recmap.erase(inst->GetRecordingId());
|
||||||
|
inst->Stop(remove_event);
|
||||||
|
|
||||||
if(inst->Timeshift())
|
if(inst->Timeshift())
|
||||||
autoshift = false;
|
autoshift = false;
|
||||||
@@ -1200,7 +1208,6 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey )
|
|||||||
mutex.lock();
|
mutex.lock();
|
||||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++)
|
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++)
|
||||||
{
|
{
|
||||||
//t_channel_id channel_id = it->first;
|
|
||||||
CRecordInstance * inst = it->second;
|
CRecordInstance * inst = it->second;
|
||||||
t_channel_id channel_id = inst->GetChannelId();
|
t_channel_id channel_id = inst->GetChannelId();
|
||||||
|
|
||||||
@@ -1294,10 +1301,9 @@ bool CRecordManager::ShowMenu(void)
|
|||||||
|
|
||||||
int i = 0 , shortcut = 1;
|
int i = 0 , shortcut = 1;
|
||||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
||||||
t_channel_id channel_id = it->first;
|
|
||||||
CRecordInstance * inst = it->second;
|
CRecordInstance * inst = it->second;
|
||||||
|
|
||||||
channel_ids[i] = channel_id;
|
channel_ids[i] = inst->GetChannelId();
|
||||||
recording_ids[i] = inst->GetRecordingId();
|
recording_ids[i] = inst->GetRecordingId();
|
||||||
|
|
||||||
std::string title;
|
std::string title;
|
||||||
@@ -1443,7 +1449,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, const int mo
|
|||||||
found = true;
|
found = true;
|
||||||
} else {
|
} else {
|
||||||
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) {
|
||||||
if(SAME_TRANSPONDER(it->first, channel_id)) {
|
if(SAME_TRANSPONDER(it->second->GetChannelId(), channel_id)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user