summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hammerschmid <linux@home.pages.at>2002-08-31 12:19:51 +0200
committerMartin Hammerschmid <linux@home.pages.at>2002-08-31 12:19:51 +0200
commitca0ae4567ef652252372fba01327dd23d9d1b8b0 (patch)
tree92be82098f5f74328dc22ff6d253f47081dc3173
parent2a3f6ddb352317d0f23624ca24fb8240d1cb5026 (diff)
downloadvdr-plugin-lcdproc-ca0ae4567ef652252372fba01327dd23d9d1b8b0.tar.gz
vdr-plugin-lcdproc-ca0ae4567ef652252372fba01327dd23d9d1b8b0.tar.bz2
-rw-r--r--lcd.c73
-rw-r--r--lcd.h4
-rw-r--r--lcdproc.c10
3 files changed, 74 insertions, 13 deletions
diff --git a/lcd.c b/lcd.c
index 950f484..dd61bca 100644
--- a/lcd.c
+++ b/lcd.c
@@ -32,7 +32,7 @@
cLcd::cLcd() {
int i,j;
- connected=false; ThreadStateData.showvolume=false; sock=wid=hgt=cellwid=cellhgt=0;
+ connected=false; ThreadStateData.showvolume=false; ThreadStateData.newscroll=false; sock=wid=hgt=cellwid=cellhgt=0;
replayDvbApi=NULL; primaryDvbApi=NULL;
for (i=0;i<LCDMAXSTATES;i++) for (j=0;j<4;j++) {
@@ -132,6 +132,13 @@ void cLcd::SetMain( unsigned int n, const char *string) {
char line3[wid+1];
if (string != NULL) {
+ cLcd::Copy(ThreadStateData.lcdfullbuffer[n],string,LCDMAXFULLSTRING-3);
+ int i = strlen(ThreadStateData.lcdfullbuffer[n]);
+ ThreadStateData.lcdfullbuffer[n][i++]=' ';
+ ThreadStateData.lcdfullbuffer[n][i++]='*';
+ ThreadStateData.lcdfullbuffer[n][i++]=' ';
+ ThreadStateData.lcdfullbuffer[n][i]='\0';
+ ThreadStateData.newscroll=true;
cLcd::Copy(StringBuffer,string,2*wid);
cLcd::Split(StringBuffer,line2,line3);
}
@@ -314,6 +321,7 @@ void cLcd::SetRunning( bool nownext, const char *string1, const char *string2, c
(string3==NULL || string3[0]=='\0')?"":"|",
(string3==NULL || string3[0]=='\0')?" ":string3);
cLcd::Copy(line1,line,2*wid);
+
if (nownext) {
cLcd::Split(line1,ThreadStateData.lcdbuffer[LCDMISC][2],ThreadStateData.lcdbuffer[LCDMISC][3]);
ThreadStateData.lcddirty[LCDMISC][2]=true; ThreadStateData.lcddirty[LCDMISC][3]=true;
@@ -323,6 +331,14 @@ void cLcd::SetRunning( bool nownext, const char *string1, const char *string2, c
ThreadStateData.lcddirty[LCDTITLE][2]=true; ThreadStateData.lcddirty[LCDTITLE][3]=true;
EndMutualExclusion();
cLcd::SetBuffer(LCDMISC,ThreadStateData.lcdbuffer[LCDTITLE][2],ThreadStateData.lcdbuffer[LCDTITLE][3],NULL,NULL);
+
+ cLcd::Copy(ThreadStateData.lcdfullbuffer[LCDTITLE],line,LCDMAXFULLSTRING-3);
+ int i = strlen(ThreadStateData.lcdfullbuffer[LCDTITLE]);
+ ThreadStateData.lcdfullbuffer[LCDTITLE][i++]=' ';
+ ThreadStateData.lcdfullbuffer[LCDTITLE][i++]='*';
+ ThreadStateData.lcdfullbuffer[LCDTITLE][i++]=' ';
+ ThreadStateData.lcdfullbuffer[LCDTITLE][i]='\0';
+ ThreadStateData.newscroll=true;
}
}
@@ -503,8 +519,8 @@ void cLcd::GetTimeDateStat( char *string, unsigned int OutStateData[] ) {
#define VolumeKeep 1500000 // us
void cLcd::Action(void) { // LCD output thread
- unsigned int i,j, barx=1, bary=1, barl=0;
- int Current=0, Total=1;
+ unsigned int i,j, barx=1, bary=1, barl=0, ScrollState=0, ScrollLine=1;
+ int Current=0, Total=1, scrollpos=0,scrollspeed=3,scrollcnt=0, scrollwait=10, scrollwaitcnt=10;
struct timeval now, voltime;
char workstring[256];
cLcd::ThreadStates PrevState=Menu;
@@ -546,7 +562,8 @@ void cLcd::Action(void) { // LCD output thread
if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
SetRunning(false,Present->GetTimeString(),PresentTitle,PresentSubtitle);
else if (!isempty(PresentTitle)) SetRunning(false,Present->GetTimeString(),PresentTitle);
- }
+ } else
+ SetRunning(false,"No EPG info available.\0", NULL); // XXX tr !!!
if ((Present = Schedule->GetFollowingEvent()) != NULL)
nextLcdUpdate=(Present->GetTime()<nextLcdUpdate)?Present->GetTime():nextLcdUpdate;
}
@@ -564,19 +581,59 @@ void cLcd::Action(void) { // LCD output thread
replayDvbApi->GetIndex(Current, Total, false);
sprintf(tempbuffer,IndexToHMSF(Total));
SetProgress(IndexToHMSF(Current),tempbuffer, (100 * Current) / Total);
- }
+ }
+
+
// copy
BeginMutualExclusion(); // all data needed for output are copied here
memcpy(&OutStateData,&ThreadStateData, sizeof (cLcd::StateData));
- ThreadStateData.showvolume=false;
+ ThreadStateData.showvolume=false;
+ if (ThreadStateData.newscroll) { scrollpos=0; scrollwaitcnt=scrollwait; ThreadStateData.newscroll=false; }
for (i=0;i<LCDMAXSTATES;i++) for (j=0;j<4;j++) {
ThreadStateData.lcddirty[i][j]=false;
Lcddirty[i][j]= Lcddirty[i][j] || OutStateData.lcddirty[i][j];
}
EndMutualExclusion();
+
+ // scroller
+ if ( (OutStateData.State==PrevState) && ( PrevState == Replay || PrevState == Menu || PrevState == Title ) ) {
+ switch (PrevState) {
+ case Replay:
+ ScrollState=LCDREPLAY; ScrollLine=1;
+ break;
+ case Menu:
+ ScrollState=LCDMENU; ScrollLine=1;
+ break;
+ case Title:
+ ScrollState=LCDTITLE; ScrollLine=2;
+ break;
+ default:
+ break;
+ }
+
+ if ( ( strlen(OutStateData.lcdfullbuffer[ScrollState]) > (2*wid+3) )
+ && !(scrollcnt=(scrollcnt+1)%scrollspeed) ) {
+ if ( (scrollpos) || (scrollwaitcnt-- < 1) ) {
+ scrollpos=(scrollpos+1)%strlen(OutStateData.lcdfullbuffer[ScrollState]);
+ if ( scrollpos==1 ) scrollwaitcnt=scrollwait;
+ for (i=0; i<wid; i++) {
+ OutStateData.lcdbuffer[ScrollState][ScrollLine][i]=
+ OutStateData.lcdfullbuffer[ScrollState][(scrollpos+i)%strlen(OutStateData.lcdfullbuffer[ScrollState])];
+ }
+ OutStateData.lcdbuffer[ScrollState][ScrollLine][wid]='\0';
+ for (i=0; i<wid; i++) {
+ OutStateData.lcdbuffer[ScrollState][ScrollLine+1][i]=
+ OutStateData.lcdfullbuffer[ScrollState][(scrollpos+wid+i)%strlen(OutStateData.lcdfullbuffer[ScrollState])];
+ }
+ OutStateData.lcdbuffer[ScrollState][ScrollLine+1][wid]='\0';
+ Lcddirty[ScrollState][ScrollLine]=Lcddirty[ScrollState][ScrollLine+1]=true;
+ }
+ }
+ }
+
// volume
if (OutStateData.showvolume) gettimeofday(&voltime,NULL);
@@ -596,7 +653,7 @@ void cLcd::Action(void) { // LCD output thread
switch (OutStateData.State) {
case Menu: // display menu = 0
- LineMode=1;
+ LineMode=1; if (!volume) { OutStateData.barx=1; OutStateData.bary=1; OutStateData.barl=0; }
if (PrevState != Menu) for (i=0;i<4;i++) Lcddirty[LCDMENU][i]=true;
for (i=0;i<4;i++) if (Lcddirty[LCDMENU][i]) {
cLcd::Write(i+1,OutStateData.lcdbuffer[LCDMENU][i]);
@@ -625,7 +682,7 @@ void cLcd::Action(void) { // LCD output thread
cLcd::GetTimeDateStat(workstring,OutStateData.CardStat);
cLcd::Write(1,workstring);
}
- if (PrevState != Replay) for (i=1;i<4;i++) Lcddirty[LCDREPLAY][i]=true;
+ if (PrevState != Replay) { scrollpos=0; for (i=1;i<4;i++) Lcddirty[LCDREPLAY][i]=true; }
for (i=1;i<4;i++) if (Lcddirty[LCDREPLAY][i]) {
cLcd::Write(i+1,OutStateData.lcdbuffer[LCDREPLAY][i]);
Lcddirty[LCDREPLAY][i]=false;
diff --git a/lcd.h b/lcd.h
index bc3a44b..791922c 100644
--- a/lcd.h
+++ b/lcd.h
@@ -12,6 +12,7 @@
#define LCDMAXSTATEBUF 5
#define LCDMAXWID 40
#define LCDMAXCARDS 4
+#define LCDMAXFULLSTRING 1024
class cLcd : public cThread {
public:
@@ -22,7 +23,8 @@ class cLcd : public cThread {
int LastStateP,LineMode;
struct StateData {
char lcdbuffer[LCDMAXSTATES][4][LCDMAXWID+1];
- bool lcddirty[LCDMAXSTATES][4], muted, showvolume;
+ char lcdfullbuffer[LCDMAXSTATES][LCDMAXFULLSTRING];
+ bool lcddirty[LCDMAXSTATES][4], muted, showvolume, newscroll;
ThreadStates State;
unsigned int barx, bary, barl, volume;
unsigned int CardStat[LCDMAXCARDS];
diff --git a/lcdproc.c b/lcdproc.c
index e556d0b..a0f44c6 100644
--- a/lcdproc.c
+++ b/lcdproc.c
@@ -1,5 +1,5 @@
/*
- * status.c: A plugin for the Video Disk Recorder
+ * lcdproc.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
@@ -13,7 +13,7 @@
#include <vdr/recording.h>
#include "lcd.h"
-static const char *VERSION = "0.0.2";
+static const char *VERSION = "0.0.3";
static const char *MAINMENUENTRY = NULL;
#ifdef LCD_hd44780
static const char *DESCRIPTION = "LCDproc using hd44780 output-mapping";
@@ -58,7 +58,8 @@ void cLcdFeed::ChannelSwitch(const cDevice *Device, int ChannelNumber)
syslog(LOG_INFO, "lcdproc: cLcdFeed::ChannelSwitch %d %d", Device->CardIndex(), ChannelNumber);
if (ChannelNumber) {
LCDproc->SetLine(1,2," ");
- LCDproc->SetLine(1,3," ");
+ LCDproc->SetLine(1,3," ");
+ LCDproc->SetRunning(false,"No EPG info available.\0", NULL); // XXX tr !!!
switched = true;
} else switched = false;
if (Device) LCDproc->SetPrimaryDevice( (cDevice *) Device );
@@ -183,6 +184,7 @@ void cLcdFeed::OsdProgramme(time_t PresentTime, const char *PresentTitle, const
if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
LCDproc->SetRunning(false,buffer,PresentTitle,PresentSubtitle);
else if (!isempty(PresentTitle)) LCDproc->SetRunning(false,buffer,PresentTitle);
+ else LCDproc->SetRunning(false,"No EPG info available.\0", NULL); // XXX tr !!!
strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
@@ -192,7 +194,7 @@ void cLcdFeed::OsdProgramme(time_t PresentTime, const char *PresentTitle, const
if ( (!isempty(FollowingTitle)) && (!isempty(FollowingSubtitle)) )
LCDproc->SetRunning(true,buffer,FollowingTitle,FollowingSubtitle);
else if (!isempty(FollowingTitle)) LCDproc->SetRunning(true,buffer,FollowingTitle);
-
+ else LCDproc->SetRunning(true,"No EPG info available.\0", NULL); // XXX tr !!!
}
// ---