Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Bug in 'PauseLiveVideo'
Hello,
after playing with the ''PauseLiveVideo' function in vdr 1.2.1 today i've
noticed the following bug:
If you stop the live-view and call again the pause-function (on the same
channel), sometimes vdr dies. If this happens, the last eintries in the log
are:
Jun 14 22:35:57 linux vdr[15822]: already recording:
'/video/@Tremors_2_-_Die_Rückkehr_der_Raketenwürmer__/2003-06-14.22.35.10.01.rec'
Jun 14 22:35:59 linux vdr[15822]: replay (null)
This happens only if the new start of the PauseLiveVideo is in the same minute
as start before because the generated name for the timer is the same. You can
find the code which caused this behavior in menu.c, cRecordControl
constructor, after the comment "crude attempt to avoid duplicate recordings:"
If you stop the live-view and call again the pause-function (on the same
channel) at least 1 minute after the first call, vdr will create again a
recording timer for this channel. Now you have 2 recordings for the same
channel, as you can also see in the menu( my current record is 6 recordings
for the same channel). Next error: if you use the menu-function 'stop
recording <instantId>' for one of these recordings, all of them will be
stopped.
In my opinion the PausLiveVideo-function should reenter the current
instant-recording of the channel if there is one. This could be done by
checking the instantId of the cRecordControl-entries when PauseLiveVideo is
invoked. If you agree with this you can test the following patch.
Greetings
diff -Nru vdr-1.2.1/include/vdr/menu.h vdr-1.2.1patch/include/vdr/menu.h
--- vdr-1.2.1/include/vdr/menu.h 2003-06-14 10:40:42.000000000 +0200
+++ vdr-1.2.1patch/include/vdr/menu.h 2003-06-14 15:44:45.000000000 +0200
@@ -138,6 +138,7 @@
static bool PauseLiveVideo(void);
static const char *GetInstantId(const char *LastInstantId);
static cRecordControl *GetRecordControl(const char *FileName);
+ static cRecordControl *GetRecordControlByInstantId(const char *InstantId);
static void Process(time_t t);
static bool Active(void);
static void Shutdown(void);
diff -Nru vdr-1.2.1/menu.c vdr-1.2.1patch/menu.c
--- vdr-1.2.1/menu.c 2003-06-14 10:40:42.000000000 +0200
+++ vdr-1.2.1patch/menu.c 2003-06-15 00:10:21.000000000 +0200
@@ -3115,12 +3115,35 @@
bool cRecordControls::PauseLiveVideo(void)
{
+ char *theInstantId = NULL;
+ cTimer *timer = new cTimer(true, true);
+ cDevice *device = cDevice::PrimaryDevice();//XXX
+ asprintf(&theInstantId, cDevice::NumDevices() > 1 ? "%s - %d" : "%s", timer->Channel()->Name(), device->CardIndex() + 1);
+ delete timer;
+ cRecordControl *cRC = cRecordControls::GetRecordControlByInstantId(theInstantId);
+ free(theInstantId);
+
Interface->Open(Setup.OSDwidth, -1);
- Interface->Status(tr("Pausing live video..."));
- Interface->Flush();
- cReplayControl::SetRecording(NULL, NULL); // make sure the new cRecordControl will set cReplayControl::LastReplayed()
- if (Start(NULL, true)) {
- sleep(2); // allow recorded file to fill up enough to start replaying
+
+ bool bStartOk = false;
+ if (cRC != NULL){
+ Interface->Status(tr("Resume live video..."));
+ Interface->Flush();
+ cReplayControl::SetRecording(cRC->FileName(), NULL);
+ bStartOk = true;
+ }
+ else
+ {
+ Interface->Status(tr("Pausing live video..."));
+ Interface->Flush();
+ cReplayControl::SetRecording(NULL, NULL); // make sure the new cRecordControl will set cReplayControl::LastReplayed()
+ if (Start(NULL, true))
+ {
+ bStartOk = true;
+ sleep(2); // allow recorded file to fill up enough to start replaying
+ }
+ }
+ if (bStartOk) {
cReplayControl *rc = new cReplayControl;
cControl::Launch(rc);
cControl::Attach();
@@ -3155,6 +3178,19 @@
return NULL;
}
+cRecordControl *cRecordControls::GetRecordControlByInstantId(const char *InstantId)
+{
+ if( InstantId == NULL )
+ return NULL;
+ dsyslog("GetRecordControlByInstantId instantId: '%s'", InstantId);
+ for (int i = 0; i < MAXRECORDCONTROLS; i++) {
+ dsyslog("GetRecordControlByInstantId %d instantId: '%s'",i, (RecordControls[i] != NULL ? RecordControls[i]->InstantId() : ""));
+ if (RecordControls[i] && RecordControls[i]->InstantId() != NULL && strcmp(RecordControls[i]->InstantId(), InstantId) == 0)
+ return RecordControls[i];
+ }
+ return NULL;
+}
+
void cRecordControls::Process(time_t t)
{
for (int i = 0; i < MAXRECORDCONTROLS; i++) {
diff -Nru vdr-1.2.1/menu.h vdr-1.2.1patch/menu.h
--- vdr-1.2.1/menu.h 2003-06-14 10:40:42.000000000 +0200
+++ vdr-1.2.1patch/menu.h 2003-06-14 15:44:45.000000000 +0200
@@ -138,6 +138,7 @@
static bool PauseLiveVideo(void);
static const char *GetInstantId(const char *LastInstantId);
static cRecordControl *GetRecordControl(const char *FileName);
+ static cRecordControl *GetRecordControlByInstantId(const char *InstantId);
static void Process(time_t t);
static bool Active(void);
static void Shutdown(void);
Home |
Main Index |
Thread Index