From c5492fbccef5c45b31249ca2e928d07fbe16adde Mon Sep 17 00:00:00 2001 From: woro Date: Mon, 14 Apr 2008 09:15:24 +0000 Subject: get rid of HAVE_OSDMOD, and make USE_BITMAP work on unmodified FF cards. Both by dynamically reducing OSD mem footage until the OSD can handle it. git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@1186 e10066b5-e1e2-0310-b819-94efdf66514b --- vdr_player.c | 144 ++++++++++++++++++++++++++++++++++++----------------------- vdr_player.h | 4 +- 2 files changed, 90 insertions(+), 58 deletions(-) diff --git a/vdr_player.c b/vdr_player.c index 68a6935..7602a24 100644 --- a/vdr_player.c +++ b/vdr_player.c @@ -162,7 +162,7 @@ cmdOsd(NULL) { timeoutShow=0; messagetime=0; lastkeytime=number=timecount=0; - x1=depth=0; + x1=coverdepth=0; framesPerSecond=SecondsToFrames(1); #if APIVERSNUM >= 10338 @@ -307,7 +307,7 @@ mgPlayerControl::InitLayout(void) { fh=27; artistfirst = the_setup.ArtistFirst; - depth = 4; + coverdepth = 4; clrTopBG1 = mgSkin.clrTopBG1; clrTopTextFG1 = mgSkin.clrTopTextFG1; @@ -361,16 +361,28 @@ mgPlayerControl::InitLayout(void) { InfoTop=lh; InfoBottom = PBTop - 1; int imagex1,imagey1,imagex2,imagey2; + listdepth=4; if (the_setup.BackgrMode==1) { CoverWidth = PBBottom-lh; - CoverX = osdwidth - CoverWidth -3*fw -2; - CoverX /=4; - CoverX *=4; - InfoWidth = CoverX -27 -3*fw; - imagex1=Setup.OSDLeft+CoverX-10; - imagey1=Setup.OSDTop+InfoTop; - imagex2=Setup.OSDLeft+CoverX+CoverWidth+3; - imagey2=BottomTop+Setup.OSDTop-1 ; + int areanum; + tArea *pa; + while (1) { + CoverX = osdwidth - CoverWidth -3*fw -2; + CoverX /=4; + CoverX *=4; + InfoWidth = CoverX -27 -3*fw; + imagex1=Setup.OSDLeft+CoverX-10; + imagey1=Setup.OSDTop+InfoTop; + imagex2=Setup.OSDLeft+CoverX+CoverWidth+3; + imagey2=BottomTop+Setup.OSDTop-1; + pa=ProgressAreas(areanum); + if (osd->CanHandleAreas(pa, areanum)!=oeOutOfMemory) + break; + if (listdepth==4) + listdepth=2; + else + CoverWidth--; + } } else if (the_setup.BackgrMode==2) { CoverWidth=0; CoverX = osdwidth; @@ -504,35 +516,45 @@ mgPlayerControl::ShowList(void) { } } +void +mgPlayerControl::DumpAreas(const char *caller,const tArea *Areas, int NumAreas,eOsdError err) { + for (int i=0;iCanHandleAreas(Areas, NumAreas); - if (result == oeOk) + if (result == oeOk) osd->SetAreas(Areas, NumAreas); - else { - for (int i=0;iGetIndex (current_frame, total_frames); if (!osd) { osd=cOsdProvider::NewOsd(Setup.OSDLeft, Setup.OSDTop,50); if (!osd) return; - tArea Area[] = { - { 0, 0, x1 -1, TopHeight, 2 }, // border top - { 0, fh -2, x1 -1, 2*fh -1, 2 }, // between top and tracklist -#ifdef HAVE_OSDMOD - { 0, 2*fh, x1 -1, lh -1, 4 }, // tracklist - { 0, lh, CoverX-1, PBTop-1 , 4 }, // Info -#else - { 0, 2*fh, x1 -1, lh -1, 2 }, // tracklist - { 0, lh, CoverX-1, PBTop-1 , 2 }, // Info -#endif -#ifdef USE_BITMAP - { CoverX, lh, x1 - 1, BottomTop-1, depth }, // Cover -#endif - { 0, PBTop , CoverX-1, BottomTop-1 , 2 }, // Progressbar - { 0, BottomTop , x1 -1, osdheight-1 , 4 }, // Bottom - }; - - if (!SetAreas("ShowProgress",Area,sizeof(Area) / sizeof(tArea))) + InitLayout(); + int num; + tArea* areas=ProgressAreas(num); + if (!SetAreas("ShowProgress",areas,num)) return; //top @@ -1222,10 +1254,8 @@ void mgPlayerControl::LoadCover(void) { #if USE_BITMAP int bmpcolors = 15; // TODO xine can handle 256 - int w1 = CoverWidth; - int h1 = CoverWidth; cMP3Bitmap *bmp; - if ((bmp = cMP3Bitmap::Load(coverpicture, imgalpha, h1, w1, bmpcolors)) !=NULL) { + if ((bmp = cMP3Bitmap::Load(coverpicture, imgalpha, CoverWidth, CoverWidth, bmpcolors)) !=NULL) { osd->DrawRectangle(CoverX, lh, osdwidth -1, PBBottom, clrInfoBG1); osd->DrawBitmap(CoverX , PBBottom -CoverWidth, bmp->Get(), clrTransparent, clrTransparent, true); } diff --git a/vdr_player.h b/vdr_player.h index 520694b..e685cfe 100644 --- a/vdr_player.h +++ b/vdr_player.h @@ -75,7 +75,7 @@ class mgPlayerControl:public cControl, cStatus time_t fliptime, listtime; int rows; int flip, flipint, osdwidth, osdheight, lh, showbuttons; - int x0, x1, depth, CoverX, CoverWidth, TopHeight,BottomTop,PBTop,PBHeight,PBBottom; + int x0, x1, coverdepth, listdepth,CoverX, CoverWidth, TopHeight,BottomTop,PBTop,PBHeight,PBBottom; int InfoTop,InfoWidth,InfoBottom; int lastIndex, lastTotal, prevTop, prevScrollPosition; int framesPerSecond; @@ -151,7 +151,9 @@ class mgPlayerControl:public cControl, cStatus const cFont * OsdFont(void); const cFont * BigFont(void); const cFont * SmallFont(void); + void DumpAreas(const char *caller,const tArea *Areas, int NumAreas,eOsdError err); bool SetAreas(const char *caller,const tArea *Areas, int NumAreas); + tArea * ProgressAreas(int& NumAreas); void Scroll(int by); void ShowCommandMenu(); -- cgit v1.2.3