]> git.vomp.tv Git - vompclient.git/commitdiff
Replace old jpeg rendering with hardware accelarated TVMedia rendering also for inter...
authorMarten Richter <marten.richter@freenet.de>
Sat, 6 Sep 2014 13:39:44 +0000 (15:39 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sat, 6 Sep 2014 13:39:44 +0000 (15:39 +0200)
13 files changed:
command.cc
imageomx.cc
imageomx.h
message.h
osdopenvg.cc
osdopenvg.h
osdvector.cc
osdvector.h
surfacevector.cc
tvmedia.cc
tvmedia.h
vdr.cc
vdr.h

index eb7a4ea2d9f3cc048b7b09a578a81c051eb0b86f..8094a26ab64cda45bf983d70ad84033b7944a5d6 100644 (file)
@@ -454,6 +454,14 @@ void Command::processMessage(Message* m)
          }
 
       } break;
+      case Message::NEW_PICTURE_STATIC:
+      {
+         OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+         if (osdv) {
+                 osdv->informPicture(((long long)m->tag)<<32LL,m->parameter);
+         }
+
+      } break;
     }
   }
   else
index e12b86ad9b3fa76f1d409593ff889e5fb0f28f98..bd75d6eb4525bf1a93716cfdea4e491ca72846a9 100644 (file)
@@ -125,7 +125,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length)
        OMX_ERRORTYPE error;
        static OMX_CALLBACKTYPE callbacks= {&VideoOMX::EventHandler_OMX,&EmptyBufferDone_OMX,&FillBufferDone_OMX};
 
-       Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX");
+       //Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX");
        //Clock, move later to Image
        VideoOMX *video=(VideoOMX*)Video::getInstance();
 
@@ -228,7 +228,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length)
 
 
 
-       Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX finished");
+       //Log::getInstance()->log("Image", Log::NOTICE, "Allocate Codecs OMX finished");
 
        return 1;
 }
@@ -238,7 +238,7 @@ int ImageOMX::AllocateCodecsOMX(unsigned char * buffer, unsigned int length)
 
 
 
-bool ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length)
+bool ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem)
 {
        if (pictInfValid) return false; // does support only one image at a Time;
 //     Log::getInstance()->log("Image", Log::DEBUG,
@@ -266,7 +266,7 @@ bool ImageOMX::decodePicture(LoadIndex index, unsigned char * buffer, unsigned i
        DeAllocateCodecsOMX();
        pthread_setcancelstate(oldcancelstate, NULL);
        pthread_setcanceltype(oldcanceltype, NULL);
-       if (ret) free(buffer);
+       if (ret && freemem) free(buffer);
 
        return ret;
 }
index dbc2af7476e5d2bf07dde2d72a272ce59d473132..1921c402a483b0bec9565b49cde9043883671079 100644 (file)
@@ -51,7 +51,7 @@ class ImageOMX : public OsdVector::PictureDecoder
     void init();
     void shutdown();
 
-    bool decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length);
+    bool decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem);
     bool getDecodedPicture(struct OsdVector::PictureInfo& pict_inf);
     void freeReference(void * ref);
 
index e79a5a3e22e5dae0e53316e6c962eaf70eadaf42..a8d10d30f71fc8da25e4ad10a89d2dfa6d6f6dcf 100644 (file)
--- a/message.h
+++ b/message.h
@@ -78,6 +78,7 @@ class Message
     const static ULONG SUBTITLE_CHANGE_CHANNEL = 34;
     const static ULONG MOUSE_ANDROID_SCROLL = 35;
     const static ULONG NEW_PICTURE = 36;
+    const static ULONG NEW_PICTURE_STATIC = 37;
 };
 
 #endif
index 9868bf57c79ccea77958fdfea618b905f1dfd42b..5caf58152c2f22ca86b41e61c6557383902aee0e 100644 (file)
@@ -23,7 +23,7 @@
 #include "mtd.h"
 #include "videoomx.h"
 #include "surface.h"
-#include <Magick++.h>
+//#include <Magick++.h>
 
 #include "message.h"
 #include "command.h"
@@ -35,7 +35,7 @@
 #include <math.h>
 #include <bcm_host.h>
 
-using namespace Magick;
+//using namespace Magick;
 
 extern uint8_t vdr_data[]     asm("_binary_other_vdrhires_jpg_start");
 extern uint8_t vdr_data_end[] asm("_binary_other_vdrhires_jpg_end");
@@ -292,7 +292,7 @@ int OsdOpenVG::init(void* device)
   /*if (((VideoOMX*)Video::getInstance())->initUsingOSDObjects()!=1) { //call Video for init  stuff
          return 0;
   }*/
-  InitializeMagick("");
// InitializeMagick("");
 
 
 
@@ -368,7 +368,7 @@ int OsdOpenVG::stopUpdate()
        processTasks();
        return 1;
 }
-
+/*
 void OsdOpenVG::purgeAllReferences()
 {
        images_ref.clear();
@@ -382,12 +382,19 @@ void OsdOpenVG::purgeAllReferences()
        }
        monobitmaps.clear();
 
-       map<string,ImageIndex>::iterator jitty=jpegs.begin();
+       /*map<string,ImageIndex>::iterator jitty=jpegs.begin();
        while (jitty!=jpegs.end()) {
                vgDestroyImage((VGImage)(*jitty).second);
                jitty++;
        }
-       jpegs.clear();
+       jpegs.clear();*
+
+       map<TVMediaInfo,ImageIndex>::iterator titty=tvmedias.begin();
+       while (titty!=tvmedias.end()) {
+               vgDestroyImage((VGImage)(*titty).second);
+               titty++;
+       }
+       tvmedias.clear();
 
        map<pair<Colour*,unsigned int>,unsigned int>::iterator sitty=styles.begin();
        while (sitty!=styles.end()) {
@@ -396,7 +403,7 @@ void OsdOpenVG::purgeAllReferences()
        }
        styles.clear();
 
-}
+}*/
 
 int OsdOpenVG::shutdown()
 {
@@ -1019,11 +1026,12 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
        } break;
 
        case OVGdestroyImageRef: {
+               //Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia Draw Image Destroy %d ",command.param1);
                vgDestroyImage((VGImage)command.param1);
                return 0;
        } break;
        case OVGdestroyPaint: {
-               Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint Destroy %d ",command.param1);
+               //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint Destroy %d ",command.param1);
                vgDestroyPaint((VGPaint)command.param1);
                return 0;
        } break;
@@ -1071,7 +1079,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
        //      Log::getInstance()->log("OSD", Log::DEBUG, "Draw create mono2  %d %d %x %d",command.param1,command.param2,vgGetError(),handle);
                return handle;
        } break;
-       case OVGcreateImageFile: {
+       /*case OVGcreateImageFile: {
                VGImage handle;
                try{
                        Image *imagefile=(Image*)command.data;
@@ -1095,7 +1103,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
 
                //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create file  %d %d %x %d",command.param1,command.param2,vgGetError(),handle);
                return handle;
-       } break;
+       } break;*/
        case OVGcreateImageMemory: {
                PictureInfo *info = (PictureInfo*) command.data;
                VGImage handle;
@@ -1104,12 +1112,22 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
                vgImageSubData(handle,info->image,info->width*4,
                                                        VG_sXBGR_8888,0,0,info->width,info->height);
                info->decoder->freeReference(info->reference);
+
+               bool static_image=true;
+               if (info->lindex & 0xffffffff) static_image=false;
+
                Message* m = new  Message();
                // We have a pictures! send a message to ourself, to switch to gui thread
-               m->message=Message::NEW_PICTURE;
                m->from=this;
                m->to=Command::getInstance();
                m->parameter = handle;
+               if (!static_image) {
+                       m->message=Message::NEW_PICTURE;
+                       m->tag = info->lindex;
+               } else {
+                       m->message=Message::NEW_PICTURE_STATIC;
+                       m->tag = info->lindex>> 32LL;
+               }
                m->tag = info->lindex;
                Command::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture
 
@@ -1132,13 +1150,20 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
        case OVGreadyEGLImage: {
                PictureInfo *info = (PictureInfo*) command.data;
                eglDestroyImageKHR(egl_display,info->reference);
+               bool static_image=true;
+               if (info->lindex & 0xffffffff) static_image=false;
 
                Message* m = new  Message();
-               m->message=Message::NEW_PICTURE;
                m->from=this;
                m->to=Command::getInstance();
                m->parameter = info->handle;
-               m->tag = info->lindex;
+               if (!static_image) {
+                       m->message=Message::NEW_PICTURE;
+                       m->tag = info->lindex;
+               } else {
+                       m->message=Message::NEW_PICTURE_STATIC;
+                       m->tag = info->lindex>> 32LL;
+               }
                Command::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture
 
                delete info;
@@ -1313,7 +1338,7 @@ void OsdOpenVG::destroyImageRef(ImageIndex index)
        comm.param1=index;
        putOpenVGCommand(comm,false);
 }
-
+/*
 ImageIndex OsdOpenVG::createJpeg(const char* fileName, int *width,int *height)
 {
        Image* magicimage=NULL;
@@ -1348,6 +1373,27 @@ ImageIndex OsdOpenVG::createJpeg(const char* fileName, int *width,int *height)
        }
        comm.data=magicimage;
        return putOpenVGCommand(comm,true);
+}*/
+
+bool OsdOpenVG::getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length)
+{
+       switch (static_id) {
+       case 1: {
+               *userdata = vdr_data;
+               *length = vdr_data_end-vdr_data;
+               return true;
+       } break;
+       case 2: {
+               *userdata = wallpaper_data;
+               *length = wallpaper_data_end-wallpaper_data;
+               return true;
+       } break;
+       default: {
+               *userdata = NULL;
+               *length = 0;
+               return false;
+       } break;
+       };
 }
 
 void  OsdOpenVG::createPicture(struct PictureInfo& pict_inf)
index bc472c7c5af152b1c895b9d78318b36c9c6c56e6..0eb31fb75ceaef59c1db299c98d143ef45b93b30 100644 (file)
@@ -54,7 +54,7 @@ enum OpenVGTask {
        OVGcreateMonoBitmap,
        OVGcreateColorRef,
        OVGimageUploadLine,
-       OVGcreateImageFile,
+       //OVGcreateImageFile,
        OVGreplacefont,
        OVGcreateImageMemory,
        OVGcreateEGLImage,
@@ -107,13 +107,14 @@ protected:
 
    /*osd vector implementation*/
     void destroyImageRef(ImageIndex index);
-    ImageIndex createJpeg(const char* fileName, int *width,int *height);
+   // ImageIndex createJpeg(const char* fileName, int *width,int *height);
     ImageIndex createMonoBitmap(void *base,int width,int height);
     ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);
     void createPicture(struct PictureInfo& pict_inf);
     void destroyStyleRef(unsigned int index);
        unsigned int createStyleRef(const DrawStyle &c);
        unsigned int createColorRef(const Colour &c);
+       bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length);
 
        void drawSetTrans(SurfaceCommands & sc);
        void executeDrawCommand(SVGCommand & command);
@@ -136,7 +137,7 @@ protected:
     bool haveOpenVGResponse(unsigned int id,unsigned int * resp);
     unsigned int  putOpenVGCommand(OpenVGCommand& comm,bool wait);
     unsigned int handleTask(OpenVGCommand& command);
-    void purgeAllReferences();
+    //void purgeAllReferences();
     unsigned int wait_id;
 
     FT_Library  ft_library;
index d315c081b6c3599bcf34aeed1430df33c8bcbf4a..07022891af9df7ad45572ae2af8a6eaabe6d8574 100644 (file)
@@ -35,7 +35,7 @@ class MagickDecoder: public OsdVector::PictureDecoder {
 public:
        MagickDecoder(OsdVector::PictureReader* treader): OsdVector::PictureDecoder(treader) {pictInfValid=false;};
 
-       bool decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length);
+       bool decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem);
 
     bool getDecodedPicture( struct OsdVector::PictureInfo& pict_inf);
 
@@ -46,7 +46,7 @@ protected:
        bool pictInfValid;
 };
 
-bool MagickDecoder::decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length)
+bool MagickDecoder::decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem)
 {
        if (pictInfValid) return false; // does support only one image at a Time;
        Image magicimage;
@@ -55,7 +55,8 @@ bool MagickDecoder::decodePicture(LoadIndex index, unsigned char * buffer, unsig
        try{
                Log::getInstance()->log("MagickDecoder", Log::DEBUG, "decodePicture");
                Blob myblob;
-               myblob.updateNoCopy(buffer,length,Blob::MallocAllocator);
+               if (freemem) myblob.updateNoCopy(buffer,length,Blob::MallocAllocator);
+               else myblob.update(buffer,length);
                magicimage.read(myblob);
 
                magicimage.write(imageblob,"RGBA");
@@ -155,10 +156,16 @@ int OsdVector::restore()
        //also clear all handles, they are now invalid, no need to release them
        images_ref.clear();
        monobitmaps.clear();
-       jpegs.clear();
+       //jpegs.clear();
        styles.clear();
        styles_ref.clear();
 
+       tvmedias.clear();
+       loadindex_ref.clear();
+       tvmedias_load.clear();
+       tvmedias_load_inv.clear();
+       tvmedias_loaded.clear();
+
        surfaces_mutex.Unlock();
        return 1;
 }
@@ -267,16 +274,7 @@ void OsdVector::updateOrAddSurface(const SurfaceVector *surf,float x,float y,flo
        (*itty).commands.clear();
        (*itty).commands=commands;
        //increase the references
-       list<SVGCommand>::iterator sitty=(*itty).commands.begin();
-       while (sitty!=(*itty).commands.end())
-       {
-               incStyleRef((*sitty).getRef());
-               ImageIndex ii=(*sitty).getImageIndex();
-               if (ii) incImageRef(ii);
-               LoadIndex li=(*sitty).getLoadIndex();
-               if (li) incLoadIndexRef(li);
-               sitty++;
-       }
+       referenceSVGCommand((*itty).commands);
        cleanupOrphanedRefs();
 
        surfaces_mutex.Unlock();
@@ -397,7 +395,7 @@ void OsdVector::cleanupOrphanedRefs()
                } else ++mitty;
        }
 
-       map<string,ImageIndex>::iterator jitty=jpegs.begin();
+       /*map<string,ImageIndex>::iterator jitty=jpegs.begin();
        while (jitty!=jpegs.end()) {
                map<ImageIndex,int>::iterator curitty=images_ref.find((*jitty).second);
                int count=(*curitty).second;
@@ -407,7 +405,7 @@ void OsdVector::cleanupOrphanedRefs()
                        images_ref.erase(curitty++);
                        destroyImageRef(ref);
                } else ++jitty;
-       }
+       }*/
 
        map<TVMediaInfo,ImageIndex>::iterator titty=tvmedias.begin();
        while (titty!=tvmedias.end()) {
@@ -416,12 +414,24 @@ void OsdVector::cleanupOrphanedRefs()
                if (count==0) {
                        ImageIndex ref=(*curitty).first;
                        tvmedias.erase(titty++);
-                       images_ref.erase(curitty++);
+                       images_ref.erase(curitty);
                        destroyImageRef(ref);
                } else ++titty;
        }
 
 
+       map<TVMediaInfo,LoadIndex>::iterator litty=tvmedias_load.begin();
+       while (litty!=tvmedias_load.end()) {
+               map<LoadIndex,int>::iterator curitty=loadindex_ref.find((*litty).second);
+               int count=(*curitty).second;
+               if (count==0) {
+                       tvmedias_load_inv.erase((*litty).second);
+                       tvmedias_loaded.erase((*litty).second);
+                       tvmedias_load.erase(litty++);
+               } else ++litty;
+       }
+
+
        map<pair<Colour*,unsigned int>,unsigned int>::iterator sitty=styles.begin();
        while (sitty!=styles.end()) {
                map<unsigned int,int>::iterator curitty=styles_ref.find((*sitty).second);
@@ -537,6 +547,10 @@ LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia)
                case 3:
                        index=VDR::getInstance()->loadTVMediaRecThumb(tvmedia);
                        break;
+               case 4: {
+                       index = ((long long) tvmedia.getPrimaryID()) << 32LL;
+                       reader.addStaticImage(tvmedia.getPrimaryID());
+               } break;
                default:
                        index=VDR::getInstance()->loadTVMedia(tvmedia);
                        break;
@@ -545,6 +559,7 @@ LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia)
                tvmedias_load[tvmedia]=index;
                tvmedias_load_inv[index]=tvmedia;
        } else {
+
                index=tvmedias_load[tvmedia];
        }
 
@@ -561,7 +576,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex)
        ImageIndex image_index=0;
 
        TVMediaInfo tvmedia=tvmedias_load_inv[index];
-         Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Picture for request id %d arrived",index);
+         Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Picture for request id %llx arrived %d",index, imageIndex);
        if (imageIndex) {
                image_index=tvmedias[tvmedia]=imageIndex;
                tvmedias_loaded[index]=image_index;
@@ -583,7 +598,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex)
 
 
 
-
+/*
 ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height)
 {
        ImageIndex image_handle=0;
@@ -602,6 +617,7 @@ ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height)
        incImageRef(image_handle);
        return image_handle;
 }
+*/
 
 ImageIndex OsdVector::getMonoBitmapRef(void *base,int width,int height)
 {
@@ -740,6 +756,16 @@ void OsdVector::PictureReader::receivePicture(VDR_ResponsePacket *vresp)
        threadSignal();
 }
 
+
+void OsdVector::PictureReader::addStaticImage(unsigned int id)
+{
+       pict_lock_incoming.Lock();
+       pict_incoming_static.push(id);
+       invalid_loadindex.erase(((long long) id) << 32LL);
+       pict_lock_incoming.Unlock();
+       threadSignal();
+}
+
 bool OsdVector::PictureReader::processReceivedPictures()
 {
        bool decoded = false;
@@ -776,6 +802,32 @@ bool OsdVector::PictureReader::processReceivedPictures()
                }
                //else  osd->informPicture(vresp->getStreamID(), 0);
                delete vresp;
+       } else if (pict_incoming_static.size()){
+               unsigned int static_id = pict_incoming_static.front();
+               pict_incoming_static.pop();
+               set<LoadIndex>::iterator setpos = invalid_loadindex.find(((long long) static_id) << 32LL);
+               if (setpos != invalid_loadindex.end()) {
+                       valid = false;
+                       invalid_loadindex.erase(setpos);
+               }
+               pict_lock_incoming.Unlock();
+               if (!valid) { // we do not want it anymore skip it;
+                       return true;
+               }
+
+               UCHAR *userdata;
+               ULONG length;
+               if (((OsdVector*)Osd::getInstance())->getStaticImageData(static_id, &userdata, &length))
+               {
+                       std::list<PictureDecoder*>::iterator itty=decoders.begin();
+                       while (itty!=decoders.end()) {
+                               if ((*itty)->decodePicture(((long long) static_id) << 32LL,userdata, length, false)){
+                                       decoded=true;
+                                       break;
+                               }
+                               itty++;
+                       }
+               }
        } else {
                pict_lock_incoming.Unlock();
        }
index a91d63cf4a4c5a7277d2238b4bfcac44ff6b63ae..ad2a0b92c8540fdf14f6269ed2940897108925d9 100644 (file)
@@ -59,7 +59,7 @@ enum Corner{
 };
 
 typedef  unsigned int ImageIndex;
-typedef unsigned int LoadIndex;
+typedef unsigned long long LoadIndex;
 
 class SVGCommand
 {
@@ -171,7 +171,7 @@ public:
                if (instr!=DrawImage) return 0;
                else return target.image;
        };
-       ImageIndex getLoadIndex() {
+       LoadIndex getLoadIndex() {
                if (instr!=DrawImageLoading) return 0;
                else return target.loadindex;
        };
@@ -226,11 +226,15 @@ class OsdVector : public Osd
        virtual float getFontHeight()=0;
        virtual float getCharWidth(wchar_t c)=0;
 
-       virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height);
+       //virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height);
        virtual LoadIndex getTVMediaRef(TVMediaInfo& tvmedia,ImageIndex& image);
        virtual ImageIndex getMonoBitmapRef(void *base,int width,int height);
        virtual ImageIndex getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);
        virtual void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data)=0;
+
+
+       virtual bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length)=0;
+
        void removeImageRef(const ImageIndex ref);
        void removeLoadIndexRef(const LoadIndex ref);
        unsigned int getColorRef(const Colour &c); //internally this is the same as getStyleRef
@@ -276,7 +280,7 @@ class OsdVector : public Osd
        virtual ~PictureDecoder() {};
 
        // its is always guaranted, that after getDecodedPicture a call to decodePicture follows, if the return value was true;
-       virtual bool decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length)=0;
+       virtual bool decodePicture(LoadIndex index, unsigned char * buffer, unsigned int length, bool freemem=true)=0;
 
        virtual bool getDecodedPicture(struct PictureInfo& pict_inf)=0;
        virtual void freeReference(void * ref)=0;
@@ -305,6 +309,8 @@ class OsdVector : public Osd
        // should be called from command thread
        void receivePicture(VDR_ResponsePacket *vresp);
 
+       void addStaticImage(unsigned int id);
+
        void invalidateLoadIndex(LoadIndex index);
 
 
@@ -318,6 +324,7 @@ class OsdVector : public Osd
        Mutex pict_lock_incoming; //locks
        Mutex decoders_lock;
        std::queue<VDR_ResponsePacket*> pict_incoming;
+       std::queue<unsigned int> pict_incoming_static;
        std::list<PictureDecoder*> decoders;
        set<LoadIndex> invalid_loadindex;
 
@@ -340,7 +347,7 @@ protected:
        int getLoadIndexRef(LoadIndex index);
 
 
-       virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
+       //virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
        virtual ImageIndex createMonoBitmap(void *base,int width,int height)=0;
        virtual ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)=0;
        virtual void createPicture(struct PictureInfo& pict_inf)=0;
@@ -351,7 +358,7 @@ protected:
 
        map<ImageIndex,int> images_ref;
        map<void *,ImageIndex> monobitmaps;
-       map<string,ImageIndex> jpegs;
+       //map<string,ImageIndex> jpegs;
        map<TVMediaInfo,ImageIndex> tvmedias;
 
 
index dff343299ba721c9b3a10130b42682922ade1cde..72fc69864304df0b9e76e47b261e434ab28847bf 100644 (file)
@@ -22,6 +22,7 @@
 #include "bitmap.h"
 #include <wchar.h>
 #include <stdlib.h>
+#include <math.h>
 
 SurfaceVector::SurfaceVector(OsdVector* vosd)
 {
@@ -158,6 +159,26 @@ int SurfaceVector::drawTextCentre(const char* text, int x, int y, const DrawStyl
        return drawText(text, x-shift/2.,  y, c);
 }
 
+void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height)
+{
+       int jpeg_index=-1; // This is for compatibility only
+       if (strcmp(fileName,"/vdr.jpg")==0) {
+               jpeg_index=1;
+               *height=100; // this is faked so that the system does use the old coordinate system
+               *width=ceil(190.f*osd->getPixelAspect());
+       } else if (strcmp(fileName,"/wallpaperPAL.jpg")==0) {
+               jpeg_index=2;
+               *width=720; // this is faked so that the system does use the old coordinate system
+               *height=576;
+       }
+       if (jpeg_index>0) {
+               TVMediaInfo info;
+               info.setDefaultJpeg(jpeg_index);
+               drawTVMedia(info,x,y,*width,*height,TopLeft);
+       }
+}
+
+/*
 void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height)
 {
        command_mutex.Lock();
@@ -165,6 +186,7 @@ void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *
        commands.push_back(SVGCommand::PaintImage(x,y,*width,*height,image,0));
        command_mutex.Unlock();
 }
+*/
 
 void SurfaceVector::drawTVMedia(TVMediaInfo & tvmedia,float x, float y, float  width, float height, Corner corner)
 {
index b02ebdd4538704a5ba82f4fb3bca80b767613932..7bf8896ad83f9218e01c690e213e8de1dae8cd6c 100644 (file)
@@ -67,6 +67,12 @@ void TVMediaInfo::setPosterThumb(const char* recname)
        primary_name=recname;
 }
 
+void TVMediaInfo::setDefaultJpeg(int jpeg_index)
+{
+       type=4;
+       primary_id=jpeg_index;
+}
+
 bool operator<(const TVMediaInfo& rhs, const TVMediaInfo& lhs)
 {
        if (rhs.type==lhs.type) {
index a1cebc9857c87cf458b80fb38eaf45ac289e011f..99c65e1d1ae69c39e14e576723c88a775d97e017 100644 (file)
--- a/tvmedia.h
+++ b/tvmedia.h
@@ -44,10 +44,12 @@ public:
        void setMovieInfo(const MovieInfo * mi);
        void setSeriesInfo(const SeriesInfo * si);
        void setPosterThumb(const char* recname);
+       void setDefaultJpeg(int jpeg_index);
        int getType() {return type;};
+       int getPrimaryID() {return primary_id;};
 
 private:
-       int type; // movie or series or unknown recording
+       int type; // 1 movie or 2 series or 3 unknown recording or 4 static artwork
        int primary_id; //movie or series_id
        int secondary_id;  //0 or episode id
        int type_pict; // 0 full info, 1 poster thumb, 2 season thumb
diff --git a/vdr.cc b/vdr.cc
index 7f879693ee78915f55fa1b3e56872a741bf1ecf3..d09e12f647312f7bb07996d5436b4e42b86c3cfa 100644 (file)
--- a/vdr.cc
+++ b/vdr.cc
@@ -39,6 +39,7 @@
 #include "osd.h"
 #include "movieinfo.h"
 #include "seriesinfo.h"
+#include "osdvector.h"
 
 #define VOMP_PROTOCOLL_VERSION 0x00000302
 
diff --git a/vdr.h b/vdr.h
index 1aec760f33b747851c7c04a351503c7c64596e70..5282f75541bf6c90bb15a0bbbb3ced9475e46d11 100644 (file)
--- a/vdr.h
+++ b/vdr.h
@@ -40,7 +40,7 @@
 #include "eventdispatcher.h"
 #include "i18n.h"
 #include "log.h"
-#include "osdvector.h"
+#include "tvmedia.h"
 
 class TCP;
 class Log;