LDFLAGS = -Wall -Wl,--format=binary -Wl,other/vdrhires.jpg -Wl,other/wallpaper720p.jpg -Wl,--format=default
LIBS = -L/opt/vc/lib -lpthread -lrt -lEGL -lOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil
-OBJECTS += main.o threadp.o osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o wjpegsimple.o remotelinux.o
+OBJECTS += main.o threadp.o osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o imageomx.o wjpegsimple.o remotelinux.o
LIBS+= -lfreetype -lMagick++
CROSSLIBS =
INCLUDES = -DVOMP_PLATTFORM_RASPBERRY -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/ImageMagick
LDFLAGS = -Wall -Wl,--format=binary -Wl,other/vdrhires.jpg -Wl,other/wallpaper720p.jpg -Wl,--format=default -Wl,--verbose -Xlinker --rpath-link=rpi-root/usr/lib/arm-linux-gnueabihf -Xlinker --rpath-link=rpi-root/lib/arm-linux-gnueabihf -Xlinker --rpath-link=rpi-root/opt/vc/lib
LIBS = -Lrpi-root/opt/vc/lib -Lrpi-root/lib -Lrpi-root/usr/lib -Lrpi-root/lib/arm-linux-gnueabihf -Lrpi-root/usr/lib/arm-linux-gnueabihf -Lrpi-root/usr/local/lib -lpthread -lrt -lEGL -lOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -ldl -lfontconfig
-OBJECTS += main.o threadp.o osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o wjpegsimple.o remotelinux.o
+OBJECTS += main.o threadp.o osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o imageomx.o wjpegsimple.o remotelinux.o
LIBS+= -lfreetype -lMagick++
CROSSLIBS =
INCLUDES = -DVOMP_PLATTFORM_RASPBERRY -Irpi-root/opt/vc/include -Irpi-root/opt/vc/include/interface/vcos/pthreads -Irpi-root/usr/include -Irpi-root/usr/include/freetype2 -Irpi-root/usr/include/ImageMagick
#define VPE_OMX_CLOCK "OMX.broadcom.clock"
#define VPE_OMX_AUDIO_DECODER "OMX.broadcom.audio_decode"
#define VPE_OMX_AUDIO_REND "OMX.broadcom.audio_render"
+ #define VPE_OMX_IMAGE_DECODER "OMX.broadcom.image_decode"
+ #define VPE_OMX_EGL_REND "OMX.broadcom.egl_render"
//#define VPE_LIBAV_SUPPORT
// #define VPE_LIBAV_MPEG2_TRANSCODING
taskmutex.Unlock();
vgmutex.Unlock();
+#ifdef PICTURE_DECODER_OMX
+ imageomx=new ImageOMX(&reader);
+ reader.addDecoder(imageomx);
+#endif
+
return 1;
}
int OsdOpenVG::shutdown()
{
reader.shutdown();
+#ifdef PICTURE_DECODER_OMX
+ if (imageomx) reader.removeDecoder(imageomx);
+ imageomx=NULL;
+#endif
+
if (!initted) return 0;
initted = 0;
delete info;
} break;
+ case OVGcreateEGLImage: {
+ PictureInfo *info = (PictureInfo*) command.data;
+ VGImage handle;
+ //Log::getInstance()->log("OSD", Log::DEBUG, "TVMedia OVGcreateImageMemory");
+ handle=vgCreateImage(VG_sXBGR_8888,info->width,info->height,VG_IMAGE_QUALITY_BETTER);
+
+ info->handle = handle;
+ info->reference = eglCreateImageKHR(egl_display, egl_context, EGL_VG_PARENT_IMAGE_KHR, (EGLClientBuffer)handle, NULL);
+ if (info->reference) return true;
+ else return false;
+
+ } break;
+
+ case OVGreadyEGLImage: {
+ PictureInfo *info = (PictureInfo*) command.data;
+ eglDestroyImageKHR(egl_display,info->reference);
+
+ Message* m = new Message();
+ m->message=Message::NEW_PICTURE;
+ m->from=this;
+ m->to=Command::getInstance();
+ m->parameter = info->handle;
+ m->tag = info->lindex;
+ Command::getInstance()->postMessageFromOuterSpace(m); // inform command about new picture
+
+ delete info;
+ } break;
+
+
case OVGcreateColorRef :{
VGPaint handle;
comm.task = OVGcreateImageMemory;
comm.data = new PictureInfo(pict_inf);
putOpenVGCommand(comm,false);
+ } else if (pict_inf.type == PictureInfo::EGLImage) {
+ comm.task = OVGreadyEGLImage;
+ comm.data = new PictureInfo(pict_inf);
+ putOpenVGCommand(comm,false);
} else {
// unsupported
pict_inf.decoder->freeReference(pict_inf.reference);
}
}
+bool OsdOpenVG::getEGLPicture(struct OsdVector::PictureInfo & info , EGLDisplay * display)
+{
+ struct OpenVGCommand comm;
+ info.type = PictureInfo::EGLImage;
+ comm.task = OVGcreateEGLImage;
+ comm.data = &info;
+ *display = egl_display;
+ return putOpenVGCommand(comm,true);
+}
+
ImageIndex OsdOpenVG::createMonoBitmap(void *base,int width,int height)
#include "threadp.h"
#include "mutex.h"
#include "videoomx.h"
+#ifdef PICTURE_DECODER_OMX
+#include "imageomx.h"
+#endif
#include <deque>
OVGimageUploadLine,
OVGcreateImageFile,
OVGreplacefont,
- OVGcreateImageMemory
+ OVGcreateImageMemory,
+ OVGcreateEGLImage,
+ OVGreadyEGLImage
};
struct OpenVGCommand
};
-class OsdOpenVG : public OsdVector, public Thread_TYPE
+class OsdOpenVG : public OsdVector, public Thread_TYPE, public EGLPictureCreator
{
public:
OsdOpenVG();
virtual float getPixelAspect() {return aspect_correction;};
+ bool getEGLPicture(struct OsdVector::PictureInfo & info, EGLDisplay * display);
+
protected:
float aspect_correction;
bool freetype_inited;
+#ifdef PICTURE_DECODER_OMX
+ ImageOMX *imageomx;
+#endif
};
void OsdVector::PictureReader::addDecoder(PictureDecoder* decoder)
{
decoders_lock.Lock();
+ decoder->init();
decoders.push_front(decoder);
decoders_lock.Unlock();
}
+void OsdVector::PictureReader::removeDecoder(PictureDecoder* decoder)
+{
+ decoders_lock.Lock();
+ std::list<PictureDecoder*>::iterator itty=decoders.begin();
+ while (itty!=decoders.end()) {
+ if ((*itty) == decoder)
+ {
+ decoders.erase(itty);
+ break;
+ }
+ itty++;
+ }
+ Log::getInstance()->log("OsdVector", Log::DEBUG, "removeDecoder");
+ decoder->shutdown();
+ delete decoder;
+ decoders_lock.Unlock();
+}
+
void OsdVector::PictureReader::threadMethod()
{
OsdVector *osdvector = dynamic_cast<OsdVector*>(Osd::getInstance());
ULONG width;
ULONG height;
LoadIndex lindex;
+ union {
const void * image;
+ unsigned int handle;
+ };
void *reference;
PictureDecoder* decoder;
};
{
public:
PictureDecoder(PictureReader * treader) {reader=treader;};
+ 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 getDecodedPicture(struct PictureInfo& pict_inf)=0;
virtual void freeReference(void * ref)=0;
+ virtual void init() {};
+ virtual void shutdown() {};
+
protected:
PictureReader * reader;
};
void init();
void addDecoder(PictureDecoder*);
+ void removeDecoder(PictureDecoder*);
void shutdown();
class VideoOMX : public Video
{
friend class AudioOMX;
+ friend class ImageOMX;
public:
VideoOMX();
virtual ~VideoOMX();