2 Copyright 2012 Marten Richter, 2020 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
20 #include "surfacevector.h"
22 #include "vdrresponsepacket.h"
26 #include "osdvector.h"
28 // The next section is activated, if the magick++ PictureReader is provided, it should be available for many POSIX platforms
29 #ifdef PICTURE_DECODER_MAGICK
30 #define MAGICKCORE_QUANTUM_DEPTH 16
31 #define MAGICKCORE_HDRI_ENABLE 0
34 using namespace Magick;
36 class MagickDecoder: public OsdVector::PictureDecoder
39 MagickDecoder(OsdVector::PictureReader* treader): OsdVector::PictureDecoder(treader) {pictInfValid = false;};
41 unsigned char* decodePicture(LoadIndex index, unsigned char* buffer, unsigned int length, bool freemem);
43 bool getDecodedPicture( struct OsdVector::PictureInfo& pict_inf);
45 void freeReference(void* ref);
48 OsdVector::PictureInfo pictInf;
52 unsigned char* MagickDecoder::decodePicture(LoadIndex index, unsigned char* buffer, unsigned int length, bool freemem)
54 if (pictInfValid) return buffer; // does support only one image at a Time;
57 Blob* imageblob = new Blob();
62 Log::getInstance()->log("MagickDecoder", Log::DEBUG, "decodePicture");
64 if (freemem) myblob.updateNoCopy(buffer, length, Blob::MallocAllocator);
65 else myblob.update(buffer, length);
67 magicimage.read(myblob);
69 magicimage.write(imageblob, "RGBA");
72 catch ( Exception& error_ )
74 Log::getInstance()->log("MagickDecoder", Log::DEBUG, "Libmagick: %s", error_.what());
76 Log::getInstance()->log("MagickDecoder", Log::DEBUG, "Libmagick: error mark2");
77 unsigned char* newbuffer = (unsigned char*) malloc(length);
78 memcpy(newbuffer, myblob.data(), length);
82 pictInf.reference = (void*) imageblob;
83 pictInf.width = magicimage.columns();
84 pictInf.height = magicimage.rows();
85 pictInf.image = imageblob->data();
86 pictInf.decoder = this;
87 pictInf.type = OsdVector::PictureInfo::RGBAMemBlock;
88 pictInf.lindex = index;
93 // I can handle everything, so the return value is always true
96 void MagickDecoder::freeReference(void* ref)
98 Blob* todelete = (Blob*) ref;
102 bool MagickDecoder::getDecodedPicture(struct OsdVector::PictureInfo& pict_inf)
104 if (!pictInfValid) return false;
107 pictInfValid = false;
114 OsdVector::OsdVector()
116 setlocale(LC_CTYPE, "C.UTF-8");
117 #ifdef PICTURE_DECODER_MAGICK
118 reader.addDecoder(new MagickDecoder(&reader));
122 void OsdVector::screenShot(const char* fileName)
124 //Do nothing, if no libmagick is there
125 #ifdef PICTURE_DECODER_MAGICK
127 getRealScreenSize(width, height);
128 size_t length = width * height * 4;
129 void* mem = malloc(length);
135 if (!screenShot(mem, width, height, true))
137 Log::getInstance()->log("OsdVector", Log::DEBUG, "Screenshot failed!");
142 myblob.updateNoCopy(mem, length, Blob::MallocAllocator);
143 Image image(myblob, Geometry(width, height), 8, "RGBA");
144 image.write(fileName);
146 catch ( Exception& error_ )
148 Log::getInstance()->log("MagickEncoder", Log::DEBUG, "Libmagick: %s", error_.what());
155 Surface* OsdVector::createNewSurface()
157 return new SurfaceVector(this);
160 void OsdVector::Blank()
162 // do nothing? remove this one?
165 int OsdVector::restore()
167 // First clear the contents of all registered surfaces
168 surfaces_mutex.lock();
170 //Now go through all surfaces and clear them
171 for (auto& surface : surfaces)
173 surface.commands.clear();
174 surface.commands.reserve(2048);
177 //also clear all handles, they are now invalid, no need to release them
181 drawstyleHandles.clear();
182 drawstyleHandlesRefCounts.clear();
183 drawstyleHandles_lastit_valid = drawstyleHandlesRefCounts_lastit_valid = false;
187 loadindex_ref.clear();
188 tvmedias_load.clear();
189 tvmedias_load_inv.clear();
190 tvmedias_loaded.clear();
192 surfaces_mutex.unlock();
196 void OsdVector::drawSurfaces()
198 surfaces_mutex.lock();
199 std::list<SurfaceInfo*> todraw; //First figure out if a surfaces is below another surface
200 std::list<SurfaceInfo>::iterator itty1 = surfaces.begin();
202 while (itty1 != surfaces.end())
204 std::list<SurfaceInfo>::iterator itty2 = itty1;
208 while (itty2 != surfaces.end())
210 SurfaceInfo& ref1 = *itty1;
211 SurfaceInfo& ref2 = *itty2;
213 if (ref1.x >= ref2.x && ref1.y >= ref2.y
214 && (ref1.x + ref1.w) <= (ref2.x + ref2.w)
215 && (ref1.y + ref1.h) <= (ref2.y + ref2.h) )
224 if (!hidden) // we are not hidden, perfect
226 todraw.push_back(&(*itty1));
233 getScreenSize(swidth, sheight);
234 //Now go through all surfaces and draw them
235 std::list<SurfaceInfo*>::iterator curdraw = todraw.begin();
237 while (curdraw != todraw.end())
239 drawSetTrans(*(*curdraw));
240 std::vector<SVGCommand>::iterator commands = (*(*curdraw)).commands.begin();
241 std::vector<SVGCommand>::iterator end = (*(*curdraw)).commands.end();
243 while (commands != end)
245 // update any images loaded in the mean time
246 if ((*commands).instr == DrawImageLoading)
248 LoadIndex loadindex = (*commands).target.loadindex;
250 if (tvmedias_loaded.find(loadindex) != tvmedias_loaded.end())
252 (*commands).instr = DrawImage;
253 (*commands).target.image = tvmedias_loaded[loadindex];;
254 incImageRef((*commands).target.image);
255 removeLoadIndexRef(loadindex);
260 // Now check if the command is on screen!
261 if (!(*commands).Outside(0, 0, swidth, sheight))
263 executeDrawCommand(*commands);
272 surfaces_mutex.unlock();
275 void OsdVector::updateOrAddSurface(const SurfaceVector* surf, float x, float y, float height, float width, std::vector<SVGCommand>& commands)
277 std::lock_guard<std::mutex> lg(surfaces_mutex);
280 // First determine it is already in our system
281 for(si = surfaces.begin(); si != surfaces.end(); si++)
283 if (si->surface == surf)
285 // If the surface given (surf) is already in our surfaces vector, reset our SurfaceInfo->commands vector
286 decrementAllRefCounts(si->commands);
287 si->commands.clear();
292 // if not found, make a new SurfaceInfo
293 if (si == surfaces.end())
296 new_sc.surface = surf;
301 si = surfaces.insert(si, new_sc);
304 // update any images loaded in the mean time
306 for (SVGCommand& command : commands)
308 if (command.instr == DrawImageLoading)
310 LoadIndex loadindex = command.target.loadindex;
312 if (tvmedias_loaded.find(loadindex) != tvmedias_loaded.end())
314 command.instr = DrawImage;
315 command.target.image = tvmedias_loaded[loadindex];
316 incImageRef(command.target.image);
317 removeLoadIndexRef(loadindex);
322 si->commands = commands; // Copy surf->commands to our SurfaceInfo->commands
323 incrementAllRefCounts(si->commands);
325 cleanupOrphanedRefs();
328 void OsdVector::removeSurface(const SurfaceVector* surf)
330 std::lock_guard<std::mutex> lg(surfaces_mutex);
331 for (auto i = surfaces.begin(); i != surfaces.end(); i++)
333 if (i->surface == surf)
335 decrementAllRefCounts(i->commands);
343 void OsdVector::decrementAllRefCounts(std::vector<SVGCommand>& commands)
345 for (SVGCommand& command : commands)
347 decrementDrawStyleHandleRefCount(command.getRef()); // FIXME BUG BUG BUG
349 ImageIndex ii = command.getImageIndex();
350 if (ii) removeImageRef(ii);
352 LoadIndex li = command.getLoadIndex();
353 if (li) removeLoadIndexRef(li);
357 void OsdVector::incrementAllRefCounts(std::vector<SVGCommand>& commands)
359 for (SVGCommand& command : commands)
361 incrementDrawStyleHandleRefCount(command.getRef()); // FIXME BUG BUG BUG
363 ImageIndex ii = command.getImageIndex();
364 if (ii) incImageRef(ii);
366 LoadIndex li = command.getLoadIndex();
367 if (li) incLoadIndexRef(li);
371 void OsdVector::incImageRef(ImageIndex index)
373 if (images_ref.find(index) == images_ref.end())
375 images_ref[index] = 1;
383 void OsdVector::removeImageRef(const ImageIndex ref)
388 int OsdVector::getLoadIndexRef(LoadIndex index)
390 surfaces_mutex.lock();
392 if (loadindex_ref.find(index) == loadindex_ref.end())
398 return loadindex_ref[index];
401 surfaces_mutex.unlock();
404 void OsdVector::incLoadIndexRef(LoadIndex index)
406 if (loadindex_ref.find(index) == loadindex_ref.end())
408 loadindex_ref[index] = 1;
412 loadindex_ref[index]++;
416 void OsdVector::removeLoadIndexRef(const LoadIndex ref)
418 loadindex_ref[ref]--;
420 if (loadindex_ref[ref] == 0)
422 //now check, if it is already loaded
423 std::map<LoadIndex, ImageIndex>::iterator itty = tvmedias_loaded.find(ref);
425 if ( itty != tvmedias_loaded.end())
427 removeImageRef((*itty).second); // remove lock
430 tvmedias_loaded.erase(ref);
431 // Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia removeLoadIndexRef %d %llx",tvmedias_load.size(),ref);
432 tvmedias_load.erase(tvmedias_load_inv[ref]);
433 tvmedias_load_inv.erase(ref);
435 reader.invalidateLoadIndex(ref);
439 void OsdVector::cleanupOrphanedRefs()
441 // Do some garbage collection
443 std::map<void*, ImageIndex>::iterator mitty = monobitmaps.begin();
445 while (mitty != monobitmaps.end())
447 std::map<ImageIndex, int>::iterator curitty = images_ref.find((*mitty).second);
448 int count = (*curitty).second;
452 ImageIndex ref = (*curitty).first;
453 monobitmaps.erase(mitty++);
454 images_ref.erase(curitty++);
455 destroyImageRef(ref);
460 /*map<string,ImageIndex>::iterator jitty=jpegs.begin();
461 while (jitty!=jpegs.end()) {
462 map<ImageIndex,int>::iterator curitty=images_ref.find((*jitty).second);
463 int count=(*curitty).second;
465 ImageIndex ref=(*curitty).first;
466 jpegs.erase(jitty++);
467 images_ref.erase(curitty++);
468 destroyImageRef(ref);
472 std::map<TVMediaInfo, ImageIndex>::iterator titty = tvmedias.begin();
474 while (titty != tvmedias.end())
476 std::map<ImageIndex, int>::iterator curitty = images_ref.find((*titty).second);
477 int count = (*curitty).second;
481 ImageIndex ref = (*curitty).first;
482 tvmedias.erase(titty++);
483 images_ref.erase(curitty);
484 destroyImageRef(ref);
490 std::map<TVMediaInfo, LoadIndex>::iterator litty = tvmedias_load.begin();
492 while (litty != tvmedias_load.end())
494 std::map<LoadIndex, int>::iterator curitty = loadindex_ref.find((*litty).second);
495 int count = (*curitty).second;
499 tvmedias_load_inv.erase((*litty).second);
500 tvmedias_loaded.erase((*litty).second);
501 tvmedias_load.erase(litty++);
506 std::list<ImageIndex>::iterator pitty = palettepics.begin();
508 while (pitty != palettepics.end())
510 std::map<ImageIndex, int>::iterator curitty = images_ref.find((*pitty));
511 int count = (*curitty).second;
515 ImageIndex ref = (*curitty).first;
516 palettepics.erase(pitty++);
517 images_ref.erase(curitty++);
518 destroyImageRef(ref);
523 std::map<ImageIndex, int>::iterator citty = images_ref.begin();
525 while (citty != images_ref.end())
527 int count = (*citty).second;
531 ImageIndex ref = (*citty).first;
532 images_ref.erase(citty++);
533 destroyImageRef(ref);
539 std::map<DrawStyle, VectorHandle>::iterator sitty = drawstyleHandles.begin();
541 while (sitty != drawstyleHandles.end())
543 std::map<VectorHandle, int>::iterator curitty = drawstyleHandlesRefCounts.find((*sitty).second);
544 int count = (*curitty).second;
548 VectorHandle ref = (*curitty).first;
549 drawstyleHandles.erase(sitty++);
550 drawstyleHandlesRefCounts.erase(curitty++);
551 drawstyleHandles_lastit_valid = drawstyleHandlesRefCounts_lastit_valid = false;
552 destroyDrawStyleHandle(ref);
560 int OsdVector::getImageRef(ImageIndex index)
562 surfaces_mutex.lock();
564 if (images_ref.find(index) == images_ref.end())
570 return images_ref[index];
573 surfaces_mutex.unlock();
576 void OsdVector::incrementDrawStyleHandleRefCount(VectorHandle index)
578 if (!drawstyleHandlesRefCounts_lastit_valid || (drawstyleHandlesRefCounts_lastit->first != index))
580 drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.find(index);
581 if (drawstyleHandlesRefCounts_lastit == drawstyleHandlesRefCounts.end())
583 drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.insert(std::pair<VectorHandle, int>(index, 0)).first;
587 drawstyleHandlesRefCounts_lastit->second++;
588 drawstyleHandlesRefCounts_lastit_valid = true;
591 void OsdVector::decrementDrawStyleHandleRefCount(VectorHandle index)
593 if (!drawstyleHandlesRefCounts_lastit_valid || (drawstyleHandlesRefCounts_lastit->first != index))
595 drawstyleHandlesRefCounts_lastit_valid = false;
596 drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.find(index);
599 if (drawstyleHandlesRefCounts_lastit != drawstyleHandlesRefCounts.end())
601 drawstyleHandlesRefCounts_lastit_valid = true;
602 drawstyleHandlesRefCounts_lastit->second--;
606 VectorHandle OsdVector::getDrawStyleHandle(const DrawStyle& c)
608 surfaces_mutex.lock();
609 VectorHandle style_handle = 0;
611 if (!drawstyleHandles_lastit_valid || (drawstyleHandles_lastit->first != c))
613 drawstyleHandles_lastit_valid = false;
614 drawstyleHandles_lastit = drawstyleHandles.find(c);
617 if (drawstyleHandles_lastit == drawstyleHandles.end())
619 surfaces_mutex.unlock();
620 style_handle = createDrawStyleHandle(c);
621 surfaces_mutex.lock();
622 drawstyleHandles_lastit = drawstyleHandles.insert(std::pair<DrawStyle, VectorHandle>(c, style_handle)).first;
626 style_handle = drawstyleHandles_lastit->second;
628 //Now check if the handle is valid
629 if (!drawstyleHandlesRefCounts_lastit_valid || (*drawstyleHandlesRefCounts_lastit).first != style_handle)
631 drawstyleHandlesRefCounts_lastit_valid = false;
632 drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.find(style_handle);
635 if (drawstyleHandlesRefCounts_lastit == drawstyleHandlesRefCounts.end())
637 //invalid handle recreate
638 surfaces_mutex.unlock();
639 style_handle = createDrawStyleHandle(c);
640 surfaces_mutex.lock();
641 drawstyleHandles_lastit->second = style_handle;
643 else drawstyleHandlesRefCounts_lastit_valid = true;
646 drawstyleHandles_lastit_valid = true;
647 incrementDrawStyleHandleRefCount(style_handle);
648 surfaces_mutex.unlock();
652 LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image)
654 ImageIndex image_handle = 0;
655 LoadIndex loadindex = 0;
656 surfaces_mutex.lock();
658 if (tvmedias.find(tvmedia) == tvmedias.end())
660 loadindex = loadTVMedia(tvmedia);
664 image_handle = tvmedias[tvmedia];
666 if (images_ref.find(image_handle) == images_ref.end())
668 //invalid handle recreate
669 loadindex = loadTVMedia(tvmedia);
674 incImageRef(image_handle);
678 /*tvmedias[tvmedia]=createTVMedia(tvmedia,width,height);
679 incImageRef(image_handle);*/
680 image = image_handle;
681 surfaces_mutex.unlock();
685 LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia)
689 if (tvmedias_load.find(tvmedia) == tvmedias_load.end())
691 switch (tvmedia.getType())
694 index = VDR::getInstance()->loadTVMediaRecThumb(tvmedia);
699 index = ((long long) tvmedia.getPrimaryID()) << 32LL;
700 reader.addStaticImage(tvmedia.getPrimaryID());
704 index = VDR::getInstance()->loadTVMediaEventThumb(tvmedia);
708 index = VDR::getInstance()->loadChannelLogo(tvmedia);
712 index = VDR::getInstance()->loadTVMedia(tvmedia);
716 if (tvmedia.getType() != 4 && tvmedia.getStaticFallback() > -1)
718 reader.informFallback(index, tvmedia.getStaticFallback());
721 tvmedias_load[tvmedia] = index;
722 tvmedias_load_inv[index] = tvmedia;
726 index = tvmedias_load[tvmedia];
729 incLoadIndexRef(index);
734 void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex)
736 //Beware for thread safety
737 ImageIndex image_index = 0;
739 Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Picture for request id %llx arrived %x", index, imageIndex);
740 surfaces_mutex.lock();
741 TVMediaInfo tvmedia = tvmedias_load_inv[index];
745 std::map<LoadIndex, int>::iterator itty = loadindex_ref.find(index);
746 image_index = tvmedias[tvmedia] = imageIndex;
747 tvmedias_loaded[index] = image_index;
749 if (itty == loadindex_ref.end() || (*itty).second == 0)
751 // we do not want the picture anymore . Really...
752 // fill images_ref in to not irritate the garbage collector
753 if (images_ref.find(image_index) == images_ref.end())
755 images_ref[image_index] = 0;
760 incImageRef(image_index); // hold one index until all loadings refs are gone;
764 surfaces_mutex.unlock();
768 ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height)
770 ImageIndex image_handle=0;
771 if (jpegs.find(fileName)==jpegs.end())
773 image_handle=jpegs[fileName]=createJpeg(fileName,width,height);
775 image_handle=jpegs[fileName];
778 if (images_ref.find(image_handle)==images_ref.end()) {
779 //invalid handle recreate
780 image_handle=jpegs[fileName]=createJpeg(fileName,width,height);
783 incImageRef(image_handle);
788 ImageIndex OsdVector::getMonoBitmapRef(void* base, int width, int height)
790 ImageIndex image_handle;
791 surfaces_mutex.lock();
793 if (monobitmaps.find(base) == monobitmaps.end())
795 surfaces_mutex.unlock();
796 image_handle = createMonoBitmap(base, width, height);
797 surfaces_mutex.lock();
798 monobitmaps[base] = image_handle;
802 image_handle = monobitmaps[base];
804 if (images_ref.find(image_handle) == images_ref.end())
806 //invalid handle recreate
807 surfaces_mutex.unlock();
808 image_handle = createMonoBitmap(base, width, height);
809 surfaces_mutex.lock();
810 monobitmaps[base] = image_handle;
814 incImageRef(image_handle);
815 surfaces_mutex.unlock();
819 ImageIndex OsdVector::getImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data)
821 ImageIndex image_handle;
822 image_handle = createImagePalette(width, height, image_data, palette_data);
823 surfaces_mutex.lock();
824 palettepics.push_back(image_handle);
825 incImageRef(image_handle);
826 surfaces_mutex.unlock();
830 OsdVector::PictureReader::~PictureReader()
832 decoders_lock.lock();
834 while (decoders.size())
836 PictureDecoder* dec = decoders.front();
837 decoders.pop_front();
841 decoders_lock.unlock();
844 void OsdVector::PictureReader::init()
849 void OsdVector::PictureReader::shutdown()
854 void OsdVector::PictureReader::addDecoder(PictureDecoder* decoder)
856 decoders_lock.lock();
858 decoders.push_front(decoder);
859 decoders_lock.unlock();
862 void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder)
864 decoders_lock.lock();
865 std::list<PictureDecoder*>::iterator itty = decoders.begin();
867 while (itty != decoders.end())
869 if ((*itty) == decoder)
871 decoders.erase(itty);
878 Log::getInstance()->log("OsdVector", Log::DEBUG, "removeDecoder");
881 decoders_lock.unlock();
884 void OsdVector::PictureReader::threadMethod()
886 OsdVector* osdvector = dynamic_cast<OsdVector*>(Osd::getInstance());
887 Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Start Picture Reader");
891 if (!threadIsActive())
893 Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia End Picture Reader");
903 decoders_lock.lock();
904 std::list<PictureDecoder*>::iterator itty = decoders.begin();
906 while (itty != decoders.end())
908 if ((*itty)->getDecodedPicture(pictinf))
911 osdvector->createPicture(pictinf);
917 if (processReceivedPictures())
922 decoders_lock.unlock();
925 //Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Sleep Picture Reader");
927 struct timespec target_time;
928 getClockRealTime(&target_time);
930 target_time.tv_nsec += 1000000LL * 10;
932 if (target_time.tv_nsec > 999999999)
934 target_time.tv_nsec -= 1000000000L;
935 target_time.tv_sec += 1;
939 threadWaitForSignalTimed(&target_time);
941 //Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Sleep end Picture Reader");
945 void OsdVector::PictureReader::invalidateLoadIndex(LoadIndex index)
947 pict_lock_incoming.lock();
948 invalid_loadindex.insert(index);
949 pict_lock_incoming.unlock();
952 void OsdVector::PictureReader::informFallback(LoadIndex index, int fallback)
954 pict_lock_incoming.lock();
955 inform_fallback[index] = fallback;
956 pict_lock_incoming.unlock();
959 void OsdVector::PictureReader::receivePicture(VDR_ResponsePacket* vresp)
961 pict_lock_incoming.lock();
962 pict_incoming.push(vresp);
963 pict_lock_incoming.unlock();
968 void OsdVector::PictureReader::addStaticImage(unsigned int id)
970 pict_lock_incoming.lock();
971 pict_incoming_static.push(id);
972 invalid_loadindex.erase(((long long) id) << 32LL);
973 pict_lock_incoming.unlock();
979 #pragma warning(disable : 4703)
982 bool OsdVector::PictureReader::processReceivedPictures()
984 bool decoded = false;
986 pict_lock_incoming.lock();
988 if (pict_incoming.size())
990 VDR_ResponsePacket* vresp = pict_incoming.front();
992 std::set<LoadIndex>::iterator setpos = invalid_loadindex.find(vresp->getStreamID());
994 if (setpos != invalid_loadindex.end())
997 invalid_loadindex.erase(setpos);
1000 pict_lock_incoming.unlock();
1002 if (!valid) // we do not want it anymore skip it;
1008 // Log::getInstance()->log("OsdVector", Log::DEBUG, "TVMedia Pictures arrived VDR %x %d %d",
1009 // vresp->getStreamID(),vresp->getUserDataLength(),vresp->getFlag());
1010 bool decode = false;
1015 if (vresp->getFlag() != 2)
1017 userdata = vresp->getUserData();
1018 length = vresp->getUserDataLength();
1025 pict_lock_incoming.lock();
1027 if (inform_fallback.find(vresp->getStreamID()) != inform_fallback.end())
1029 fallback = inform_fallback[vresp->getStreamID()];
1032 pict_lock_incoming.unlock();
1034 if (fallback >= 0 && ((OsdVector*)Osd::getInstance())->getStaticImageData(fallback, &userdata, &length))
1043 std::list<PictureDecoder*>::iterator itty = decoders.begin();
1045 while (itty != decoders.end())
1047 userdata = (*itty)->decodePicture(vresp->getStreamID(), userdata, length, freed);
1058 if (!decoded && userdata && freed)
1064 pict_lock_incoming.lock();
1065 inform_fallback.erase(vresp->getStreamID());
1066 pict_lock_incoming.unlock();
1067 //else osd->informPicture(vresp->getStreamID(), 0);
1070 else if (pict_incoming_static.size())
1072 unsigned int static_id = pict_incoming_static.front();
1073 pict_incoming_static.pop();
1074 std::set<LoadIndex>::iterator setpos = invalid_loadindex.find(((long long) static_id) << 32LL);
1076 if (setpos != invalid_loadindex.end())
1079 invalid_loadindex.erase(setpos);
1082 pict_lock_incoming.unlock();
1084 if (!valid) // we do not want it anymore skip it;
1092 if (((OsdVector*)Osd::getInstance())->getStaticImageData(static_id, &userdata, &length))
1094 std::list<PictureDecoder*>::iterator itty = decoders.begin();
1096 while (itty != decoders.end())
1098 if (!(*itty)->decodePicture(((long long) static_id) << 32LL, userdata, length, false))
1110 pict_lock_incoming.unlock();
1113 if (pict_incoming.size() || pict_incoming_static.size()) return true;